@edgex-web/components 0.2.0-beta.16 → 0.2.0-beta.17
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/{ccip-Bk0UQcGE.mjs → ccip-b8Cqywm8.mjs} +2 -2
- package/dist/{ccip-Bk0UQcGE.mjs.map → ccip-b8Cqywm8.mjs.map} +1 -1
- package/dist/components/Deposit/src/components/mpc/index.d.ts.map +1 -1
- package/dist/{index-CTfqYNy7.mjs → index-Bs_1Js5W.mjs} +1538 -1538
- package/dist/{index-CTfqYNy7.mjs.map → index-Bs_1Js5W.mjs.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +47 -47
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(re,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(re=typeof globalThis<"u"?globalThis:re||self,x(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,x,je){"use strict";var uP=Object.defineProperty;var lP=(re,x,je)=>x in re?uP(re,x,{enumerable:!0,configurable:!0,writable:!0,value:je}):re[x]=je;var Go=(re,x,je)=>lP(re,typeof x!="symbol"?x+"":x,je);function Cu(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=Cu(x),Br=Cu(je);function
|
|
1
|
+
(function(re,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(re=typeof globalThis<"u"?globalThis:re||self,x(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,x,je){"use strict";var uP=Object.defineProperty;var lP=(re,x,je)=>x in re?uP(re,x,{enumerable:!0,configurable:!0,writable:!0,value:je}):re[x]=je;var Go=(re,x,je)=>lP(re,typeof x!="symbol"?x+"":x,je);function Cu(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=Cu(x),Br=Cu(je);function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mi={exports:{}},Lr={};/**
|
|
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 Iu;function
|
|
9
|
+
*/var Iu;function Fm(){if(Iu)return Lr;Iu=1;var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(c,a,u){var l,f={},p=null,d=null;u!==void 0&&(p=""+u),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(f[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)f[l]===void 0&&(f[l]=a[l]);return{$$typeof:t,type:c,key:p,ref:d,props:f,_owner:o.current}}return Lr.Fragment=n,Lr.jsx=i,Lr.jsxs=i,Lr}var Fr={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,52 +14,52 @@
|
|
|
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 Mu;function
|
|
17
|
+
*/var Mu;function Dm(){return Mu||(Mu=1,process.env.NODE_ENV!=="production"&&function(){var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function w(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[m];return typeof q=="function"?q:null}var $=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(R){{for(var q=arguments.length,Y=new Array(q>1?q-1:0),te=1;te<q;te++)Y[te-1]=arguments[te];P("error",R,Y)}}function P(R,q,Y){{var te=$.ReactDebugCurrentFrame,he=te.getStackAddendum();he!==""&&(q+="%s",Y=Y.concat([he]));var be=Y.map(function(ue){return String(ue)});be.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,be)}}var N=!1,B=!1,F=!1,D=!1,b=!1,g;g=Symbol.for("react.module.reference");function v(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||b||R===o||R===u||R===l||D||R===d||N||B||F||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===g||R.getModuleId!==void 0))}function C(R,q,Y){var te=R.displayName;if(te)return te;var he=q.displayName||q.name||"";return he!==""?Y+"("+he+")":Y}function O(R){return R.displayName||"Context"}function I(R){if(R==null)return null;if(typeof R.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var q=R;return O(q)+".Consumer";case i:var Y=R;return O(Y._context)+".Provider";case a:return C(R,R.render,"ForwardRef");case f:var te=R.displayName||null;return te!==null?te:I(R.type)||"Memo";case p:{var he=R,be=he._payload,ue=he._init;try{return I(ue(be))}catch{return null}}}return null}var M=Object.assign,y=0,T,A,S,L,j,z,_;function W(){}W.__reactDisabledLog=!0;function K(){{if(y===0){T=console.log,A=console.info,S=console.warn,L=console.error,j=console.group,z=console.groupCollapsed,_=console.groupEnd;var R={configurable:!0,enumerable:!0,value:W,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}y++}}function G(){{if(y--,y===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},R,{value:T}),info:M({},R,{value:A}),warn:M({},R,{value:S}),error:M({},R,{value:L}),group:M({},R,{value:j}),groupCollapsed:M({},R,{value:z}),groupEnd:M({},R,{value:_})})}y<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=$.ReactCurrentDispatcher,Z;function J(R,q,Y){{if(Z===void 0)try{throw Error()}catch(he){var te=he.stack.trim().match(/\n( *(at )?)/);Z=te&&te[1]||""}return`
|
|
18
18
|
`+Z+R}}var oe=!1,me;{var ge=typeof WeakMap=="function"?WeakMap:Map;me=new ge}function de(R,q){if(!R||oe)return"";{var Y=me.get(R);if(Y!==void 0)return Y}var te;oe=!0;var he=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var be;be=H.current,H.current=null,K();try{if(q){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(Xe){te=Xe}Reflect.construct(R,[],ue)}else{try{ue.call()}catch(Xe){te=Xe}R.call(ue.prototype)}}else{try{throw Error()}catch(Xe){te=Xe}R()}}catch(Xe){if(Xe&&te&&typeof Xe.stack=="string"){for(var ce=Xe.stack.split(`
|
|
19
19
|
`),Re=te.stack.split(`
|
|
20
20
|
`),Se=ce.length-1,$e=Re.length-1;Se>=1&&$e>=0&&ce[Se]!==Re[$e];)$e--;for(;Se>=1&&$e>=0;Se--,$e--)if(ce[Se]!==Re[$e]){if(Se!==1||$e!==1)do if(Se--,$e--,$e<0||ce[Se]!==Re[$e]){var yt=`
|
|
21
|
-
`+ce[Se].replace(" at new "," at ");return R.displayName&&yt.includes("<anonymous>")&&(yt=yt.replace("<anonymous>",R.displayName)),typeof R=="function"&&me.set(R,yt),yt}while(Se>=1&&$e>=0);break}}}finally{oe=!1,H.current=be,G(),Error.prepareStackTrace=he}var kr=R?R.displayName||R.name:"",Jn=kr?J(kr):"";return typeof R=="function"&&me.set(R,Jn),Jn}function se(R,q,Y){return de(R,!1)}function pe(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function ee(R,q,Y){if(R==null)return"";if(typeof R=="function")return de(R,pe(R));if(typeof R=="string")return J(R);switch(R){case u:return J("Suspense");case l:return J("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return se(R.render);case f:return ee(R.type,q,Y);case p:{var te=R,he=te._payload,be=te._init;try{return ee(be(he),q,Y)}catch{}}}return""}var Pe=Object.prototype.hasOwnProperty,On={},gt=$.ReactDebugCurrentFrame;function hi(R){if(R){var q=R._owner,Y=ee(R.type,R._source,q?q.type:null);gt.setExtraStackFrame(Y)}else gt.setExtraStackFrame(null)}function U4(R,q,Y,te,he){{var be=Function.call.bind(Pe);for(var ue in R)if(be(R,ue)){var ce=void 0;try{if(typeof R[ue]!="function"){var Re=Error((te||"React class")+": "+Y+" type `"+ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}ce=R[ue](q,ue,te,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ce=Se}ce&&!(ce instanceof Error)&&(hi(he),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",te||"React class",Y,ue,typeof ce),hi(null)),ce instanceof Error&&!(ce.message in On)&&(On[ce.message]=!0,hi(he),E("Failed %s type: %s",Y,ce.message),hi(null))}}}var z4=Array.isArray;function Pu(R){return z4(R)}function H4(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,Y=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function W4(R){try{return
|
|
21
|
+
`+ce[Se].replace(" at new "," at ");return R.displayName&&yt.includes("<anonymous>")&&(yt=yt.replace("<anonymous>",R.displayName)),typeof R=="function"&&me.set(R,yt),yt}while(Se>=1&&$e>=0);break}}}finally{oe=!1,H.current=be,G(),Error.prepareStackTrace=he}var kr=R?R.displayName||R.name:"",Jn=kr?J(kr):"";return typeof R=="function"&&me.set(R,Jn),Jn}function se(R,q,Y){return de(R,!1)}function pe(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function ee(R,q,Y){if(R==null)return"";if(typeof R=="function")return de(R,pe(R));if(typeof R=="string")return J(R);switch(R){case u:return J("Suspense");case l:return J("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return se(R.render);case f:return ee(R.type,q,Y);case p:{var te=R,he=te._payload,be=te._init;try{return ee(be(he),q,Y)}catch{}}}return""}var Pe=Object.prototype.hasOwnProperty,On={},gt=$.ReactDebugCurrentFrame;function hi(R){if(R){var q=R._owner,Y=ee(R.type,R._source,q?q.type:null);gt.setExtraStackFrame(Y)}else gt.setExtraStackFrame(null)}function U4(R,q,Y,te,he){{var be=Function.call.bind(Pe);for(var ue in R)if(be(R,ue)){var ce=void 0;try{if(typeof R[ue]!="function"){var Re=Error((te||"React class")+": "+Y+" type `"+ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}ce=R[ue](q,ue,te,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ce=Se}ce&&!(ce instanceof Error)&&(hi(he),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",te||"React class",Y,ue,typeof ce),hi(null)),ce instanceof Error&&!(ce.message in On)&&(On[ce.message]=!0,hi(he),E("Failed %s type: %s",Y,ce.message),hi(null))}}}var z4=Array.isArray;function Pu(R){return z4(R)}function H4(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,Y=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function W4(R){try{return Em(R),!1}catch{return!0}}function Em(R){return""+R}function Pm(R){if(W4(R))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",H4(R)),Em(R)}var Sm=$.ReactCurrentOwner,V4={key:!0,ref:!0,__self:!0,__source:!0},$m,Am;function G4(R){if(Pe.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function q4(R){if(Pe.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function Z4(R,q){typeof R.ref=="string"&&Sm.current}function Y4(R,q){{var Y=function(){$m||($m=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function K4(R,q){{var Y=function(){Am||(Am=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var X4=function(R,q,Y,te,he,be,ue){var ce={$$typeof:t,type:R,key:q,ref:Y,props:ue,_owner:be};return ce._store={},Object.defineProperty(ce._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ce,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(ce,"_source",{configurable:!1,enumerable:!1,writable:!1,value:he}),Object.freeze&&(Object.freeze(ce.props),Object.freeze(ce)),ce};function Q4(R,q,Y,te,he){{var be,ue={},ce=null,Re=null;Y!==void 0&&(Pm(Y),ce=""+Y),q4(q)&&(Pm(q.key),ce=""+q.key),G4(q)&&(Re=q.ref,Z4(q,he));for(be in q)Pe.call(q,be)&&!V4.hasOwnProperty(be)&&(ue[be]=q[be]);if(R&&R.defaultProps){var Se=R.defaultProps;for(be in Se)ue[be]===void 0&&(ue[be]=Se[be])}if(ce||Re){var $e=typeof R=="function"?R.displayName||R.name||"Unknown":R;ce&&Y4(ue,$e),Re&&K4(ue,$e)}return X4(R,ce,Re,he,te,Sm.current,ue)}}var Su=$.ReactCurrentOwner,Tm=$.ReactDebugCurrentFrame;function Mr(R){if(R){var q=R._owner,Y=ee(R.type,R._source,q?q.type:null);Tm.setExtraStackFrame(Y)}else Tm.setExtraStackFrame(null)}var $u;$u=!1;function Au(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Om(){{if(Su.current){var R=I(Su.current.type);if(R)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+R+"`."}return""}}function J4(R){return""}var
|
|
23
|
+
Check the render method of \``+R+"`."}return""}}function J4(R){return""}var Nm={};function eP(R){{var q=Om();if(!q){var Y=typeof R=="string"?R:R.displayName||R.name;Y&&(q=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+Y+">.")}return q}}function
|
|
25
|
+
Check the top-level render call using <`+Y+">.")}return q}}function Cm(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=eP(q);if(Nm[Y])return;Nm[Y]=!0;var te="";R&&R._owner&&R._owner!==Su.current&&(te=" It was passed a child from "+I(R._owner.type)+"."),Mr(R),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,te),Mr(null)}}function Im(R,q){{if(typeof R!="object")return;if(Pu(R))for(var Y=0;Y<R.length;Y++){var te=R[Y];Au(te)&&Cm(te,q)}else if(Au(R))R._store&&(R._store.validated=!0);else if(R){var he=w(R);if(typeof he=="function"&&he!==R.entries)for(var be=he.call(R),ue;!(ue=be.next()).done;)Au(ue.value)&&Cm(ue.value,q)}}}function tP(R){{var q=R.type;if(q==null||typeof q=="string")return;var Y;if(typeof q=="function")Y=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))Y=q.propTypes;else return;if(Y){var te=I(q);U4(Y,R.props,"prop",te,R)}else if(q.PropTypes!==void 0&&!$u){$u=!0;var he=I(q);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",he||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function nP(R){{for(var q=Object.keys(R.props),Y=0;Y<q.length;Y++){var te=q[Y];if(te!=="children"&&te!=="key"){Mr(R),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),Mr(null);break}}R.ref!==null&&(Mr(R),E("Invalid attribute `ref` supplied to `React.Fragment`."),Mr(null))}}var Mm={};function km(R,q,Y,te,he,be){{var ue=v(R);if(!ue){var ce="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(ce+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Re=J4();Re?ce+=Re:ce+=Om();var Se;R===null?Se="null":Pu(R)?Se="array":R!==void 0&&R.$$typeof===t?(Se="<"+(I(R.type)||"Unknown")+" />",ce=" Did you accidentally export a JSX literal instead of a component?"):Se=typeof R,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Se,ce)}var $e=Q4(R,q,Y,he,be);if($e==null)return $e;if(ue){var yt=q.children;if(yt!==void 0)if(te)if(Pu(yt)){for(var kr=0;kr<yt.length;kr++)Im(yt[kr],R);Object.freeze&&Object.freeze(yt)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Im(yt,R)}if(Pe.call(q,"key")){var Jn=I(R),Xe=Object.keys(q).filter(function(cP){return cP!=="key"}),Tu=Xe.length>0?"{key: someKey, "+Xe.join(": ..., ")+": ...}":"{key: someKey}";if(!Mm[Jn+Tu]){var aP=Xe.length>0?"{"+Xe.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Tu,Jn,aP,Jn),
|
|
30
|
+
<%s key={someKey} {...props} />`,Tu,Jn,aP,Jn),Mm[Jn+Tu]=!0}}return R===r?nP($e):tP($e),$e}}function rP(R,q,Y){return km(R,q,Y,!0)}function oP(R,q,Y){return km(R,q,Y,!1)}var sP=oP,iP=rP;Fr.Fragment=r,Fr.jsx=sP,Fr.jsxs=iP}()),Fr}process.env.NODE_ENV==="production"?mi.exports=Fm():mi.exports=Dm();var k=mi.exports;const Rm={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
|
|
31
31
|
充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,maxDepositSplitTip:"单笔充值金额上限为200,000。若需要充值金额大于200,000,请分多笔进行操作。",spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
|
|
32
|
-
跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"},account:{title:"账户",perpetual:"合约账户",spot:"现货账户"}},
|
|
32
|
+
跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"},account:{title:"账户",perpetual:"合约账户",spot:"现货账户"}},jm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
33
33
|
If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,maxDepositSplitTip:"The maximum amount per deposit is 200,000. If you need to deposit more than 200,000, please split it into multiple deposits.",spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
34
|
-
Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance."},account:{title:"Account",perpetual:"Perpetual Account",spot:"Spot Account"}},
|
|
34
|
+
Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance."},account:{title:"Account",perpetual:"Perpetual Account",spot:"Spot Account"}},_m={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
|
|
35
35
|
入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
|
|
36
|
-
クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"},account:{title:"アカウント",perpetual:"パーペチュアルアカウント",spot:"スポットアカウント"}},
|
|
36
|
+
クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"},account:{title:"アカウント",perpetual:"パーペチュアルアカウント",spot:"スポットアカウント"}},Um={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
|
|
37
37
|
Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
|
|
38
|
-
За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:"Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perpetual:"Перпетуальный счет",spot:"Спотовый счет"}},
|
|
38
|
+
За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:"Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perpetual:"Перпетуальный счет",spot:"Спотовый счет"}},zm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
39
39
|
充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
40
|
-
跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},bi=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],ku={"en-US":Rm,"ja-JP":jm,"ru-RU":_m,"zh-CN":Dm,"zh-TW":Um},qo="en-US",zm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},Hm=e=>bi.includes(e)?ku[e]:ku[qo],Wm=e=>bi.includes(e),Bu=x.createContext(null),Vm=({config:e,children:t})=>{const n=x.useMemo(()=>{const r=e.locale||qo,o=Wm(r)?r:qo,s=Hm(o);return{...e,currentLocale:o,translations:s}},[e]);return k.jsx(Bu.Provider,{value:n,children:t})},Lu=()=>{const e=x.useContext(Bu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var Gm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,gi=Math.ceil,ot=Math.floor,_e="[BigNumber Error] ",Fu=_e+"Number primitive has more than 15 significant digits: ",wt=1e14,ne=14,yi=9007199254740991,wi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],fn=1e7,Oe=1e9;function Du(e){var t,n,r,o=E.prototype={constructor:E,toString:null,valueOf:null},s=new E(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function E(b,g){var v,C,O,I,M,y,T,A,S=this;if(!(S instanceof E))return new E(b,g);if(g==null){if(b&&b._isBigNumber===!0){S.s=b.s,!b.c||b.e>f?S.c=S.e=null:b.e<l?S.c=[S.e=0]:(S.e=b.e,S.c=b.c.slice());return}if((y=typeof b=="number")&&b*0==0){if(S.s=1/b<0?(b=-b,-1):1,b===~~b){for(I=0,M=b;M>=10;M/=10,I++);I>f?S.c=S.e=null:(S.e=I,S.c=[b]);return}A=String(b)}else{if(!Gm.test(A=String(b)))return r(S,A,y);S.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(I=A.indexOf("."))>-1&&(A=A.replace(".","")),(M=A.search(/e/i))>0?(I<0&&(I=M),I+=+A.slice(M+1),A=A.substring(0,M)):I<0&&(I=A.length)}else{if(ye(g,2,w.length,"Base"),g==10&&$)return S=new E(b),F(S,i+S.e+1,c);if(A=String(b),y=typeof b=="number"){if(b*0!=0)return r(S,A,y,g);if(S.s=1/b<0?(A=A.slice(1),-1):1,E.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(Fu+b)}else S.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(v=w.slice(0,g),I=M=0,T=A.length;M<T;M++)if(v.indexOf(C=A.charAt(M))<0){if(C=="."){if(M>I){I=T;continue}}else if(!O&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){O=!0,M=-1,I=0;continue}return r(S,String(b),y,g)}y=!1,A=n(A,g,10,S.s),(I=A.indexOf("."))>-1?A=A.replace(".",""):I=A.length}for(M=0;A.charCodeAt(M)===48;M++);for(T=A.length;A.charCodeAt(--T)===48;);if(A=A.slice(M,++T)){if(T-=M,y&&E.DEBUG&&T>15&&(b>yi||b!==ot(b)))throw Error(Fu+S.s*b);if((I=I-M-1)>f)S.c=S.e=null;else if(I<l)S.c=[S.e=0];else{if(S.e=I,S.c=[],M=(I+1)%ne,I<0&&(M+=ne),M<T){for(M&&S.c.push(+A.slice(0,M)),T-=ne;M<T;)S.c.push(+A.slice(M,M+=ne));M=ne-(A=A.slice(M)).length}else M-=T;for(;M--;A+="0");S.c.push(+A)}}else S.c=[S.e=0]}E.clone=Du,E.ROUND_UP=0,E.ROUND_DOWN=1,E.ROUND_CEIL=2,E.ROUND_FLOOR=3,E.ROUND_HALF_UP=4,E.ROUND_HALF_DOWN=5,E.ROUND_HALF_EVEN=6,E.ROUND_HALF_CEIL=7,E.ROUND_HALF_FLOOR=8,E.EUCLID=9,E.config=E.set=function(b){var g,v;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(g="DECIMAL_PLACES")&&(v=b[g],ye(v,0,Oe,g),i=v),b.hasOwnProperty(g="ROUNDING_MODE")&&(v=b[g],ye(v,0,8,g),c=v),b.hasOwnProperty(g="EXPONENTIAL_AT")&&(v=b[g],v&&v.pop?(ye(v[0],-Oe,0,g),ye(v[1],0,Oe,g),a=v[0],u=v[1]):(ye(v,-Oe,Oe,g),a=-(u=v<0?-v:v))),b.hasOwnProperty(g="RANGE"))if(v=b[g],v&&v.pop)ye(v[0],-Oe,-1,g),ye(v[1],1,Oe,g),l=v[0],f=v[1];else if(ye(v,-Oe,Oe,g),v)l=-(f=v<0?-v:v);else throw Error(_e+g+" cannot be zero: "+v);if(b.hasOwnProperty(g="CRYPTO"))if(v=b[g],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=v;else throw p=!v,Error(_e+"crypto unavailable");else p=v;else throw Error(_e+g+" not true or false: "+v);if(b.hasOwnProperty(g="MODULO_MODE")&&(v=b[g],ye(v,0,9,g),d=v),b.hasOwnProperty(g="POW_PRECISION")&&(v=b[g],ye(v,0,Oe,g),h=v),b.hasOwnProperty(g="FORMAT"))if(v=b[g],typeof v=="object")m=v;else throw Error(_e+g+" not an object: "+v);if(b.hasOwnProperty(g="ALPHABET"))if(v=b[g],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))$=v.slice(0,10)=="0123456789",w=v;else throw Error(_e+g+" invalid: "+v)}else throw Error(_e+"Object expected: "+b);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:w}},E.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!E.DEBUG)return!0;var g,v,C=b.c,O=b.e,I=b.s;e:if({}.toString.call(C)=="[object Array]"){if((I===1||I===-1)&&O>=-Oe&&O<=Oe&&O===ot(O)){if(C[0]===0){if(O===0&&C.length===1)return!0;break e}if(g=(O+1)%ne,g<1&&(g+=ne),String(C[0]).length==g){for(g=0;g<C.length;g++)if(v=C[g],v<0||v>=wt||v!==ot(v))break e;if(v!==0)return!0}}}else if(C===null&&O===null&&(I===null||I===1||I===-1))return!0;throw Error(_e+"Invalid BigNumber: "+b)},E.maximum=E.max=function(){return N(arguments,-1)},E.minimum=E.min=function(){return N(arguments,1)},E.random=function(){var b=9007199254740992,g=Math.random()*b&2097151?function(){return ot(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var C,O,I,M,y,T=0,A=[],S=new E(s);if(v==null?v=i:ye(v,0,Oe),M=gi(v/ne),p)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(M*=2));T<M;)y=C[T]*131072+(C[T+1]>>>11),y>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),C[T]=O[0],C[T+1]=O[1]):(A.push(y%1e14),T+=2);T=M/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(M*=7);T<M;)y=(C[T]&31)*281474976710656+C[T+1]*1099511627776+C[T+2]*4294967296+C[T+3]*16777216+(C[T+4]<<16)+(C[T+5]<<8)+C[T+6],y>=9e15?crypto.randomBytes(7).copy(C,T):(A.push(y%1e14),T+=7);T=M/7}else throw p=!1,Error(_e+"crypto unavailable");if(!p)for(;T<M;)y=g(),y<9e15&&(A[T++]=y%1e14);for(M=A[--T],v%=ne,M&&v&&(y=wi[ne-v],A[T]=ot(M/y)*y);A[T]===0;A.pop(),T--);if(T<0)A=[I=0];else{for(I=-1;A[0]===0;A.splice(0,1),I-=ne);for(T=1,y=A[0];y>=10;y/=10,T++);T<ne&&(I-=ne-T)}return S.e=I,S.c=A,S}}(),E.sum=function(){for(var b=1,g=arguments,v=new E(g[0]);b<g.length;)v=v.plus(g[b++]);return v},n=function(){var b="0123456789";function g(v,C,O,I){for(var M,y=[0],T,A=0,S=v.length;A<S;){for(T=y.length;T--;y[T]*=C);for(y[0]+=I.indexOf(v.charAt(A++)),M=0;M<y.length;M++)y[M]>O-1&&(y[M+1]==null&&(y[M+1]=0),y[M+1]+=y[M]/O|0,y[M]%=O)}return y.reverse()}return function(v,C,O,I,M){var y,T,A,S,L,j,z,_,W=v.indexOf("."),K=i,G=c;for(W>=0&&(S=h,h=0,v=v.replace(".",""),_=new E(C),j=_.pow(v.length-W),h=S,_.c=g(Vt(it(j.c),j.e,"0"),10,O,b),_.e=_.c.length),z=g(v,C,O,M?(y=w,b):(y=b,w)),A=S=z.length;z[--S]==0;z.pop());if(!z[0])return y.charAt(0);if(W<0?--A:(j.c=z,j.e=A,j.s=I,j=t(j,_,K,G,O),z=j.c,L=j.r,A=j.e),T=A+K+1,W=z[T],S=O/2,L=L||T<0||z[T+1]!=null,L=G<4?(W!=null||L)&&(G==0||G==(j.s<0?3:2)):W>S||W==S&&(G==4||L||G==6&&z[T-1]&1||G==(j.s<0?8:7)),T<1||!z[0])v=L?Vt(y.charAt(1),-K,y.charAt(0)):y.charAt(0);else{if(z.length=T,L)for(--O;++z[--T]>O;)z[T]=0,T||(++A,z=[1].concat(z));for(S=z.length;!z[--S];);for(W=0,v="";W<=S;v+=y.charAt(z[W++]));v=Vt(v,A,y.charAt(0))}return v}}(),t=function(){function b(C,O,I){var M,y,T,A,S=0,L=C.length,j=O%fn,z=O/fn|0;for(C=C.slice();L--;)T=C[L]%fn,A=C[L]/fn|0,M=z*T+A*j,y=j*T+M%fn*fn+S,S=(y/I|0)+(M/fn|0)+z*A,C[L]=y%I;return S&&(C=[S].concat(C)),C}function g(C,O,I,M){var y,T;if(I!=M)T=I>M?1:-1;else for(y=T=0;y<I;y++)if(C[y]!=O[y]){T=C[y]>O[y]?1:-1;break}return T}function v(C,O,I,M){for(var y=0;I--;)C[I]-=y,y=C[I]<O[I]?1:0,C[I]=y*M+C[I]-O[I];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,O,I,M,y){var T,A,S,L,j,z,_,W,K,G,H,Z,J,oe,me,ge,de,se=C.s==O.s?1:-1,pe=C.c,ee=O.c;if(!pe||!pe[0]||!ee||!ee[0])return new E(!C.s||!O.s||(pe?ee&&pe[0]==ee[0]:!ee)?NaN:pe&&pe[0]==0||!ee?se*0:se/0);for(W=new E(se),K=W.c=[],A=C.e-O.e,se=I+A+1,y||(y=wt,A=st(C.e/ne)-st(O.e/ne),se=se/ne|0),S=0;ee[S]==(pe[S]||0);S++);if(ee[S]>(pe[S]||0)&&A--,se<0)K.push(1),L=!0;else{for(oe=pe.length,ge=ee.length,S=0,se+=2,j=ot(y/(ee[0]+1)),j>1&&(ee=b(ee,j,y),pe=b(pe,j,y),ge=ee.length,oe=pe.length),J=ge,G=pe.slice(0,ge),H=G.length;H<ge;G[H++]=0);de=ee.slice(),de=[0].concat(de),me=ee[0],ee[1]>=y/2&&me++;do{if(j=0,T=g(ee,G,ge,H),T<0){if(Z=G[0],ge!=H&&(Z=Z*y+(G[1]||0)),j=ot(Z/me),j>1)for(j>=y&&(j=y-1),z=b(ee,j,y),_=z.length,H=G.length;g(z,G,_,H)==1;)j--,v(z,ge<_?de:ee,_,y),_=z.length,T=1;else j==0&&(T=j=1),z=ee.slice(),_=z.length;if(_<H&&(z=[0].concat(z)),v(G,z,H,y),H=G.length,T==-1)for(;g(ee,G,ge,H)<1;)j++,v(G,ge<H?de:ee,H,y),H=G.length}else T===0&&(j++,G=[0]);K[S++]=j,G[0]?G[H++]=pe[J]||0:(G=[pe[J]],H=1)}while((J++<oe||G[0]!=null)&&se--);L=G[0]!=null,K[0]||K.splice(0,1)}if(y==wt){for(S=1,se=K[0];se>=10;se/=10,S++);F(W,I+(W.e=S+A*ne-1)+1,M,L)}else W.e=A,W.r=+L;return W}}();function P(b,g,v,C){var O,I,M,y,T;if(v==null?v=c:ye(v,0,8),!b.c)return b.toString();if(O=b.c[0],M=b.e,g==null)T=it(b.c),T=C==1||C==2&&(M<=a||M>=u)?Yo(T,M):Vt(T,M,"0");else if(b=F(new E(b),g,v),I=b.e,T=it(b.c),y=T.length,C==1||C==2&&(g<=I||I<=a)){for(;y<g;T+="0",y++);T=Yo(T,I)}else if(g-=M+(C===2&&I>M),T=Vt(T,I,"0"),I+1>y){if(--g>0)for(T+=".";g--;T+="0");}else if(g+=I-y,g>0)for(I+1==y&&(T+=".");g--;T+="0");return b.s<0&&O?"-"+T:T}function N(b,g){for(var v,C,O=1,I=new E(b[0]);O<b.length;O++)C=new E(b[O]),(!C.s||(v=Nn(I,C))===g||v===0&&I.s===g)&&(I=C);return I}function B(b,g,v){for(var C=1,O=g.length;!g[--O];g.pop());for(O=g[0];O>=10;O/=10,C++);return(v=C+v*ne-1)>f?b.c=b.e=null:v<l?b.c=[b.e=0]:(b.e=v,b.c=g),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,O=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(I,M,y,T){var A,S=y?M:M.replace(O,"");if(C.test(S))I.s=isNaN(S)?null:S<0?-1:1;else{if(!y&&(S=S.replace(b,function(L,j,z){return A=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!T||T==A?j:L}),T&&(A=T,S=S.replace(g,"$1").replace(v,"0.$1")),M!=S))return new E(S,A);if(E.DEBUG)throw Error(_e+"Not a"+(T?" base "+T:"")+" number: "+M);I.s=null}I.c=I.e=null}}();function F(b,g,v,C){var O,I,M,y,T,A,S,L=b.c,j=wi;if(L){e:{for(O=1,y=L[0];y>=10;y/=10,O++);if(I=g-O,I<0)I+=ne,M=g,T=L[A=0],S=ot(T/j[O-M-1]%10);else if(A=gi((I+1)/ne),A>=L.length)if(C){for(;L.length<=A;L.push(0));T=S=0,O=1,I%=ne,M=I-ne+1}else break e;else{for(T=y=L[A],O=1;y>=10;y/=10,O++);I%=ne,M=I-ne+O,S=M<0?0:ot(T/j[O-M-1]%10)}if(C=C||g<0||L[A+1]!=null||(M<0?T:T%j[O-M-1]),C=v<4?(S||C)&&(v==0||v==(b.s<0?3:2)):S>5||S==5&&(v==4||C||v==6&&(I>0?M>0?T/j[O-M]:0:L[A-1])%10&1||v==(b.s<0?8:7)),g<1||!L[0])return L.length=0,C?(g-=b.e+1,L[0]=j[(ne-g%ne)%ne],b.e=-g||0):L[0]=b.e=0,b;if(I==0?(L.length=A,y=1,A--):(L.length=A+1,y=j[ne-I],L[A]=M>0?ot(T/j[O-M]%j[M])*y:0),C)for(;;)if(A==0){for(I=1,M=L[0];M>=10;M/=10,I++);for(M=L[0]+=y,y=1;M>=10;M/=10,y++);I!=y&&(b.e++,L[0]==wt&&(L[0]=1));break}else{if(L[A]+=y,L[A]!=wt)break;L[A--]=0,y=1}for(I=L.length;L[--I]===0;L.pop());}b.e>f?b.c=b.e=null:b.e<l&&(b.c=[b.e=0])}return b}function D(b){var g,v=b.e;return v===null?b.toString():(g=it(b.c),g=v<=a||v>=u?Yo(g,v):Vt(g,v,"0"),b.s<0?"-"+g:g)}return o.absoluteValue=o.abs=function(){var b=new E(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,g){return Nn(this,new E(b,g))},o.decimalPlaces=o.dp=function(b,g){var v,C,O,I=this;if(b!=null)return ye(b,0,Oe),g==null?g=c:ye(g,0,8),F(new E(I),b+I.e+1,g);if(!(v=I.c))return null;if(C=((O=v.length-1)-st(this.e/ne))*ne,O=v[O])for(;O%10==0;O/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(b,g){return t(this,new E(b,g),i,c)},o.dividedToIntegerBy=o.idiv=function(b,g){return t(this,new E(b,g),0,1)},o.exponentiatedBy=o.pow=function(b,g){var v,C,O,I,M,y,T,A,S,L=this;if(b=new E(b),b.c&&!b.isInteger())throw Error(_e+"Exponent not an integer: "+D(b));if(g!=null&&(g=new E(g)),y=b.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!b.c||!b.c[0])return S=new E(Math.pow(+D(L),y?b.s*(2-Zo(b)):+D(b))),g?S.mod(g):S;if(T=b.s<0,g){if(g.c?!g.c[0]:!g.s)return new E(NaN);C=!T&&L.isInteger()&&g.isInteger(),C&&(L=L.mod(g))}else{if(b.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||y&&L.c[1]>=24e7:L.c[0]<8e13||y&&L.c[0]<=9999975e7)))return I=L.s<0&&Zo(b)?-0:0,L.e>-1&&(I=1/I),new E(T?1/I:I);h&&(I=gi(h/ne+2))}for(y?(v=new E(.5),T&&(b.s=1),A=Zo(b)):(O=Math.abs(+D(b)),A=O%2),S=new E(s);;){if(A){if(S=S.times(L),!S.c)break;I?S.c.length>I&&(S.c.length=I):C&&(S=S.mod(g))}if(O){if(O=ot(O/2),O===0)break;A=O%2}else if(b=b.times(v),F(b,b.e+1,1),b.e>14)A=Zo(b);else{if(O=+D(b),O===0)break;A=O%2}L=L.times(L),I?L.c&&L.c.length>I&&(L.c.length=I):C&&(L=L.mod(g))}return C?S:(T&&(S=s.div(S)),g?S.mod(g):I?F(S,h,c,M):S)},o.integerValue=function(b){var g=new E(this);return b==null?b=c:ye(b,0,8),F(g,g.e+1,b)},o.isEqualTo=o.eq=function(b,g){return Nn(this,new E(b,g))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,g){return Nn(this,new E(b,g))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,g){return(g=Nn(this,new E(b,g)))===1||g===0},o.isInteger=function(){return!!this.c&&st(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(b,g){return Nn(this,new E(b,g))<0},o.isLessThanOrEqualTo=o.lte=function(b,g){return(g=Nn(this,new E(b,g)))===-1||g===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(b,g){var v,C,O,I,M=this,y=M.s;if(b=new E(b,g),g=b.s,!y||!g)return new E(NaN);if(y!=g)return b.s=-g,M.plus(b);var T=M.e/ne,A=b.e/ne,S=M.c,L=b.c;if(!T||!A){if(!S||!L)return S?(b.s=-g,b):new E(L?M:NaN);if(!S[0]||!L[0])return L[0]?(b.s=-g,b):new E(S[0]?M:c==3?-0:0)}if(T=st(T),A=st(A),S=S.slice(),y=T-A){for((I=y<0)?(y=-y,O=S):(A=T,O=L),O.reverse(),g=y;g--;O.push(0));O.reverse()}else for(C=(I=(y=S.length)<(g=L.length))?y:g,y=g=0;g<C;g++)if(S[g]!=L[g]){I=S[g]<L[g];break}if(I&&(O=S,S=L,L=O,b.s=-b.s),g=(C=L.length)-(v=S.length),g>0)for(;g--;S[v++]=0);for(g=wt-1;C>y;){if(S[--C]<L[C]){for(v=C;v&&!S[--v];S[v]=g);--S[v],S[C]+=wt}S[C]-=L[C]}for(;S[0]==0;S.splice(0,1),--A);return S[0]?B(b,S,A):(b.s=c==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,g){var v,C,O=this;return b=new E(b,g),!O.c||!b.s||b.c&&!b.c[0]?new E(NaN):!b.c||O.c&&!O.c[0]?new E(O):(d==9?(C=b.s,b.s=1,v=t(O,b,0,3),b.s=C,v.s*=C):v=t(O,b,0,d),b=O.minus(v.times(b)),!b.c[0]&&d==1&&(b.s=O.s),b)},o.multipliedBy=o.times=function(b,g){var v,C,O,I,M,y,T,A,S,L,j,z,_,W,K,G=this,H=G.c,Z=(b=new E(b,g)).c;if(!H||!Z||!H[0]||!Z[0])return!G.s||!b.s||H&&!H[0]&&!Z||Z&&!Z[0]&&!H?b.c=b.e=b.s=null:(b.s*=G.s,!H||!Z?b.c=b.e=null:(b.c=[0],b.e=0)),b;for(C=st(G.e/ne)+st(b.e/ne),b.s*=G.s,T=H.length,L=Z.length,T<L&&(_=H,H=Z,Z=_,O=T,T=L,L=O),O=T+L,_=[];O--;_.push(0));for(W=wt,K=fn,O=L;--O>=0;){for(v=0,j=Z[O]%K,z=Z[O]/K|0,M=T,I=O+M;I>O;)A=H[--M]%K,S=H[M]/K|0,y=z*A+S*j,A=j*A+y%K*K+_[I]+v,v=(A/W|0)+(y/K|0)+z*S,_[I--]=A%W;_[I]=v}return v?++C:_.splice(0,1),B(b,_,C)},o.negated=function(){var b=new E(this);return b.s=-b.s||null,b},o.plus=function(b,g){var v,C=this,O=C.s;if(b=new E(b,g),g=b.s,!O||!g)return new E(NaN);if(O!=g)return b.s=-g,C.minus(b);var I=C.e/ne,M=b.e/ne,y=C.c,T=b.c;if(!I||!M){if(!y||!T)return new E(O/0);if(!y[0]||!T[0])return T[0]?b:new E(y[0]?C:O*0)}if(I=st(I),M=st(M),y=y.slice(),O=I-M){for(O>0?(M=I,v=T):(O=-O,v=y),v.reverse();O--;v.push(0));v.reverse()}for(O=y.length,g=T.length,O-g<0&&(v=T,T=y,y=v,g=O),O=0;g;)O=(y[--g]=y[g]+T[g]+O)/wt|0,y[g]=wt===y[g]?0:y[g]%wt;return O&&(y=[O].concat(y),++M),B(b,y,M)},o.precision=o.sd=function(b,g){var v,C,O,I=this;if(b!=null&&b!==!!b)return ye(b,1,Oe),g==null?g=c:ye(g,0,8),F(new E(I),b,g);if(!(v=I.c))return null;if(O=v.length-1,C=O*ne+1,O=v[O]){for(;O%10==0;O/=10,C--);for(O=v[0];O>=10;O/=10,C++);}return b&&I.e+1>C&&(C=I.e+1),C},o.shiftedBy=function(b){return ye(b,-yi,yi),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,g,v,C,O,I=this,M=I.c,y=I.s,T=I.e,A=i+4,S=new E("0.5");if(y!==1||!M||!M[0])return new E(!y||y<0&&(!M||M[0])?NaN:M?I:1/0);if(y=Math.sqrt(+D(I)),y==0||y==1/0?(g=it(M),(g.length+T)%2==0&&(g+="0"),y=Math.sqrt(+g),T=st((T+1)/2)-(T<0||T%2),y==1/0?g="5e"+T:(g=y.toExponential(),g=g.slice(0,g.indexOf("e")+1)+T),v=new E(g)):v=new E(y+""),v.c[0]){for(T=v.e,y=T+A,y<3&&(y=0);;)if(O=v,v=S.times(O.plus(t(I,O,A,1))),it(O.c).slice(0,y)===(g=it(v.c)).slice(0,y))if(v.e<T&&--y,g=g.slice(y-3,y+1),g=="9999"||!C&&g=="4999"){if(!C&&(F(O,O.e+i+2,0),O.times(O).eq(I))){v=O;break}A+=4,y+=4,C=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(F(v,v.e+i+2,1),b=!v.times(v).eq(I));break}}return F(v,v.e+i+1,c,b)},o.toExponential=function(b,g){return b!=null&&(ye(b,0,Oe),b++),P(this,b,g,1)},o.toFixed=function(b,g){return b!=null&&(ye(b,0,Oe),b=b+this.e+1),P(this,b,g)},o.toFormat=function(b,g,v){var C,O=this;if(v==null)b!=null&&g&&typeof g=="object"?(v=g,g=null):b&&typeof b=="object"?(v=b,b=g=null):v=m;else if(typeof v!="object")throw Error(_e+"Argument not an object: "+v);if(C=O.toFixed(b,g),O.c){var I,M=C.split("."),y=+v.groupSize,T=+v.secondaryGroupSize,A=v.groupSeparator||"",S=M[0],L=M[1],j=O.s<0,z=j?S.slice(1):S,_=z.length;if(T&&(I=y,y=T,T=I,_-=I),y>0&&_>0){for(I=_%y||y,S=z.substr(0,I);I<_;I+=y)S+=A+z.substr(I,y);T>0&&(S+=A+z.slice(I)),j&&(S="-"+S)}C=L?S+(v.decimalSeparator||"")+((T=+v.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):L):S}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(b){var g,v,C,O,I,M,y,T,A,S,L,j,z=this,_=z.c;if(b!=null&&(y=new E(b),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(_e+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+D(y));if(!_)return new E(z);for(g=new E(s),A=v=new E(s),C=T=new E(s),j=it(_),I=g.e=j.length-z.e-1,g.c[0]=wi[(M=I%ne)<0?ne+M:M],b=!b||y.comparedTo(g)>0?I>0?g:A:y,M=f,f=1/0,y=new E(j),T.c[0]=0;S=t(y,g,0,1),O=v.plus(S.times(C)),O.comparedTo(b)!=1;)v=C,C=O,A=T.plus(S.times(O=A)),T=O,g=y.minus(S.times(O=g)),y=O;return O=t(b.minus(v),C,0,1),T=T.plus(O.times(A)),v=v.plus(O.times(C)),T.s=A.s=z.s,I=I*2,L=t(A,C,I,c).minus(z).abs().comparedTo(t(T,v,I,c).minus(z).abs())<1?[A,C]:[T,v],f=M,L},o.toNumber=function(){return+D(this)},o.toPrecision=function(b,g){return b!=null&&ye(b,1,Oe),P(this,b,g,2)},o.toString=function(b){var g,v=this,C=v.s,O=v.e;return O===null?C?(g="Infinity",C<0&&(g="-"+g)):g="NaN":(b==null?g=O<=a||O>=u?Yo(it(v.c),O):Vt(it(v.c),O,"0"):b===10&&$?(v=F(new E(v),i+O+1,c),g=Vt(it(v.c),v.e,"0")):(ye(b,2,w.length,"Base"),g=n(Vt(it(v.c),O,"0"),10,b,C,!0)),C<0&&v.c[0]&&(g="-"+g)),g},o.valueOf=o.toJSON=function(){return D(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&E.set(e),E}function st(e){var t=e|0;return e>0||e===t?t:t-1}function it(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Nn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function ye(e,t,n,r){if(e<t||e>n||e!==ot(e))throw Error(_e+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Zo(e){var t=e.c.length-1;return st(e.e/ne)==t&&e.c[t]%2!=0}function Yo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Vt(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 Ie=Du();const qm=(e,t=6)=>{try{const n=new Ie(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ie.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},vt=()=>{const{translations:e,currentLocale:t}=Lu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},Zm="1.1.0";let Ue=class Ou extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Ou?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Ou&&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@${Zm}`].join(`
|
|
41
|
-
`);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Gt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Ru=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ju=/^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)?$/,_u=/^\(.+?\).*?$/,Uu=/^tuple(?<array>(\[(\d*)\])*)$/;function vi(e){let t=e.type;if(Uu.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+=vi(s),o<n-1&&(t+=", ")}const r=Gt(Uu,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,vi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function er(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=vi(o),r!==n-1&&(t+=", ")}return t}function Ko(e){var t;return e.type==="function"?`function ${e.name}(${er(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${er(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${er(e.inputs)})`:e.type==="error"?`error ${e.name}(${er(e.inputs)})`:e.type==="constructor"?`constructor(${er(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const zu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ym(e){return zu.test(e)}function Km(e){return Gt(zu,e)}const Hu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Xm(e){return Hu.test(e)}function Qm(e){return Gt(Hu,e)}const Wu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Jm(e){return Wu.test(e)}function eb(e){return Gt(Wu,e)}const Vu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Xo(e){return Vu.test(e)}function tb(e){return Gt(Vu,e)}const Gu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function nb(e){return Gu.test(e)}function rb(e){return Gt(Gu,e)}const qu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function ob(e){return qu.test(e)}function sb(e){return Gt(qu,e)}const ib=/^receive\(\) external payable$/;function ab(e){return ib.test(e)}const Zu=new Set(["memory","indexed","storage","calldata"]),cb=new Set(["indexed"]),xi=new Set(["calldata","memory","storage"]);class ub extends Ue{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 lb extends Ue{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 fb extends Ue{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 db extends Ue{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 pb extends Ue{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class hb extends Ue{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 mb extends Ue{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 bb extends Ue{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 gb extends Ue{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class tr extends Ue{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class yb extends Ue{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class wb extends Ue{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 vb extends Ue{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 xb extends Ue{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 Eb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Ei=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 Pi(e,t={}){if(Jm(e))return Pb(e,t);if(Xm(e))return Sb(e,t);if(Ym(e))return $b(e,t);if(nb(e))return Ab(e,t);if(ob(e))return Tb(e);if(ab(e))return{type:"receive",stateMutability:"payable"};throw new yb({signature:e})}function Pb(e,t={}){const n=eb(e);if(!n)throw new tr({signature:e,type:"function"});const r=Qe(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(qt(r[c],{modifiers:xi,structs:t,type:"function"}));const i=[];if(n.returns){const c=Qe(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(qt(c[u],{modifiers:xi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Sb(e,t={}){const n=Qm(e);if(!n)throw new tr({signature:e,type:"event"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{modifiers:cb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function $b(e,t={}){const n=Km(e);if(!n)throw new tr({signature:e,type:"error"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Ab(e,t={}){const n=rb(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Tb(e){const t=sb(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Ob=/^(?<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$_]*))?$/,Nb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Cb=/^u?int$/;function qt(e,t){var f,p;const n=Eb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Ei.has(n))return Ei.get(n);const r=_u.test(e),o=Gt(r?Nb:Ob,e);if(!o)throw new pb({param:e});if(o.name&&Mb(o.name))throw new hb({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const d=Qe(o.type),h=[],m=d.length;for(let w=0;w<m;w++)h.push(qt(d[w],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(Cb.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"&&!Yu(a))throw new fb({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 mb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(xi.has(o.modifier)&&!kb(a,!!o.array))throw new bb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Ei.set(n,l),l}function Qe(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?Qe(c,[...t,n.trim()]):Qe(c,t,`${n}${i}`,r);case"(":return Qe(c,t,`${n}${i}`,r+1);case")":return Qe(c,t,`${n}${i}`,r-1);default:return Qe(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new xb({current:n,depth:r});return t.push(n.trim()),t}function Yu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Ru.test(e)||ju.test(e)}const Ib=/^(?: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 Mb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Ru.test(e)||ju.test(e)||Ib.test(e)}function kb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Si(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!Xo(c))continue;const a=tb(c);if(!a)throw new tr({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let p=0;p<f;p++){const h=u[p].trim();if(!h)continue;const m=qt(h,{type:"struct"});l.push(m)}if(!l.length)throw new wb({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=Ku(a,t)}return r}const Bb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Ku(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(_u.test(i.type))r.push(i);else{const a=Gt(Bb,i.type);if(!(a!=null&&a.type))throw new gb({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new vb({type:l});r.push({...i,type:`tuple${u??""}`,components:Ku(t[l]??[],t,new Set([...n,l]))})}else if(Yu(l))r.push(i);else throw new lb({type:l})}}return r}function Xu(e){const t=Si(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];Xo(s)||n.push(Pi(s,t))}return n}function Qu(e){let t;if(typeof e=="string")t=Pi(e);else{const n=Si(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!Xo(s)){t=Pi(s,n);break}}}if(!t)throw new ub({signature:e});return t}function Ju(e){const t=[];if(typeof e=="string"){const n=Qe(e),r=n.length;for(let o=0;o<r;o++)t.push(qt(n[o],{modifiers:Zu}))}else{const n=Si(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(Xo(s))continue;const i=Qe(s),c=i.length;for(let a=0;a<c;a++)t.push(qt(i[a],{modifiers:Zu,structs:n}))}}if(t.length===0)throw new db({params:e});return t}function X(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 xt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Zb(e.type);return`${e.name}(${Qo(e.inputs,{includeName:t})})`}function Qo(e,{includeName:t=!1}={}){return e?e.map(n=>Lb(n,{includeName:t})).join(t?", ":","):""}function Lb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Qo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Et(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return Et(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const el="2.42.1";let Dr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${el}`},V=class Nu extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof Nu?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Nu&&n.cause.docsPath||n.docsPath,s=(c=Dr.getDocsUrl)==null?void 0:c.call(Dr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Dr.version?[`Version: ${Dr.version}`]:[]].join(`
|
|
42
|
-
`);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=el}walk(t){return tl(this,t)}};function tl(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?tl(e.cause,t):t?null:e}class
|
|
40
|
+
跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},bi=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],ku={"en-US":jm,"ja-JP":_m,"ru-RU":Um,"zh-CN":Rm,"zh-TW":zm},qo="en-US",Hm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},Wm=e=>bi.includes(e)?ku[e]:ku[qo],Vm=e=>bi.includes(e),Bu=x.createContext(null),Gm=({config:e,children:t})=>{const n=x.useMemo(()=>{const r=e.locale||qo,o=Vm(r)?r:qo,s=Wm(o);return{...e,currentLocale:o,translations:s}},[e]);return k.jsx(Bu.Provider,{value:n,children:t})},Lu=()=>{const e=x.useContext(Bu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var qm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,gi=Math.ceil,ot=Math.floor,_e="[BigNumber Error] ",Fu=_e+"Number primitive has more than 15 significant digits: ",wt=1e14,ne=14,yi=9007199254740991,wi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],fn=1e7,Oe=1e9;function Du(e){var t,n,r,o=E.prototype={constructor:E,toString:null,valueOf:null},s=new E(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function E(b,g){var v,C,O,I,M,y,T,A,S=this;if(!(S instanceof E))return new E(b,g);if(g==null){if(b&&b._isBigNumber===!0){S.s=b.s,!b.c||b.e>f?S.c=S.e=null:b.e<l?S.c=[S.e=0]:(S.e=b.e,S.c=b.c.slice());return}if((y=typeof b=="number")&&b*0==0){if(S.s=1/b<0?(b=-b,-1):1,b===~~b){for(I=0,M=b;M>=10;M/=10,I++);I>f?S.c=S.e=null:(S.e=I,S.c=[b]);return}A=String(b)}else{if(!qm.test(A=String(b)))return r(S,A,y);S.s=A.charCodeAt(0)==45?(A=A.slice(1),-1):1}(I=A.indexOf("."))>-1&&(A=A.replace(".","")),(M=A.search(/e/i))>0?(I<0&&(I=M),I+=+A.slice(M+1),A=A.substring(0,M)):I<0&&(I=A.length)}else{if(ye(g,2,w.length,"Base"),g==10&&$)return S=new E(b),F(S,i+S.e+1,c);if(A=String(b),y=typeof b=="number"){if(b*0!=0)return r(S,A,y,g);if(S.s=1/b<0?(A=A.slice(1),-1):1,E.DEBUG&&A.replace(/^0\.0*|\./,"").length>15)throw Error(Fu+b)}else S.s=A.charCodeAt(0)===45?(A=A.slice(1),-1):1;for(v=w.slice(0,g),I=M=0,T=A.length;M<T;M++)if(v.indexOf(C=A.charAt(M))<0){if(C=="."){if(M>I){I=T;continue}}else if(!O&&(A==A.toUpperCase()&&(A=A.toLowerCase())||A==A.toLowerCase()&&(A=A.toUpperCase()))){O=!0,M=-1,I=0;continue}return r(S,String(b),y,g)}y=!1,A=n(A,g,10,S.s),(I=A.indexOf("."))>-1?A=A.replace(".",""):I=A.length}for(M=0;A.charCodeAt(M)===48;M++);for(T=A.length;A.charCodeAt(--T)===48;);if(A=A.slice(M,++T)){if(T-=M,y&&E.DEBUG&&T>15&&(b>yi||b!==ot(b)))throw Error(Fu+S.s*b);if((I=I-M-1)>f)S.c=S.e=null;else if(I<l)S.c=[S.e=0];else{if(S.e=I,S.c=[],M=(I+1)%ne,I<0&&(M+=ne),M<T){for(M&&S.c.push(+A.slice(0,M)),T-=ne;M<T;)S.c.push(+A.slice(M,M+=ne));M=ne-(A=A.slice(M)).length}else M-=T;for(;M--;A+="0");S.c.push(+A)}}else S.c=[S.e=0]}E.clone=Du,E.ROUND_UP=0,E.ROUND_DOWN=1,E.ROUND_CEIL=2,E.ROUND_FLOOR=3,E.ROUND_HALF_UP=4,E.ROUND_HALF_DOWN=5,E.ROUND_HALF_EVEN=6,E.ROUND_HALF_CEIL=7,E.ROUND_HALF_FLOOR=8,E.EUCLID=9,E.config=E.set=function(b){var g,v;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(g="DECIMAL_PLACES")&&(v=b[g],ye(v,0,Oe,g),i=v),b.hasOwnProperty(g="ROUNDING_MODE")&&(v=b[g],ye(v,0,8,g),c=v),b.hasOwnProperty(g="EXPONENTIAL_AT")&&(v=b[g],v&&v.pop?(ye(v[0],-Oe,0,g),ye(v[1],0,Oe,g),a=v[0],u=v[1]):(ye(v,-Oe,Oe,g),a=-(u=v<0?-v:v))),b.hasOwnProperty(g="RANGE"))if(v=b[g],v&&v.pop)ye(v[0],-Oe,-1,g),ye(v[1],1,Oe,g),l=v[0],f=v[1];else if(ye(v,-Oe,Oe,g),v)l=-(f=v<0?-v:v);else throw Error(_e+g+" cannot be zero: "+v);if(b.hasOwnProperty(g="CRYPTO"))if(v=b[g],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=v;else throw p=!v,Error(_e+"crypto unavailable");else p=v;else throw Error(_e+g+" not true or false: "+v);if(b.hasOwnProperty(g="MODULO_MODE")&&(v=b[g],ye(v,0,9,g),d=v),b.hasOwnProperty(g="POW_PRECISION")&&(v=b[g],ye(v,0,Oe,g),h=v),b.hasOwnProperty(g="FORMAT"))if(v=b[g],typeof v=="object")m=v;else throw Error(_e+g+" not an object: "+v);if(b.hasOwnProperty(g="ALPHABET"))if(v=b[g],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))$=v.slice(0,10)=="0123456789",w=v;else throw Error(_e+g+" invalid: "+v)}else throw Error(_e+"Object expected: "+b);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:w}},E.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!E.DEBUG)return!0;var g,v,C=b.c,O=b.e,I=b.s;e:if({}.toString.call(C)=="[object Array]"){if((I===1||I===-1)&&O>=-Oe&&O<=Oe&&O===ot(O)){if(C[0]===0){if(O===0&&C.length===1)return!0;break e}if(g=(O+1)%ne,g<1&&(g+=ne),String(C[0]).length==g){for(g=0;g<C.length;g++)if(v=C[g],v<0||v>=wt||v!==ot(v))break e;if(v!==0)return!0}}}else if(C===null&&O===null&&(I===null||I===1||I===-1))return!0;throw Error(_e+"Invalid BigNumber: "+b)},E.maximum=E.max=function(){return N(arguments,-1)},E.minimum=E.min=function(){return N(arguments,1)},E.random=function(){var b=9007199254740992,g=Math.random()*b&2097151?function(){return ot(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var C,O,I,M,y,T=0,A=[],S=new E(s);if(v==null?v=i:ye(v,0,Oe),M=gi(v/ne),p)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(M*=2));T<M;)y=C[T]*131072+(C[T+1]>>>11),y>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),C[T]=O[0],C[T+1]=O[1]):(A.push(y%1e14),T+=2);T=M/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(M*=7);T<M;)y=(C[T]&31)*281474976710656+C[T+1]*1099511627776+C[T+2]*4294967296+C[T+3]*16777216+(C[T+4]<<16)+(C[T+5]<<8)+C[T+6],y>=9e15?crypto.randomBytes(7).copy(C,T):(A.push(y%1e14),T+=7);T=M/7}else throw p=!1,Error(_e+"crypto unavailable");if(!p)for(;T<M;)y=g(),y<9e15&&(A[T++]=y%1e14);for(M=A[--T],v%=ne,M&&v&&(y=wi[ne-v],A[T]=ot(M/y)*y);A[T]===0;A.pop(),T--);if(T<0)A=[I=0];else{for(I=-1;A[0]===0;A.splice(0,1),I-=ne);for(T=1,y=A[0];y>=10;y/=10,T++);T<ne&&(I-=ne-T)}return S.e=I,S.c=A,S}}(),E.sum=function(){for(var b=1,g=arguments,v=new E(g[0]);b<g.length;)v=v.plus(g[b++]);return v},n=function(){var b="0123456789";function g(v,C,O,I){for(var M,y=[0],T,A=0,S=v.length;A<S;){for(T=y.length;T--;y[T]*=C);for(y[0]+=I.indexOf(v.charAt(A++)),M=0;M<y.length;M++)y[M]>O-1&&(y[M+1]==null&&(y[M+1]=0),y[M+1]+=y[M]/O|0,y[M]%=O)}return y.reverse()}return function(v,C,O,I,M){var y,T,A,S,L,j,z,_,W=v.indexOf("."),K=i,G=c;for(W>=0&&(S=h,h=0,v=v.replace(".",""),_=new E(C),j=_.pow(v.length-W),h=S,_.c=g(Vt(it(j.c),j.e,"0"),10,O,b),_.e=_.c.length),z=g(v,C,O,M?(y=w,b):(y=b,w)),A=S=z.length;z[--S]==0;z.pop());if(!z[0])return y.charAt(0);if(W<0?--A:(j.c=z,j.e=A,j.s=I,j=t(j,_,K,G,O),z=j.c,L=j.r,A=j.e),T=A+K+1,W=z[T],S=O/2,L=L||T<0||z[T+1]!=null,L=G<4?(W!=null||L)&&(G==0||G==(j.s<0?3:2)):W>S||W==S&&(G==4||L||G==6&&z[T-1]&1||G==(j.s<0?8:7)),T<1||!z[0])v=L?Vt(y.charAt(1),-K,y.charAt(0)):y.charAt(0);else{if(z.length=T,L)for(--O;++z[--T]>O;)z[T]=0,T||(++A,z=[1].concat(z));for(S=z.length;!z[--S];);for(W=0,v="";W<=S;v+=y.charAt(z[W++]));v=Vt(v,A,y.charAt(0))}return v}}(),t=function(){function b(C,O,I){var M,y,T,A,S=0,L=C.length,j=O%fn,z=O/fn|0;for(C=C.slice();L--;)T=C[L]%fn,A=C[L]/fn|0,M=z*T+A*j,y=j*T+M%fn*fn+S,S=(y/I|0)+(M/fn|0)+z*A,C[L]=y%I;return S&&(C=[S].concat(C)),C}function g(C,O,I,M){var y,T;if(I!=M)T=I>M?1:-1;else for(y=T=0;y<I;y++)if(C[y]!=O[y]){T=C[y]>O[y]?1:-1;break}return T}function v(C,O,I,M){for(var y=0;I--;)C[I]-=y,y=C[I]<O[I]?1:0,C[I]=y*M+C[I]-O[I];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,O,I,M,y){var T,A,S,L,j,z,_,W,K,G,H,Z,J,oe,me,ge,de,se=C.s==O.s?1:-1,pe=C.c,ee=O.c;if(!pe||!pe[0]||!ee||!ee[0])return new E(!C.s||!O.s||(pe?ee&&pe[0]==ee[0]:!ee)?NaN:pe&&pe[0]==0||!ee?se*0:se/0);for(W=new E(se),K=W.c=[],A=C.e-O.e,se=I+A+1,y||(y=wt,A=st(C.e/ne)-st(O.e/ne),se=se/ne|0),S=0;ee[S]==(pe[S]||0);S++);if(ee[S]>(pe[S]||0)&&A--,se<0)K.push(1),L=!0;else{for(oe=pe.length,ge=ee.length,S=0,se+=2,j=ot(y/(ee[0]+1)),j>1&&(ee=b(ee,j,y),pe=b(pe,j,y),ge=ee.length,oe=pe.length),J=ge,G=pe.slice(0,ge),H=G.length;H<ge;G[H++]=0);de=ee.slice(),de=[0].concat(de),me=ee[0],ee[1]>=y/2&&me++;do{if(j=0,T=g(ee,G,ge,H),T<0){if(Z=G[0],ge!=H&&(Z=Z*y+(G[1]||0)),j=ot(Z/me),j>1)for(j>=y&&(j=y-1),z=b(ee,j,y),_=z.length,H=G.length;g(z,G,_,H)==1;)j--,v(z,ge<_?de:ee,_,y),_=z.length,T=1;else j==0&&(T=j=1),z=ee.slice(),_=z.length;if(_<H&&(z=[0].concat(z)),v(G,z,H,y),H=G.length,T==-1)for(;g(ee,G,ge,H)<1;)j++,v(G,ge<H?de:ee,H,y),H=G.length}else T===0&&(j++,G=[0]);K[S++]=j,G[0]?G[H++]=pe[J]||0:(G=[pe[J]],H=1)}while((J++<oe||G[0]!=null)&&se--);L=G[0]!=null,K[0]||K.splice(0,1)}if(y==wt){for(S=1,se=K[0];se>=10;se/=10,S++);F(W,I+(W.e=S+A*ne-1)+1,M,L)}else W.e=A,W.r=+L;return W}}();function P(b,g,v,C){var O,I,M,y,T;if(v==null?v=c:ye(v,0,8),!b.c)return b.toString();if(O=b.c[0],M=b.e,g==null)T=it(b.c),T=C==1||C==2&&(M<=a||M>=u)?Yo(T,M):Vt(T,M,"0");else if(b=F(new E(b),g,v),I=b.e,T=it(b.c),y=T.length,C==1||C==2&&(g<=I||I<=a)){for(;y<g;T+="0",y++);T=Yo(T,I)}else if(g-=M+(C===2&&I>M),T=Vt(T,I,"0"),I+1>y){if(--g>0)for(T+=".";g--;T+="0");}else if(g+=I-y,g>0)for(I+1==y&&(T+=".");g--;T+="0");return b.s<0&&O?"-"+T:T}function N(b,g){for(var v,C,O=1,I=new E(b[0]);O<b.length;O++)C=new E(b[O]),(!C.s||(v=Nn(I,C))===g||v===0&&I.s===g)&&(I=C);return I}function B(b,g,v){for(var C=1,O=g.length;!g[--O];g.pop());for(O=g[0];O>=10;O/=10,C++);return(v=C+v*ne-1)>f?b.c=b.e=null:v<l?b.c=[b.e=0]:(b.e=v,b.c=g),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,O=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(I,M,y,T){var A,S=y?M:M.replace(O,"");if(C.test(S))I.s=isNaN(S)?null:S<0?-1:1;else{if(!y&&(S=S.replace(b,function(L,j,z){return A=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!T||T==A?j:L}),T&&(A=T,S=S.replace(g,"$1").replace(v,"0.$1")),M!=S))return new E(S,A);if(E.DEBUG)throw Error(_e+"Not a"+(T?" base "+T:"")+" number: "+M);I.s=null}I.c=I.e=null}}();function F(b,g,v,C){var O,I,M,y,T,A,S,L=b.c,j=wi;if(L){e:{for(O=1,y=L[0];y>=10;y/=10,O++);if(I=g-O,I<0)I+=ne,M=g,T=L[A=0],S=ot(T/j[O-M-1]%10);else if(A=gi((I+1)/ne),A>=L.length)if(C){for(;L.length<=A;L.push(0));T=S=0,O=1,I%=ne,M=I-ne+1}else break e;else{for(T=y=L[A],O=1;y>=10;y/=10,O++);I%=ne,M=I-ne+O,S=M<0?0:ot(T/j[O-M-1]%10)}if(C=C||g<0||L[A+1]!=null||(M<0?T:T%j[O-M-1]),C=v<4?(S||C)&&(v==0||v==(b.s<0?3:2)):S>5||S==5&&(v==4||C||v==6&&(I>0?M>0?T/j[O-M]:0:L[A-1])%10&1||v==(b.s<0?8:7)),g<1||!L[0])return L.length=0,C?(g-=b.e+1,L[0]=j[(ne-g%ne)%ne],b.e=-g||0):L[0]=b.e=0,b;if(I==0?(L.length=A,y=1,A--):(L.length=A+1,y=j[ne-I],L[A]=M>0?ot(T/j[O-M]%j[M])*y:0),C)for(;;)if(A==0){for(I=1,M=L[0];M>=10;M/=10,I++);for(M=L[0]+=y,y=1;M>=10;M/=10,y++);I!=y&&(b.e++,L[0]==wt&&(L[0]=1));break}else{if(L[A]+=y,L[A]!=wt)break;L[A--]=0,y=1}for(I=L.length;L[--I]===0;L.pop());}b.e>f?b.c=b.e=null:b.e<l&&(b.c=[b.e=0])}return b}function D(b){var g,v=b.e;return v===null?b.toString():(g=it(b.c),g=v<=a||v>=u?Yo(g,v):Vt(g,v,"0"),b.s<0?"-"+g:g)}return o.absoluteValue=o.abs=function(){var b=new E(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,g){return Nn(this,new E(b,g))},o.decimalPlaces=o.dp=function(b,g){var v,C,O,I=this;if(b!=null)return ye(b,0,Oe),g==null?g=c:ye(g,0,8),F(new E(I),b+I.e+1,g);if(!(v=I.c))return null;if(C=((O=v.length-1)-st(this.e/ne))*ne,O=v[O])for(;O%10==0;O/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(b,g){return t(this,new E(b,g),i,c)},o.dividedToIntegerBy=o.idiv=function(b,g){return t(this,new E(b,g),0,1)},o.exponentiatedBy=o.pow=function(b,g){var v,C,O,I,M,y,T,A,S,L=this;if(b=new E(b),b.c&&!b.isInteger())throw Error(_e+"Exponent not an integer: "+D(b));if(g!=null&&(g=new E(g)),y=b.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!b.c||!b.c[0])return S=new E(Math.pow(+D(L),y?b.s*(2-Zo(b)):+D(b))),g?S.mod(g):S;if(T=b.s<0,g){if(g.c?!g.c[0]:!g.s)return new E(NaN);C=!T&&L.isInteger()&&g.isInteger(),C&&(L=L.mod(g))}else{if(b.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||y&&L.c[1]>=24e7:L.c[0]<8e13||y&&L.c[0]<=9999975e7)))return I=L.s<0&&Zo(b)?-0:0,L.e>-1&&(I=1/I),new E(T?1/I:I);h&&(I=gi(h/ne+2))}for(y?(v=new E(.5),T&&(b.s=1),A=Zo(b)):(O=Math.abs(+D(b)),A=O%2),S=new E(s);;){if(A){if(S=S.times(L),!S.c)break;I?S.c.length>I&&(S.c.length=I):C&&(S=S.mod(g))}if(O){if(O=ot(O/2),O===0)break;A=O%2}else if(b=b.times(v),F(b,b.e+1,1),b.e>14)A=Zo(b);else{if(O=+D(b),O===0)break;A=O%2}L=L.times(L),I?L.c&&L.c.length>I&&(L.c.length=I):C&&(L=L.mod(g))}return C?S:(T&&(S=s.div(S)),g?S.mod(g):I?F(S,h,c,M):S)},o.integerValue=function(b){var g=new E(this);return b==null?b=c:ye(b,0,8),F(g,g.e+1,b)},o.isEqualTo=o.eq=function(b,g){return Nn(this,new E(b,g))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,g){return Nn(this,new E(b,g))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,g){return(g=Nn(this,new E(b,g)))===1||g===0},o.isInteger=function(){return!!this.c&&st(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(b,g){return Nn(this,new E(b,g))<0},o.isLessThanOrEqualTo=o.lte=function(b,g){return(g=Nn(this,new E(b,g)))===-1||g===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(b,g){var v,C,O,I,M=this,y=M.s;if(b=new E(b,g),g=b.s,!y||!g)return new E(NaN);if(y!=g)return b.s=-g,M.plus(b);var T=M.e/ne,A=b.e/ne,S=M.c,L=b.c;if(!T||!A){if(!S||!L)return S?(b.s=-g,b):new E(L?M:NaN);if(!S[0]||!L[0])return L[0]?(b.s=-g,b):new E(S[0]?M:c==3?-0:0)}if(T=st(T),A=st(A),S=S.slice(),y=T-A){for((I=y<0)?(y=-y,O=S):(A=T,O=L),O.reverse(),g=y;g--;O.push(0));O.reverse()}else for(C=(I=(y=S.length)<(g=L.length))?y:g,y=g=0;g<C;g++)if(S[g]!=L[g]){I=S[g]<L[g];break}if(I&&(O=S,S=L,L=O,b.s=-b.s),g=(C=L.length)-(v=S.length),g>0)for(;g--;S[v++]=0);for(g=wt-1;C>y;){if(S[--C]<L[C]){for(v=C;v&&!S[--v];S[v]=g);--S[v],S[C]+=wt}S[C]-=L[C]}for(;S[0]==0;S.splice(0,1),--A);return S[0]?B(b,S,A):(b.s=c==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,g){var v,C,O=this;return b=new E(b,g),!O.c||!b.s||b.c&&!b.c[0]?new E(NaN):!b.c||O.c&&!O.c[0]?new E(O):(d==9?(C=b.s,b.s=1,v=t(O,b,0,3),b.s=C,v.s*=C):v=t(O,b,0,d),b=O.minus(v.times(b)),!b.c[0]&&d==1&&(b.s=O.s),b)},o.multipliedBy=o.times=function(b,g){var v,C,O,I,M,y,T,A,S,L,j,z,_,W,K,G=this,H=G.c,Z=(b=new E(b,g)).c;if(!H||!Z||!H[0]||!Z[0])return!G.s||!b.s||H&&!H[0]&&!Z||Z&&!Z[0]&&!H?b.c=b.e=b.s=null:(b.s*=G.s,!H||!Z?b.c=b.e=null:(b.c=[0],b.e=0)),b;for(C=st(G.e/ne)+st(b.e/ne),b.s*=G.s,T=H.length,L=Z.length,T<L&&(_=H,H=Z,Z=_,O=T,T=L,L=O),O=T+L,_=[];O--;_.push(0));for(W=wt,K=fn,O=L;--O>=0;){for(v=0,j=Z[O]%K,z=Z[O]/K|0,M=T,I=O+M;I>O;)A=H[--M]%K,S=H[M]/K|0,y=z*A+S*j,A=j*A+y%K*K+_[I]+v,v=(A/W|0)+(y/K|0)+z*S,_[I--]=A%W;_[I]=v}return v?++C:_.splice(0,1),B(b,_,C)},o.negated=function(){var b=new E(this);return b.s=-b.s||null,b},o.plus=function(b,g){var v,C=this,O=C.s;if(b=new E(b,g),g=b.s,!O||!g)return new E(NaN);if(O!=g)return b.s=-g,C.minus(b);var I=C.e/ne,M=b.e/ne,y=C.c,T=b.c;if(!I||!M){if(!y||!T)return new E(O/0);if(!y[0]||!T[0])return T[0]?b:new E(y[0]?C:O*0)}if(I=st(I),M=st(M),y=y.slice(),O=I-M){for(O>0?(M=I,v=T):(O=-O,v=y),v.reverse();O--;v.push(0));v.reverse()}for(O=y.length,g=T.length,O-g<0&&(v=T,T=y,y=v,g=O),O=0;g;)O=(y[--g]=y[g]+T[g]+O)/wt|0,y[g]=wt===y[g]?0:y[g]%wt;return O&&(y=[O].concat(y),++M),B(b,y,M)},o.precision=o.sd=function(b,g){var v,C,O,I=this;if(b!=null&&b!==!!b)return ye(b,1,Oe),g==null?g=c:ye(g,0,8),F(new E(I),b,g);if(!(v=I.c))return null;if(O=v.length-1,C=O*ne+1,O=v[O]){for(;O%10==0;O/=10,C--);for(O=v[0];O>=10;O/=10,C++);}return b&&I.e+1>C&&(C=I.e+1),C},o.shiftedBy=function(b){return ye(b,-yi,yi),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,g,v,C,O,I=this,M=I.c,y=I.s,T=I.e,A=i+4,S=new E("0.5");if(y!==1||!M||!M[0])return new E(!y||y<0&&(!M||M[0])?NaN:M?I:1/0);if(y=Math.sqrt(+D(I)),y==0||y==1/0?(g=it(M),(g.length+T)%2==0&&(g+="0"),y=Math.sqrt(+g),T=st((T+1)/2)-(T<0||T%2),y==1/0?g="5e"+T:(g=y.toExponential(),g=g.slice(0,g.indexOf("e")+1)+T),v=new E(g)):v=new E(y+""),v.c[0]){for(T=v.e,y=T+A,y<3&&(y=0);;)if(O=v,v=S.times(O.plus(t(I,O,A,1))),it(O.c).slice(0,y)===(g=it(v.c)).slice(0,y))if(v.e<T&&--y,g=g.slice(y-3,y+1),g=="9999"||!C&&g=="4999"){if(!C&&(F(O,O.e+i+2,0),O.times(O).eq(I))){v=O;break}A+=4,y+=4,C=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(F(v,v.e+i+2,1),b=!v.times(v).eq(I));break}}return F(v,v.e+i+1,c,b)},o.toExponential=function(b,g){return b!=null&&(ye(b,0,Oe),b++),P(this,b,g,1)},o.toFixed=function(b,g){return b!=null&&(ye(b,0,Oe),b=b+this.e+1),P(this,b,g)},o.toFormat=function(b,g,v){var C,O=this;if(v==null)b!=null&&g&&typeof g=="object"?(v=g,g=null):b&&typeof b=="object"?(v=b,b=g=null):v=m;else if(typeof v!="object")throw Error(_e+"Argument not an object: "+v);if(C=O.toFixed(b,g),O.c){var I,M=C.split("."),y=+v.groupSize,T=+v.secondaryGroupSize,A=v.groupSeparator||"",S=M[0],L=M[1],j=O.s<0,z=j?S.slice(1):S,_=z.length;if(T&&(I=y,y=T,T=I,_-=I),y>0&&_>0){for(I=_%y||y,S=z.substr(0,I);I<_;I+=y)S+=A+z.substr(I,y);T>0&&(S+=A+z.slice(I)),j&&(S="-"+S)}C=L?S+(v.decimalSeparator||"")+((T=+v.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):L):S}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(b){var g,v,C,O,I,M,y,T,A,S,L,j,z=this,_=z.c;if(b!=null&&(y=new E(b),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(_e+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+D(y));if(!_)return new E(z);for(g=new E(s),A=v=new E(s),C=T=new E(s),j=it(_),I=g.e=j.length-z.e-1,g.c[0]=wi[(M=I%ne)<0?ne+M:M],b=!b||y.comparedTo(g)>0?I>0?g:A:y,M=f,f=1/0,y=new E(j),T.c[0]=0;S=t(y,g,0,1),O=v.plus(S.times(C)),O.comparedTo(b)!=1;)v=C,C=O,A=T.plus(S.times(O=A)),T=O,g=y.minus(S.times(O=g)),y=O;return O=t(b.minus(v),C,0,1),T=T.plus(O.times(A)),v=v.plus(O.times(C)),T.s=A.s=z.s,I=I*2,L=t(A,C,I,c).minus(z).abs().comparedTo(t(T,v,I,c).minus(z).abs())<1?[A,C]:[T,v],f=M,L},o.toNumber=function(){return+D(this)},o.toPrecision=function(b,g){return b!=null&&ye(b,1,Oe),P(this,b,g,2)},o.toString=function(b){var g,v=this,C=v.s,O=v.e;return O===null?C?(g="Infinity",C<0&&(g="-"+g)):g="NaN":(b==null?g=O<=a||O>=u?Yo(it(v.c),O):Vt(it(v.c),O,"0"):b===10&&$?(v=F(new E(v),i+O+1,c),g=Vt(it(v.c),v.e,"0")):(ye(b,2,w.length,"Base"),g=n(Vt(it(v.c),O,"0"),10,b,C,!0)),C<0&&v.c[0]&&(g="-"+g)),g},o.valueOf=o.toJSON=function(){return D(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&E.set(e),E}function st(e){var t=e|0;return e>0||e===t?t:t-1}function it(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Nn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function ye(e,t,n,r){if(e<t||e>n||e!==ot(e))throw Error(_e+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Zo(e){var t=e.c.length-1;return st(e.e/ne)==t&&e.c[t]%2!=0}function Yo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Vt(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 Ie=Du();const Zm=(e,t=6)=>{try{const n=new Ie(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ie.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},vt=()=>{const{translations:e,currentLocale:t}=Lu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},Ym="1.1.0";let Ue=class Ou extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Ou?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Ou&&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@${Ym}`].join(`
|
|
41
|
+
`);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Gt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Ru=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ju=/^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)?$/,_u=/^\(.+?\).*?$/,Uu=/^tuple(?<array>(\[(\d*)\])*)$/;function vi(e){let t=e.type;if(Uu.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+=vi(s),o<n-1&&(t+=", ")}const r=Gt(Uu,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,vi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function er(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=vi(o),r!==n-1&&(t+=", ")}return t}function Ko(e){var t;return e.type==="function"?`function ${e.name}(${er(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${er(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${er(e.inputs)})`:e.type==="error"?`error ${e.name}(${er(e.inputs)})`:e.type==="constructor"?`constructor(${er(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const zu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Km(e){return zu.test(e)}function Xm(e){return Gt(zu,e)}const Hu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Qm(e){return Hu.test(e)}function Jm(e){return Gt(Hu,e)}const Wu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function eb(e){return Wu.test(e)}function tb(e){return Gt(Wu,e)}const Vu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Xo(e){return Vu.test(e)}function nb(e){return Gt(Vu,e)}const Gu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function rb(e){return Gu.test(e)}function ob(e){return Gt(Gu,e)}const qu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function sb(e){return qu.test(e)}function ib(e){return Gt(qu,e)}const ab=/^receive\(\) external payable$/;function cb(e){return ab.test(e)}const Zu=new Set(["memory","indexed","storage","calldata"]),ub=new Set(["indexed"]),xi=new Set(["calldata","memory","storage"]);class lb extends Ue{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 fb extends Ue{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 db extends Ue{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 pb extends Ue{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 hb extends Ue{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class mb extends Ue{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 Ue{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 gb extends Ue{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 yb extends Ue{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class tr extends Ue{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class wb extends Ue{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class vb extends Ue{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 xb extends Ue{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 Eb extends Ue{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 Pb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Ei=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 Pi(e,t={}){if(eb(e))return Sb(e,t);if(Qm(e))return $b(e,t);if(Km(e))return Ab(e,t);if(rb(e))return Tb(e,t);if(sb(e))return Ob(e);if(cb(e))return{type:"receive",stateMutability:"payable"};throw new wb({signature:e})}function Sb(e,t={}){const n=tb(e);if(!n)throw new tr({signature:e,type:"function"});const r=Qe(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(qt(r[c],{modifiers:xi,structs:t,type:"function"}));const i=[];if(n.returns){const c=Qe(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(qt(c[u],{modifiers:xi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function $b(e,t={}){const n=Jm(e);if(!n)throw new tr({signature:e,type:"event"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{modifiers:ub,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Ab(e,t={}){const n=Xm(e);if(!n)throw new tr({signature:e,type:"error"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Tb(e,t={}){const n=ob(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=Qe(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(qt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Ob(e){const t=ib(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Nb=/^(?<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$_]*))?$/,Cb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ib=/^u?int$/;function qt(e,t){var f,p;const n=Pb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Ei.has(n))return Ei.get(n);const r=_u.test(e),o=Gt(r?Cb:Nb,e);if(!o)throw new hb({param:e});if(o.name&&kb(o.name))throw new mb({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const d=Qe(o.type),h=[],m=d.length;for(let w=0;w<m;w++)h.push(qt(d[w],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(Ib.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"&&!Yu(a))throw new db({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(xi.has(o.modifier)&&!Bb(a,!!o.array))throw new gb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Ei.set(n,l),l}function Qe(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?Qe(c,[...t,n.trim()]):Qe(c,t,`${n}${i}`,r);case"(":return Qe(c,t,`${n}${i}`,r+1);case")":return Qe(c,t,`${n}${i}`,r-1);default:return Qe(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Eb({current:n,depth:r});return t.push(n.trim()),t}function Yu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Ru.test(e)||ju.test(e)}const Mb=/^(?: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 kb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Ru.test(e)||ju.test(e)||Mb.test(e)}function Bb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Si(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!Xo(c))continue;const a=nb(c);if(!a)throw new tr({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let p=0;p<f;p++){const h=u[p].trim();if(!h)continue;const m=qt(h,{type:"struct"});l.push(m)}if(!l.length)throw new vb({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=Ku(a,t)}return r}const Lb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Ku(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(_u.test(i.type))r.push(i);else{const a=Gt(Lb,i.type);if(!(a!=null&&a.type))throw new yb({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new xb({type:l});r.push({...i,type:`tuple${u??""}`,components:Ku(t[l]??[],t,new Set([...n,l]))})}else if(Yu(l))r.push(i);else throw new fb({type:l})}}return r}function Xu(e){const t=Si(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];Xo(s)||n.push(Pi(s,t))}return n}function Qu(e){let t;if(typeof e=="string")t=Pi(e);else{const n=Si(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!Xo(s)){t=Pi(s,n);break}}}if(!t)throw new lb({signature:e});return t}function Ju(e){const t=[];if(typeof e=="string"){const n=Qe(e),r=n.length;for(let o=0;o<r;o++)t.push(qt(n[o],{modifiers:Zu}))}else{const n=Si(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(Xo(s))continue;const i=Qe(s),c=i.length;for(let a=0;a<c;a++)t.push(qt(i[a],{modifiers:Zu,structs:n}))}}if(t.length===0)throw new pb({params:e});return t}function X(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 xt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Yb(e.type);return`${e.name}(${Qo(e.inputs,{includeName:t})})`}function Qo(e,{includeName:t=!1}={}){return e?e.map(n=>Fb(n,{includeName:t})).join(t?", ":","):""}function Fb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Qo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Et(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return Et(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const el="2.42.1";let Dr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${el}`},V=class Nu extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof Nu?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Nu&&n.cause.docsPath||n.docsPath,s=(c=Dr.getDocsUrl)==null?void 0:c.call(Dr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Dr.version?[`Version: ${Dr.version}`]:[]].join(`
|
|
42
|
+
`);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=el}walk(t){return tl(this,t)}};function tl(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?tl(e.cause,t):t?null:e}class Db 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(`
|
|
43
43
|
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class nl 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(`
|
|
44
44
|
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class rl extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
45
|
-
`),{metaMessages:[`Params: (${Qo(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 Rr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class
|
|
46
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class
|
|
47
|
-
`),{name:"AbiEncodingLengthMismatchError"})}}class
|
|
45
|
+
`),{metaMessages:[`Params: (${Qo(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 Rr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class Rb 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(`
|
|
46
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class jb extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${we(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class _b extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
47
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class Ub 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(`
|
|
48
48
|
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class ol 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(`
|
|
49
49
|
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class sl extends V{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
50
|
-
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class
|
|
50
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class zb extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Hb extends V{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
51
51
|
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class il extends V{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
|
|
52
52
|
`),{docsPath:n,name:"AbiEventNotFoundError"})}}class nr extends V{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
53
53
|
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class al extends V{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
54
|
-
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class
|
|
55
|
-
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class
|
|
54
|
+
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Wb extends V{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
55
|
+
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class Vb extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${xt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${xt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let Gb=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Jo extends V{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
|
|
56
56
|
`),{metaMessages:[`Params: (${Qo(r,{includeName:!0})})`,`Data: ${n} (${o} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=o}}class $i extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${xt(t,{includeName:!0})}".`].join(`
|
|
57
|
-
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class
|
|
58
|
-
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class
|
|
57
|
+
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class qb extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
58
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Zb extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
59
59
|
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let cl=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
60
|
-
`),{name:"InvalidArrayError"})}};class
|
|
61
|
-
`),{name:"InvalidDefinitionTypeError"})}}class Yb extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let ul=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"})}},ll=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 fl extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?dn(e,{dir:t,size:n}):Kb(e,{dir:t,size:n})}function dn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new ll({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Kb(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ll({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 dl=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"})}},Xb=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 Qb 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 Jb=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Cn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function Pt(e,{size:t}){if(we(e)>t)throw new Jb({givenSize:we(e),maxSize:t})}function kt(e,t={}){const{signed:n}=t;t.size&&Pt(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 e1(e,t={}){let n=e;if(t.size&&(Pt(n,{size:t.size}),n=Cn(n)),Cn(n)==="0x00")return!1;if(Cn(n)==="0x01")return!0;throw new Qb(n)}function Zt(e,t={}){return Number(kt(e,t))}const t1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function pn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Q(e,t):typeof e=="string"?jr(e,t):typeof e=="boolean"?pl(e,t):Ae(e,t)}function pl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Pt(n,{size:t.size}),rr(n,{size:t.size})):n}function Ae(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=t1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Pt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function Q(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new dl({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?rr(c,{size:r}):c}const n1=new TextEncoder;function jr(e,t={}){const n=n1.encode(e);return Ae(n,t)}const r1=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?s1(e,t):typeof e=="boolean"?o1(e,t):Et(e)?Bt(e,t):In(e,t)}function o1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Pt(n,{size:t.size}),rr(n,{size:t.size})):n}const Yt={zero:48,nine:57,A:65,F:70,a:97,f:102};function hl(e){if(e>=Yt.zero&&e<=Yt.nine)return e-Yt.zero;if(e>=Yt.A&&e<=Yt.F)return e-(Yt.A-10);if(e>=Yt.a&&e<=Yt.f)return e-(Yt.a-10)}function Bt(e,t={}){let n=e;t.size&&(Pt(n,{size:t.size}),n=rr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=hl(r.charCodeAt(c++)),u=hl(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function s1(e,t){const n=Q(e,t);return Bt(n)}function In(e,t={}){const n=r1.encode(e);return typeof t.size=="number"?(Pt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const es=BigInt(2**32-1),ml=BigInt(32);function i1(e,t=!1){return t?{h:Number(e&es),l:Number(e>>ml&es)}:{h:Number(e>>ml&es)|0,l:Number(e&es)|0}}function a1(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l:c}=i1(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const c1=(e,t,n)=>e<<n|t>>>32-n,u1=(e,t,n)=>t<<n|e>>>32-n,l1=(e,t,n)=>t<<n-32|e>>>64-n,f1=(e,t,n)=>e<<n-32|t>>>64-n,sr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function d1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function _r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Mn(e,...t){if(!d1(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 p1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");_r(e.outputLen),_r(e.blockLen)}function ir(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function bl(e,t){Mn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function h1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ar(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ai(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Lt(e,t){return e<<32-t|e>>>t}const m1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function b1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function g1(e){for(let t=0;t<e.length;t++)e[t]=b1(e[t]);return e}const gl=m1?e=>e:g1;function y1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ts(e){return typeof e=="string"&&(e=y1(e)),Mn(e),e}function w1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Mn(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 Ti{}function yl(e){const t=r=>e().update(ts(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function v1(e=32){if(sr&&typeof sr.getRandomValues=="function")return sr.getRandomValues(new Uint8Array(e));if(sr&&typeof sr.randomBytes=="function")return Uint8Array.from(sr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const x1=BigInt(0),Ur=BigInt(1),E1=BigInt(2),P1=BigInt(7),S1=BigInt(256),$1=BigInt(113),wl=[],vl=[],xl=[];for(let e=0,t=Ur,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],wl.push(2*(5*r+n)),vl.push((e+1)*(e+2)/2%64);let o=x1;for(let s=0;s<7;s++)t=(t<<Ur^(t>>P1)*$1)%S1,t&E1&&(o^=Ur<<(Ur<<BigInt(s))-Ur);xl.push(o)}const El=a1(xl,!0),A1=El[0],T1=El[1],Pl=(e,t,n)=>n>32?l1(e,t,n):c1(e,t,n),Sl=(e,t,n)=>n>32?f1(e,t,n):u1(e,t,n);function O1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,u=n[a],l=n[a+1],f=Pl(u,l,1)^n[c],p=Sl(u,l,1)^n[c+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=vl[i],a=Pl(o,s,c),u=Sl(o,s,c),l=wl[i];o=e[l],s=e[l+1],e[l]=a,e[l+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=A1[r],e[1]^=T1[r]}ar(n)}class Oi extends Ti{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,_r(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=h1(this.state)}clone(){return this._cloneInto()}keccak(){gl(this.state32),O1(this.state32,this.rounds),gl(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=ts(t),Mn(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){ir(this,!1),Mn(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 _r(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(bl(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ar(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Oi(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 N1=(e,t,n)=>yl(()=>new Oi(t,e,n)),$l=N1(1,136,256/8);function Me(e,t){const n=t||"hex",r=$l(Et(e,{strict:!1})?or(e):e);return n==="bytes"?r:pn(r)}const C1=e=>Me(or(e));function I1(e){return C1(e)}function M1(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new V("Unable to normalize signature.");return o}const k1=e=>{const t=typeof e=="string"?e:Ko(e);return M1(t)};function Al(e){return I1(k1(e))}const ns=Al;let hn=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"})}},rs=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 Ni=new rs(8192);function os(e,t){if(Ni.has(`${e}.${t}`))return Ni.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Me(In(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return Ni.set(`${e}.${t}`,s),s}function mn(e,t){if(!at(e,{strict:!1}))throw new hn({address:e});return os(e,t)}const B1=/^0x[a-fA-F0-9]{40}$/,Ci=new rs(8192);function at(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ci.has(r))return Ci.get(r);const o=B1.test(e)?e.toLowerCase()===e?!0:n?os(e)===e:!0:!1;return Ci.set(r,o),o}function St(e){return typeof e[0]=="string"?cr(e):L1(e)}function L1(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 cr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function ur(e,t,n,{strict:r}={}){return Et(e,{strict:!1})?F1(e,t,n,{strict:r}):Nl(e,t,n,{strict:r})}function Tl(e,t){if(typeof t=="number"&&t>0&&t>we(e)-1)throw new ul({offset:t,position:"start",size:we(e)})}function Ol(e,t,n){if(typeof t=="number"&&typeof n=="number"&&we(e)!==n-t)throw new ul({offset:n,position:"end",size:we(e)})}function Nl(e,t,n,{strict:r}={}){Tl(e,t);const o=e.slice(t,n);return r&&Ol(o,t,n),o}function F1(e,t,n,{strict:r}={}){Tl(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Ol(o,t,n),o}const D1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Cl=/^(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 bn(e,t){if(e.length!==t.length)throw new jb({expectedLength:e.length,givenLength:t.length});const n=R1({params:e,values:t}),r=Mi(n);return r.length===0?"0x":r}function R1({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ii({param:e[r],value:t[r]}));return n}function Ii({param:e,value:t}){const n=ki(e.type);if(n){const[r,o]=n;return _1(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return V1(t,{param:e});if(e.type==="address")return j1(t);if(e.type==="bool")return z1(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Cl.exec(e.type)??[];return H1(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return U1(t,{param:e});if(e.type==="string")return W1(t);throw new Gb(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Mi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=we(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Q(t+o,{size:32})),r.push(c),o+=we(c)):n.push(c)}return St([...n,...r])}function j1(e){if(!at(e))throw new hn({address:e});return{dynamic:!1,encoded:dn(e.toLowerCase())}}function _1(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new cl(e);if(!r&&e.length!==t)throw new Db({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Ii({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Mi(s);if(r){const c=Q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?St([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:St(s.map(({encoded:i})=>i))}}function U1(e,{param:t}){const[,n]=t.type.split("bytes"),r=we(e);if(!n){let o=e;return r%32!==0&&(o=dn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:St([dn(Q(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new Rb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:dn(e,{dir:"right"})}}function z1(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:dn(pl(e))}}function H1(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 dl({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Q(e,{size:32,signed:t})}}function W1(e){const t=jr(e),n=Math.ceil(we(t)/32),r=[];for(let o=0;o<n;o++)r.push(dn(ur(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:St([dn(Q(we(t),{size:32})),...r])}}function V1(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=Ii({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Mi(r):St(r.map(({encoded:o})=>o))}}function ki(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const zr=e=>ur(Al(e),0,4);function kn(e){const{abi:t,args:n=[],name:r}=e,o=Et(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?zr(c)===r:c.type==="event"?ns(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,l)=>{const f="inputs"in c&&c.inputs[l];return f?Bi(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=Il(c.inputs,i.inputs,n);if(u)throw new Wb({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Bi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return at(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)=>Bi(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=>Bi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Il(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 Il(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")?at(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?at(n[r],{strict:!1}):!1)return i}}const Ml="/docs/contract/encodeEventTopics";function Hr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=kn({abi:t,name:n});if(!u)throw new il(n,{docsPath:Ml});o=u}if(o.type!=="event")throw new il(void 0,{docsPath:Ml});const s=xt(o),i=ns(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((f,p)=>Array.isArray(l[p])?l[p].map((d,h)=>kl({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?kl({param:f,value:l[p]}):null))??[])}return[i,...c]}function kl({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Me(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Yb(e.type);return bn([e],[t])}function ss(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function Bl(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=ss(e,{method:"eth_newFilter"}),l=s?Hr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?Q(i):i,toBlock:typeof a=="bigint"?Q(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function Je(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Ll="/docs/contract/encodeFunctionData";function G1(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=kn({abi:t,args:n,name:r});if(!s)throw new nr(r,{docsPath:Ll});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:Ll});return{abi:[o],functionName:zr(xt(o))}}function $t(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:G1(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?bn(o.inputs,t??[]):void 0;return cr([s,i??"0x"])}const q1={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."},Fl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Z1={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let Dl=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Rl=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},Y1=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const K1={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 Y1({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Rl({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Dl({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 Dl({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 Li(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(K1);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function X1(e,t={}){typeof t.size<"u"&&Pt(e,{size:t.size});const n=Ae(e,t);return kt(n,t)}function Q1(e,t={}){let n=e;if(typeof t.size<"u"&&(Pt(n,{size:t.size}),n=Cn(n)),n.length>1||n[0]>1)throw new Xb(n);return!!n[0]}function Kt(e,t={}){typeof t.size<"u"&&Pt(e,{size:t.size});const n=Ae(e,t);return Zt(n,t)}function J1(e,t={}){let n=e;return typeof t.size<"u"&&(Pt(n,{size:t.size}),n=Cn(n,{dir:"right"})),new TextDecoder().decode(n)}function Wr(e,t){const n=typeof t=="string"?Bt(t):t,r=Li(n);if(we(n)===0&&e.length>0)throw new Rr;if(we(t)&&we(t)<32)throw new rl({data:typeof t=="string"?t:Ae(t),params:e,size:we(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=lr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function lr(e,t,{staticPosition:n}){const r=ki(t.type);if(r){const[o,s]=r;return tg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return sg(e,t,{staticPosition:n});if(t.type==="address")return eg(e);if(t.type==="bool")return ng(e);if(t.type.startsWith("bytes"))return rg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return og(e,t);if(t.type==="string")return ig(e,{staticPosition:n});throw new qb(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const jl=32,Fi=32;function eg(e){const t=e.readBytes(32);return[os(Ae(Nl(t,-20))),32]}function tg(e,t,{length:n,staticPosition:r}){if(!n){const i=Kt(e.readBytes(Fi)),c=r+i,a=c+jl;e.setPosition(c);const u=Kt(e.readBytes(jl)),l=Vr(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=lr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Vr(t)){const i=Kt(e.readBytes(Fi)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=lr(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=lr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function ng(e){return[Q1(e.readBytes(32),{size:32}),32]}function rg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Kt(e.readBytes(32));e.setPosition(n+i);const c=Kt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ae(a),32]}return[Ae(e.readBytes(Number.parseInt(o,10),32)),32]}function og(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?X1(o,{signed:n}):Kt(o,{signed:n}),32]}function sg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Vr(t)){const i=Kt(e.readBytes(Fi)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=lr(e,u,{staticPosition:c});s+=f,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=lr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function ig(e,{staticPosition:t}){const n=Kt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Kt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=J1(Cn(s));return e.setPosition(t+32),[i,32]}function Vr(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(Vr);const n=ki(e.type);return!!(n&&Vr({...e,type:n[1]}))}function _l(e){const{abi:t,data:n}=e,r=ur(n,0,4);if(r==="0x")throw new Rr;const s=[...t||[],Fl,Z1].find(i=>i.type==="error"&&r===zr(xt(i)));if(!s)throw new sl(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Wr(s.inputs,ur(n,4)):void 0,errorName:s.name}}const Te=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Ul({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Te(t[s]):t[s]}`).join(", ")})`}const ag={gwei:9,wei:18},cg={ether:-9,wei:9};function Di(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 Ri(e,t="wei"){return Di(e,ag[t])}function ze(e,t="wei"){return Di(e,cg[t])}class ug extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class lg extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function zl(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
62
|
-
`,"")}function
|
|
60
|
+
`),{name:"InvalidArrayError"})}};class Yb extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
61
|
+
`),{name:"InvalidDefinitionTypeError"})}}class Kb extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let ul=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"})}},ll=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 fl extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?dn(e,{dir:t,size:n}):Xb(e,{dir:t,size:n})}function dn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new ll({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Xb(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ll({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 dl=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"})}},Qb=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 Jb 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 e1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Cn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function Pt(e,{size:t}){if(we(e)>t)throw new e1({givenSize:we(e),maxSize:t})}function kt(e,t={}){const{signed:n}=t;t.size&&Pt(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 t1(e,t={}){let n=e;if(t.size&&(Pt(n,{size:t.size}),n=Cn(n)),Cn(n)==="0x00")return!1;if(Cn(n)==="0x01")return!0;throw new Jb(n)}function Zt(e,t={}){return Number(kt(e,t))}const n1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function pn(e,t={}){return typeof e=="number"||typeof e=="bigint"?Q(e,t):typeof e=="string"?jr(e,t):typeof e=="boolean"?pl(e,t):Ae(e,t)}function pl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Pt(n,{size:t.size}),rr(n,{size:t.size})):n}function Ae(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=n1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Pt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function Q(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new dl({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?rr(c,{size:r}):c}const r1=new TextEncoder;function jr(e,t={}){const n=r1.encode(e);return Ae(n,t)}const o1=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?i1(e,t):typeof e=="boolean"?s1(e,t):Et(e)?Bt(e,t):In(e,t)}function s1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Pt(n,{size:t.size}),rr(n,{size:t.size})):n}const Yt={zero:48,nine:57,A:65,F:70,a:97,f:102};function hl(e){if(e>=Yt.zero&&e<=Yt.nine)return e-Yt.zero;if(e>=Yt.A&&e<=Yt.F)return e-(Yt.A-10);if(e>=Yt.a&&e<=Yt.f)return e-(Yt.a-10)}function Bt(e,t={}){let n=e;t.size&&(Pt(n,{size:t.size}),n=rr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=hl(r.charCodeAt(c++)),u=hl(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function i1(e,t){const n=Q(e,t);return Bt(n)}function In(e,t={}){const n=o1.encode(e);return typeof t.size=="number"?(Pt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const es=BigInt(2**32-1),ml=BigInt(32);function a1(e,t=!1){return t?{h:Number(e&es),l:Number(e>>ml&es)}:{h:Number(e>>ml&es)|0,l:Number(e&es)|0}}function c1(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l:c}=a1(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const u1=(e,t,n)=>e<<n|t>>>32-n,l1=(e,t,n)=>t<<n|e>>>32-n,f1=(e,t,n)=>t<<n-32|e>>>64-n,d1=(e,t,n)=>e<<n-32|t>>>64-n,sr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function p1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function _r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Mn(e,...t){if(!p1(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 h1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");_r(e.outputLen),_r(e.blockLen)}function ir(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function bl(e,t){Mn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function m1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ar(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ai(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Lt(e,t){return e<<32-t|e>>>t}const b1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function g1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function y1(e){for(let t=0;t<e.length;t++)e[t]=g1(e[t]);return e}const gl=b1?e=>e:y1;function w1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ts(e){return typeof e=="string"&&(e=w1(e)),Mn(e),e}function v1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Mn(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 Ti{}function yl(e){const t=r=>e().update(ts(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function x1(e=32){if(sr&&typeof sr.getRandomValues=="function")return sr.getRandomValues(new Uint8Array(e));if(sr&&typeof sr.randomBytes=="function")return Uint8Array.from(sr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const E1=BigInt(0),Ur=BigInt(1),P1=BigInt(2),S1=BigInt(7),$1=BigInt(256),A1=BigInt(113),wl=[],vl=[],xl=[];for(let e=0,t=Ur,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],wl.push(2*(5*r+n)),vl.push((e+1)*(e+2)/2%64);let o=E1;for(let s=0;s<7;s++)t=(t<<Ur^(t>>S1)*A1)%$1,t&P1&&(o^=Ur<<(Ur<<BigInt(s))-Ur);xl.push(o)}const El=c1(xl,!0),T1=El[0],O1=El[1],Pl=(e,t,n)=>n>32?f1(e,t,n):u1(e,t,n),Sl=(e,t,n)=>n>32?d1(e,t,n):l1(e,t,n);function N1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,u=n[a],l=n[a+1],f=Pl(u,l,1)^n[c],p=Sl(u,l,1)^n[c+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=vl[i],a=Pl(o,s,c),u=Sl(o,s,c),l=wl[i];o=e[l],s=e[l+1],e[l]=a,e[l+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=T1[r],e[1]^=O1[r]}ar(n)}class Oi extends Ti{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,_r(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=m1(this.state)}clone(){return this._cloneInto()}keccak(){gl(this.state32),N1(this.state32,this.rounds),gl(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=ts(t),Mn(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){ir(this,!1),Mn(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 _r(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(bl(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ar(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Oi(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 C1=(e,t,n)=>yl(()=>new Oi(t,e,n)),$l=C1(1,136,256/8);function Me(e,t){const n=t||"hex",r=$l(Et(e,{strict:!1})?or(e):e);return n==="bytes"?r:pn(r)}const I1=e=>Me(or(e));function M1(e){return I1(e)}function k1(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new V("Unable to normalize signature.");return o}const B1=e=>{const t=typeof e=="string"?e:Ko(e);return k1(t)};function Al(e){return M1(B1(e))}const ns=Al;let hn=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"})}},rs=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 Ni=new rs(8192);function os(e,t){if(Ni.has(`${e}.${t}`))return Ni.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Me(In(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return Ni.set(`${e}.${t}`,s),s}function mn(e,t){if(!at(e,{strict:!1}))throw new hn({address:e});return os(e,t)}const L1=/^0x[a-fA-F0-9]{40}$/,Ci=new rs(8192);function at(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ci.has(r))return Ci.get(r);const o=L1.test(e)?e.toLowerCase()===e?!0:n?os(e)===e:!0:!1;return Ci.set(r,o),o}function St(e){return typeof e[0]=="string"?cr(e):F1(e)}function F1(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 cr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function ur(e,t,n,{strict:r}={}){return Et(e,{strict:!1})?D1(e,t,n,{strict:r}):Nl(e,t,n,{strict:r})}function Tl(e,t){if(typeof t=="number"&&t>0&&t>we(e)-1)throw new ul({offset:t,position:"start",size:we(e)})}function Ol(e,t,n){if(typeof t=="number"&&typeof n=="number"&&we(e)!==n-t)throw new ul({offset:n,position:"end",size:we(e)})}function Nl(e,t,n,{strict:r}={}){Tl(e,t);const o=e.slice(t,n);return r&&Ol(o,t,n),o}function D1(e,t,n,{strict:r}={}){Tl(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Ol(o,t,n),o}const R1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Cl=/^(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 bn(e,t){if(e.length!==t.length)throw new _b({expectedLength:e.length,givenLength:t.length});const n=j1({params:e,values:t}),r=Mi(n);return r.length===0?"0x":r}function j1({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ii({param:e[r],value:t[r]}));return n}function Ii({param:e,value:t}){const n=ki(e.type);if(n){const[r,o]=n;return U1(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return G1(t,{param:e});if(e.type==="address")return _1(t);if(e.type==="bool")return H1(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Cl.exec(e.type)??[];return W1(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return z1(t,{param:e});if(e.type==="string")return V1(t);throw new qb(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Mi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=we(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Q(t+o,{size:32})),r.push(c),o+=we(c)):n.push(c)}return St([...n,...r])}function _1(e){if(!at(e))throw new hn({address:e});return{dynamic:!1,encoded:dn(e.toLowerCase())}}function U1(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new cl(e);if(!r&&e.length!==t)throw new Rb({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Ii({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Mi(s);if(r){const c=Q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?St([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:St(s.map(({encoded:i})=>i))}}function z1(e,{param:t}){const[,n]=t.type.split("bytes"),r=we(e);if(!n){let o=e;return r%32!==0&&(o=dn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:St([dn(Q(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new jb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:dn(e,{dir:"right"})}}function H1(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:dn(pl(e))}}function W1(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 dl({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Q(e,{size:32,signed:t})}}function V1(e){const t=jr(e),n=Math.ceil(we(t)/32),r=[];for(let o=0;o<n;o++)r.push(dn(ur(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:St([dn(Q(we(t),{size:32})),...r])}}function G1(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=Ii({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Mi(r):St(r.map(({encoded:o})=>o))}}function ki(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const zr=e=>ur(Al(e),0,4);function kn(e){const{abi:t,args:n=[],name:r}=e,o=Et(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?zr(c)===r:c.type==="event"?ns(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,l)=>{const f="inputs"in c&&c.inputs[l];return f?Bi(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=Il(c.inputs,i.inputs,n);if(u)throw new Vb({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Bi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return at(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)=>Bi(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=>Bi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Il(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 Il(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")?at(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?at(n[r],{strict:!1}):!1)return i}}const Ml="/docs/contract/encodeEventTopics";function Hr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=kn({abi:t,name:n});if(!u)throw new il(n,{docsPath:Ml});o=u}if(o.type!=="event")throw new il(void 0,{docsPath:Ml});const s=xt(o),i=ns(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((f,p)=>Array.isArray(l[p])?l[p].map((d,h)=>kl({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?kl({param:f,value:l[p]}):null))??[])}return[i,...c]}function kl({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Me(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Kb(e.type);return bn([e],[t])}function ss(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function Bl(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=ss(e,{method:"eth_newFilter"}),l=s?Hr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?Q(i):i,toBlock:typeof a=="bigint"?Q(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function Je(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Ll="/docs/contract/encodeFunctionData";function q1(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=kn({abi:t,args:n,name:r});if(!s)throw new nr(r,{docsPath:Ll});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:Ll});return{abi:[o],functionName:zr(xt(o))}}function $t(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:q1(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?bn(o.inputs,t??[]):void 0;return cr([s,i??"0x"])}const Z1={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."},Fl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Y1={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let Dl=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Rl=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},K1=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const X1={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 K1({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Rl({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Dl({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 Dl({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 Li(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(X1);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Q1(e,t={}){typeof t.size<"u"&&Pt(e,{size:t.size});const n=Ae(e,t);return kt(n,t)}function J1(e,t={}){let n=e;if(typeof t.size<"u"&&(Pt(n,{size:t.size}),n=Cn(n)),n.length>1||n[0]>1)throw new Qb(n);return!!n[0]}function Kt(e,t={}){typeof t.size<"u"&&Pt(e,{size:t.size});const n=Ae(e,t);return Zt(n,t)}function eg(e,t={}){let n=e;return typeof t.size<"u"&&(Pt(n,{size:t.size}),n=Cn(n,{dir:"right"})),new TextDecoder().decode(n)}function Wr(e,t){const n=typeof t=="string"?Bt(t):t,r=Li(n);if(we(n)===0&&e.length>0)throw new Rr;if(we(t)&&we(t)<32)throw new rl({data:typeof t=="string"?t:Ae(t),params:e,size:we(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=lr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function lr(e,t,{staticPosition:n}){const r=ki(t.type);if(r){const[o,s]=r;return ng(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return ig(e,t,{staticPosition:n});if(t.type==="address")return tg(e);if(t.type==="bool")return rg(e);if(t.type.startsWith("bytes"))return og(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return sg(e,t);if(t.type==="string")return ag(e,{staticPosition:n});throw new Zb(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const jl=32,Fi=32;function tg(e){const t=e.readBytes(32);return[os(Ae(Nl(t,-20))),32]}function ng(e,t,{length:n,staticPosition:r}){if(!n){const i=Kt(e.readBytes(Fi)),c=r+i,a=c+jl;e.setPosition(c);const u=Kt(e.readBytes(jl)),l=Vr(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=lr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Vr(t)){const i=Kt(e.readBytes(Fi)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=lr(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=lr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function rg(e){return[J1(e.readBytes(32),{size:32}),32]}function og(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Kt(e.readBytes(32));e.setPosition(n+i);const c=Kt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ae(a),32]}return[Ae(e.readBytes(Number.parseInt(o,10),32)),32]}function sg(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?Q1(o,{signed:n}):Kt(o,{signed:n}),32]}function ig(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Vr(t)){const i=Kt(e.readBytes(Fi)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=lr(e,u,{staticPosition:c});s+=f,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=lr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function ag(e,{staticPosition:t}){const n=Kt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Kt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=eg(Cn(s));return e.setPosition(t+32),[i,32]}function Vr(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(Vr);const n=ki(e.type);return!!(n&&Vr({...e,type:n[1]}))}function _l(e){const{abi:t,data:n}=e,r=ur(n,0,4);if(r==="0x")throw new Rr;const s=[...t||[],Fl,Y1].find(i=>i.type==="error"&&r===zr(xt(i)));if(!s)throw new sl(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Wr(s.inputs,ur(n,4)):void 0,errorName:s.name}}const Te=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Ul({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Te(t[s]):t[s]}`).join(", ")})`}const cg={gwei:9,wei:18},ug={ether:-9,wei:9};function Di(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 Ri(e,t="wei"){return Di(e,cg[t])}function ze(e,t="wei"){return Di(e,ug[t])}class lg extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class fg extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function zl(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
62
|
+
`,"")}function dg(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
|
|
63
63
|
`;return r.nonce&&(o+=` nonce: ${r.nonce}
|
|
64
64
|
`),r.balance&&(o+=` balance: ${r.balance}
|
|
65
65
|
`),r.code&&(o+=` code: ${r.code}
|
|
@@ -67,23 +67,23 @@ React keys must be passed directly to JSX without using spread:
|
|
|
67
67
|
`,o+=zl(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
68
68
|
`,o+=zl(r.stateDiff)),o},` State Override:
|
|
69
69
|
`).slice(0,-1)}function Gr(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
|
|
70
|
-
`)}class
|
|
71
|
-
${
|
|
72
|
-
`):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=u}}class
|
|
70
|
+
`)}class pg extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Gr(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 hg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p}){var h;const d=Gr({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"&&`${Ri(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${ze(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${ze(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${ze(u)} gwei`,nonce:l});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 Hl 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 Wl 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 mg 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 gg=e=>e,qr=e=>e;class Vl extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p,stateOverride:d}){var w;const h=n?Je(n):void 0;let m=Gr({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${Ri(p)} ${((w=o==null?void 0:o.nativeCurrency)==null?void 0:w.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${ze(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${ze(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${ze(u)} gwei`,nonce:l});d&&(m+=`
|
|
71
|
+
${dg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Gl extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=kn({abi:n,args:r,name:i}),u=a?Ul({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?xt(a,{includeName:!0}):void 0,f=Gr({address:o&&gg(o),function:l,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=c}}class ji extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=_l({abi:t,data:n});const{abiItem:l,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=Z1[d]}else{const d=l?xt(l,{includeName:!0}):void 0,h=l&&p?Ul({abiItem:l,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(l){s=l}else o&&(a=o);let u;s instanceof sl&&(u=s.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
|
|
72
|
+
`):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=u}}class yg 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 wg 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 is 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 Bn 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: ${qr(i)}`,t&&`Request body: ${Te(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=o,this.status=s,this.url=i}}class _i extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${qr(r)}`,`Request body: ${Te(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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 ql extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${qr(n)}`,`Request body: ${Te(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const vg=-1;class He extends V{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof _i?t.code:n??vg}}class et extends He{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Zr extends He{constructor(t){super(t,{code:Zr.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Yr extends He{constructor(t){super(t,{code:Yr.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Kr extends He{constructor(t,{method:n}={}){super(t,{code:Kr.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Xr extends He{constructor(t){super(t,{code:Xr.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
73
73
|
`)})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ln extends He{constructor(t){super(t,{code:Ln.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class gn extends He{constructor(t){super(t,{code:gn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
74
|
-
`)})}}Object.defineProperty(gn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Qr extends He{constructor(t){super(t,{code:Qr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Jr extends He{constructor(t){super(t,{code:Jr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class eo extends He{constructor(t){super(t,{code:eo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Fn extends He{constructor(t,{method:n}={}){super(t,{code:Fn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class fr extends He{constructor(t){super(t,{code:fr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(fr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class to extends He{constructor(t){super(t,{code:to.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class dr extends et{constructor(t){super(t,{code:dr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class no extends et{constructor(t){super(t,{code:no.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ro extends et{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class oo extends et{constructor(t){super(t,{code:oo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class so extends et{constructor(t){super(t,{code:so.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class io extends et{constructor(t){super(t,{code:io.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ao extends et{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 co extends et{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 uo extends et{constructor(t){super(t,{code:uo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class lo extends et{constructor(t){super(t,{code:lo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class fo extends et{constructor(t){super(t,{code:fo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class po extends et{constructor(t){super(t,{code:po.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class ho extends et{constructor(t){super(t,{code:ho.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class vg extends He{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const xg=3;function pr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof is?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof Rr?new gg({functionName:s}):[xg,Ln.code].includes(a)&&(u||l||f||p)||a===gn.code&&l==="execution reverted"&&u?new ji({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof _i?l:p??f}):e;return new Gl(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Eg(e){const t=Me(`0x${e.substring(4)}`).substring(26);return os(`0x${t}`)}async function Pg({hash:e,signature:t}){const n=Et(e)?e:pn(e),{secp256k1:r}=await Promise.resolve().then(()=>n6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:p}=t,d=Number(p??f),h=Zl(d);return new r.Signature(kt(u),kt(l)).addRecoveryBit(h)}const i=Et(t)?t:pn(t);if(we(i)!==65)throw new Error("invalid signature length");const c=Zt(`0x${i.slice(130)}`),a=Zl(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Zl(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 Yl({hash:e,signature:t}){return Eg(await Pg({hash:e,signature:t}))}function Sg(e,t="hex"){const n=Kl(e),r=Li(new Uint8Array(n.length));return n.encode(r),t==="hex"?Ae(r.bytes):r.bytes}function Kl(e){return Array.isArray(e)?$g(e.map(t=>Kl(t))):Ag(e)}function $g(e){const t=e.reduce((o,s)=>o+s.length,0),n=Xl(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 Ag(e){const t=typeof e=="string"?Bt(e):e,n=Xl(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 Xl(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 Tg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Me(cr(["0x05",Sg([t?Q(t):"0x",o,n?Q(n):"0x"])]));return r==="bytes"?Bt(s):s}async function Ql(e){const{authorization:t,signature:n}=e;return Yl({hash:Tg(t),signature:n??t})}class Og extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p}){var h;const d=Gr({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Ri(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${ze(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${ze(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${ze(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class hr 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(hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(hr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class as extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ze(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(as,"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 Ui extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ze(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Ui,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class zi extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(zi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Hi 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(`
|
|
74
|
+
`)})}}Object.defineProperty(gn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Qr extends He{constructor(t){super(t,{code:Qr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Jr extends He{constructor(t){super(t,{code:Jr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class eo extends He{constructor(t){super(t,{code:eo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Fn extends He{constructor(t,{method:n}={}){super(t,{code:Fn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class fr extends He{constructor(t){super(t,{code:fr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(fr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class to extends He{constructor(t){super(t,{code:to.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class dr extends et{constructor(t){super(t,{code:dr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class no extends et{constructor(t){super(t,{code:no.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ro extends et{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class oo extends et{constructor(t){super(t,{code:oo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class so extends et{constructor(t){super(t,{code:so.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class io extends et{constructor(t){super(t,{code:io.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ao extends et{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 co extends et{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 uo extends et{constructor(t){super(t,{code:uo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class lo extends et{constructor(t){super(t,{code:lo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class fo extends et{constructor(t){super(t,{code:fo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class po extends et{constructor(t){super(t,{code:po.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class ho extends et{constructor(t){super(t,{code:ho.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class xg extends He{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Eg=3;function pr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof is?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof Rr?new yg({functionName:s}):[Eg,Ln.code].includes(a)&&(u||l||f||p)||a===gn.code&&l==="execution reverted"&&u?new ji({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof _i?l:p??f}):e;return new Gl(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Pg(e){const t=Me(`0x${e.substring(4)}`).substring(26);return os(`0x${t}`)}async function Sg({hash:e,signature:t}){const n=Et(e)?e:pn(e),{secp256k1:r}=await Promise.resolve().then(()=>r6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:p}=t,d=Number(p??f),h=Zl(d);return new r.Signature(kt(u),kt(l)).addRecoveryBit(h)}const i=Et(t)?t:pn(t);if(we(i)!==65)throw new Error("invalid signature length");const c=Zt(`0x${i.slice(130)}`),a=Zl(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Zl(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 Yl({hash:e,signature:t}){return Pg(await Sg({hash:e,signature:t}))}function $g(e,t="hex"){const n=Kl(e),r=Li(new Uint8Array(n.length));return n.encode(r),t==="hex"?Ae(r.bytes):r.bytes}function Kl(e){return Array.isArray(e)?Ag(e.map(t=>Kl(t))):Tg(e)}function Ag(e){const t=e.reduce((o,s)=>o+s.length,0),n=Xl(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 Tg(e){const t=typeof e=="string"?Bt(e):e,n=Xl(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 Xl(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 Og(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Me(cr(["0x05",$g([t?Q(t):"0x",o,n?Q(n):"0x"])]));return r==="bytes"?Bt(s):s}async function Ql(e){const{authorization:t,signature:n}=e;return Yl({hash:Og(t),signature:n??t})}class Ng extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p}){var h;const d=Gr({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Ri(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${ze(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${ze(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${ze(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class hr 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(hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(hr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class as extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ze(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(as,"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 Ui extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ze(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Ui,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class zi extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(zi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Hi 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(`
|
|
75
75
|
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Hi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Wi 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(Wi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Vi extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
76
76
|
`),{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(Vi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Gi 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(Gi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class qi 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(qi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Zi extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Zi,"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?` = ${ze(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${ze(r)} gwei`:""}).`].join(`
|
|
77
|
-
`),{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 mo extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function us(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===hr.code):e;return r instanceof V?new hr({cause:e,message:r.details}):hr.nodeMessage.test(n)?new hr({cause:e,message:e.details}):as.nodeMessage.test(n)?new as({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ui.nodeMessage.test(n)?new Ui({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):zi.nodeMessage.test(n)?new zi({cause:e,nonce:t==null?void 0:t.nonce}):Hi.nodeMessage.test(n)?new Hi({cause:e,nonce:t==null?void 0:t.nonce}):Wi.nodeMessage.test(n)?new Wi({cause:e,nonce:t==null?void 0:t.nonce}):Vi.nodeMessage.test(n)?new Vi({cause:e}):Gi.nodeMessage.test(n)?new Gi({cause:e,gas:t==null?void 0:t.gas}):qi.nodeMessage.test(n)?new qi({cause:e,gas:t==null?void 0:t.gas}):Zi.nodeMessage.test(n)?new Zi({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 mo({cause:e})}function Ng(e,{docsPath:t,...n}){const r=(()=>{const o=us(e,n);return o instanceof mo?e:o})();return new Og(r,{docsPath:t,...n})}function ls(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const Cg={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function bo(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Ig(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=>Ae(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=Q(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=Q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=Q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=Q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=Q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=Q(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Cg[e.type]),typeof e.value<"u"&&(n.value=Q(e.value)),n}function Ig(e){return e.map(t=>({address:t.address,r:t.r?Q(BigInt(t.r)):t.r,s:t.s?Q(BigInt(t.s)):t.s,chainId:Q(t.chainId),nonce:Q(t.nonce),...typeof t.yParity<"u"?{yParity:Q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Q(t.v)}:{}}))}function Jl(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new fl({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new fl({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Mg(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=Q(t)),n!==void 0&&(i.nonce=Q(n)),r!==void 0&&(i.state=Jl(r)),o!==void 0){if(i.state)throw new lg;i.stateDiff=Jl(o)}return i}function Yi(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!at(n,{strict:!1}))throw new hn({address:n});if(t[n])throw new ug({address:n});t[n]=Mg(r)}return t}const ef=2n**256n-1n;function mr(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?Je(t):void 0;if(s&&!at(s.address))throw new hn({address:s.address});if(o&&!at(o))throw new hn({address:o});if(n&&n>ef)throw new as({maxFeePerGas:n});if(r&&n&&r>n)throw new cs({maxFeePerGas:n,maxPriorityFeePerGas:r})}class tf extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ki extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class kg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ze(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class nf 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 rf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Xi(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Zt(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Zt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?rf[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=Bg(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 Bg(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 of(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Xi(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 At(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,f;const s=o??!1,i=n!==void 0?Q(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new nf({blockHash:t,blockNumber:n});return(((f=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:f.format)||of)(c,"getBlock")}async function Qi(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Lg(e,t){return sf(e,t)}async function sf(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const u=n||await X(e,At,"getBlock")({}),l=await c({block:u,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return kt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):X(e,At,"getBlock")({}),X(e,Qi,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Ki;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function Fg(e,t){return Ji(e,t)}async function Ji(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new tf;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await X(e,At,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new Ki;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await sf(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await X(e,Qi,"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"?Q(r):n]},{dedupe:!!r});return Zt(o)}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(s=>Bt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>Ae(s))}function uf(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=>Bt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>Bt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>Ae(i))}function Dg(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,u=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+u,c,r)}function Rg(e,t,n){return e&t^~e&n}function jg(e,t,n){return e&t^e&n^t&n}class _g extends Ti{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=Ai(this.buffer)}update(t){ir(this),t=ts(t),Mn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=Ai(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ir(this),bl(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ar(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Dg(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Ai(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)c.setUint32(4*f,l[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const yn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ug=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wn=new Uint32Array(64);class zg extends _g{constructor(t=32){super(64,t,8,!1),this.A=yn[0]|0,this.B=yn[1]|0,this.C=yn[2]|0,this.D=yn[3]|0,this.E=yn[4]|0,this.F=yn[5]|0,this.G=yn[6]|0,this.H=yn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)wn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=wn[f-15],d=wn[f-2],h=Lt(p,7)^Lt(p,18)^p>>>3,m=Lt(d,17)^Lt(d,19)^d>>>10;wn[f]=m+wn[f-7]+h+wn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let f=0;f<64;f++){const p=Lt(c,6)^Lt(c,11)^Lt(c,25),d=l+p+Rg(c,a,u)+Ug[f]+wn[f]|0,m=(Lt(r,2)^Lt(r,13)^Lt(r,22))+jg(r,o,s)|0;l=u,u=a,a=c,c=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,a,u,l)}roundClean(){ar(wn)}destroy(){this.set(0,0,0,0,0,0,0,0),ar(this.buffer)}}const lf=yl(()=>new zg),Hg=lf;function Wg(e,t){return Hg(Et(e,{strict:!1})?or(e):e)}function Vg(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=Wg(t);return o.set([n],0),r==="bytes"?o:Ae(o)}function Gg(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(Vg({commitment:s,to:r,version:n}));return o}const ff=6,df=32,ea=4096,pf=df*ea,hf=pf*ff-1-1*ea*ff;class qg extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Zg extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function Yg(e){const t=typeof e.data=="string"?Bt(e.data):e.data,n=we(t);if(!n)throw new Zg;if(n>hf)throw new qg({maxSize:hf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Li(new Uint8Array(pf));let c=0;for(;c<ea;){const a=t.slice(s,s+(df-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>Ae(i.bytes))}function Kg(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??Yg({data:t}),s=e.commitments??cf({blobs:o,kzg:n,to:r}),i=e.proofs??uf({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function Xg(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 dg({transaction:e})}function Qg(e,{docsPath:t,...n}){const r=(()=>{const o=us(e,n);return o instanceof mo?e:o})();return new pg(r,{docsPath:t,...n})}async function ta(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Zt(t)}async function mf(e,t){var b,g,v,C,O;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:c,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:m,to:w,type:$,value:E,...P}=t,N=await(async()=>{if(!n||!m||typeof h<"u")return h;const I=Je(n),M=s?s.id:await X(e,ta,"getChainId")({});return await m.consume({address:I.address,chainId:M,client:e})})();mr(t);const B=(g=(b=s==null?void 0:s.formatters)==null?void 0:b.transactionRequest)==null?void 0:g.format,D=(B||bo)({...ls(P,{format:B}),account:n?Je(n):void 0,accessList:r,authorizationList:o,blobs:c,blobVersionedHashes:i,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:N,to:w,type:$,value:E},"fillTransaction");try{const I=await e.request({method:"eth_fillTransaction",params:[D]}),y=(((C=(v=s==null?void 0:s.formatters)==null?void 0:v.transaction)==null?void 0:C.format)||Xi)(I.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const T=await(async()=>{var j,z;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const _=await X(e,At,"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(T<1)throw new tf;const S=10**(((O=T.toString().split(".")[1])==null?void 0:O.length)??0),L=j=>j*BigInt(Math.ceil(T*S))/BigInt(S);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=L(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=L(y.gasPrice)),{raw:I.raw,transaction:{from:D.from,...y}}}catch(I){throw Qg(I,{...t,chain:e.chain})}}const Jg=["blobVersionedHashes","chainId","fees","gas","nonce","type"],bf=new Map,na=new rs(128);async function gf(e,t){var N,B,F;let n=t;const{account:r=e.account,chain:o=e.chain,nonceManager:s,parameters:i=Jg}=n,c=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function u(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await X(e,ta,"getChainId")({}),a))}const l=r&&Je(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&l&&s){const D=await u();f=await s.consume({address:l.address,chainId:D,client:e})}c!=null&&c.fn&&((N=c.runAt)!=null&&N.includes("beforeFillTransaction"))&&(n=await c.fn(n,{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||na.get(e.uid)===!1||!["fees","gas"].some(b=>i.includes(b))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await X(e,mf,"fillTransaction")({...n,nonce:f}).then(D=>{const{chainId:b,from:g,gas:v,gasPrice:C,nonce:O,maxFeePerBlobGas:I,maxFeePerGas:M,maxPriorityFeePerGas:y,type:T,...A}=D.transaction;return na.set(e.uid,!0),{...n,...g?{from:g}:{},...T?{type:T}:{},...typeof b<"u"?{chainId:b}:{},...typeof v<"u"?{gas:v}:{},...typeof C<"u"?{gasPrice:C}:{},...typeof O<"u"?{nonce:O}:{},...typeof I<"u"?{maxFeePerBlobGas:I}:{},...typeof M<"u"?{maxFeePerGas:M}:{},...typeof y<"u"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in A&&typeof A.nonceKey<"u"?{nonceKey:A.nonceKey}:{}}}).catch(D=>{var v;const b=D;return((v=b.walk)==null?void 0:v.call(b,C=>{const O=C;return O.name==="MethodNotFoundRpcError"||O.name==="MethodNotSupportedRpcError"}))&&na.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...l?{from:l==null?void 0:l.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:m,kzg:w,type:$}=n;c!=null&&c.fn&&((B=c.runAt)!=null&&B.includes("beforeFillParameters"))&&(n=await c.fn(n,{phase:"beforeFillParameters"}));let E;async function P(){return E||(E=await X(e,At,"getBlock")({blockTag:"latest"}),E)}if(i.includes("nonce")&&typeof f>"u"&&l&&!s&&(n.nonce=await X(e,af,"getTransactionCount")({address:l.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&w){const D=cf({blobs:h,kzg:w});if(i.includes("blobVersionedHashes")){const b=Gg({commitments:D,to:"hex"});n.blobVersionedHashes=b}if(i.includes("sidecars")){const b=uf({blobs:h,commitments:D,kzg:w}),g=Kg({blobs:h,commitments:D,proofs:b,to:"hex"});n.sidecars=g}}if(i.includes("chainId")&&(n.chainId=await u()),(i.includes("fees")||i.includes("type"))&&typeof $>"u")try{n.type=Xg(n)}catch{let D=bf.get(e.uid);if(typeof D>"u"){const b=await P();D=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",bf.set(e.uid,D)}n.type=D?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const D=await P(),{maxFeePerGas:b,maxPriorityFeePerGas:g}=await Ji(e,{block:D,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<g)throw new kg({maxPriorityFeePerGas:g});n.maxPriorityFeePerGas=g,n.maxFeePerGas=b}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new Ki;if(typeof n.gasPrice>"u"){const D=await P(),{gasPrice:b}=await Ji(e,{block:D,chain:o,request:n,type:"legacy"});n.gasPrice=b}}return i.includes("gas")&&typeof m>"u"&&(n.gas=await X(e,ra,"estimateGas")({...n,account:l,prepare:(l==null?void 0:l.type)==="local"?[]:["blobVersionedHashes"]})),c!=null&&c.fn&&((F=c.runAt)!=null&&F.includes("afterFillParameters"))&&(n=await c.fn(n,{phase:"afterFillParameters"})),mr(n),delete n.parameters,n}async function ra(e,t){var i,c,a;const{account:n=e.account,prepare:r=!0}=t,o=n?Je(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const u=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Ql({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:l,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:m,data:w,gas:$,gasPrice:E,maxFeePerBlobGas:P,maxFeePerGas:N,maxPriorityFeePerGas:B,nonce:F,value:D,stateOverride:b,...g}=r?await gf(e,{...t,parameters:s,to:u}):t;if($&&t.gas!==$)return $;const C=(typeof h=="bigint"?Q(h):void 0)||m,O=Yi(b);mr(t);const I=(a=(c=(i=e.chain)==null?void 0:i.formatters)==null?void 0:c.transactionRequest)==null?void 0:a.format,y=(I||bo)({...ls(g,{format:I}),account:o,accessList:l,authorizationList:f,blobs:p,blobVersionedHashes:d,data:w,gasPrice:E,maxFeePerBlobGas:P,maxFeePerGas:N,maxPriorityFeePerGas:B,nonce:F,to:u,value:D},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:O?[y,C??e.experimental_blockTag??"latest",O]:C?[y,C]:[y]}))}catch(u){throw Ng(u,{...t,account:o,chain:e.chain})}}async function ey(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=$t({abi:n,args:o,functionName:s});try{return await X(e,ra,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?Je(c.account):void 0;throw pr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function go(e,t){if(!at(e,{strict:!1}))throw new hn({address:e});if(!at(t,{strict:!1}))throw new hn({address:t});return e.toLowerCase()===t.toLowerCase()}const yf="/docs/contract/decodeEventLog";function fs(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new Ub({docsPath:yf});const a=t.find(m=>m.type==="event"&&i===ns(xt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new zb(i,{docsPath:yf});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=l.map((m,w)=>[m,w]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[w,$]=d[m],E=c[m];if(!E)throw new $i({abiItem:a,param:w});p[f?$:w.name||$]=ty({param:w,value:E})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Wr(h,n);if(m)if(f)for(let w=0;w<l.length;w++)p[w]=p[w]??m.shift();else for(let w=0;w<h.length;w++)p[h[w].name]=m[w]}catch(m){if(s)throw m instanceof rl||m instanceof Rl?new Jo({abiItem:a,data:n,params:h,size:we(n)}):m}else if(s)throw new Jo({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function ty({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Wr([e],t)||[])[0]}function oa(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var l;const c=t.filter(f=>f.type==="event"&&i.topics[0]===ns(f));if(c.length===0)return null;let a,u;for(const f of c)try{a=fs({...i,abi:[f],strict:!0}),u=f;break}catch{}if(!a&&!o){u=c[0];try{a=fs({...i,abi:[u],strict:!1})}catch{const f=(l=u.inputs)==null?void 0:l.some(p=>!("name"in p&&p.name));return{...i,args:f?[]:{},eventName:u.name}}}return!a||!u||s&&!s.includes(a.eventName)||!ny({args:a.args,inputs:u.inputs,matchArgs:n})?null:{...a,...i}}).filter(Boolean)}function ny(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?go(i,c):s.type==="string"||s.type==="bytes"?Me(or(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function Xt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function sa(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>Hr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?Q(r):r,toBlock:typeof o=="bigint"?Q(o):o}]});const d=p.map(h=>Xt(h));return l?oa({abi:l,args:c,logs:d,strict:u}):d}async function wf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?kn({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return X(e,sa,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const ia="/docs/contract/decodeFunctionResult";function Dn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=kn({abi:t,args:n,name:r});if(!c)throw new nr(r,{docsPath:ia});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:ia});if(!s.outputs)throw new al(s.name,{docsPath:ia});const i=Wr(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 aa=BigInt(0),ca=BigInt(1);function yo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ua(e){if(!yo(e))throw new Error("Uint8Array expected")}function wo(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function ds(e){const t=e.toString(16);return t.length&1?"0"+t:t}function vf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?aa:BigInt("0x"+e)}const xf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ry=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function vo(e){if(ua(e),xf)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=ry[e[n]];return t}const Qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ef(e){if(e>=Qt._0&&e<=Qt._9)return e-Qt._0;if(e>=Qt.A&&e<=Qt.F)return e-(Qt.A-10);if(e>=Qt.a&&e<=Qt.f)return e-(Qt.a-10)}function ps(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(xf)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=Ef(e.charCodeAt(s)),c=Ef(e.charCodeAt(s+1));if(i===void 0||c===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+c}return r}function Rn(e){return vf(vo(e))}function Pf(e){return ua(e),vf(vo(Uint8Array.from(e).reverse()))}function xo(e,t){return ps(e.toString(16).padStart(t*2,"0"))}function Sf(e,t){return xo(e,t).reverse()}function ct(e,t,n){let r;if(typeof t=="string")try{r=ps(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(yo(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 hs(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];ua(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 la=e=>typeof e=="bigint"&&aa<=e;function fa(e,t,n){return la(e)&&la(t)&&la(n)&&t<=e&&e<n}function br(e,t,n,r){if(!fa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function oy(e){let t;for(t=0;e>aa;e>>=ca,t+=1);return t}const ms=e=>(ca<<BigInt(e))-ca,da=e=>new Uint8Array(e),$f=e=>Uint8Array.from(e);function sy(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=da(e),o=da(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},c=(...f)=>n(o,r,...f),a=(f=da(0))=>{o=c($f([0]),f),r=c(),f.length!==0&&(o=c($f([1]),f),r=c())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=c();const d=r.slice();p.push(d),f+=r.length}return hs(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(u()));)a();return i(),d}}const iy={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"||yo(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 bs(e,t,n={}){const r=(o,s,i)=>{const c=iy[s];if(typeof c!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!c(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function Af(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const ay="0.1.1";function cy(){return ay}class ie extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof ie){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ie&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
|
|
78
|
-
`);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${cy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Tf(this,t)}}function Tf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Tf(e.cause,t):t?null:e}function Eo(e,t){if(gr(e)>t)throw new $y({givenSize:gr(e),maxSize:t})}const Jt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Of(e){if(e>=Jt.zero&&e<=Jt.nine)return e-Jt.zero;if(e>=Jt.A&&e<=Jt.F)return e-(Jt.A-10);if(e>=Jt.a&&e<=Jt.f)return e-(Jt.a-10)}function uy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Ay({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 Nf(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 gs(e,t){if(tt(e)>t)throw new My({givenSize:tt(e),maxSize:t})}function ly(e,t){if(typeof t=="number"&&t>0&&t>tt(e)-1)throw new _f({offset:t,position:"start",size:tt(e)})}function fy(e,t,n){if(typeof t=="number"&&typeof n=="number"&&tt(e)!==n-t)throw new _f({offset:n,position:"end",size:tt(e)})}function Cf(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 ky({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const dy="#__bigint";function If(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+dy:o,n)}const py=new TextDecoder,hy=new TextEncoder;function my(e){return e instanceof Uint8Array?e:typeof e=="string"?Mf(e):by(e)}function by(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Mf(e,t={}){const{size:n}=t;let r=e;n&&(gs(e,n),r=_n(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=Of(o.charCodeAt(a++)),l=Of(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new ie(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function gy(e,t={}){const{size:n}=t,r=hy.encode(e);return typeof n=="number"?(Eo(r,n),yy(r,n)):r}function yy(e,t){return uy(e,{dir:"right",size:t})}function gr(e){return e.length}function wy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function vy(e,t={}){const{size:n}=t;typeof n<"u"&&Eo(e,n);const r=Ot(e,t);return Lf(r,t)}function xy(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Eo(r,n),r=kf(r)),r.length>1||r[0]>1)throw new Sy(r);return!!r[0]}function en(e,t={}){const{size:n}=t;typeof n<"u"&&Eo(e,n);const r=Ot(e,t);return Ff(r,t)}function Ey(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Eo(r,n),r=Py(r)),py.decode(r)}function kf(e){return Nf(e,{dir:"left"})}function Py(e){return Nf(e,{dir:"right"})}class Sy extends ie{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 $y=class extends ie{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"})}},Ay=class extends ie{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 Ty=new TextEncoder,Oy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ny(e,t={}){const{strict:n=!1}=t;if(!e)throw new Rf(e);if(typeof e!="string")throw new Rf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new jf(e);if(!e.startsWith("0x"))throw new jf(e)}function Tt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Cy(e){return e instanceof Uint8Array?Ot(e):Array.isArray(e)?Ot(new Uint8Array(e)):e}function Bf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(gs(n,t.size),jn(n,t.size)):n}function Ot(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Oy[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(gs(r,t.size),_n(r,t.size)):r}function Le(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const u=typeof e=="bigint"?"n":"";throw new Df({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?jn(a,r):a}function pa(e,t={}){return Ot(Ty.encode(e),t)}function jn(e,t){return Cf(e,{dir:"left",size:t})}function _n(e,t){return Cf(e,{dir:"right",size:t})}function Ft(e,t,n,r={}){const{strict:o}=r;ly(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&fy(s,t,n),s}function tt(e){return Math.ceil((e.length-2)/2)}function Lf(e,t={}){const{signed:n}=t;t.size&&gs(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 Ff(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:Lf(e,t))}function Iy(e,t={}){const{strict:n=!1}=t;try{return Ny(e,{strict:n}),!0}catch{return!1}}class Df extends ie{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 Rf extends ie{constructor(t){super(`Value \`${typeof t=="object"?If(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 jf extends ie{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 My extends ie{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 _f extends ie{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 ky extends ie{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 By(e){return{address:e.address,amount:Le(e.amount),index:Le(e.index),validatorIndex:Le(e.validatorIndex)}}function Uf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Le(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Le(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Le(e.gasLimit)},...typeof e.number=="bigint"&&{number:Le(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Le(e.prevRandao)},...typeof e.time=="bigint"&&{time:Le(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(By)}}}const ys=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],ha=[{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"}]}],zf=[{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"}],Hf=[...zf,{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"}]}],Ly=[...zf,{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"}]}],Wf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Vf=[{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"}]}],Gf=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],qf=[{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"}],yr=[{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"}]}],Fy="0x82ad56cb",Zf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Dy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Ry="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",ma="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class ba 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 Yf extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const ga="/docs/contract/encodeDeployData";function ya(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 Fb({docsPath:ga});if(!("inputs"in o))throw new nl({docsPath:ga});if(!o.inputs||o.inputs.length===0)throw new nl({docsPath:ga});const s=bn(o.inputs,n);return cr([r,s])}function wr({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 ba({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ba({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Kf(e,{docsPath:t,...n}){const r=(()=>{const o=us(e,n);return o instanceof mo?e:o})();return new Vl(r,{docsPath:t,...n})}function Xf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const wa=new Map;function Qf({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<l.length;d++){const{resolve:h}=l[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<l.length;d++){const{reject:h}=l[d];h==null||h(p)}})},i=()=>wa.delete(t),c=()=>a().map(({args:l})=>l),a=()=>wa.get(t)||[],u=l=>wa.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=Xf();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:p,reject:d}),f):(u({args:l,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Po(e,t){var I,M,y,T;const{account:n=e.account,authorizationList:r,batch:o=!!((I=e.batch)!=null&&I.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:$,maxPriorityFeePerGas:E,nonce:P,to:N,value:B,stateOverride:F,...D}=t,b=n?Je(n):void 0;if(l&&(p||d))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&N)throw new V("Cannot provide both `code` & `to` as parameters.");const g=l&&f,v=p&&d&&N&&f,C=g||v,O=g?Jf({code:l,data:f}):v?Uy({data:f,factory:p,factoryData:d,to:N}):f;try{mr(t);const S=(typeof s=="bigint"?Q(s):void 0)||i,L=u?Uf(u):void 0,j=Yi(F),z=(T=(y=(M=e.chain)==null?void 0:M.formatters)==null?void 0:y.transactionRequest)==null?void 0:T.format,W=(z||bo)({...ls(D,{format:z}),accessList:c,account:b,authorizationList:r,blobs:a,data:O,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:$,maxPriorityFeePerGas:E,nonce:P,to:C?void 0:N,value:B},"call");if(o&&jy({request:W})&&!j&&!L)try{return await _y(e,{...W,blockNumber:s,blockTag:i})}catch(H){if(!(H instanceof Yf)&&!(H instanceof ba))throw H}const K=(()=>{const H=[W,S];return j&&L?[...H,j,L]:j?[...H,j]:L?[...H,{},L]:H})(),G=await e.request({method:"eth_call",params:K});return G==="0x"?{data:void 0}:{data:G}}catch(A){const S=zy(A),{offchainLookup:L,offchainLookupSignature:j}=await Promise.resolve().then(()=>_w);if(e.ccipRead!==!1&&(S==null?void 0:S.slice(0,10))===j&&N)return{data:await L(e,{data:S,to:N})};throw C&&(S==null?void 0:S.slice(0,10))==="0x101bb98d"?new yg({factory:p}):Kf(A,{...t,account:b,chain:e.chain})}}function jy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Fy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function _y(e,t){var m;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:c,to:a}=t,u=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return wr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Yf})(),f=(typeof s=="bigint"?Q(s):void 0)||i,{schedule:p}=Qf({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(w){return w.reduce((E,{data:P})=>E+(P.length-2),0)>n*2},fn:async w=>{const $=w.map(N=>({allowFailure:!0,callData:N.data,target:N.to})),E=$t({abi:ys,args:[$],functionName:"aggregate3"}),P=await e.request({method:"eth_call",params:[{...u===null?{data:Jf({code:ma,data:E})}:{to:u,data:E}},f]});return Dn({abi:ys,args:[$],functionName:"aggregate3",data:P||"0x"})}}),[{returnData:d,success:h}]=await p({data:c,to:a});if(!h)throw new is({data:d});return d==="0x"?{data:void 0}:{data:d}}function Jf(e){const{code:t,data:n}=e;return ya({abi:Xu(["constructor(bytes, bytes)"]),bytecode:Zf,args:[t,n]})}function Uy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return ya({abi:Xu(["constructor(address, bytes, address, bytes)"]),bytecode:Dy,args:[o,t,n,r]})}function zy(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 Nt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=$t({abi:n,args:o,functionName:s});try{const{data:a}=await X(e,Po,"call")({...i,data:c,to:r});return Dn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw pr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Hy(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?Je(c.account):e.account,u=$t({abi:n,args:o,functionName:i});try{const{data:l}=await X(e,Po,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Dn({abi:n,args:o,functionName:i,data:l||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw pr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const va=new Map,ed=new Map;let Wy=0;function vn(e,t,n){const r=++Wy,o=()=>va.get(e)||[],s=()=>{const l=o();va.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=ed.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(va.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[l])==null||h.call(d,...f)};const u=n(a);return typeof u=="function"&&ed.set(e,u),i}async function xa(e){return new Promise(t=>setTimeout(t,e))}function So(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await xa(a);const u=async()=>{o&&(await e({unpoll:s}),await xa(r),u())};u()})(),s}const Vy=new Map,Gy=new Map;function qy(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,Vy),r=t(e,Gy);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function Zy(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=qy(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 Yy=e=>`blockNumber.${e}`;async function $o(e,{cacheTime:t=e.cacheTime}={}){const n=await Zy(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Yy(e.uid),cacheTime:t});return BigInt(n)}async function ws(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Xt(s));return!("abi"in t)||!t.abi?o:oa({abi:t.abi,logs:o,strict:n})}async function vs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function Ky(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof l<"u"?l:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const w=p??!1,$=Te(["watchContractEvent",r,o,s,e.uid,i,f,w,c]);return vn($,{onLogs:u,onError:a},E=>{let P;c!==void 0&&(P=c-1n);let N,B=!1;const F=So(async()=>{var D;if(!B){try{N=await X(e,Bl,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:w,fromBlock:c})}catch{}B=!0;return}try{let b;if(N)b=await X(e,ws,"getFilterChanges")({filter:N});else{const g=await X(e,$o,"getBlockNumber")({});P&&P<g?b=await X(e,wf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:P+1n,toBlock:g,strict:w}):b=[],P=g}if(b.length===0)return;if(s)E.onLogs(b);else for(const g of b)E.onLogs([g])}catch(b){N&&b instanceof gn&&(B=!1),(D=E.onError)==null||D.call(E,b)}},{emitOnBegin:!0,interval:f});return async()=>{N&&await X(e,vs,"uninstallFilter")({filter:N}),F()}})})():(()=>{const w=p??!1,$=Te(["watchContractEvent",r,o,s,e.uid,i,f,w]);let E=!0,P=()=>E=!1;return vn($,{onLogs:u,onError:a},N=>((async()=>{try{const B=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(g=>g.config.type==="webSocket"||g.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),F=i?Hr({abi:n,eventName:i,args:o}):[],{unsubscribe:D}=await B.subscribe({params:["logs",{address:r,topics:F}],onData(b){var v;if(!E)return;const g=b.result;try{const{eventName:C,args:O}=fs({abi:n,data:g.data,topics:g.topics,strict:p}),I=Xt(g,{args:O,eventName:C});N.onLogs([I])}catch(C){let O,I;if(C instanceof Jo||C instanceof $i){if(p)return;O=C.abiItem.name,I=(v=C.abiItem.inputs)==null?void 0:v.some(y=>!("name"in y&&y.name))}const M=Xt(g,{args:I?[]:{},eventName:O});N.onLogs([M])}},onError(b){var g;(g=N.onError)==null||g.call(N,b)}});P=D,E||P()}catch(B){a==null||a(B)}})(),()=>P()))})()}async function Xy(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ea(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await xa(l),i({count:c+1})};try{const u=await e();o(u)}catch(u){if(c<n&&await r({count:c,error:u}))return a({error:u});s(u)}};i()})}const Qy={"0x0":"reverted","0x1":"success"};function td(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=>Xt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Zt(e.transactionIndex):null,status:e.status?Qy[e.status]:null,type:e.type?rf[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Pa=256;let xs=Pa,Es;function nd(e=11){if(!Es||xs+e>Pa*2){Es="",xs=0;for(let t=0;t<Pa;t++)Es+=(256+Math.random()*256|0).toString(16).substring(1)}return Es.substring(xs,xs+++e)}function Jy(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,f=e.cacheTime??l,p=e.account?Je(e.account):void 0,{config:d,request:h,value:m}=e.transport({account:p,chain:n,pollingInterval:l}),w={...d,...m},$={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:w,type:i,uid:nd(),...c?{experimental_blockTag:c}:{}};function E(P){return N=>{const B=N(P);for(const D in $)delete B[D];const F={...P,...B};return Object.assign(F,{extend:E(F)})}}return Object.assign($,{extend:E($)})}function Sa(e){var n,r,o,s,i,c;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof ji);return t instanceof ji?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((c=t.data)==null?void 0:c.errorName)==="UnsupportedResolverProfile":!1}function ew(e){const{abi:t,data:n}=e,r=ur(n,0,4),o=t.find(s=>s.type==="function"&&r===zr(xt(s)));if(!o)throw new Hb(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Wr(o.inputs,ur(n,4)):void 0}}const $a="/docs/contract/encodeErrorResult";function rd(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=kn({abi:t,args:r,name:n});if(!a)throw new ol(n,{docsPath:$a});o=a}if(o.type!=="error")throw new ol(void 0,{docsPath:$a});const s=xt(o),i=zr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new _b(o.name,{docsPath:$a});c=bn(o.inputs,r)}return cr([i,c])}const Aa="/docs/contract/encodeFunctionResult";function tw(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=kn({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Aa});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Aa});if(!o.outputs)throw new al(o.name,{docsPath:Aa});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new cl(r)})();return bn(o.outputs,s)}const Ao="x-batch-gateway:true";async function od(e){const{data:t,ccipRequest:n}=e,{args:[r]}=ew({abi:ha,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Ao)?await od({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=nw(a)}})),tw({abi:ha,functionName:"query",result:[o,s]})}function nw(e){return e.name==="HttpRequestError"&&e.status?rd({abi:ha,errorName:"HttpError",args:[e.status,e.shortMessage]}):rd({abi:[Fl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function sd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Et(t)?t:null}function Ta(e){let t=new Uint8Array(32).fill(0);if(!e)return Ae(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=sd(n[r]),s=o?or(o):Me(In(n[r]),"bytes");t=Me(St([t,s]),"bytes")}return Ae(t)}function rw(e){return`[${e.slice(2)}]`}function ow(e){const t=new Uint8Array(32).fill(0);return e?sd(e)||Me(In(e)):Ae(t)}function Oa(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(In(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=In(o[s]);i.byteLength>255&&(i=In(rw(ow(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 sw(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return wr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(p=>s.endsWith(p)))return null;const f=o!=null?[Ta(s),BigInt(o)]:[Ta(s)];try{const p=$t({abi:Vf,functionName:"addr",args:f}),d={address:u,abi:Hf,functionName:"resolveWithGateways",args:[pn(Oa(s)),p,i??[Ao]],blockNumber:n,blockTag:r},m=await X(e,Nt,"readContract")(d);if(m[0]==="0x")return null;const w=Dn({abi:Vf,args:f,functionName:"addr",data:m[0]});return w==="0x"||Cn(w)==="0x00"?null:w}catch(p){if(c)throw p;if(Sa(p))return null;throw p}}class iw 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 To extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Na 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 aw extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const cw=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,uw=/^(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>\/.*)?$/,lw=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,fw=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function dw(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 id(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function ad({uri:e,gatewayUrls:t}){const n=lw.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=id(t==null?void 0:t.ipfs,"https://ipfs.io"),o=id(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(cw),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||uw.test(e);if(e.startsWith("http")&&!l&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((l||f)&&a)return{uri:`${r}/${l?"ipns":"ipfs"}/${a}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${u||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(fw,"");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 Na({uri:e})}function cd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new iw({data:e});return e.image||e.image_url||e.image_data}async function pw({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Ca({gatewayUrls:e,uri:cd(n)})}catch{throw new Na({uri:t})}}async function Ca({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=ad({uri:t,gatewayUrls:e});if(r||await dw(n))return n;throw new Na({uri:t})}function hw(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new To({reason:"Only EIP-155 supported"});if(!i)throw new To({reason:"Chain ID not found"});if(!a)throw new To({reason:"Contract address not found"});if(!o)throw new To({reason:"Token ID not found"});if(!c)throw new To({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function mw(e,{nft:t}){if(t.namespace==="erc721")return Nt(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 Nt(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 aw({namespace:t.namespace})}async function bw(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?gw(e,{gatewayUrls:t,record:n}):Ca({uri:n,gatewayUrls:t})}async function gw(e,{gatewayUrls:t,record:n}){const r=hw(n),o=await mw(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=ad({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return Ca({uri:cd(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),pw({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function ud(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return wr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f={address:u,abi:Hf,args:[pn(Oa(s)),$t({abi:Wf,functionName:"text",args:[Ta(s),o]}),i??[Ao]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await X(e,Nt,"readContract")(f);if(d[0]==="0x")return null;const h=Dn({abi:Wf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Sa(f))return null;throw f}}async function yw(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await X(e,ud,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await bw(e,{record:a,gatewayUrls:r})}catch{return null}}async function ww(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return wr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const l={address:u,abi:Ly,args:[n,s,i??[Ao]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=X(e,Nt,"readContract"),[p]=await f(l);return p||null}catch(l){if(c)throw l;if(Sa(l))return null;throw l}}async function vw(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 wr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await X(e,Nt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[pn(Oa(o))],blockNumber:n,blockTag:r});return a}async function ld(e,t){var w,$,E;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?Je(n):void 0;try{mr(t);const N=(typeof r=="bigint"?Q(r):void 0)||o,B=(E=($=(w=e.chain)==null?void 0:w.formatters)==null?void 0:$.transactionRequest)==null?void 0:E.format,D=(B||bo)({...ls(h,{format:B}),account:m,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),b=await e.request({method:"eth_createAccessList",params:[D,N]});return{accessList:b.accessList,gasUsed:BigInt(b.gasUsed)}}catch(P){throw Kf(P,{...t,account:m,chain:e.chain})}}async function xw(e){const t=ss(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function fd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=ss(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>Hr({abi:[d],eventName:d.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?Q(s):s,toBlock:typeof c=="bigint"?Q(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:u(f),strict:!!i,toBlock:c,type:"event"}}async function dd(e){const t=ss(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Ew(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?Q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Pw(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Sw(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?Q(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),Zt(s)}async function Ia(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?Q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class $w 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 Aw(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await X(e,Nt,"readContract")({abi:Tw,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new $w({address:n}):i}}const Tw=[{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 Ow(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 Nw(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?Q(n):void 0,i=await e.request({method:"eth_feeHistory",params:[Q(t),s||r,o]},{dedupe:!!s});return Ow(i)}async function Cw(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Xt(s));return t.abi?oa({abi:t.abi,logs:o,strict:n}):o}async function Iw({address:e,authorization:t,signature:n}){return go(mn(e),await Ql({authorization:t,signature:n}))}const Ps=new rs(8192);function Mw(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Ps.get(n))return Ps.get(n);const r=e().finally(()=>Ps.delete(n));return Ps.set(n,r),r}function kw(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(u))throw new Fn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Fn(new Error("method not supported"),{method:u});const l=o?jr(`${a}.${Te(n)}`):void 0;return Mw(()=>Ea(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case Zr.code:throw new Zr(d);case Yr.code:throw new Yr(d);case Kr.code:throw new Kr(d,{method:n.method});case Xr.code:throw new Xr(d);case Ln.code:throw new Ln(d);case gn.code:throw new gn(d);case Qr.code:throw new Qr(d);case Jr.code:throw new Jr(d);case eo.code:throw new eo(d);case Fn.code:throw new Fn(d,{method:n.method});case fr.code:throw new fr(d);case to.code:throw new to(d);case dr.code:throw new dr(d);case no.code:throw new no(d);case ro.code:throw new ro(d);case oo.code:throw new oo(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case co.code:throw new co(d);case uo.code:throw new uo(d);case lo.code:throw new lo(d);case fo.code:throw new fo(d);case po.code:throw new po(d);case ho.code:throw new ho(d);case 5e3:throw new dr(d);default:throw p instanceof V?p:new vg(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Bn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m,10)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>Bw(p)}),{enabled:o,id:l})}}function Bw(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===fr.code||e.code===Ln.code:e instanceof Bn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class Lw extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${qr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class Fw extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${qr(n)}`,`Response: ${Te(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Dw 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 Rw="0x556f1830",pd={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 jw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=_l({data:r,abi:[pd]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:hd;try{if(!go(o,i))throw new Dw({sender:i,to:o});const d=c.includes(Ao)?await od({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Po(e,{blockNumber:t,blockTag:n,data:St([u,bn([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new Lw({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function hd({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let f;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await l.json()).data:f=await l.text(),!l.ok){r=new Bn({body:a,details:f!=null&&f.error?Te(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!Et(f)){r=new Fw({result:f,url:i});continue}return f}catch(l){r=new Bn({body:a,details:l.message,url:i})}}throw r}const _w=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:hd,offchainLookup:jw,offchainLookupAbiItem:pd,offchainLookupSignature:Rw},Symbol.toStringTag,{value:"Module"}));function Uw(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function zw(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function Hw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const md=Hw();function Ww(e,t={}){return{async request(n){var p;const{body:r,fetchFn:o=t.fetchFn??fetch,onRequest:s=t.onRequest,onResponse:i=t.onResponse,timeout:c=t.timeout??1e4}=n,a={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:l,signal:f}=a;try{const d=await zw(async({signal:m})=>{const w={...a,body:Array.isArray(r)?Te(r.map(N=>({jsonrpc:"2.0",id:N.id??md.take(),...N}))):Te({jsonrpc:"2.0",id:r.id??md.take(),...r}),headers:{"Content-Type":"application/json",...u},method:l||"POST",signal:f||(c>0?m:null)},$=new Request(e,w),E=await(s==null?void 0:s($,w))??{...w,url:e};return await o(E.url??e,E)},{errorInstance:new ql({body:r,url:e}),timeout:c,signal:!0});i&&await i(d);let h;if((p=d.headers.get("Content-Type"))!=null&&p.startsWith("application/json"))h=await d.json();else{h=await d.text();try{h=JSON.parse(h||"{}")}catch(m){if(d.ok)throw m;h={error:h}}}if(!d.ok)throw new Bn({body:r,details:Te(h.error)||d.statusText,headers:d.headers,status:d.status,url:e});return h}catch(d){throw d instanceof Bn||d instanceof ql?d:new Bn({body:r,cause:d,url:e})}}}}const Vw=`Ethereum Signed Message:
|
|
79
|
-
`;function Gw(e){const t=typeof e=="string"?jr(e):typeof e.raw=="string"?e.raw:Ae(e.raw),n=jr(`${Vw}${we(t)}`);return St([n,t])}function bd(e,t){return Me(Gw(e),t)}class qw extends V{constructor({domain:t}){super(`Invalid domain "${Te(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class Zw 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 Yw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function Kw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:u,type:l}=a,f=c[u],p=l.match(Cl);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,w,$]=p;Q(f,{signed:w==="int",size:Number.parseInt($,10)/8})}if(l==="address"&&typeof f=="string"&&!at(f))throw new hn({address:f});const d=l.match(D1);if(d){const[m,w]=d;if(w&&we(f)!==Number.parseInt(w,10))throw new Vb({expectedSize:Number.parseInt(w,10),givenSize:we(f)})}const h=o[l];h&&(Qw(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new qw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new Zw({primaryType:r,types:o})}function Xw({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 Qw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new Yw({type:e})}function Jw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:Xw({domain:t}),...e.types};Kw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(ev({domain:t,types:o})),r!=="EIP712Domain"&&s.push(gd({data:n,primaryType:r,types:o})),Me(St(s))}function ev({domain:e,types:t}){return gd({data:e,primaryType:"EIP712Domain",types:t})}function gd({data:e,primaryType:t,types:n}){const r=yd({data:e,primaryType:t,types:n});return Me(r)}function yd({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[tv({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=vd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return bn(r,o)}function tv({primaryType:e,types:t}){const n=pn(nv({primaryType:e,types:t}));return Me(n)}function nv({primaryType:e,types:t}){let n="";const r=wd({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:c})=>`${c} ${i}`).join(",")})`;return n}function wd({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])wd({primaryType:s.type,types:t},n);return n}function vd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Me(yd({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Me(r)];if(n==="string")return[{type:"bytes32"},Me(pn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>vd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Me(bn(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class rv extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const Ma={checksum:new rv(8192)}.checksum;function xd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=$l(my(e));return n==="Bytes"?r:Ot(r)}const ov=/^0x[a-fA-F0-9]{40}$/;function Ss(e,t={}){const{strict:n=!0}=t;if(!ov.test(e))throw new Pd({address:e,cause:new sv});if(n){if(e.toLowerCase()===e)return;if(Ed(e)!==e)throw new Pd({address:e,cause:new iv})}}function Ed(e){if(Ma.has(e))return Ma.get(e);Ss(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=xd(gy(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return Ma.set(e,o),o}function ka(e,t={}){const{strict:n=!0}=t??{};try{return Ss(e,{strict:n}),!0}catch{return!1}}class Pd extends ie{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 sv extends ie{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 iv extends ie{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const av=/^(.*)\[([0-9]*)\]$/,cv=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Sd=/^(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)?$/,$d=2n**256n-1n;function vr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=Da(t.type);if(s){const[i,c]=s;return lv(e,{...t,type:c},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return hv(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return uv(e,{checksum:r});if(t.type==="bool")return fv(e);if(t.type.startsWith("bytes"))return dv(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return pv(e,t);if(t.type==="string")return mv(e,{staticPosition:o});throw new _a(t.type)}const Ad=32,Ba=32;function uv(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Ed(s):s)(Ot(wy(r,-20))),32]}function lv(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=en(e.readBytes(Ba)),u=s+a,l=u+Ad;e.setPosition(u);const f=en(e.readBytes(Ad)),p=Oo(t);let d=0;const h=[];for(let m=0;m<f;++m){e.setPosition(l+(p?m*32:d));const[w,$]=vr(e,t,{checksumAddress:r,staticPosition:l});d+=$,h.push(w)}return e.setPosition(s+32),[h,32]}if(Oo(t)){const a=en(e.readBytes(Ba)),u=s+a,l=[];for(let f=0;f<o;++f){e.setPosition(u+f*32);const[p]=vr(e,t,{checksumAddress:r,staticPosition:u});l.push(p)}return e.setPosition(s+32),[l,32]}let i=0;const c=[];for(let a=0;a<o;++a){const[u,l]=vr(e,t,{checksumAddress:r,staticPosition:s+i});i+=l,c.push(u)}return[c,i]}function fv(e){return[xy(e.readBytes(32),{size:32}),32]}function dv(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=en(e.readBytes(32));e.setPosition(n+i);const c=en(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ot(a),32]}return[Ot(e.readBytes(Number.parseInt(o,10),32)),32]}function pv(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?vy(o,{signed:n}):en(o,{signed:n}),32]}function hv(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let c=0;if(Oo(t)){const a=en(e.readBytes(Ba)),u=o+a;for(let l=0;l<t.components.length;++l){const f=t.components[l];e.setPosition(u+c);const[p,d]=vr(e,f,{checksumAddress:r,staticPosition:u});c+=d,i[s?l:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const u=t.components[a],[l,f]=vr(e,u,{checksumAddress:r,staticPosition:o});i[s?a:u==null?void 0:u.name]=l,c+=f}return[i,c]}function mv(e,{staticPosition:t}){const n=en(e.readBytes(32)),r=t+n;e.setPosition(r);const o=en(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=Ey(kf(s));return e.setPosition(t+32),[i,32]}function bv({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(La({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function La({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Da(r.type);if(o){const[s,i]=o;return yv(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Pv(n,{checksumAddress:e,parameter:r});if(r.type==="address")return gv(n,{checksum:e});if(r.type==="bool")return vv(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Sd.exec(r.type)??[];return xv(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return wv(n,{type:r.type});if(r.type==="string")return Ev(n);throw new _a(r.type)}function Fa(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=tt(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Le(t+o,{size:32})),r.push(c),o+=tt(c)):n.push(c)}return Tt(...n,...r)}function gv(e,t){const{checksum:n=!1}=t;return Ss(e,{strict:n}),{dynamic:!1,encoded:jn(e.toLowerCase())}}function yv(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new Mv(e);if(!s&&e.length!==r)throw new Iv({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=La({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=Fa(c);if(s){const u=Le(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Tt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Tt(...c.map(({encoded:a})=>a))}}function wv(e,{type:t}){const[,n]=t.split("bytes"),r=tt(e);if(!n){let o=e;return r%32!==0&&(o=_n(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Tt(jn(Le(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new Nd({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:_n(e)}}function vv(e){if(typeof e!="boolean")throw new ie(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:jn(Bf(e))}}function xv(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 Df({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Le(e,{size:32,signed:t})}}function Ev(e){const t=pa(e),n=Math.ceil(tt(t)/32),r=[];for(let o=0;o<n;o++)r.push(_n(Ft(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Tt(_n(Le(tt(t),{size:32})),...r)}}function Pv(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,u=La({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Fa(s):Tt(...s.map(({encoded:i})=>i))}}function Da(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Oo(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(Oo);const n=Da(e.type);return!!(n&&Oo({...e,type:n[1]}))}const Sv={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 Tv({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Av({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Td({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 Td({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 $v(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Sv);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Td extends ie{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Av extends ie{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 Tv extends ie{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 Ov(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?Mf(t):t,i=$v(s);if(gr(s)===0&&e.length>0)throw new Cv;if(gr(s)&&gr(s)<32)throw new Nv({data:typeof t=="string"?t:Ot(t),parameters:e,size:gr(s)});let c=0;const a=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const l=e[u];i.setPosition(c);const[f,p]=vr(i,l,{checksumAddress:o,staticPosition:0});c+=p,r==="Array"?a.push(f):a[l.name??u]=f}return a}function Ra(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Cd({expectedLength:e.length,givenLength:t.length});const o=bv({checksumAddress:r,parameters:e,values:t}),s=Fa(o);return s.length===0?"0x":s}function ja(e,t){if(e.length!==t.length)throw new Cd({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(ja.encode(o,s))}return Tt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Ss(a),jn(a.toLowerCase(),o?32:0)}if(n==="string")return pa(r);if(n==="bytes")return r;if(n==="bool")return jn(Bf(r),o?32:1);const s=n.match(Sd);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l,10)/8;return Le(r,{size:o?32:f,signed:u==="int"})}const i=n.match(cv);if(i){const[a,u]=i;if(Number.parseInt(u,10)!==(r.length-2)/2)throw new Nd({expectedSize:Number.parseInt(u,10),value:r});return _n(r,o?32:0)}const c=n.match(av);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let f=0;f<r.length;f++)l.push(t(u,r[f],!0));return l.length===0?"0x":Tt(...l)}throw new _a(n)}e.encode=t})(ja||(ja={}));function Od(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?Ju(e):e}class Nv extends ie{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${er(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Cv extends ie{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Iv extends ie{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 Nd extends ie{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${tt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Cd extends ie{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
80
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Mv extends ie{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class _a extends ie{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}class Id extends Ti{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,p1(t);const r=ts(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),ar(s)}update(t){return ir(this),this.iHash.update(t),this}digestInto(t){ir(this),Mn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Md=(e,t,n)=>new Id(e,t).update(n).digest();Md.create=(e,t)=>new Id(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const We=BigInt(0),Fe=BigInt(1),Un=BigInt(2),kv=BigInt(3),kd=BigInt(4),Bd=BigInt(5),Ld=BigInt(8);function Ve(e,t){const n=e%t;return n>=We?n:t+n}function ut(e,t,n){let r=e;for(;t-- >We;)r*=r,r%=n;return r}function Ua(e,t){if(e===We)throw new Error("invert: expected non-zero number");if(t<=We)throw new Error("invert: expected positive modulus, got "+t);let n=Ve(e,t),r=t,o=We,s=Fe;for(;n!==We;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Fe)throw new Error("invert: does not exist");return Ve(o,t)}function Fd(e,t){const n=(e.ORDER+Fe)/kd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Bv(e,t){const n=(e.ORDER-Bd)/Ld,r=e.mul(t,Un),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Un),o),c=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(c),t))throw new Error("Cannot find square root");return c}function Lv(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Fe,n=0;for(;t%Un===We;)t/=Un,n++;let r=Un;const o=za(e);for(;Rd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Fd;let s=o.pow(r,t);const i=(t+Fe)/Un;return function(a,u){if(a.is0(u))return u;if(Rd(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),p=a.pow(u,t),d=a.pow(u,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const w=Fe<<BigInt(l-h-1),$=a.pow(f,w);l=h,f=a.sqr($),p=a.mul(p,f),d=a.mul(d,$)}return d}}function Fv(e){return e%kd===kv?Fd:e%Ld===Bd?Bv:Lv(e)}const Dv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Rv(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Dv.reduce((r,o)=>(r[o]="function",r),t);return bs(e,n)}function jv(e,t,n){if(n<We)throw new Error("invalid exponent, negatives unsupported");if(n===We)return e.ONE;if(n===Fe)return t;let r=e.ONE,o=t;for(;n>We;)n&Fe&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Fe;return r}function Dd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function Rd(e,t){const n=(e.ORDER-Fe)/Un,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function jd(e,t){t!==void 0&&_r(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function za(e,t,n=!1,r={}){if(e<=We)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=jd(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const c=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:ms(o),ZERO:We,ONE:Fe,create:a=>Ve(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return We<=a&&a<e},is0:a=>a===We,isOdd:a=>(a&Fe)===Fe,neg:a=>Ve(-a,e),eql:(a,u)=>a===u,sqr:a=>Ve(a*a,e),add:(a,u)=>Ve(a+u,e),sub:(a,u)=>Ve(a-u,e),mul:(a,u)=>Ve(a*u,e),pow:(a,u)=>jv(c,a,u),div:(a,u)=>Ve(a*Ua(u,e),e),sqrN:a=>a*a,addN:(a,u)=>a+u,subN:(a,u)=>a-u,mulN:(a,u)=>a*u,inv:a=>Ua(a,e),sqrt:r.sqrt||(a=>(i||(i=Fv(e)),i(c,a))),toBytes:a=>n?Sf(a,s):xo(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Pf(a):Rn(a)},invertBatch:a=>Dd(c,a),cmov:(a,u,l)=>l?u:a});return Object.freeze(c)}function _d(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 Ud(e){const t=_d(e);return t+Math.ceil(t/2)}function _v(e,t,n=!1){const r=e.length,o=_d(t),s=Ud(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Pf(e):Rn(e),c=Ve(i,t-Fe)+Fe;return n?Sf(c,o):xo(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zd=BigInt(0),Ha=BigInt(1);function Wa(e,t){const n=t.negate();return e?n:t}function Hd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Va(e,t){Hd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=ms(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Wd(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Ha);const u=t*r,l=u+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:l,isZero:f,isNeg:p,isNegF:d,offsetF:u}}function Uv(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 zv(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 Ga=new WeakMap,Vd=new WeakMap;function qa(e){return Vd.get(e)||1}function Hv(e,t){return{constTimeNegate:Wa,hasPrecomputes(n){return qa(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>zd;)r&Ha&&(o=o.add(s)),s=s.double(),r>>=Ha;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=Va(r,t),i=[];let c=n,a=c;for(let u=0;u<o;u++){a=c,i.push(a);for(let l=1;l<s;l++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const c=Va(n,t);for(let a=0;a<c.windows;a++){const{nextN:u,offset:l,isZero:f,isNeg:p,isNegF:d,offsetF:h}=Wd(o,a,c);o=u,f?i=i.add(Wa(d,r[h])):s=s.add(Wa(p,r[l]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=Va(n,t);for(let c=0;c<i.windows&&o!==zd;c++){const{nextN:a,offset:u,isZero:l,isNeg:f}=Wd(o,c,i);if(o=a,!l){const p=r[u];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=Ga.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&Ga.set(r,o(s))),s},wNAFCached(n,r,o){const s=qa(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=qa(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){Hd(r,t),Vd.set(n,r),Ga.delete(n)}}}function Wv(e,t,n,r){Uv(n,e),zv(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,c=oy(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=ms(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){l.fill(i);for(let m=0;m<s;m++){const w=r[m],$=Number(w>>BigInt(d)&u);l[$]=l[$].add(n[m])}let h=i;for(let m=l.length-1,w=i;m>0;m--)w=w.add(l[m]),h=h.add(w);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function Gd(e){return Rv(e.Fp),bs(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...jd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qd(e){e.lowS!==void 0&&wo("lowS",e.lowS),e.prehash!==void 0&&wo("prehash",e.prehash)}function Vv(e){const t=Gd(e);bs(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 Gv extends Error{constructor(t=""){super(t)}}const tn={Err:Gv,_tlv:{encode:(e,t)=>{const{Err:n}=tn;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=ds(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ds(o.length/2|128):"";return ds(e)+s+o+t},decode(e,t){const{Err:n}=tn;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+a);if(u.length!==a)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=tn;if(e<nn)throw new t("integer: negative integers are not allowed");let n=ds(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}=tn;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 Rn(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=tn,o=ct("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=tn,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 Za(e,t){return vo(xo(e,t))}const nn=BigInt(0),Ne=BigInt(1);BigInt(2);const Ya=BigInt(3),qv=BigInt(4);function Zv(e){const t=Vv(e),{Fp:n}=t,r=za(t.n,t.nBitLength),o=t.toBytes||((P,N,B)=>{const F=N.toAffine();return hs(Uint8Array.from([4]),n.toBytes(F.x),n.toBytes(F.y))}),s=t.fromBytes||(P=>{const N=P.subarray(1),B=n.fromBytes(N.subarray(0,n.BYTES)),F=n.fromBytes(N.subarray(n.BYTES,2*n.BYTES));return{x:B,y:F}});function i(P){const{a:N,b:B}=t,F=n.sqr(P),D=n.mul(F,P);return n.add(n.add(D,n.mul(P,N)),B)}function c(P,N){const B=n.sqr(N),F=i(P);return n.eql(B,F)}if(!c(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,Ya),qv),u=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,u)))throw new Error("bad curve params: a or b");function l(P){return fa(P,Ne,t.n)}function f(P){const{allowedPrivateKeyLengths:N,nByteLength:B,wrapPrivateKey:F,n:D}=t;if(N&&typeof P!="bigint"){if(yo(P)&&(P=vo(P)),typeof P!="string"||!N.includes(P.length))throw new Error("invalid private key");P=P.padStart(B*2,"0")}let b;try{b=typeof P=="bigint"?P:Rn(ct("private key",P,B))}catch{throw new Error("invalid private key, expected hex or "+B+" bytes, got "+typeof P)}return F&&(b=Ve(b,D)),br("private key",b,Ne,D),b}function p(P){if(!(P instanceof m))throw new Error("ProjectivePoint expected")}const d=Af((P,N)=>{const{px:B,py:F,pz:D}=P;if(n.eql(D,n.ONE))return{x:B,y:F};const b=P.is0();N==null&&(N=b?n.ONE:n.inv(D));const g=n.mul(B,N),v=n.mul(F,N),C=n.mul(D,N);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(C,n.ONE))throw new Error("invZ was invalid");return{x:g,y:v}}),h=Af(P=>{if(P.is0()){if(t.allowInfinityPoint&&!n.is0(P.py))return;throw new Error("bad point: ZERO")}const{x:N,y:B}=P.toAffine();if(!n.isValid(N)||!n.isValid(B))throw new Error("bad point: x or y not FE");if(!c(N,B))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class m{constructor(N,B,F){if(N==null||!n.isValid(N))throw new Error("x required");if(B==null||!n.isValid(B)||n.is0(B))throw new Error("y required");if(F==null||!n.isValid(F))throw new Error("z required");this.px=N,this.py=B,this.pz=F,Object.freeze(this)}static fromAffine(N){const{x:B,y:F}=N||{};if(!N||!n.isValid(B)||!n.isValid(F))throw new Error("invalid affine point");if(N instanceof m)throw new Error("projective point not allowed");const D=b=>n.eql(b,n.ZERO);return D(B)&&D(F)?m.ZERO:new m(B,F,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(N){const B=Dd(n,N.map(F=>F.pz));return N.map((F,D)=>F.toAffine(B[D])).map(m.fromAffine)}static fromHex(N){const B=m.fromAffine(s(ct("pointHex",N)));return B.assertValidity(),B}static fromPrivateKey(N){return m.BASE.multiply(f(N))}static msm(N,B){return Wv(m,r,N,B)}_setWindowSize(N){E.setWindowSize(this,N)}assertValidity(){h(this)}hasEvenY(){const{y:N}=this.toAffine();if(n.isOdd)return!n.isOdd(N);throw new Error("Field doesn't support isOdd")}equals(N){p(N);const{px:B,py:F,pz:D}=this,{px:b,py:g,pz:v}=N,C=n.eql(n.mul(B,v),n.mul(b,D)),O=n.eql(n.mul(F,v),n.mul(g,D));return C&&O}negate(){return new m(this.px,n.neg(this.py),this.pz)}double(){const{a:N,b:B}=t,F=n.mul(B,Ya),{px:D,py:b,pz:g}=this;let v=n.ZERO,C=n.ZERO,O=n.ZERO,I=n.mul(D,D),M=n.mul(b,b),y=n.mul(g,g),T=n.mul(D,b);return T=n.add(T,T),O=n.mul(D,g),O=n.add(O,O),v=n.mul(N,O),C=n.mul(F,y),C=n.add(v,C),v=n.sub(M,C),C=n.add(M,C),C=n.mul(v,C),v=n.mul(T,v),O=n.mul(F,O),y=n.mul(N,y),T=n.sub(I,y),T=n.mul(N,T),T=n.add(T,O),O=n.add(I,I),I=n.add(O,I),I=n.add(I,y),I=n.mul(I,T),C=n.add(C,I),y=n.mul(b,g),y=n.add(y,y),I=n.mul(y,T),v=n.sub(v,I),O=n.mul(y,M),O=n.add(O,O),O=n.add(O,O),new m(v,C,O)}add(N){p(N);const{px:B,py:F,pz:D}=this,{px:b,py:g,pz:v}=N;let C=n.ZERO,O=n.ZERO,I=n.ZERO;const M=t.a,y=n.mul(t.b,Ya);let T=n.mul(B,b),A=n.mul(F,g),S=n.mul(D,v),L=n.add(B,F),j=n.add(b,g);L=n.mul(L,j),j=n.add(T,A),L=n.sub(L,j),j=n.add(B,D);let z=n.add(b,v);return j=n.mul(j,z),z=n.add(T,S),j=n.sub(j,z),z=n.add(F,D),C=n.add(g,v),z=n.mul(z,C),C=n.add(A,S),z=n.sub(z,C),I=n.mul(M,j),C=n.mul(y,S),I=n.add(C,I),C=n.sub(A,I),I=n.add(A,I),O=n.mul(C,I),A=n.add(T,T),A=n.add(A,T),S=n.mul(M,S),j=n.mul(y,j),A=n.add(A,S),S=n.sub(T,S),S=n.mul(M,S),j=n.add(j,S),T=n.mul(A,j),O=n.add(O,T),T=n.mul(z,j),C=n.mul(L,C),C=n.sub(C,T),T=n.mul(L,A),I=n.mul(z,I),I=n.add(I,T),new m(C,O,I)}subtract(N){return this.add(N.negate())}is0(){return this.equals(m.ZERO)}wNAF(N){return E.wNAFCached(this,N,m.normalizeZ)}multiplyUnsafe(N){const{endo:B,n:F}=t;br("scalar",N,nn,F);const D=m.ZERO;if(N===nn)return D;if(this.is0()||N===Ne)return this;if(!B||E.hasPrecomputes(this))return E.wNAFCachedUnsafe(this,N,m.normalizeZ);let{k1neg:b,k1:g,k2neg:v,k2:C}=B.splitScalar(N),O=D,I=D,M=this;for(;g>nn||C>nn;)g&Ne&&(O=O.add(M)),C&Ne&&(I=I.add(M)),M=M.double(),g>>=Ne,C>>=Ne;return b&&(O=O.negate()),v&&(I=I.negate()),I=new m(n.mul(I.px,B.beta),I.py,I.pz),O.add(I)}multiply(N){const{endo:B,n:F}=t;br("scalar",N,Ne,F);let D,b;if(B){const{k1neg:g,k1:v,k2neg:C,k2:O}=B.splitScalar(N);let{p:I,f:M}=this.wNAF(v),{p:y,f:T}=this.wNAF(O);I=E.constTimeNegate(g,I),y=E.constTimeNegate(C,y),y=new m(n.mul(y.px,B.beta),y.py,y.pz),D=I.add(y),b=M.add(T)}else{const{p:g,f:v}=this.wNAF(N);D=g,b=v}return m.normalizeZ([D,b])[0]}multiplyAndAddUnsafe(N,B,F){const D=m.BASE,b=(v,C)=>C===nn||C===Ne||!v.equals(D)?v.multiplyUnsafe(C):v.multiply(C),g=b(this,B).add(b(N,F));return g.is0()?void 0:g}toAffine(N){return d(this,N)}isTorsionFree(){const{h:N,isTorsionFree:B}=t;if(N===Ne)return!0;if(B)return B(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:N,clearCofactor:B}=t;return N===Ne?this:B?B(m,this):this.multiplyUnsafe(t.h)}toRawBytes(N=!0){return wo("isCompressed",N),this.assertValidity(),o(m,this,N)}toHex(N=!0){return wo("isCompressed",N),vo(this.toRawBytes(N))}}m.BASE=new m(t.Gx,t.Gy,n.ONE),m.ZERO=new m(n.ZERO,n.ONE,n.ZERO);const{endo:w,nBitLength:$}=t,E=Hv(m,w?Math.ceil($/2):$);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:l}}function Yv(e){const t=Gd(e);return bs(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Kv(e){const t=Yv(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,c=2*n.BYTES+1;function a(y){return Ve(y,r)}function u(y){return Ua(y,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=Zv({...t,toBytes(y,T,A){const S=T.toAffine(),L=n.toBytes(S.x),j=hs;return wo("isCompressed",A),A?j(Uint8Array.from([T.hasEvenY()?2:3]),L):j(Uint8Array.from([4]),L,n.toBytes(S.y))},fromBytes(y){const T=y.length,A=y[0],S=y.subarray(1);if(T===i&&(A===2||A===3)){const L=Rn(S);if(!fa(L,Ne,n.ORDER))throw new Error("Point is not on curve");const j=p(L);let z;try{z=n.sqrt(j)}catch(K){const G=K instanceof Error?": "+K.message:"";throw new Error("Point is not on curve"+G)}const _=(z&Ne)===Ne;return(A&1)===1!==_&&(z=n.neg(z)),{x:L,y:z}}else if(T===c&&A===4){const L=n.fromBytes(S.subarray(0,n.BYTES)),j=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:L,y:j}}else{const L=i,j=c;throw new Error("invalid Point, expected length of "+L+", or uncompressed "+j+", got "+T)}}});function h(y){const T=r>>Ne;return y>T}function m(y){return h(y)?a(-y):y}const w=(y,T,A)=>Rn(y.slice(T,A));class ${constructor(T,A,S){br("r",T,Ne,r),br("s",A,Ne,r),this.r=T,this.s=A,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(T){const A=o;return T=ct("compactSignature",T,A*2),new $(w(T,0,A),w(T,A,2*A))}static fromDER(T){const{r:A,s:S}=tn.toSig(ct("DER",T));return new $(A,S)}assertValidity(){}addRecoveryBit(T){return new $(this.r,this.s,T)}recoverPublicKey(T){const{r:A,s:S,recovery:L}=this,j=D(ct("msgHash",T));if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");const z=L===2||L===3?A+t.n:A;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=L&1?"03":"02",W=l.fromHex(_+Za(z,n.BYTES)),K=u(z),G=a(-j*K),H=a(S*K),Z=l.BASE.multiplyAndAddUnsafe(W,G,H);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new $(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return ps(this.toDERHex())}toDERHex(){return tn.hexFromSig(this)}toCompactRawBytes(){return ps(this.toCompactHex())}toCompactHex(){const T=o;return Za(this.r,T)+Za(this.s,T)}}const E={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=Ud(t.n);return _v(t.randomBytes(y),t.n)},precompute(y=8,T=l.BASE){return T._setWindowSize(y),T.multiply(BigInt(3)),T}};function P(y,T=!0){return l.fromPrivateKey(y).toRawBytes(T)}function N(y){if(typeof y=="bigint")return!1;if(y instanceof l)return!0;const A=ct("key",y).length,S=n.BYTES,L=S+1,j=2*S+1;if(!(t.allowedPrivateKeyLengths||o===L))return A===L||A===j}function B(y,T,A=!0){if(N(y)===!0)throw new Error("first arg must be private key");if(N(T)===!1)throw new Error("second arg must be public key");return l.fromHex(T).multiply(f(y)).toRawBytes(A)}const F=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const T=Rn(y),A=y.length*8-s;return A>0?T>>BigInt(A):T},D=t.bits2int_modN||function(y){return a(F(y))},b=ms(s);function g(y){return br("num < 2^"+s,y,nn,b),xo(y,o)}function v(y,T,A=C){if(["recovered","canonical"].some(oe=>oe in A))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:L}=t;let{lowS:j,prehash:z,extraEntropy:_}=A;j==null&&(j=!0),y=ct("msgHash",y),qd(A),z&&(y=ct("prehashed msgHash",S(y)));const W=D(y),K=f(T),G=[g(K),g(W)];if(_!=null&&_!==!1){const oe=_===!0?L(n.BYTES):_;G.push(ct("extraEntropy",oe))}const H=hs(...G),Z=W;function J(oe){const me=F(oe);if(!d(me))return;const ge=u(me),de=l.BASE.multiply(me).toAffine(),se=a(de.x);if(se===nn)return;const pe=a(ge*a(Z+se*K));if(pe===nn)return;let ee=(de.x===se?0:2)|Number(de.y&Ne),Pe=pe;return j&&h(pe)&&(Pe=m(pe),ee^=1),new $(se,Pe,ee)}return{seed:H,k2sig:J}}const C={lowS:t.lowS,prehash:!1},O={lowS:t.lowS,prehash:!1};function I(y,T,A=C){const{seed:S,k2sig:L}=v(y,T,A),j=t;return sy(j.hash.outputLen,j.nByteLength,j.hmac)(S,L)}l.BASE._setWindowSize(8);function M(y,T,A,S=O){var ee;const L=y;T=ct("msgHash",T),A=ct("publicKey",A);const{lowS:j,prehash:z,format:_}=S;if(qd(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const W=typeof L=="string"||yo(L),K=!W&&!_&&typeof L=="object"&&L!==null&&typeof L.r=="bigint"&&typeof L.s=="bigint";if(!W&&!K)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let G,H;try{if(K&&(G=new $(L.r,L.s)),W){try{_!=="compact"&&(G=$.fromDER(L))}catch(Pe){if(!(Pe instanceof tn.Err))throw Pe}!G&&_!=="der"&&(G=$.fromCompact(L))}H=l.fromHex(A)}catch{return!1}if(!G||j&&G.hasHighS())return!1;z&&(T=t.hash(T));const{r:Z,s:J}=G,oe=D(T),me=u(J),ge=a(oe*me),de=a(Z*me),se=(ee=l.BASE.multiplyAndAddUnsafe(H,ge,de))==null?void 0:ee.toAffine();return se?a(se.x)===Z:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:B,sign:I,verify:M,ProjectivePoint:l,Signature:$,utils:E}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Xv(e){return{hash:e,hmac:(t,...n)=>Md(e,t,w1(...n)),randomBytes:v1}}function Qv(e,t){const n=r=>Kv({...e,...Xv(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zd=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Yd=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Jv=BigInt(0),e6=BigInt(1),Ka=BigInt(2),Kd=(e,t)=>(e+t/Ka)/t;function t6(e){const t=Zd,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=ut(l,n,t)*l%t,p=ut(f,n,t)*l%t,d=ut(p,Ka,t)*u%t,h=ut(d,o,t)*d%t,m=ut(h,s,t)*h%t,w=ut(m,c,t)*m%t,$=ut(w,a,t)*w%t,E=ut($,c,t)*m%t,P=ut(E,n,t)*l%t,N=ut(P,i,t)*h%t,B=ut(N,r,t)*u%t,F=ut(B,Ka,t);if(!Xa.eql(Xa.sqr(F),e))throw new Error("Cannot find square root");return F}const Xa=za(Zd,void 0,void 0,{sqrt:t6}),Xd=Qv({a:Jv,b:BigInt(7),Fp:Xa,n:Yd,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Yd,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-e6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),c=Kd(s*e,t),a=Kd(-r*e,t);let u=Ve(e-c*n-a*o,t),l=Ve(-c*r-a*s,t);const f=u>i,p=l>i;if(f&&(u=t-u),p&&(l=t-l),u>i||l>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}}},lf),n6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Xd},Symbol.toStringTag,{value:"Module"}));function Qd(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Ja({signature:e});if(typeof e.s>"u")throw new Ja({signature:e});if(n&&typeof e.yParity>"u")throw new Ja({signature:e});if(e.r<0n||e.r>$d)throw new u6({value:e.r});if(e.s<0n||e.s>$d)throw new l6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new ec({value:e.yParity})}function r6(e){return Jd(Ot(e))}function Jd(e){if(e.length!==130&&e.length!==132)throw new c6({signature:e});const t=BigInt(Ft(e,0,32)),n=BigInt(Ft(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return Qa(o)}catch{throw new ec({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function o6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return s6(e)}function s6(e){const t=typeof e=="string"?Jd(e):e instanceof Uint8Array?r6(e):typeof e.r=="string"?a6(e):e.v?i6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return Qd(t),t}function i6(e){return{r:e.r,s:e.s,yParity:Qa(e.v)}}function a6(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=Qa(n)),typeof r!="number")throw new ec({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function Qa(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 f6({value:e})}class c6 extends ie{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${tt(Cy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Ja extends ie{constructor({signature:t}){super(`Signature \`${If(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class u6 extends ie{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 l6 extends ie{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 ec extends ie{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 f6 extends ie{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"?p6(e):{...e,...t.signature}}function p6(e){const{address:t,chainId:n,nonce:r}=e,o=o6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const h6="0x8010801080108010801080108010801080108010801080108010801080108010",m6=Od("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function e0(e){if(typeof e=="string"){if(Ft(e,-32)!==h6)throw new y6(e)}else Qd(e.authorization)}function b6(e){e0(e);const t=Ff(Ft(e,-64,-32)),n=Ft(e,-t-64,-64),r=Ft(e,0,-t-64),[o,s,i]=Ov(m6,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 g6(e){try{return e0(e),!0}catch{return!1}}let y6=class extends ie{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 w6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function v6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new w6({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,i,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function x6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function E6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Zt(e.nonce):void 0,storageProof:e.storageProof?x6(e.storageProof):void 0}}async function P6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?Q(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return E6(c)}async function S6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?Q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function tc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:c}){var p,d,h;const a=r||"latest",u=n!==void 0?Q(n):void 0;let l=null;if(o?l=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?l=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Q(s)]},{dedupe:!0}):typeof s=="number"?l=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||a,Q(s)]},{dedupe:!!u}):i&&typeof c=="number"&&(l=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,Q(c)]},{dedupe:!0})),!l)throw new Hl({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)||Xi)(l,"getTransaction")}async function $6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([X(e,$o,"getBlockNumber")({}),t?X(e,tc,"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 $s(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Wl({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||td)(n,"getTransactionReceipt")}async function A6(e,t){var E;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:c,stateOverride:a}=t,u=t.contracts,{batchSize:l=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((E=e.batch)==null?void 0:E.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return wr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,m=0;for(let P=0;P<u.length;P++){const{abi:N,address:B,args:F,functionName:D}=u[P];try{const b=$t({abi:N,args:F,functionName:D});m+=(b.length-2)/2,l>0&&m>l&&d[h].length>0&&(h++,m=(b.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:b,target:B}]}catch(b){const g=pr(b,{abi:N,address:B,args:F,docsPath:"/docs/contract/multicall",functionName:D,sender:n});if(!o)throw g;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:B}]}}const w=await Promise.allSettled(d.map(P=>X(e,Nt,"readContract")({...p===null?{code:ma}:{address:p},abi:ys,account:n,args:[P],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:c,functionName:"aggregate3",stateOverride:a}))),$=[];for(let P=0;P<w.length;P++){const N=w[P];if(N.status==="rejected"){if(!o)throw N.reason;for(let F=0;F<d[P].length;F++)$.push({status:"failure",error:N.reason,result:void 0});continue}const B=N.value;for(let F=0;F<B.length;F++){const{returnData:D,success:b}=B[F],{callData:g}=d[P][F],{abi:v,address:C,functionName:O,args:I}=u[$.length];try{if(g==="0x")throw new Rr;if(!b)throw new is({data:D});const M=Dn({abi:v,args:I,data:D,functionName:O});$.push(o?{result:M,status:"success"}:M)}catch(M){const y=pr(M,{abi:v,address:C,args:I,docsPath:"/docs/contract/multicall",functionName:O});if(!o)throw y;$.push({error:y,result:void 0,status:"failure"})}}}if($.length!==u.length)throw new V("multicall results mismatch");return $}async function nc(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?Uf(p.blockOverrides):void 0,h=p.calls.map(w=>{const $=w,E=$.account?Je($.account):void 0,P=$.abi?$t($):$.data,N={...$,account:E,data:$.dataSuffix?St([P||"0x",$.dataSuffix]):P,from:$.from??(E==null?void 0:E.address)};return mr(N),bo(N)}),m=p.stateOverrides?Yi(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?Q(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((p,d)=>({...of(p),calls:p.calls.map((h,m)=>{var v,C;const{abi:w,args:$,functionName:E,to:P}=o[d].calls[m],N=((v=h.error)==null?void 0:v.data)??h.returnData,B=BigInt(h.gasUsed),F=(C=h.logs)==null?void 0:C.map(O=>Xt(O)),D=h.status==="0x1"?"success":"failure",b=w&&D==="success"&&N!=="0x"?Dn({abi:w,data:N,functionName:E}):null,g=(()=>{var I;if(D==="success")return;let O;if(((I=h.error)==null?void 0:I.data)==="0x"?O=new Rr:h.error&&(O=new is(h.error)),!!O)return pr(O,{abi:w??[],address:P??"0x",args:$,functionName:E??"<unknown>"})})();return{data:N,gasUsed:B,logs:F,status:D,...D==="success"?{result:b}:{error:g}}})}))}catch(a){const u=a,l=us(u,{});throw l instanceof mo?u:l}}function rc(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new ie("Unable to normalize signature.");return o}function oc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ka(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)=>oc(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=>oc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function t0(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 t0(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")?ka(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ka(n[r],{strict:!1}):!1)return i}}function n0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Qu(e):e;return{...r,...n?{hash:xr(r)}:{}}}function As(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Iy(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?r0(u)===Ft(t,0,4):u.type==="event"?xr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Ts({name:t});if(i.length===1)return{...i[0],...o?{hash:xr(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:xr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in u&&u.inputs[p];return d?oc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=t0(u.inputs,c.inputs,r);if(f)throw new O6({abiItem:u,type:f[0]},{abiItem:c,type:f[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new Ts({name:t});return{...a,...o?{hash:xr(a)}:{}}}function r0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return As(n,r)}return e[0]})();return Ft(xr(t),0,4)}function T6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return As(r,o)}return e[0]})(),n=typeof t=="string"?t:Ko(t);return rc(n)}function xr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return As(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:xd(pa(T6(t)))}class O6 extends ie{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${rc(Ko(t.abiItem))}\`, and`,`\`${n.type}\` in \`${rc(Ko(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 Ts extends ie{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 N6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,c]=e;return[I6(i),c]}return e})(),{bytecode:r,args:o}=n;return Tt(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?Ra(t.inputs,o):"0x")}function C6(e){return n0(e)}function I6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Ts({name:"constructor"});return t}function M6(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[u,l,f]=e;return[o0(u,l,{args:f}),f]}const[c,a]=e;return[c,a]})(),{overloads:r}=t,o=r?o0([t,...r],t.name,{args:n}):t,s=k6(o),i=n.length>0?Ra(o.inputs,n):void 0;return i?Tt(s,i):s}function Er(e,t={}){return n0(e,t)}function o0(e,t,n){const r=As(e,t,n);if(r.type!=="function")throw new Ts({name:t,type:"function"});return r}function k6(e){return r0(e)}const B6="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Dt="0x0000000000000000000000000000000000000000",L6="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function F6(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?Je(t.account):void 0;if(i&&!u)throw new V("`account` is required when `traceAssetChanges` is true");const l=u?N6(C6("constructor(bytes, bytes)"),{bytecode:Zf,args:[L6,M6(Er("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async S=>{if(!S.data&&!S.abi)return;const{accessList:L}=await ld(e,{account:u.address,...S,data:S.abi?$t(S):S.data});return L.map(({address:j,storageKeys:z})=>z.length>0?j:null)})).then(S=>S.flat().filter(Boolean)):[],p=await nc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((S,L)=>({abi:[Er("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:S,from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]}]:[],{calls:[...o,{}].map(S=>({...S,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((S,L)=>({abi:[Er("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:S,from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((S,L)=>({to:S,abi:[Er("function decimals() returns (uint256)")],functionName:"decimals",from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((S,L)=>({to:S,abi:[Er("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((S,L)=>({to:S,abi:[Er("function symbol() returns (string)")],functionName:"symbol",from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,w,$,E,P,N]=i?p:[],{calls:B,...F}=d,D=B.slice(0,-1)??[],b=(h==null?void 0:h.calls)??[],g=(m==null?void 0:m.calls)??[],v=[...b,...g].map(S=>S.status==="success"?kt(S.data):null),C=(w==null?void 0:w.calls)??[],O=($==null?void 0:$.calls)??[],I=[...C,...O].map(S=>S.status==="success"?kt(S.data):null),M=((E==null?void 0:E.calls)??[]).map(S=>S.status==="success"?S.result:null),y=((N==null?void 0:N.calls)??[]).map(S=>S.status==="success"?S.result:null),T=((P==null?void 0:P.calls)??[]).map(S=>S.status==="success"?S.result:null),A=[];for(const[S,L]of I.entries()){const j=v[S];if(typeof L!="bigint"||typeof j!="bigint")continue;const z=M[S-1],_=y[S-1],W=T[S-1],K=S===0?{address:B6,decimals:18,symbol:"ETH"}:{address:f[S-1],decimals:W||z?Number(z??1):void 0,symbol:_??void 0};A.some(G=>G.token.address===K.address)||A.push({token:K,value:{pre:j,post:L,diff:L-j}})}return{assetChanges:A,block:F,results:D}}const s0="0x6492649264926492649264926492649264926492649264926492649264926492";function D6(e){if(Ft(e,-32)!==s0)throw new _6(e)}function R6(e){const{data:t,signature:n,to:r}=e;return Tt(Ra(Od("address, bytes, bytes"),[r,t,n]),s0)}function j6(e){try{return D6(e),!0}catch{return!1}}class _6 extends ie{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 U6({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 Xd.Signature(kt(e),kt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:Bt(i)}async function Os(e,t){var c,a,u,l,f,p;const{address:n,hash:r,erc6492VerifierAddress:o=t.universalSignatureVerifierAddress??((u=(a=(c=e.chain)==null?void 0:c.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:u.address),multicallAddress:s=t.multicallAddress??((p=(f=(l=e.chain)==null?void 0:l.contracts)==null?void 0:f.multicall3)==null?void 0:p.address)}=t,i=(()=>{const d=t.signature;return Et(d)?d:typeof d=="object"&&"r"in d&&"s"in d?U6(d):Ae(d)})();try{return g6(i)?await z6(e,{...t,multicallAddress:s,signature:i}):await H6(e,{...t,verifierAddress:o,signature:i})}catch(d){try{if(go(mn(n),await Yl({hash:r,signature:i})))return!0}catch{}if(d instanceof zn)return!1;throw d}}async function z6(e,t){var w;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:c,data:a,signature:u,to:l}=b6(t.signature);if(await Ia(e,{address:n,blockNumber:r,blockTag:o})===cr(["0xef0100",c.address]))return await W6(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:u});const p={address:c.address,chainId:Number(c.chainId),nonce:Number(c.nonce),r:Q(c.r,{size:32}),s:Q(c.s,{size:32}),yParity:c.yParity};if(!await Iw({address:n,authorization:p}))throw new zn;const h=await X(e,Nt,"readContract")({...i?{address:i}:{code:ma},authorizationList:[p],abi:ys,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:l??n,callData:a}]:[],{allowFailure:!0,target:n,callData:$t({abi:Gf,functionName:"isValidSignature",args:[s,u]})}]]}),m=(w=h[h.length-1])==null?void 0:w.returnData;if(m!=null&&m.startsWith("0x1626ba7e"))return!0;throw new zn}async function H6(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:c,...a}=t,u=await(async()=>!r&&!o||j6(i)?i:R6({data:o,signature:i,to:r}))(),l=c?{to:c,data:$t({abi:qf,functionName:"isValidSig",args:[n,s,u]}),...a}:{data:ya({abi:qf,args:[n,s,u],bytecode:Ry}),...a},{data:f}=await X(e,Po,"call")(l).catch(p=>{throw p instanceof Vl?new zn:p});if(e1(f??"0x0"))return!0;throw new zn}async function W6(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await X(e,Nt,"readContract")({address:n,abi:Gf,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof Gl?new zn:a})).startsWith("0x1626ba7e"))return!0;throw new zn}class zn extends Error{}async function V6(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=bd(n);return X(e,Os,"verifyHash")({address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function G6(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=Jw({message:i,primaryType:c,types:a,domain:u});return X(e,Os,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function i0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return c?(()=>{const f=Te(["watchBlockNumber",e.uid,t,n,i]);return vn(f,{onBlockNumber:r,onError:o},p=>So(async()=>{var d;try{const h=await X(e,$o,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Te(["watchBlockNumber",e.uid,t,n]);return vn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(E=>E.config.type==="webSocket"||E.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),{unsubscribe:w}=await m.subscribe({params:["newHeads"],onData($){var P;if(!d)return;const E=kt((P=$.result)==null?void 0:P.number);p.onBlockNumber(E,a),a=E},onError($){var E;(E=p.onError)==null||E.call(p,$)}});h=w,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function q6(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:B})=>~~(1<<B)*200,timeout:a=18e4}=t,u=Te(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var B;return t.pollingInterval?t.pollingInterval:(B=e.chain)!=null&&B.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,w;const{promise:$,resolve:E,reject:P}=Xf(),N=a?setTimeout(()=>{w==null||w(),m==null||m(),P(new mg({hash:o}))},a):void 0;return m=vn(u,{onReplaced:s,resolve:E,reject:P},async B=>{if(d=await X(e,$s,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(N),B.resolve(d),m==null||m();return}w=X(e,i0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(F){const D=g=>{clearTimeout(N),w==null||w(),g(),m==null||m()};let b=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;D(()=>B.resolve(d));return}if(n&&!f&&(h=!0,await Ea(async()=>{f=await X(e,tc,"getTransaction")({hash:o}),f.blockNumber&&(b=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await X(e,$s,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;D(()=>B.resolve(d))}catch(g){if(g instanceof Hl||g instanceof Wl){if(!f){h=!1;return}try{p=f,h=!0;const v=await Ea(()=>X(e,At,"getBlock")({blockNumber:b,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:I})=>I instanceof nf});h=!1;const C=v.transactions.find(({from:I,nonce:M})=>I===p.from&&M===p.nonce);if(!C||(d=await X(e,$s,"getTransactionReceipt")({hash:C.hash}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r)))return;let O="replaced";C.to===p.to&&C.value===p.value&&C.input===p.input?O="repriced":C.from===C.to&&C.value===0n&&(O="cancelled"),D(()=>{var I;(I=B.onReplaced)==null||I.call(B,{reason:O,replacedTransaction:p,transaction:C,transactionReceipt:d}),B.resolve(d)})}catch(v){D(()=>B.reject(v))}}else D(()=>B.reject(g))}}})}),$}function Z6(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),l=i??!1;let f;return u?(()=>{const h=Te(["watchBlocks",e.uid,t,n,r,l,a]);return vn(h,{onBlock:o,onError:s},m=>So(async()=>{var w;try{const $=await X(e,At,"getBlock")({blockTag:t,includeTransactions:l});if($.number!==null&&(f==null?void 0:f.number)!=null){if($.number===f.number)return;if($.number-f.number>1&&n)for(let E=(f==null?void 0:f.number)+1n;E<$.number;E++){const P=await X(e,At,"getBlock")({blockNumber:E,includeTransactions:l});m.onBlock(P,f),f=P}}((f==null?void 0:f.number)==null||t==="pending"&&($==null?void 0:$.number)==null||$.number!==null&&$.number>f.number)&&(m.onBlock($,f),f=$)}catch($){(w=m.onError)==null||w.call(m,$)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,w=()=>h=!1;return(async()=>{try{r&&X(e,At,"getBlock")({blockTag:t,includeTransactions:l}).then(P=>{h&&m&&(o(P,void 0),m=!1)}).catch(s);const $=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(N=>N.config.type==="webSocket"||N.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:E}=await $.subscribe({params:["newHeads"],async onData(P){var B;if(!h)return;const N=await X(e,At,"getBlock")({blockNumber:(B=P.result)==null?void 0:B.number,includeTransactions:l}).catch(()=>{});h&&(o(N,f),m=!1,f=N)},onError(P){s==null||s(P)}});w=E,h||w()}catch($){s==null||s($)}})(),()=>w()})()}function Y6(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:u,pollingInterval:l=e.pollingInterval,strict:f}){const p=typeof u<"u"?u:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const w=Te(["watchEvent",t,n,r,e.uid,o,l,i]);return vn(w,{onLogs:a,onError:c},$=>{let E;i!==void 0&&(E=i-1n);let P,N=!1;const B=So(async()=>{var F;if(!N){try{P=await X(e,fd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}N=!0;return}try{let D;if(P)D=await X(e,ws,"getFilterChanges")({filter:P});else{const b=await X(e,$o,"getBlockNumber")({});E&&E!==b?D=await X(e,sa,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:E+1n,toBlock:b}):D=[],E=b}if(D.length===0)return;if(r)$.onLogs(D);else for(const b of D)$.onLogs([b])}catch(D){P&&D instanceof gn&&(N=!1),(F=$.onError)==null||F.call($,D)}},{emitOnBegin:!0,interval:l});return async()=>{P&&await X(e,vs,"uninstallFilter")({filter:P}),B()}})})():(()=>{let w=!0,$=()=>w=!1;return(async()=>{try{const E=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(D=>D.config.type==="webSocket"||D.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),P=s??(o?[o]:void 0);let N=[];P&&(N=[P.flatMap(D=>Hr({abi:[D],eventName:D.name,args:n}))],o&&(N=N[0]));const{unsubscribe:B}=await E.subscribe({params:["logs",{address:t,topics:N}],onData(F){var b;if(!w)return;const D=F.result;try{const{eventName:g,args:v}=fs({abi:P??[],data:D.data,topics:D.topics,strict:d}),C=Xt(D,{args:v,eventName:g});a([C])}catch(g){let v,C;if(g instanceof Jo||g instanceof $i){if(f)return;v=g.abiItem.name,C=(b=g.abiItem.inputs)==null?void 0:b.some(I=>!("name"in I&&I.name))}const O=Xt(D,{args:C?[]:{},eventName:v});a([O])}},onError(F){c==null||c(F)}});$=B,w||$()}catch(E){c==null||c(E)}})(),()=>$()})()}function K6(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Te(["watchPendingTransactions",e.uid,t,s]);return vn(u,{onTransactions:r,onError:n},l=>{let f;const p=So(async()=>{var d;try{if(!f)try{f=await X(e,dd,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await X(e,ws,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(d=l.onError)==null||d.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await X(e,vs,"uninstallFilter")({filter:f}),p()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!u)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function X6(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(Q6))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(J6))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
81
|
-
- `).slice(1);return{...r,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const
|
|
77
|
+
`),{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 mo extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function us(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===hr.code):e;return r instanceof V?new hr({cause:e,message:r.details}):hr.nodeMessage.test(n)?new hr({cause:e,message:e.details}):as.nodeMessage.test(n)?new as({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ui.nodeMessage.test(n)?new Ui({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):zi.nodeMessage.test(n)?new zi({cause:e,nonce:t==null?void 0:t.nonce}):Hi.nodeMessage.test(n)?new Hi({cause:e,nonce:t==null?void 0:t.nonce}):Wi.nodeMessage.test(n)?new Wi({cause:e,nonce:t==null?void 0:t.nonce}):Vi.nodeMessage.test(n)?new Vi({cause:e}):Gi.nodeMessage.test(n)?new Gi({cause:e,gas:t==null?void 0:t.gas}):qi.nodeMessage.test(n)?new qi({cause:e,gas:t==null?void 0:t.gas}):Zi.nodeMessage.test(n)?new Zi({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 mo({cause:e})}function Cg(e,{docsPath:t,...n}){const r=(()=>{const o=us(e,n);return o instanceof mo?e:o})();return new Ng(r,{docsPath:t,...n})}function ls(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const Ig={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function bo(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Mg(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=>Ae(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=Q(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=Q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=Q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=Q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=Q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=Q(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Ig[e.type]),typeof e.value<"u"&&(n.value=Q(e.value)),n}function Mg(e){return e.map(t=>({address:t.address,r:t.r?Q(BigInt(t.r)):t.r,s:t.s?Q(BigInt(t.s)):t.s,chainId:Q(t.chainId),nonce:Q(t.nonce),...typeof t.yParity<"u"?{yParity:Q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Q(t.v)}:{}}))}function Jl(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new fl({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new fl({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function kg(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=Q(t)),n!==void 0&&(i.nonce=Q(n)),r!==void 0&&(i.state=Jl(r)),o!==void 0){if(i.state)throw new fg;i.stateDiff=Jl(o)}return i}function Yi(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!at(n,{strict:!1}))throw new hn({address:n});if(t[n])throw new lg({address:n});t[n]=kg(r)}return t}const ef=2n**256n-1n;function mr(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?Je(t):void 0;if(s&&!at(s.address))throw new hn({address:s.address});if(o&&!at(o))throw new hn({address:o});if(n&&n>ef)throw new as({maxFeePerGas:n});if(r&&n&&r>n)throw new cs({maxFeePerGas:n,maxPriorityFeePerGas:r})}class tf extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ki extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Bg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ze(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class nf 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 rf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Xi(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Zt(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Zt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?rf[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=Lg(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 Lg(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 of(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Xi(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 At(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,f;const s=o??!1,i=n!==void 0?Q(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new nf({blockHash:t,blockNumber:n});return(((f=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:f.format)||of)(c,"getBlock")}async function Qi(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Fg(e,t){return sf(e,t)}async function sf(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const u=n||await X(e,At,"getBlock")({}),l=await c({block:u,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return kt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):X(e,At,"getBlock")({}),X(e,Qi,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Ki;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function Dg(e,t){return Ji(e,t)}async function Ji(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new tf;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await X(e,At,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new Ki;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await sf(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await X(e,Qi,"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"?Q(r):n]},{dedupe:!!r});return Zt(o)}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(s=>Bt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>Ae(s))}function uf(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=>Bt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>Bt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>Ae(i))}function Rg(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,u=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+u,c,r)}function jg(e,t,n){return e&t^~e&n}function _g(e,t,n){return e&t^e&n^t&n}class Ug extends Ti{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=Ai(this.buffer)}update(t){ir(this),t=ts(t),Mn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=Ai(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ir(this),bl(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ar(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Rg(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Ai(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)c.setUint32(4*f,l[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const yn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),zg=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wn=new Uint32Array(64);class Hg extends Ug{constructor(t=32){super(64,t,8,!1),this.A=yn[0]|0,this.B=yn[1]|0,this.C=yn[2]|0,this.D=yn[3]|0,this.E=yn[4]|0,this.F=yn[5]|0,this.G=yn[6]|0,this.H=yn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)wn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=wn[f-15],d=wn[f-2],h=Lt(p,7)^Lt(p,18)^p>>>3,m=Lt(d,17)^Lt(d,19)^d>>>10;wn[f]=m+wn[f-7]+h+wn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let f=0;f<64;f++){const p=Lt(c,6)^Lt(c,11)^Lt(c,25),d=l+p+jg(c,a,u)+zg[f]+wn[f]|0,m=(Lt(r,2)^Lt(r,13)^Lt(r,22))+_g(r,o,s)|0;l=u,u=a,a=c,c=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,a,u,l)}roundClean(){ar(wn)}destroy(){this.set(0,0,0,0,0,0,0,0),ar(this.buffer)}}const lf=yl(()=>new Hg),Wg=lf;function Vg(e,t){return Wg(Et(e,{strict:!1})?or(e):e)}function Gg(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=Vg(t);return o.set([n],0),r==="bytes"?o:Ae(o)}function qg(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(Gg({commitment:s,to:r,version:n}));return o}const ff=6,df=32,ea=4096,pf=df*ea,hf=pf*ff-1-1*ea*ff;class Zg extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Yg extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function Kg(e){const t=typeof e.data=="string"?Bt(e.data):e.data,n=we(t);if(!n)throw new Yg;if(n>hf)throw new Zg({maxSize:hf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Li(new Uint8Array(pf));let c=0;for(;c<ea;){const a=t.slice(s,s+(df-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>Ae(i.bytes))}function Xg(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??Kg({data:t}),s=e.commitments??cf({blobs:o,kzg:n,to:r}),i=e.proofs??uf({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function Qg(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 pg({transaction:e})}function Jg(e,{docsPath:t,...n}){const r=(()=>{const o=us(e,n);return o instanceof mo?e:o})();return new hg(r,{docsPath:t,...n})}async function ta(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Zt(t)}async function mf(e,t){var b,g,v,C,O;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:c,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:m,to:w,type:$,value:E,...P}=t,N=await(async()=>{if(!n||!m||typeof h<"u")return h;const I=Je(n),M=s?s.id:await X(e,ta,"getChainId")({});return await m.consume({address:I.address,chainId:M,client:e})})();mr(t);const B=(g=(b=s==null?void 0:s.formatters)==null?void 0:b.transactionRequest)==null?void 0:g.format,D=(B||bo)({...ls(P,{format:B}),account:n?Je(n):void 0,accessList:r,authorizationList:o,blobs:c,blobVersionedHashes:i,data:a,gas:u,gasPrice:l,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:N,to:w,type:$,value:E},"fillTransaction");try{const I=await e.request({method:"eth_fillTransaction",params:[D]}),y=(((C=(v=s==null?void 0:s.formatters)==null?void 0:v.transaction)==null?void 0:C.format)||Xi)(I.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const T=await(async()=>{var j,z;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const _=await X(e,At,"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(T<1)throw new tf;const S=10**(((O=T.toString().split(".")[1])==null?void 0:O.length)??0),L=j=>j*BigInt(Math.ceil(T*S))/BigInt(S);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=L(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=L(y.gasPrice)),{raw:I.raw,transaction:{from:D.from,...y}}}catch(I){throw Jg(I,{...t,chain:e.chain})}}const ey=["blobVersionedHashes","chainId","fees","gas","nonce","type"],bf=new Map,na=new rs(128);async function gf(e,t){var N,B,F;let n=t;const{account:r=e.account,chain:o=e.chain,nonceManager:s,parameters:i=ey}=n,c=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function u(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await X(e,ta,"getChainId")({}),a))}const l=r&&Je(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&l&&s){const D=await u();f=await s.consume({address:l.address,chainId:D,client:e})}c!=null&&c.fn&&((N=c.runAt)!=null&&N.includes("beforeFillTransaction"))&&(n=await c.fn(n,{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||na.get(e.uid)===!1||!["fees","gas"].some(b=>i.includes(b))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await X(e,mf,"fillTransaction")({...n,nonce:f}).then(D=>{const{chainId:b,from:g,gas:v,gasPrice:C,nonce:O,maxFeePerBlobGas:I,maxFeePerGas:M,maxPriorityFeePerGas:y,type:T,...A}=D.transaction;return na.set(e.uid,!0),{...n,...g?{from:g}:{},...T?{type:T}:{},...typeof b<"u"?{chainId:b}:{},...typeof v<"u"?{gas:v}:{},...typeof C<"u"?{gasPrice:C}:{},...typeof O<"u"?{nonce:O}:{},...typeof I<"u"?{maxFeePerBlobGas:I}:{},...typeof M<"u"?{maxFeePerGas:M}:{},...typeof y<"u"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in A&&typeof A.nonceKey<"u"?{nonceKey:A.nonceKey}:{}}}).catch(D=>{var v;const b=D;return((v=b.walk)==null?void 0:v.call(b,C=>{const O=C;return O.name==="MethodNotFoundRpcError"||O.name==="MethodNotSupportedRpcError"}))&&na.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...l?{from:l==null?void 0:l.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:m,kzg:w,type:$}=n;c!=null&&c.fn&&((B=c.runAt)!=null&&B.includes("beforeFillParameters"))&&(n=await c.fn(n,{phase:"beforeFillParameters"}));let E;async function P(){return E||(E=await X(e,At,"getBlock")({blockTag:"latest"}),E)}if(i.includes("nonce")&&typeof f>"u"&&l&&!s&&(n.nonce=await X(e,af,"getTransactionCount")({address:l.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&w){const D=cf({blobs:h,kzg:w});if(i.includes("blobVersionedHashes")){const b=qg({commitments:D,to:"hex"});n.blobVersionedHashes=b}if(i.includes("sidecars")){const b=uf({blobs:h,commitments:D,kzg:w}),g=Xg({blobs:h,commitments:D,proofs:b,to:"hex"});n.sidecars=g}}if(i.includes("chainId")&&(n.chainId=await u()),(i.includes("fees")||i.includes("type"))&&typeof $>"u")try{n.type=Qg(n)}catch{let D=bf.get(e.uid);if(typeof D>"u"){const b=await P();D=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",bf.set(e.uid,D)}n.type=D?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const D=await P(),{maxFeePerGas:b,maxPriorityFeePerGas:g}=await Ji(e,{block:D,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<g)throw new Bg({maxPriorityFeePerGas:g});n.maxPriorityFeePerGas=g,n.maxFeePerGas=b}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new Ki;if(typeof n.gasPrice>"u"){const D=await P(),{gasPrice:b}=await Ji(e,{block:D,chain:o,request:n,type:"legacy"});n.gasPrice=b}}return i.includes("gas")&&typeof m>"u"&&(n.gas=await X(e,ra,"estimateGas")({...n,account:l,prepare:(l==null?void 0:l.type)==="local"?[]:["blobVersionedHashes"]})),c!=null&&c.fn&&((F=c.runAt)!=null&&F.includes("afterFillParameters"))&&(n=await c.fn(n,{phase:"afterFillParameters"})),mr(n),delete n.parameters,n}async function ra(e,t){var i,c,a;const{account:n=e.account,prepare:r=!0}=t,o=n?Je(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const u=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Ql({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:l,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:m,data:w,gas:$,gasPrice:E,maxFeePerBlobGas:P,maxFeePerGas:N,maxPriorityFeePerGas:B,nonce:F,value:D,stateOverride:b,...g}=r?await gf(e,{...t,parameters:s,to:u}):t;if($&&t.gas!==$)return $;const C=(typeof h=="bigint"?Q(h):void 0)||m,O=Yi(b);mr(t);const I=(a=(c=(i=e.chain)==null?void 0:i.formatters)==null?void 0:c.transactionRequest)==null?void 0:a.format,y=(I||bo)({...ls(g,{format:I}),account:o,accessList:l,authorizationList:f,blobs:p,blobVersionedHashes:d,data:w,gasPrice:E,maxFeePerBlobGas:P,maxFeePerGas:N,maxPriorityFeePerGas:B,nonce:F,to:u,value:D},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:O?[y,C??e.experimental_blockTag??"latest",O]:C?[y,C]:[y]}))}catch(u){throw Cg(u,{...t,account:o,chain:e.chain})}}async function ty(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=$t({abi:n,args:o,functionName:s});try{return await X(e,ra,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?Je(c.account):void 0;throw pr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function go(e,t){if(!at(e,{strict:!1}))throw new hn({address:e});if(!at(t,{strict:!1}))throw new hn({address:t});return e.toLowerCase()===t.toLowerCase()}const yf="/docs/contract/decodeEventLog";function fs(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new zb({docsPath:yf});const a=t.find(m=>m.type==="event"&&i===ns(xt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Hb(i,{docsPath:yf});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=l.map((m,w)=>[m,w]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[w,$]=d[m],E=c[m];if(!E)throw new $i({abiItem:a,param:w});p[f?$:w.name||$]=ny({param:w,value:E})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Wr(h,n);if(m)if(f)for(let w=0;w<l.length;w++)p[w]=p[w]??m.shift();else for(let w=0;w<h.length;w++)p[h[w].name]=m[w]}catch(m){if(s)throw m instanceof rl||m instanceof Rl?new Jo({abiItem:a,data:n,params:h,size:we(n)}):m}else if(s)throw new Jo({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function ny({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Wr([e],t)||[])[0]}function oa(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var l;const c=t.filter(f=>f.type==="event"&&i.topics[0]===ns(f));if(c.length===0)return null;let a,u;for(const f of c)try{a=fs({...i,abi:[f],strict:!0}),u=f;break}catch{}if(!a&&!o){u=c[0];try{a=fs({...i,abi:[u],strict:!1})}catch{const f=(l=u.inputs)==null?void 0:l.some(p=>!("name"in p&&p.name));return{...i,args:f?[]:{},eventName:u.name}}}return!a||!u||s&&!s.includes(a.eventName)||!ry({args:a.args,inputs:u.inputs,matchArgs:n})?null:{...a,...i}}).filter(Boolean)}function ry(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?go(i,c):s.type==="string"||s.type==="bytes"?Me(or(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function Xt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function sa(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>Hr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?Q(r):r,toBlock:typeof o=="bigint"?Q(o):o}]});const d=p.map(h=>Xt(h));return l?oa({abi:l,args:c,logs:d,strict:u}):d}async function wf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?kn({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return X(e,sa,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const ia="/docs/contract/decodeFunctionResult";function Dn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=kn({abi:t,args:n,name:r});if(!c)throw new nr(r,{docsPath:ia});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:ia});if(!s.outputs)throw new al(s.name,{docsPath:ia});const i=Wr(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 aa=BigInt(0),ca=BigInt(1);function yo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ua(e){if(!yo(e))throw new Error("Uint8Array expected")}function wo(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function ds(e){const t=e.toString(16);return t.length&1?"0"+t:t}function vf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?aa:BigInt("0x"+e)}const xf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",oy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function vo(e){if(ua(e),xf)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=oy[e[n]];return t}const Qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ef(e){if(e>=Qt._0&&e<=Qt._9)return e-Qt._0;if(e>=Qt.A&&e<=Qt.F)return e-(Qt.A-10);if(e>=Qt.a&&e<=Qt.f)return e-(Qt.a-10)}function ps(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(xf)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=Ef(e.charCodeAt(s)),c=Ef(e.charCodeAt(s+1));if(i===void 0||c===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+c}return r}function Rn(e){return vf(vo(e))}function Pf(e){return ua(e),vf(vo(Uint8Array.from(e).reverse()))}function xo(e,t){return ps(e.toString(16).padStart(t*2,"0"))}function Sf(e,t){return xo(e,t).reverse()}function ct(e,t,n){let r;if(typeof t=="string")try{r=ps(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(yo(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 hs(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];ua(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 la=e=>typeof e=="bigint"&&aa<=e;function fa(e,t,n){return la(e)&&la(t)&&la(n)&&t<=e&&e<n}function br(e,t,n,r){if(!fa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function sy(e){let t;for(t=0;e>aa;e>>=ca,t+=1);return t}const ms=e=>(ca<<BigInt(e))-ca,da=e=>new Uint8Array(e),$f=e=>Uint8Array.from(e);function iy(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=da(e),o=da(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},c=(...f)=>n(o,r,...f),a=(f=da(0))=>{o=c($f([0]),f),r=c(),f.length!==0&&(o=c($f([1]),f),r=c())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=c();const d=r.slice();p.push(d),f+=r.length}return hs(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(u()));)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"||yo(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 bs(e,t,n={}){const r=(o,s,i)=>{const c=ay[s];if(typeof c!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!c(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function Af(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const cy="0.1.1";function uy(){return cy}class ie extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof ie){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ie&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
|
|
78
|
+
`);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${uy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Tf(this,t)}}function Tf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Tf(e.cause,t):t?null:e}function Eo(e,t){if(gr(e)>t)throw new Ay({givenSize:gr(e),maxSize:t})}const Jt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Of(e){if(e>=Jt.zero&&e<=Jt.nine)return e-Jt.zero;if(e>=Jt.A&&e<=Jt.F)return e-(Jt.A-10);if(e>=Jt.a&&e<=Jt.f)return e-(Jt.a-10)}function ly(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Ty({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 Nf(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 gs(e,t){if(tt(e)>t)throw new ky({givenSize:tt(e),maxSize:t})}function fy(e,t){if(typeof t=="number"&&t>0&&t>tt(e)-1)throw new _f({offset:t,position:"start",size:tt(e)})}function dy(e,t,n){if(typeof t=="number"&&typeof n=="number"&&tt(e)!==n-t)throw new _f({offset:n,position:"end",size:tt(e)})}function Cf(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 By({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const py="#__bigint";function If(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+py:o,n)}const hy=new TextDecoder,my=new TextEncoder;function by(e){return e instanceof Uint8Array?e:typeof e=="string"?Mf(e):gy(e)}function gy(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Mf(e,t={}){const{size:n}=t;let r=e;n&&(gs(e,n),r=_n(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=Of(o.charCodeAt(a++)),l=Of(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new ie(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function yy(e,t={}){const{size:n}=t,r=my.encode(e);return typeof n=="number"?(Eo(r,n),wy(r,n)):r}function wy(e,t){return ly(e,{dir:"right",size:t})}function gr(e){return e.length}function vy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function xy(e,t={}){const{size:n}=t;typeof n<"u"&&Eo(e,n);const r=Ot(e,t);return Lf(r,t)}function Ey(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Eo(r,n),r=kf(r)),r.length>1||r[0]>1)throw new $y(r);return!!r[0]}function en(e,t={}){const{size:n}=t;typeof n<"u"&&Eo(e,n);const r=Ot(e,t);return Ff(r,t)}function Py(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Eo(r,n),r=Sy(r)),hy.decode(r)}function kf(e){return Nf(e,{dir:"left"})}function Sy(e){return Nf(e,{dir:"right"})}class $y extends ie{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 Ay=class extends ie{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"})}},Ty=class extends ie{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 Oy=new TextEncoder,Ny=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Cy(e,t={}){const{strict:n=!1}=t;if(!e)throw new Rf(e);if(typeof e!="string")throw new Rf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new jf(e);if(!e.startsWith("0x"))throw new jf(e)}function Tt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Iy(e){return e instanceof Uint8Array?Ot(e):Array.isArray(e)?Ot(new Uint8Array(e)):e}function Bf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(gs(n,t.size),jn(n,t.size)):n}function Ot(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ny[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(gs(r,t.size),_n(r,t.size)):r}function Le(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const u=typeof e=="bigint"?"n":"";throw new Df({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?jn(a,r):a}function pa(e,t={}){return Ot(Oy.encode(e),t)}function jn(e,t){return Cf(e,{dir:"left",size:t})}function _n(e,t){return Cf(e,{dir:"right",size:t})}function Ft(e,t,n,r={}){const{strict:o}=r;fy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&dy(s,t,n),s}function tt(e){return Math.ceil((e.length-2)/2)}function Lf(e,t={}){const{signed:n}=t;t.size&&gs(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 Ff(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:Lf(e,t))}function My(e,t={}){const{strict:n=!1}=t;try{return Cy(e,{strict:n}),!0}catch{return!1}}class Df extends ie{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 Rf extends ie{constructor(t){super(`Value \`${typeof t=="object"?If(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 jf extends ie{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 ky extends ie{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 _f extends ie{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 By extends ie{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 Ly(e){return{address:e.address,amount:Le(e.amount),index:Le(e.index),validatorIndex:Le(e.validatorIndex)}}function Uf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Le(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Le(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Le(e.gasLimit)},...typeof e.number=="bigint"&&{number:Le(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Le(e.prevRandao)},...typeof e.time=="bigint"&&{time:Le(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Ly)}}}const ys=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],ha=[{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"}]}],zf=[{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"}],Hf=[...zf,{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"}]}],Fy=[...zf,{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"}]}],Wf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Vf=[{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"}]}],Gf=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],qf=[{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"}],yr=[{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"}]}],Dy="0x82ad56cb",Zf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Ry="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",jy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",ma="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class ba 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 Yf extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const ga="/docs/contract/encodeDeployData";function ya(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 Db({docsPath:ga});if(!("inputs"in o))throw new nl({docsPath:ga});if(!o.inputs||o.inputs.length===0)throw new nl({docsPath:ga});const s=bn(o.inputs,n);return cr([r,s])}function wr({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 ba({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ba({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Kf(e,{docsPath:t,...n}){const r=(()=>{const o=us(e,n);return o instanceof mo?e:o})();return new Vl(r,{docsPath:t,...n})}function Xf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const wa=new Map;function Qf({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<l.length;d++){const{resolve:h}=l[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<l.length;d++){const{reject:h}=l[d];h==null||h(p)}})},i=()=>wa.delete(t),c=()=>a().map(({args:l})=>l),a=()=>wa.get(t)||[],u=l=>wa.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=Xf();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:p,reject:d}),f):(u({args:l,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Po(e,t){var I,M,y,T;const{account:n=e.account,authorizationList:r,batch:o=!!((I=e.batch)!=null&&I.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:$,maxPriorityFeePerGas:E,nonce:P,to:N,value:B,stateOverride:F,...D}=t,b=n?Je(n):void 0;if(l&&(p||d))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&N)throw new V("Cannot provide both `code` & `to` as parameters.");const g=l&&f,v=p&&d&&N&&f,C=g||v,O=g?Jf({code:l,data:f}):v?zy({data:f,factory:p,factoryData:d,to:N}):f;try{mr(t);const S=(typeof s=="bigint"?Q(s):void 0)||i,L=u?Uf(u):void 0,j=Yi(F),z=(T=(y=(M=e.chain)==null?void 0:M.formatters)==null?void 0:y.transactionRequest)==null?void 0:T.format,W=(z||bo)({...ls(D,{format:z}),accessList:c,account:b,authorizationList:r,blobs:a,data:O,gas:h,gasPrice:m,maxFeePerBlobGas:w,maxFeePerGas:$,maxPriorityFeePerGas:E,nonce:P,to:C?void 0:N,value:B},"call");if(o&&_y({request:W})&&!j&&!L)try{return await Uy(e,{...W,blockNumber:s,blockTag:i})}catch(H){if(!(H instanceof Yf)&&!(H instanceof ba))throw H}const K=(()=>{const H=[W,S];return j&&L?[...H,j,L]:j?[...H,j]:L?[...H,{},L]:H})(),G=await e.request({method:"eth_call",params:K});return G==="0x"?{data:void 0}:{data:G}}catch(A){const S=Hy(A),{offchainLookup:L,offchainLookupSignature:j}=await Promise.resolve().then(()=>Uw);if(e.ccipRead!==!1&&(S==null?void 0:S.slice(0,10))===j&&N)return{data:await L(e,{data:S,to:N})};throw C&&(S==null?void 0:S.slice(0,10))==="0x101bb98d"?new wg({factory:p}):Kf(A,{...t,account:b,chain:e.chain})}}function _y({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Dy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Uy(e,t){var m;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:c,to:a}=t,u=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return wr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Yf})(),f=(typeof s=="bigint"?Q(s):void 0)||i,{schedule:p}=Qf({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(w){return w.reduce((E,{data:P})=>E+(P.length-2),0)>n*2},fn:async w=>{const $=w.map(N=>({allowFailure:!0,callData:N.data,target:N.to})),E=$t({abi:ys,args:[$],functionName:"aggregate3"}),P=await e.request({method:"eth_call",params:[{...u===null?{data:Jf({code:ma,data:E})}:{to:u,data:E}},f]});return Dn({abi:ys,args:[$],functionName:"aggregate3",data:P||"0x"})}}),[{returnData:d,success:h}]=await p({data:c,to:a});if(!h)throw new is({data:d});return d==="0x"?{data:void 0}:{data:d}}function Jf(e){const{code:t,data:n}=e;return ya({abi:Xu(["constructor(bytes, bytes)"]),bytecode:Zf,args:[t,n]})}function zy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return ya({abi:Xu(["constructor(address, bytes, address, bytes)"]),bytecode:Ry,args:[o,t,n,r]})}function Hy(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 Nt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=$t({abi:n,args:o,functionName:s});try{const{data:a}=await X(e,Po,"call")({...i,data:c,to:r});return Dn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw pr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Wy(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?Je(c.account):e.account,u=$t({abi:n,args:o,functionName:i});try{const{data:l}=await X(e,Po,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Dn({abi:n,args:o,functionName:i,data:l||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw pr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const va=new Map,ed=new Map;let Vy=0;function vn(e,t,n){const r=++Vy,o=()=>va.get(e)||[],s=()=>{const l=o();va.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=ed.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(va.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[l])==null||h.call(d,...f)};const u=n(a);return typeof u=="function"&&ed.set(e,u),i}async function xa(e){return new Promise(t=>setTimeout(t,e))}function So(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await xa(a);const u=async()=>{o&&(await e({unpoll:s}),await xa(r),u())};u()})(),s}const Gy=new Map,qy=new Map;function Zy(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,Gy),r=t(e,qy);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function Yy(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=Zy(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 Ky=e=>`blockNumber.${e}`;async function $o(e,{cacheTime:t=e.cacheTime}={}){const n=await Yy(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Ky(e.uid),cacheTime:t});return BigInt(n)}async function ws(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Xt(s));return!("abi"in t)||!t.abi?o:oa({abi:t.abi,logs:o,strict:n})}async function vs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function Xy(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof l<"u"?l:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const w=p??!1,$=Te(["watchContractEvent",r,o,s,e.uid,i,f,w,c]);return vn($,{onLogs:u,onError:a},E=>{let P;c!==void 0&&(P=c-1n);let N,B=!1;const F=So(async()=>{var D;if(!B){try{N=await X(e,Bl,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:w,fromBlock:c})}catch{}B=!0;return}try{let b;if(N)b=await X(e,ws,"getFilterChanges")({filter:N});else{const g=await X(e,$o,"getBlockNumber")({});P&&P<g?b=await X(e,wf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:P+1n,toBlock:g,strict:w}):b=[],P=g}if(b.length===0)return;if(s)E.onLogs(b);else for(const g of b)E.onLogs([g])}catch(b){N&&b instanceof gn&&(B=!1),(D=E.onError)==null||D.call(E,b)}},{emitOnBegin:!0,interval:f});return async()=>{N&&await X(e,vs,"uninstallFilter")({filter:N}),F()}})})():(()=>{const w=p??!1,$=Te(["watchContractEvent",r,o,s,e.uid,i,f,w]);let E=!0,P=()=>E=!1;return vn($,{onLogs:u,onError:a},N=>((async()=>{try{const B=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(g=>g.config.type==="webSocket"||g.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),F=i?Hr({abi:n,eventName:i,args:o}):[],{unsubscribe:D}=await B.subscribe({params:["logs",{address:r,topics:F}],onData(b){var v;if(!E)return;const g=b.result;try{const{eventName:C,args:O}=fs({abi:n,data:g.data,topics:g.topics,strict:p}),I=Xt(g,{args:O,eventName:C});N.onLogs([I])}catch(C){let O,I;if(C instanceof Jo||C instanceof $i){if(p)return;O=C.abiItem.name,I=(v=C.abiItem.inputs)==null?void 0:v.some(y=>!("name"in y&&y.name))}const M=Xt(g,{args:I?[]:{},eventName:O});N.onLogs([M])}},onError(b){var g;(g=N.onError)==null||g.call(N,b)}});P=D,E||P()}catch(B){a==null||a(B)}})(),()=>P()))})()}async function Qy(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ea(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await xa(l),i({count:c+1})};try{const u=await e();o(u)}catch(u){if(c<n&&await r({count:c,error:u}))return a({error:u});s(u)}};i()})}const Jy={"0x0":"reverted","0x1":"success"};function td(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=>Xt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Zt(e.transactionIndex):null,status:e.status?Jy[e.status]:null,type:e.type?rf[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Pa=256;let xs=Pa,Es;function nd(e=11){if(!Es||xs+e>Pa*2){Es="",xs=0;for(let t=0;t<Pa;t++)Es+=(256+Math.random()*256|0).toString(16).substring(1)}return Es.substring(xs,xs+++e)}function ew(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,f=e.cacheTime??l,p=e.account?Je(e.account):void 0,{config:d,request:h,value:m}=e.transport({account:p,chain:n,pollingInterval:l}),w={...d,...m},$={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:w,type:i,uid:nd(),...c?{experimental_blockTag:c}:{}};function E(P){return N=>{const B=N(P);for(const D in $)delete B[D];const F={...P,...B};return Object.assign(F,{extend:E(F)})}}return Object.assign($,{extend:E($)})}function Sa(e){var n,r,o,s,i,c;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof ji);return t instanceof ji?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((c=t.data)==null?void 0:c.errorName)==="UnsupportedResolverProfile":!1}function tw(e){const{abi:t,data:n}=e,r=ur(n,0,4),o=t.find(s=>s.type==="function"&&r===zr(xt(s)));if(!o)throw new Wb(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Wr(o.inputs,ur(n,4)):void 0}}const $a="/docs/contract/encodeErrorResult";function rd(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=kn({abi:t,args:r,name:n});if(!a)throw new ol(n,{docsPath:$a});o=a}if(o.type!=="error")throw new ol(void 0,{docsPath:$a});const s=xt(o),i=zr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new Ub(o.name,{docsPath:$a});c=bn(o.inputs,r)}return cr([i,c])}const Aa="/docs/contract/encodeFunctionResult";function nw(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=kn({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Aa});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Aa});if(!o.outputs)throw new al(o.name,{docsPath:Aa});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new cl(r)})();return bn(o.outputs,s)}const Ao="x-batch-gateway:true";async function od(e){const{data:t,ccipRequest:n}=e,{args:[r]}=tw({abi:ha,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Ao)?await od({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=rw(a)}})),nw({abi:ha,functionName:"query",result:[o,s]})}function rw(e){return e.name==="HttpRequestError"&&e.status?rd({abi:ha,errorName:"HttpError",args:[e.status,e.shortMessage]}):rd({abi:[Fl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function sd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Et(t)?t:null}function Ta(e){let t=new Uint8Array(32).fill(0);if(!e)return Ae(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=sd(n[r]),s=o?or(o):Me(In(n[r]),"bytes");t=Me(St([t,s]),"bytes")}return Ae(t)}function ow(e){return`[${e.slice(2)}]`}function sw(e){const t=new Uint8Array(32).fill(0);return e?sd(e)||Me(In(e)):Ae(t)}function Oa(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(In(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=In(o[s]);i.byteLength>255&&(i=In(ow(sw(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 iw(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return wr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(p=>s.endsWith(p)))return null;const f=o!=null?[Ta(s),BigInt(o)]:[Ta(s)];try{const p=$t({abi:Vf,functionName:"addr",args:f}),d={address:u,abi:Hf,functionName:"resolveWithGateways",args:[pn(Oa(s)),p,i??[Ao]],blockNumber:n,blockTag:r},m=await X(e,Nt,"readContract")(d);if(m[0]==="0x")return null;const w=Dn({abi:Vf,args:f,functionName:"addr",data:m[0]});return w==="0x"||Cn(w)==="0x00"?null:w}catch(p){if(c)throw p;if(Sa(p))return null;throw p}}class aw 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 To extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Na 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 cw extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const uw=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,lw=/^(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>\/.*)?$/,fw=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dw=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function pw(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 id(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function ad({uri:e,gatewayUrls:t}){const n=fw.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=id(t==null?void 0:t.ipfs,"https://ipfs.io"),o=id(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(uw),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||lw.test(e);if(e.startsWith("http")&&!l&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((l||f)&&a)return{uri:`${r}/${l?"ipns":"ipfs"}/${a}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${u||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(dw,"");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 Na({uri:e})}function cd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new aw({data:e});return e.image||e.image_url||e.image_data}async function hw({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Ca({gatewayUrls:e,uri:cd(n)})}catch{throw new Na({uri:t})}}async function Ca({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=ad({uri:t,gatewayUrls:e});if(r||await pw(n))return n;throw new Na({uri:t})}function mw(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new To({reason:"Only EIP-155 supported"});if(!i)throw new To({reason:"Chain ID not found"});if(!a)throw new To({reason:"Contract address not found"});if(!o)throw new To({reason:"Token ID not found"});if(!c)throw new To({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function bw(e,{nft:t}){if(t.namespace==="erc721")return Nt(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 Nt(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 cw({namespace:t.namespace})}async function gw(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?yw(e,{gatewayUrls:t,record:n}):Ca({uri:n,gatewayUrls:t})}async function yw(e,{gatewayUrls:t,record:n}){const r=mw(n),o=await bw(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=ad({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return Ca({uri:cd(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),hw({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function ud(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return wr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f={address:u,abi:Hf,args:[pn(Oa(s)),$t({abi:Wf,functionName:"text",args:[Ta(s),o]}),i??[Ao]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await X(e,Nt,"readContract")(f);if(d[0]==="0x")return null;const h=Dn({abi:Wf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Sa(f))return null;throw f}}async function ww(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await X(e,ud,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await gw(e,{record:a,gatewayUrls:r})}catch{return null}}async function vw(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return wr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const l={address:u,abi:Fy,args:[n,s,i??[Ao]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=X(e,Nt,"readContract"),[p]=await f(l);return p||null}catch(l){if(c)throw l;if(Sa(l))return null;throw l}}async function xw(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 wr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await X(e,Nt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[pn(Oa(o))],blockNumber:n,blockTag:r});return a}async function ld(e,t){var w,$,E;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?Je(n):void 0;try{mr(t);const N=(typeof r=="bigint"?Q(r):void 0)||o,B=(E=($=(w=e.chain)==null?void 0:w.formatters)==null?void 0:$.transactionRequest)==null?void 0:E.format,D=(B||bo)({...ls(h,{format:B}),account:m,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),b=await e.request({method:"eth_createAccessList",params:[D,N]});return{accessList:b.accessList,gasUsed:BigInt(b.gasUsed)}}catch(P){throw Kf(P,{...t,account:m,chain:e.chain})}}async function Ew(e){const t=ss(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function fd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=ss(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>Hr({abi:[d],eventName:d.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?Q(s):s,toBlock:typeof c=="bigint"?Q(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:u(f),strict:!!i,toBlock:c,type:"event"}}async function dd(e){const t=ss(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Pw(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?Q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Sw(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function $w(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?Q(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),Zt(s)}async function Ia(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?Q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class Aw 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 Tw(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await X(e,Nt,"readContract")({abi:Ow,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Aw({address:n}):i}}const Ow=[{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 Nw(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 Cw(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?Q(n):void 0,i=await e.request({method:"eth_feeHistory",params:[Q(t),s||r,o]},{dedupe:!!s});return Nw(i)}async function Iw(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Xt(s));return t.abi?oa({abi:t.abi,logs:o,strict:n}):o}async function Mw({address:e,authorization:t,signature:n}){return go(mn(e),await Ql({authorization:t,signature:n}))}const Ps=new rs(8192);function kw(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Ps.get(n))return Ps.get(n);const r=e().finally(()=>Ps.delete(n));return Ps.set(n,r),r}function Bw(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(u))throw new Fn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Fn(new Error("method not supported"),{method:u});const l=o?jr(`${a}.${Te(n)}`):void 0;return kw(()=>Ea(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case Zr.code:throw new Zr(d);case Yr.code:throw new Yr(d);case Kr.code:throw new Kr(d,{method:n.method});case Xr.code:throw new Xr(d);case Ln.code:throw new Ln(d);case gn.code:throw new gn(d);case Qr.code:throw new Qr(d);case Jr.code:throw new Jr(d);case eo.code:throw new eo(d);case Fn.code:throw new Fn(d,{method:n.method});case fr.code:throw new fr(d);case to.code:throw new to(d);case dr.code:throw new dr(d);case no.code:throw new no(d);case ro.code:throw new ro(d);case oo.code:throw new oo(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case co.code:throw new co(d);case uo.code:throw new uo(d);case lo.code:throw new lo(d);case fo.code:throw new fo(d);case po.code:throw new po(d);case ho.code:throw new ho(d);case 5e3:throw new dr(d);default:throw p instanceof V?p:new xg(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Bn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m,10)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>Lw(p)}),{enabled:o,id:l})}}function Lw(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===fr.code||e.code===Ln.code:e instanceof Bn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class Fw extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${qr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class Dw extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${qr(n)}`,`Response: ${Te(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Rw 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 jw="0x556f1830",pd={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 _w(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=_l({data:r,abi:[pd]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:hd;try{if(!go(o,i))throw new Rw({sender:i,to:o});const d=c.includes(Ao)?await od({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Po(e,{blockNumber:t,blockTag:n,data:St([u,bn([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new Fw({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function hd({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let f;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await l.json()).data:f=await l.text(),!l.ok){r=new Bn({body:a,details:f!=null&&f.error?Te(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!Et(f)){r=new Dw({result:f,url:i});continue}return f}catch(l){r=new Bn({body:a,details:l.message,url:i})}}throw r}const Uw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:hd,offchainLookup:_w,offchainLookupAbiItem:pd,offchainLookupSignature:jw},Symbol.toStringTag,{value:"Module"}));function zw(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function Hw(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function Ww(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const md=Ww();function Vw(e,t={}){return{async request(n){var p;const{body:r,fetchFn:o=t.fetchFn??fetch,onRequest:s=t.onRequest,onResponse:i=t.onResponse,timeout:c=t.timeout??1e4}=n,a={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:l,signal:f}=a;try{const d=await Hw(async({signal:m})=>{const w={...a,body:Array.isArray(r)?Te(r.map(N=>({jsonrpc:"2.0",id:N.id??md.take(),...N}))):Te({jsonrpc:"2.0",id:r.id??md.take(),...r}),headers:{"Content-Type":"application/json",...u},method:l||"POST",signal:f||(c>0?m:null)},$=new Request(e,w),E=await(s==null?void 0:s($,w))??{...w,url:e};return await o(E.url??e,E)},{errorInstance:new ql({body:r,url:e}),timeout:c,signal:!0});i&&await i(d);let h;if((p=d.headers.get("Content-Type"))!=null&&p.startsWith("application/json"))h=await d.json();else{h=await d.text();try{h=JSON.parse(h||"{}")}catch(m){if(d.ok)throw m;h={error:h}}}if(!d.ok)throw new Bn({body:r,details:Te(h.error)||d.statusText,headers:d.headers,status:d.status,url:e});return h}catch(d){throw d instanceof Bn||d instanceof ql?d:new Bn({body:r,cause:d,url:e})}}}}const Gw=`Ethereum Signed Message:
|
|
79
|
+
`;function qw(e){const t=typeof e=="string"?jr(e):typeof e.raw=="string"?e.raw:Ae(e.raw),n=jr(`${Gw}${we(t)}`);return St([n,t])}function bd(e,t){return Me(qw(e),t)}class Zw extends V{constructor({domain:t}){super(`Invalid domain "${Te(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class Yw 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 Kw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function Xw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:u,type:l}=a,f=c[u],p=l.match(Cl);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,w,$]=p;Q(f,{signed:w==="int",size:Number.parseInt($,10)/8})}if(l==="address"&&typeof f=="string"&&!at(f))throw new hn({address:f});const d=l.match(R1);if(d){const[m,w]=d;if(w&&we(f)!==Number.parseInt(w,10))throw new Gb({expectedSize:Number.parseInt(w,10),givenSize:we(f)})}const h=o[l];h&&(Jw(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new Zw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new Yw({primaryType:r,types:o})}function Qw({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 Jw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new Kw({type:e})}function ev(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:Qw({domain:t}),...e.types};Xw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(tv({domain:t,types:o})),r!=="EIP712Domain"&&s.push(gd({data:n,primaryType:r,types:o})),Me(St(s))}function tv({domain:e,types:t}){return gd({data:e,primaryType:"EIP712Domain",types:t})}function gd({data:e,primaryType:t,types:n}){const r=yd({data:e,primaryType:t,types:n});return Me(r)}function yd({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[nv({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=vd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return bn(r,o)}function nv({primaryType:e,types:t}){const n=pn(rv({primaryType:e,types:t}));return Me(n)}function rv({primaryType:e,types:t}){let n="";const r=wd({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:c})=>`${c} ${i}`).join(",")})`;return n}function wd({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])wd({primaryType:s.type,types:t},n);return n}function vd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Me(yd({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Me(r)];if(n==="string")return[{type:"bytes32"},Me(pn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>vd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Me(bn(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class ov extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const Ma={checksum:new ov(8192)}.checksum;function xd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=$l(by(e));return n==="Bytes"?r:Ot(r)}const sv=/^0x[a-fA-F0-9]{40}$/;function Ss(e,t={}){const{strict:n=!0}=t;if(!sv.test(e))throw new Pd({address:e,cause:new iv});if(n){if(e.toLowerCase()===e)return;if(Ed(e)!==e)throw new Pd({address:e,cause:new av})}}function Ed(e){if(Ma.has(e))return Ma.get(e);Ss(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=xd(yy(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return Ma.set(e,o),o}function ka(e,t={}){const{strict:n=!0}=t??{};try{return Ss(e,{strict:n}),!0}catch{return!1}}class Pd extends ie{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 iv extends ie{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 av extends ie{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const cv=/^(.*)\[([0-9]*)\]$/,uv=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Sd=/^(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)?$/,$d=2n**256n-1n;function vr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=Da(t.type);if(s){const[i,c]=s;return fv(e,{...t,type:c},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return mv(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return lv(e,{checksum:r});if(t.type==="bool")return dv(e);if(t.type.startsWith("bytes"))return pv(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return hv(e,t);if(t.type==="string")return bv(e,{staticPosition:o});throw new _a(t.type)}const Ad=32,Ba=32;function lv(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Ed(s):s)(Ot(vy(r,-20))),32]}function fv(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=en(e.readBytes(Ba)),u=s+a,l=u+Ad;e.setPosition(u);const f=en(e.readBytes(Ad)),p=Oo(t);let d=0;const h=[];for(let m=0;m<f;++m){e.setPosition(l+(p?m*32:d));const[w,$]=vr(e,t,{checksumAddress:r,staticPosition:l});d+=$,h.push(w)}return e.setPosition(s+32),[h,32]}if(Oo(t)){const a=en(e.readBytes(Ba)),u=s+a,l=[];for(let f=0;f<o;++f){e.setPosition(u+f*32);const[p]=vr(e,t,{checksumAddress:r,staticPosition:u});l.push(p)}return e.setPosition(s+32),[l,32]}let i=0;const c=[];for(let a=0;a<o;++a){const[u,l]=vr(e,t,{checksumAddress:r,staticPosition:s+i});i+=l,c.push(u)}return[c,i]}function dv(e){return[Ey(e.readBytes(32),{size:32}),32]}function pv(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=en(e.readBytes(32));e.setPosition(n+i);const c=en(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ot(a),32]}return[Ot(e.readBytes(Number.parseInt(o,10),32)),32]}function hv(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?xy(o,{signed:n}):en(o,{signed:n}),32]}function mv(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let c=0;if(Oo(t)){const a=en(e.readBytes(Ba)),u=o+a;for(let l=0;l<t.components.length;++l){const f=t.components[l];e.setPosition(u+c);const[p,d]=vr(e,f,{checksumAddress:r,staticPosition:u});c+=d,i[s?l:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const u=t.components[a],[l,f]=vr(e,u,{checksumAddress:r,staticPosition:o});i[s?a:u==null?void 0:u.name]=l,c+=f}return[i,c]}function bv(e,{staticPosition:t}){const n=en(e.readBytes(32)),r=t+n;e.setPosition(r);const o=en(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=Py(kf(s));return e.setPosition(t+32),[i,32]}function gv({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(La({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function La({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Da(r.type);if(o){const[s,i]=o;return wv(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Sv(n,{checksumAddress:e,parameter:r});if(r.type==="address")return yv(n,{checksum:e});if(r.type==="bool")return xv(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Sd.exec(r.type)??[];return Ev(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return vv(n,{type:r.type});if(r.type==="string")return Pv(n);throw new _a(r.type)}function Fa(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=tt(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Le(t+o,{size:32})),r.push(c),o+=tt(c)):n.push(c)}return Tt(...n,...r)}function yv(e,t){const{checksum:n=!1}=t;return Ss(e,{strict:n}),{dynamic:!1,encoded:jn(e.toLowerCase())}}function wv(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new kv(e);if(!s&&e.length!==r)throw new Mv({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=La({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=Fa(c);if(s){const u=Le(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Tt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Tt(...c.map(({encoded:a})=>a))}}function vv(e,{type:t}){const[,n]=t.split("bytes"),r=tt(e);if(!n){let o=e;return r%32!==0&&(o=_n(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Tt(jn(Le(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new Nd({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:_n(e)}}function xv(e){if(typeof e!="boolean")throw new ie(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:jn(Bf(e))}}function Ev(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 Df({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Le(e,{size:32,signed:t})}}function Pv(e){const t=pa(e),n=Math.ceil(tt(t)/32),r=[];for(let o=0;o<n;o++)r.push(_n(Ft(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Tt(_n(Le(tt(t),{size:32})),...r)}}function Sv(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,u=La({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Fa(s):Tt(...s.map(({encoded:i})=>i))}}function Da(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Oo(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(Oo);const n=Da(e.type);return!!(n&&Oo({...e,type:n[1]}))}const $v={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 Ov({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Tv({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Td({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 Td({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 Av(e,{recursiveReadLimit:t=8192}={}){const n=Object.create($v);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Td extends ie{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Tv extends ie{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 Ov extends ie{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 Nv(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?Mf(t):t,i=Av(s);if(gr(s)===0&&e.length>0)throw new Iv;if(gr(s)&&gr(s)<32)throw new Cv({data:typeof t=="string"?t:Ot(t),parameters:e,size:gr(s)});let c=0;const a=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const l=e[u];i.setPosition(c);const[f,p]=vr(i,l,{checksumAddress:o,staticPosition:0});c+=p,r==="Array"?a.push(f):a[l.name??u]=f}return a}function Ra(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Cd({expectedLength:e.length,givenLength:t.length});const o=gv({checksumAddress:r,parameters:e,values:t}),s=Fa(o);return s.length===0?"0x":s}function ja(e,t){if(e.length!==t.length)throw new Cd({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(ja.encode(o,s))}return Tt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Ss(a),jn(a.toLowerCase(),o?32:0)}if(n==="string")return pa(r);if(n==="bytes")return r;if(n==="bool")return jn(Bf(r),o?32:1);const s=n.match(Sd);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l,10)/8;return Le(r,{size:o?32:f,signed:u==="int"})}const i=n.match(uv);if(i){const[a,u]=i;if(Number.parseInt(u,10)!==(r.length-2)/2)throw new Nd({expectedSize:Number.parseInt(u,10),value:r});return _n(r,o?32:0)}const c=n.match(cv);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let f=0;f<r.length;f++)l.push(t(u,r[f],!0));return l.length===0?"0x":Tt(...l)}throw new _a(n)}e.encode=t})(ja||(ja={}));function Od(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?Ju(e):e}class Cv extends ie{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${er(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Iv extends ie{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Mv extends ie{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 Nd extends ie{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${tt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Cd extends ie{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
80
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class kv extends ie{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class _a extends ie{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}class Id extends Ti{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,h1(t);const r=ts(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),ar(s)}update(t){return ir(this),this.iHash.update(t),this}digestInto(t){ir(this),Mn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Md=(e,t,n)=>new Id(e,t).update(n).digest();Md.create=(e,t)=>new Id(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const We=BigInt(0),Fe=BigInt(1),Un=BigInt(2),Bv=BigInt(3),kd=BigInt(4),Bd=BigInt(5),Ld=BigInt(8);function Ve(e,t){const n=e%t;return n>=We?n:t+n}function ut(e,t,n){let r=e;for(;t-- >We;)r*=r,r%=n;return r}function Ua(e,t){if(e===We)throw new Error("invert: expected non-zero number");if(t<=We)throw new Error("invert: expected positive modulus, got "+t);let n=Ve(e,t),r=t,o=We,s=Fe;for(;n!==We;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Fe)throw new Error("invert: does not exist");return Ve(o,t)}function Fd(e,t){const n=(e.ORDER+Fe)/kd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Lv(e,t){const n=(e.ORDER-Bd)/Ld,r=e.mul(t,Un),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Un),o),c=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(c),t))throw new Error("Cannot find square root");return c}function Fv(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Fe,n=0;for(;t%Un===We;)t/=Un,n++;let r=Un;const o=za(e);for(;Rd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Fd;let s=o.pow(r,t);const i=(t+Fe)/Un;return function(a,u){if(a.is0(u))return u;if(Rd(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),p=a.pow(u,t),d=a.pow(u,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const w=Fe<<BigInt(l-h-1),$=a.pow(f,w);l=h,f=a.sqr($),p=a.mul(p,f),d=a.mul(d,$)}return d}}function Dv(e){return e%kd===Bv?Fd:e%Ld===Bd?Lv:Fv(e)}const Rv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function jv(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Rv.reduce((r,o)=>(r[o]="function",r),t);return bs(e,n)}function _v(e,t,n){if(n<We)throw new Error("invalid exponent, negatives unsupported");if(n===We)return e.ONE;if(n===Fe)return t;let r=e.ONE,o=t;for(;n>We;)n&Fe&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Fe;return r}function Dd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function Rd(e,t){const n=(e.ORDER-Fe)/Un,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function jd(e,t){t!==void 0&&_r(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function za(e,t,n=!1,r={}){if(e<=We)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=jd(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const c=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:ms(o),ZERO:We,ONE:Fe,create:a=>Ve(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return We<=a&&a<e},is0:a=>a===We,isOdd:a=>(a&Fe)===Fe,neg:a=>Ve(-a,e),eql:(a,u)=>a===u,sqr:a=>Ve(a*a,e),add:(a,u)=>Ve(a+u,e),sub:(a,u)=>Ve(a-u,e),mul:(a,u)=>Ve(a*u,e),pow:(a,u)=>_v(c,a,u),div:(a,u)=>Ve(a*Ua(u,e),e),sqrN:a=>a*a,addN:(a,u)=>a+u,subN:(a,u)=>a-u,mulN:(a,u)=>a*u,inv:a=>Ua(a,e),sqrt:r.sqrt||(a=>(i||(i=Dv(e)),i(c,a))),toBytes:a=>n?Sf(a,s):xo(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Pf(a):Rn(a)},invertBatch:a=>Dd(c,a),cmov:(a,u,l)=>l?u:a});return Object.freeze(c)}function _d(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 Ud(e){const t=_d(e);return t+Math.ceil(t/2)}function Uv(e,t,n=!1){const r=e.length,o=_d(t),s=Ud(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Pf(e):Rn(e),c=Ve(i,t-Fe)+Fe;return n?Sf(c,o):xo(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zd=BigInt(0),Ha=BigInt(1);function Wa(e,t){const n=t.negate();return e?n:t}function Hd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Va(e,t){Hd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=ms(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Wd(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Ha);const u=t*r,l=u+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:l,isZero:f,isNeg:p,isNegF:d,offsetF:u}}function zv(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 Hv(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 Ga=new WeakMap,Vd=new WeakMap;function qa(e){return Vd.get(e)||1}function Wv(e,t){return{constTimeNegate:Wa,hasPrecomputes(n){return qa(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>zd;)r&Ha&&(o=o.add(s)),s=s.double(),r>>=Ha;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=Va(r,t),i=[];let c=n,a=c;for(let u=0;u<o;u++){a=c,i.push(a);for(let l=1;l<s;l++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const c=Va(n,t);for(let a=0;a<c.windows;a++){const{nextN:u,offset:l,isZero:f,isNeg:p,isNegF:d,offsetF:h}=Wd(o,a,c);o=u,f?i=i.add(Wa(d,r[h])):s=s.add(Wa(p,r[l]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=Va(n,t);for(let c=0;c<i.windows&&o!==zd;c++){const{nextN:a,offset:u,isZero:l,isNeg:f}=Wd(o,c,i);if(o=a,!l){const p=r[u];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=Ga.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&Ga.set(r,o(s))),s},wNAFCached(n,r,o){const s=qa(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=qa(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){Hd(r,t),Vd.set(n,r),Ga.delete(n)}}}function Vv(e,t,n,r){zv(n,e),Hv(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,c=sy(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=ms(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){l.fill(i);for(let m=0;m<s;m++){const w=r[m],$=Number(w>>BigInt(d)&u);l[$]=l[$].add(n[m])}let h=i;for(let m=l.length-1,w=i;m>0;m--)w=w.add(l[m]),h=h.add(w);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function Gd(e){return jv(e.Fp),bs(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...jd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qd(e){e.lowS!==void 0&&wo("lowS",e.lowS),e.prehash!==void 0&&wo("prehash",e.prehash)}function Gv(e){const t=Gd(e);bs(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 qv extends Error{constructor(t=""){super(t)}}const tn={Err:qv,_tlv:{encode:(e,t)=>{const{Err:n}=tn;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=ds(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ds(o.length/2|128):"";return ds(e)+s+o+t},decode(e,t){const{Err:n}=tn;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+a);if(u.length!==a)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=tn;if(e<nn)throw new t("integer: negative integers are not allowed");let n=ds(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}=tn;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 Rn(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=tn,o=ct("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=tn,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 Za(e,t){return vo(xo(e,t))}const nn=BigInt(0),Ne=BigInt(1);BigInt(2);const Ya=BigInt(3),Zv=BigInt(4);function Yv(e){const t=Gv(e),{Fp:n}=t,r=za(t.n,t.nBitLength),o=t.toBytes||((P,N,B)=>{const F=N.toAffine();return hs(Uint8Array.from([4]),n.toBytes(F.x),n.toBytes(F.y))}),s=t.fromBytes||(P=>{const N=P.subarray(1),B=n.fromBytes(N.subarray(0,n.BYTES)),F=n.fromBytes(N.subarray(n.BYTES,2*n.BYTES));return{x:B,y:F}});function i(P){const{a:N,b:B}=t,F=n.sqr(P),D=n.mul(F,P);return n.add(n.add(D,n.mul(P,N)),B)}function c(P,N){const B=n.sqr(N),F=i(P);return n.eql(B,F)}if(!c(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,Ya),Zv),u=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,u)))throw new Error("bad curve params: a or b");function l(P){return fa(P,Ne,t.n)}function f(P){const{allowedPrivateKeyLengths:N,nByteLength:B,wrapPrivateKey:F,n:D}=t;if(N&&typeof P!="bigint"){if(yo(P)&&(P=vo(P)),typeof P!="string"||!N.includes(P.length))throw new Error("invalid private key");P=P.padStart(B*2,"0")}let b;try{b=typeof P=="bigint"?P:Rn(ct("private key",P,B))}catch{throw new Error("invalid private key, expected hex or "+B+" bytes, got "+typeof P)}return F&&(b=Ve(b,D)),br("private key",b,Ne,D),b}function p(P){if(!(P instanceof m))throw new Error("ProjectivePoint expected")}const d=Af((P,N)=>{const{px:B,py:F,pz:D}=P;if(n.eql(D,n.ONE))return{x:B,y:F};const b=P.is0();N==null&&(N=b?n.ONE:n.inv(D));const g=n.mul(B,N),v=n.mul(F,N),C=n.mul(D,N);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(C,n.ONE))throw new Error("invZ was invalid");return{x:g,y:v}}),h=Af(P=>{if(P.is0()){if(t.allowInfinityPoint&&!n.is0(P.py))return;throw new Error("bad point: ZERO")}const{x:N,y:B}=P.toAffine();if(!n.isValid(N)||!n.isValid(B))throw new Error("bad point: x or y not FE");if(!c(N,B))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class m{constructor(N,B,F){if(N==null||!n.isValid(N))throw new Error("x required");if(B==null||!n.isValid(B)||n.is0(B))throw new Error("y required");if(F==null||!n.isValid(F))throw new Error("z required");this.px=N,this.py=B,this.pz=F,Object.freeze(this)}static fromAffine(N){const{x:B,y:F}=N||{};if(!N||!n.isValid(B)||!n.isValid(F))throw new Error("invalid affine point");if(N instanceof m)throw new Error("projective point not allowed");const D=b=>n.eql(b,n.ZERO);return D(B)&&D(F)?m.ZERO:new m(B,F,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(N){const B=Dd(n,N.map(F=>F.pz));return N.map((F,D)=>F.toAffine(B[D])).map(m.fromAffine)}static fromHex(N){const B=m.fromAffine(s(ct("pointHex",N)));return B.assertValidity(),B}static fromPrivateKey(N){return m.BASE.multiply(f(N))}static msm(N,B){return Vv(m,r,N,B)}_setWindowSize(N){E.setWindowSize(this,N)}assertValidity(){h(this)}hasEvenY(){const{y:N}=this.toAffine();if(n.isOdd)return!n.isOdd(N);throw new Error("Field doesn't support isOdd")}equals(N){p(N);const{px:B,py:F,pz:D}=this,{px:b,py:g,pz:v}=N,C=n.eql(n.mul(B,v),n.mul(b,D)),O=n.eql(n.mul(F,v),n.mul(g,D));return C&&O}negate(){return new m(this.px,n.neg(this.py),this.pz)}double(){const{a:N,b:B}=t,F=n.mul(B,Ya),{px:D,py:b,pz:g}=this;let v=n.ZERO,C=n.ZERO,O=n.ZERO,I=n.mul(D,D),M=n.mul(b,b),y=n.mul(g,g),T=n.mul(D,b);return T=n.add(T,T),O=n.mul(D,g),O=n.add(O,O),v=n.mul(N,O),C=n.mul(F,y),C=n.add(v,C),v=n.sub(M,C),C=n.add(M,C),C=n.mul(v,C),v=n.mul(T,v),O=n.mul(F,O),y=n.mul(N,y),T=n.sub(I,y),T=n.mul(N,T),T=n.add(T,O),O=n.add(I,I),I=n.add(O,I),I=n.add(I,y),I=n.mul(I,T),C=n.add(C,I),y=n.mul(b,g),y=n.add(y,y),I=n.mul(y,T),v=n.sub(v,I),O=n.mul(y,M),O=n.add(O,O),O=n.add(O,O),new m(v,C,O)}add(N){p(N);const{px:B,py:F,pz:D}=this,{px:b,py:g,pz:v}=N;let C=n.ZERO,O=n.ZERO,I=n.ZERO;const M=t.a,y=n.mul(t.b,Ya);let T=n.mul(B,b),A=n.mul(F,g),S=n.mul(D,v),L=n.add(B,F),j=n.add(b,g);L=n.mul(L,j),j=n.add(T,A),L=n.sub(L,j),j=n.add(B,D);let z=n.add(b,v);return j=n.mul(j,z),z=n.add(T,S),j=n.sub(j,z),z=n.add(F,D),C=n.add(g,v),z=n.mul(z,C),C=n.add(A,S),z=n.sub(z,C),I=n.mul(M,j),C=n.mul(y,S),I=n.add(C,I),C=n.sub(A,I),I=n.add(A,I),O=n.mul(C,I),A=n.add(T,T),A=n.add(A,T),S=n.mul(M,S),j=n.mul(y,j),A=n.add(A,S),S=n.sub(T,S),S=n.mul(M,S),j=n.add(j,S),T=n.mul(A,j),O=n.add(O,T),T=n.mul(z,j),C=n.mul(L,C),C=n.sub(C,T),T=n.mul(L,A),I=n.mul(z,I),I=n.add(I,T),new m(C,O,I)}subtract(N){return this.add(N.negate())}is0(){return this.equals(m.ZERO)}wNAF(N){return E.wNAFCached(this,N,m.normalizeZ)}multiplyUnsafe(N){const{endo:B,n:F}=t;br("scalar",N,nn,F);const D=m.ZERO;if(N===nn)return D;if(this.is0()||N===Ne)return this;if(!B||E.hasPrecomputes(this))return E.wNAFCachedUnsafe(this,N,m.normalizeZ);let{k1neg:b,k1:g,k2neg:v,k2:C}=B.splitScalar(N),O=D,I=D,M=this;for(;g>nn||C>nn;)g&Ne&&(O=O.add(M)),C&Ne&&(I=I.add(M)),M=M.double(),g>>=Ne,C>>=Ne;return b&&(O=O.negate()),v&&(I=I.negate()),I=new m(n.mul(I.px,B.beta),I.py,I.pz),O.add(I)}multiply(N){const{endo:B,n:F}=t;br("scalar",N,Ne,F);let D,b;if(B){const{k1neg:g,k1:v,k2neg:C,k2:O}=B.splitScalar(N);let{p:I,f:M}=this.wNAF(v),{p:y,f:T}=this.wNAF(O);I=E.constTimeNegate(g,I),y=E.constTimeNegate(C,y),y=new m(n.mul(y.px,B.beta),y.py,y.pz),D=I.add(y),b=M.add(T)}else{const{p:g,f:v}=this.wNAF(N);D=g,b=v}return m.normalizeZ([D,b])[0]}multiplyAndAddUnsafe(N,B,F){const D=m.BASE,b=(v,C)=>C===nn||C===Ne||!v.equals(D)?v.multiplyUnsafe(C):v.multiply(C),g=b(this,B).add(b(N,F));return g.is0()?void 0:g}toAffine(N){return d(this,N)}isTorsionFree(){const{h:N,isTorsionFree:B}=t;if(N===Ne)return!0;if(B)return B(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:N,clearCofactor:B}=t;return N===Ne?this:B?B(m,this):this.multiplyUnsafe(t.h)}toRawBytes(N=!0){return wo("isCompressed",N),this.assertValidity(),o(m,this,N)}toHex(N=!0){return wo("isCompressed",N),vo(this.toRawBytes(N))}}m.BASE=new m(t.Gx,t.Gy,n.ONE),m.ZERO=new m(n.ZERO,n.ONE,n.ZERO);const{endo:w,nBitLength:$}=t,E=Wv(m,w?Math.ceil($/2):$);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:l}}function Kv(e){const t=Gd(e);return bs(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Xv(e){const t=Kv(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,c=2*n.BYTES+1;function a(y){return Ve(y,r)}function u(y){return Ua(y,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=Yv({...t,toBytes(y,T,A){const S=T.toAffine(),L=n.toBytes(S.x),j=hs;return wo("isCompressed",A),A?j(Uint8Array.from([T.hasEvenY()?2:3]),L):j(Uint8Array.from([4]),L,n.toBytes(S.y))},fromBytes(y){const T=y.length,A=y[0],S=y.subarray(1);if(T===i&&(A===2||A===3)){const L=Rn(S);if(!fa(L,Ne,n.ORDER))throw new Error("Point is not on curve");const j=p(L);let z;try{z=n.sqrt(j)}catch(K){const G=K instanceof Error?": "+K.message:"";throw new Error("Point is not on curve"+G)}const _=(z&Ne)===Ne;return(A&1)===1!==_&&(z=n.neg(z)),{x:L,y:z}}else if(T===c&&A===4){const L=n.fromBytes(S.subarray(0,n.BYTES)),j=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:L,y:j}}else{const L=i,j=c;throw new Error("invalid Point, expected length of "+L+", or uncompressed "+j+", got "+T)}}});function h(y){const T=r>>Ne;return y>T}function m(y){return h(y)?a(-y):y}const w=(y,T,A)=>Rn(y.slice(T,A));class ${constructor(T,A,S){br("r",T,Ne,r),br("s",A,Ne,r),this.r=T,this.s=A,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(T){const A=o;return T=ct("compactSignature",T,A*2),new $(w(T,0,A),w(T,A,2*A))}static fromDER(T){const{r:A,s:S}=tn.toSig(ct("DER",T));return new $(A,S)}assertValidity(){}addRecoveryBit(T){return new $(this.r,this.s,T)}recoverPublicKey(T){const{r:A,s:S,recovery:L}=this,j=D(ct("msgHash",T));if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");const z=L===2||L===3?A+t.n:A;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=L&1?"03":"02",W=l.fromHex(_+Za(z,n.BYTES)),K=u(z),G=a(-j*K),H=a(S*K),Z=l.BASE.multiplyAndAddUnsafe(W,G,H);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new $(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return ps(this.toDERHex())}toDERHex(){return tn.hexFromSig(this)}toCompactRawBytes(){return ps(this.toCompactHex())}toCompactHex(){const T=o;return Za(this.r,T)+Za(this.s,T)}}const E={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=Ud(t.n);return Uv(t.randomBytes(y),t.n)},precompute(y=8,T=l.BASE){return T._setWindowSize(y),T.multiply(BigInt(3)),T}};function P(y,T=!0){return l.fromPrivateKey(y).toRawBytes(T)}function N(y){if(typeof y=="bigint")return!1;if(y instanceof l)return!0;const A=ct("key",y).length,S=n.BYTES,L=S+1,j=2*S+1;if(!(t.allowedPrivateKeyLengths||o===L))return A===L||A===j}function B(y,T,A=!0){if(N(y)===!0)throw new Error("first arg must be private key");if(N(T)===!1)throw new Error("second arg must be public key");return l.fromHex(T).multiply(f(y)).toRawBytes(A)}const F=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const T=Rn(y),A=y.length*8-s;return A>0?T>>BigInt(A):T},D=t.bits2int_modN||function(y){return a(F(y))},b=ms(s);function g(y){return br("num < 2^"+s,y,nn,b),xo(y,o)}function v(y,T,A=C){if(["recovered","canonical"].some(oe=>oe in A))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:L}=t;let{lowS:j,prehash:z,extraEntropy:_}=A;j==null&&(j=!0),y=ct("msgHash",y),qd(A),z&&(y=ct("prehashed msgHash",S(y)));const W=D(y),K=f(T),G=[g(K),g(W)];if(_!=null&&_!==!1){const oe=_===!0?L(n.BYTES):_;G.push(ct("extraEntropy",oe))}const H=hs(...G),Z=W;function J(oe){const me=F(oe);if(!d(me))return;const ge=u(me),de=l.BASE.multiply(me).toAffine(),se=a(de.x);if(se===nn)return;const pe=a(ge*a(Z+se*K));if(pe===nn)return;let ee=(de.x===se?0:2)|Number(de.y&Ne),Pe=pe;return j&&h(pe)&&(Pe=m(pe),ee^=1),new $(se,Pe,ee)}return{seed:H,k2sig:J}}const C={lowS:t.lowS,prehash:!1},O={lowS:t.lowS,prehash:!1};function I(y,T,A=C){const{seed:S,k2sig:L}=v(y,T,A),j=t;return iy(j.hash.outputLen,j.nByteLength,j.hmac)(S,L)}l.BASE._setWindowSize(8);function M(y,T,A,S=O){var ee;const L=y;T=ct("msgHash",T),A=ct("publicKey",A);const{lowS:j,prehash:z,format:_}=S;if(qd(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const W=typeof L=="string"||yo(L),K=!W&&!_&&typeof L=="object"&&L!==null&&typeof L.r=="bigint"&&typeof L.s=="bigint";if(!W&&!K)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let G,H;try{if(K&&(G=new $(L.r,L.s)),W){try{_!=="compact"&&(G=$.fromDER(L))}catch(Pe){if(!(Pe instanceof tn.Err))throw Pe}!G&&_!=="der"&&(G=$.fromCompact(L))}H=l.fromHex(A)}catch{return!1}if(!G||j&&G.hasHighS())return!1;z&&(T=t.hash(T));const{r:Z,s:J}=G,oe=D(T),me=u(J),ge=a(oe*me),de=a(Z*me),se=(ee=l.BASE.multiplyAndAddUnsafe(H,ge,de))==null?void 0:ee.toAffine();return se?a(se.x)===Z:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:B,sign:I,verify:M,ProjectivePoint:l,Signature:$,utils:E}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Qv(e){return{hash:e,hmac:(t,...n)=>Md(e,t,v1(...n)),randomBytes:x1}}function Jv(e,t){const n=r=>Xv({...e,...Qv(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zd=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Yd=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),e6=BigInt(0),t6=BigInt(1),Ka=BigInt(2),Kd=(e,t)=>(e+t/Ka)/t;function n6(e){const t=Zd,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=ut(l,n,t)*l%t,p=ut(f,n,t)*l%t,d=ut(p,Ka,t)*u%t,h=ut(d,o,t)*d%t,m=ut(h,s,t)*h%t,w=ut(m,c,t)*m%t,$=ut(w,a,t)*w%t,E=ut($,c,t)*m%t,P=ut(E,n,t)*l%t,N=ut(P,i,t)*h%t,B=ut(N,r,t)*u%t,F=ut(B,Ka,t);if(!Xa.eql(Xa.sqr(F),e))throw new Error("Cannot find square root");return F}const Xa=za(Zd,void 0,void 0,{sqrt:n6}),Xd=Jv({a:e6,b:BigInt(7),Fp:Xa,n:Yd,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Yd,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-t6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),c=Kd(s*e,t),a=Kd(-r*e,t);let u=Ve(e-c*n-a*o,t),l=Ve(-c*r-a*s,t);const f=u>i,p=l>i;if(f&&(u=t-u),p&&(l=t-l),u>i||l>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}}},lf),r6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Xd},Symbol.toStringTag,{value:"Module"}));function Qd(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Ja({signature:e});if(typeof e.s>"u")throw new Ja({signature:e});if(n&&typeof e.yParity>"u")throw new Ja({signature:e});if(e.r<0n||e.r>$d)throw new l6({value:e.r});if(e.s<0n||e.s>$d)throw new f6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new ec({value:e.yParity})}function o6(e){return Jd(Ot(e))}function Jd(e){if(e.length!==130&&e.length!==132)throw new u6({signature:e});const t=BigInt(Ft(e,0,32)),n=BigInt(Ft(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return Qa(o)}catch{throw new ec({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function s6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return i6(e)}function i6(e){const t=typeof e=="string"?Jd(e):e instanceof Uint8Array?o6(e):typeof e.r=="string"?c6(e):e.v?a6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return Qd(t),t}function a6(e){return{r:e.r,s:e.s,yParity:Qa(e.v)}}function c6(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=Qa(n)),typeof r!="number")throw new ec({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function Qa(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 d6({value:e})}class u6 extends ie{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${tt(Iy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Ja extends ie{constructor({signature:t}){super(`Signature \`${If(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class l6 extends ie{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 f6 extends ie{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 ec extends ie{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 d6 extends ie{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 p6(e,t={}){return typeof e.chainId=="string"?h6(e):{...e,...t.signature}}function h6(e){const{address:t,chainId:n,nonce:r}=e,o=s6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const m6="0x8010801080108010801080108010801080108010801080108010801080108010",b6=Od("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function e0(e){if(typeof e=="string"){if(Ft(e,-32)!==m6)throw new w6(e)}else Qd(e.authorization)}function g6(e){e0(e);const t=Ff(Ft(e,-64,-32)),n=Ft(e,-t-64,-64),r=Ft(e,0,-t-64),[o,s,i]=Nv(b6,n);return{authorization:p6({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 y6(e){try{return e0(e),!0}catch{return!1}}let w6=class extends ie{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 v6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function x6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new v6({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,i,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function E6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function P6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Zt(e.nonce):void 0,storageProof:e.storageProof?E6(e.storageProof):void 0}}async function S6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?Q(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return P6(c)}async function $6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?Q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function tc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:c}){var p,d,h;const a=r||"latest",u=n!==void 0?Q(n):void 0;let l=null;if(o?l=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?l=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Q(s)]},{dedupe:!0}):typeof s=="number"?l=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||a,Q(s)]},{dedupe:!!u}):i&&typeof c=="number"&&(l=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,Q(c)]},{dedupe:!0})),!l)throw new Hl({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)||Xi)(l,"getTransaction")}async function A6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([X(e,$o,"getBlockNumber")({}),t?X(e,tc,"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 $s(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Wl({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||td)(n,"getTransactionReceipt")}async function T6(e,t){var E;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:c,stateOverride:a}=t,u=t.contracts,{batchSize:l=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((E=e.batch)==null?void 0:E.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return wr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,m=0;for(let P=0;P<u.length;P++){const{abi:N,address:B,args:F,functionName:D}=u[P];try{const b=$t({abi:N,args:F,functionName:D});m+=(b.length-2)/2,l>0&&m>l&&d[h].length>0&&(h++,m=(b.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:b,target:B}]}catch(b){const g=pr(b,{abi:N,address:B,args:F,docsPath:"/docs/contract/multicall",functionName:D,sender:n});if(!o)throw g;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:B}]}}const w=await Promise.allSettled(d.map(P=>X(e,Nt,"readContract")({...p===null?{code:ma}:{address:p},abi:ys,account:n,args:[P],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:c,functionName:"aggregate3",stateOverride:a}))),$=[];for(let P=0;P<w.length;P++){const N=w[P];if(N.status==="rejected"){if(!o)throw N.reason;for(let F=0;F<d[P].length;F++)$.push({status:"failure",error:N.reason,result:void 0});continue}const B=N.value;for(let F=0;F<B.length;F++){const{returnData:D,success:b}=B[F],{callData:g}=d[P][F],{abi:v,address:C,functionName:O,args:I}=u[$.length];try{if(g==="0x")throw new Rr;if(!b)throw new is({data:D});const M=Dn({abi:v,args:I,data:D,functionName:O});$.push(o?{result:M,status:"success"}:M)}catch(M){const y=pr(M,{abi:v,address:C,args:I,docsPath:"/docs/contract/multicall",functionName:O});if(!o)throw y;$.push({error:y,result:void 0,status:"failure"})}}}if($.length!==u.length)throw new V("multicall results mismatch");return $}async function nc(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?Uf(p.blockOverrides):void 0,h=p.calls.map(w=>{const $=w,E=$.account?Je($.account):void 0,P=$.abi?$t($):$.data,N={...$,account:E,data:$.dataSuffix?St([P||"0x",$.dataSuffix]):P,from:$.from??(E==null?void 0:E.address)};return mr(N),bo(N)}),m=p.stateOverrides?Yi(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?Q(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((p,d)=>({...of(p),calls:p.calls.map((h,m)=>{var v,C;const{abi:w,args:$,functionName:E,to:P}=o[d].calls[m],N=((v=h.error)==null?void 0:v.data)??h.returnData,B=BigInt(h.gasUsed),F=(C=h.logs)==null?void 0:C.map(O=>Xt(O)),D=h.status==="0x1"?"success":"failure",b=w&&D==="success"&&N!=="0x"?Dn({abi:w,data:N,functionName:E}):null,g=(()=>{var I;if(D==="success")return;let O;if(((I=h.error)==null?void 0:I.data)==="0x"?O=new Rr:h.error&&(O=new is(h.error)),!!O)return pr(O,{abi:w??[],address:P??"0x",args:$,functionName:E??"<unknown>"})})();return{data:N,gasUsed:B,logs:F,status:D,...D==="success"?{result:b}:{error:g}}})}))}catch(a){const u=a,l=us(u,{});throw l instanceof mo?u:l}}function rc(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new ie("Unable to normalize signature.");return o}function oc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ka(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)=>oc(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=>oc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function t0(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 t0(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")?ka(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ka(n[r],{strict:!1}):!1)return i}}function n0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Qu(e):e;return{...r,...n?{hash:xr(r)}:{}}}function As(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=My(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?r0(u)===Ft(t,0,4):u.type==="event"?xr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Ts({name:t});if(i.length===1)return{...i[0],...o?{hash:xr(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:xr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in u&&u.inputs[p];return d?oc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=t0(u.inputs,c.inputs,r);if(f)throw new N6({abiItem:u,type:f[0]},{abiItem:c,type:f[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new Ts({name:t});return{...a,...o?{hash:xr(a)}:{}}}function r0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return As(n,r)}return e[0]})();return Ft(xr(t),0,4)}function O6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return As(r,o)}return e[0]})(),n=typeof t=="string"?t:Ko(t);return rc(n)}function xr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return As(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:xd(pa(O6(t)))}class N6 extends ie{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${rc(Ko(t.abiItem))}\`, and`,`\`${n.type}\` in \`${rc(Ko(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 Ts extends ie{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 C6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,c]=e;return[M6(i),c]}return e})(),{bytecode:r,args:o}=n;return Tt(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?Ra(t.inputs,o):"0x")}function I6(e){return n0(e)}function M6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Ts({name:"constructor"});return t}function k6(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[u,l,f]=e;return[o0(u,l,{args:f}),f]}const[c,a]=e;return[c,a]})(),{overloads:r}=t,o=r?o0([t,...r],t.name,{args:n}):t,s=B6(o),i=n.length>0?Ra(o.inputs,n):void 0;return i?Tt(s,i):s}function Er(e,t={}){return n0(e,t)}function o0(e,t,n){const r=As(e,t,n);if(r.type!=="function")throw new Ts({name:t,type:"function"});return r}function B6(e){return r0(e)}const L6="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Dt="0x0000000000000000000000000000000000000000",F6="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function D6(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?Je(t.account):void 0;if(i&&!u)throw new V("`account` is required when `traceAssetChanges` is true");const l=u?C6(I6("constructor(bytes, bytes)"),{bytecode:Zf,args:[F6,k6(Er("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async S=>{if(!S.data&&!S.abi)return;const{accessList:L}=await ld(e,{account:u.address,...S,data:S.abi?$t(S):S.data});return L.map(({address:j,storageKeys:z})=>z.length>0?j:null)})).then(S=>S.flat().filter(Boolean)):[],p=await nc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((S,L)=>({abi:[Er("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:S,from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]}]:[],{calls:[...o,{}].map(S=>({...S,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((S,L)=>({abi:[Er("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:S,from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((S,L)=>({to:S,abi:[Er("function decimals() returns (uint256)")],functionName:"decimals",from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((S,L)=>({to:S,abi:[Er("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((S,L)=>({to:S,abi:[Er("function symbol() returns (string)")],functionName:"symbol",from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,w,$,E,P,N]=i?p:[],{calls:B,...F}=d,D=B.slice(0,-1)??[],b=(h==null?void 0:h.calls)??[],g=(m==null?void 0:m.calls)??[],v=[...b,...g].map(S=>S.status==="success"?kt(S.data):null),C=(w==null?void 0:w.calls)??[],O=($==null?void 0:$.calls)??[],I=[...C,...O].map(S=>S.status==="success"?kt(S.data):null),M=((E==null?void 0:E.calls)??[]).map(S=>S.status==="success"?S.result:null),y=((N==null?void 0:N.calls)??[]).map(S=>S.status==="success"?S.result:null),T=((P==null?void 0:P.calls)??[]).map(S=>S.status==="success"?S.result:null),A=[];for(const[S,L]of I.entries()){const j=v[S];if(typeof L!="bigint"||typeof j!="bigint")continue;const z=M[S-1],_=y[S-1],W=T[S-1],K=S===0?{address:L6,decimals:18,symbol:"ETH"}:{address:f[S-1],decimals:W||z?Number(z??1):void 0,symbol:_??void 0};A.some(G=>G.token.address===K.address)||A.push({token:K,value:{pre:j,post:L,diff:L-j}})}return{assetChanges:A,block:F,results:D}}const s0="0x6492649264926492649264926492649264926492649264926492649264926492";function R6(e){if(Ft(e,-32)!==s0)throw new U6(e)}function j6(e){const{data:t,signature:n,to:r}=e;return Tt(Ra(Od("address, bytes, bytes"),[r,t,n]),s0)}function _6(e){try{return R6(e),!0}catch{return!1}}class U6 extends ie{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 z6({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 Xd.Signature(kt(e),kt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:Bt(i)}async function Os(e,t){var c,a,u,l,f,p;const{address:n,hash:r,erc6492VerifierAddress:o=t.universalSignatureVerifierAddress??((u=(a=(c=e.chain)==null?void 0:c.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:u.address),multicallAddress:s=t.multicallAddress??((p=(f=(l=e.chain)==null?void 0:l.contracts)==null?void 0:f.multicall3)==null?void 0:p.address)}=t,i=(()=>{const d=t.signature;return Et(d)?d:typeof d=="object"&&"r"in d&&"s"in d?z6(d):Ae(d)})();try{return y6(i)?await H6(e,{...t,multicallAddress:s,signature:i}):await W6(e,{...t,verifierAddress:o,signature:i})}catch(d){try{if(go(mn(n),await Yl({hash:r,signature:i})))return!0}catch{}if(d instanceof zn)return!1;throw d}}async function H6(e,t){var w;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:c,data:a,signature:u,to:l}=g6(t.signature);if(await Ia(e,{address:n,blockNumber:r,blockTag:o})===cr(["0xef0100",c.address]))return await V6(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:u});const p={address:c.address,chainId:Number(c.chainId),nonce:Number(c.nonce),r:Q(c.r,{size:32}),s:Q(c.s,{size:32}),yParity:c.yParity};if(!await Mw({address:n,authorization:p}))throw new zn;const h=await X(e,Nt,"readContract")({...i?{address:i}:{code:ma},authorizationList:[p],abi:ys,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:l??n,callData:a}]:[],{allowFailure:!0,target:n,callData:$t({abi:Gf,functionName:"isValidSignature",args:[s,u]})}]]}),m=(w=h[h.length-1])==null?void 0:w.returnData;if(m!=null&&m.startsWith("0x1626ba7e"))return!0;throw new zn}async function W6(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:c,...a}=t,u=await(async()=>!r&&!o||_6(i)?i:j6({data:o,signature:i,to:r}))(),l=c?{to:c,data:$t({abi:qf,functionName:"isValidSig",args:[n,s,u]}),...a}:{data:ya({abi:qf,args:[n,s,u],bytecode:jy}),...a},{data:f}=await X(e,Po,"call")(l).catch(p=>{throw p instanceof Vl?new zn:p});if(t1(f??"0x0"))return!0;throw new zn}async function V6(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await X(e,Nt,"readContract")({address:n,abi:Gf,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof Gl?new zn:a})).startsWith("0x1626ba7e"))return!0;throw new zn}class zn extends Error{}async function G6(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=bd(n);return X(e,Os,"verifyHash")({address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function q6(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=ev({message:i,primaryType:c,types:a,domain:u});return X(e,Os,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function i0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return c?(()=>{const f=Te(["watchBlockNumber",e.uid,t,n,i]);return vn(f,{onBlockNumber:r,onError:o},p=>So(async()=>{var d;try{const h=await X(e,$o,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Te(["watchBlockNumber",e.uid,t,n]);return vn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(E=>E.config.type==="webSocket"||E.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),{unsubscribe:w}=await m.subscribe({params:["newHeads"],onData($){var P;if(!d)return;const E=kt((P=$.result)==null?void 0:P.number);p.onBlockNumber(E,a),a=E},onError($){var E;(E=p.onError)==null||E.call(p,$)}});h=w,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Z6(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:B})=>~~(1<<B)*200,timeout:a=18e4}=t,u=Te(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var B;return t.pollingInterval?t.pollingInterval:(B=e.chain)!=null&&B.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,w;const{promise:$,resolve:E,reject:P}=Xf(),N=a?setTimeout(()=>{w==null||w(),m==null||m(),P(new bg({hash:o}))},a):void 0;return m=vn(u,{onReplaced:s,resolve:E,reject:P},async B=>{if(d=await X(e,$s,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(N),B.resolve(d),m==null||m();return}w=X(e,i0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(F){const D=g=>{clearTimeout(N),w==null||w(),g(),m==null||m()};let b=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;D(()=>B.resolve(d));return}if(n&&!f&&(h=!0,await Ea(async()=>{f=await X(e,tc,"getTransaction")({hash:o}),f.blockNumber&&(b=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await X(e,$s,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;D(()=>B.resolve(d))}catch(g){if(g instanceof Hl||g instanceof Wl){if(!f){h=!1;return}try{p=f,h=!0;const v=await Ea(()=>X(e,At,"getBlock")({blockNumber:b,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:I})=>I instanceof nf});h=!1;const C=v.transactions.find(({from:I,nonce:M})=>I===p.from&&M===p.nonce);if(!C||(d=await X(e,$s,"getTransactionReceipt")({hash:C.hash}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r)))return;let O="replaced";C.to===p.to&&C.value===p.value&&C.input===p.input?O="repriced":C.from===C.to&&C.value===0n&&(O="cancelled"),D(()=>{var I;(I=B.onReplaced)==null||I.call(B,{reason:O,replacedTransaction:p,transaction:C,transactionReceipt:d}),B.resolve(d)})}catch(v){D(()=>B.reject(v))}}else D(()=>B.reject(g))}}})}),$}function Y6(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),l=i??!1;let f;return u?(()=>{const h=Te(["watchBlocks",e.uid,t,n,r,l,a]);return vn(h,{onBlock:o,onError:s},m=>So(async()=>{var w;try{const $=await X(e,At,"getBlock")({blockTag:t,includeTransactions:l});if($.number!==null&&(f==null?void 0:f.number)!=null){if($.number===f.number)return;if($.number-f.number>1&&n)for(let E=(f==null?void 0:f.number)+1n;E<$.number;E++){const P=await X(e,At,"getBlock")({blockNumber:E,includeTransactions:l});m.onBlock(P,f),f=P}}((f==null?void 0:f.number)==null||t==="pending"&&($==null?void 0:$.number)==null||$.number!==null&&$.number>f.number)&&(m.onBlock($,f),f=$)}catch($){(w=m.onError)==null||w.call(m,$)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,w=()=>h=!1;return(async()=>{try{r&&X(e,At,"getBlock")({blockTag:t,includeTransactions:l}).then(P=>{h&&m&&(o(P,void 0),m=!1)}).catch(s);const $=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(N=>N.config.type==="webSocket"||N.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:E}=await $.subscribe({params:["newHeads"],async onData(P){var B;if(!h)return;const N=await X(e,At,"getBlock")({blockNumber:(B=P.result)==null?void 0:B.number,includeTransactions:l}).catch(()=>{});h&&(o(N,f),m=!1,f=N)},onError(P){s==null||s(P)}});w=E,h||w()}catch($){s==null||s($)}})(),()=>w()})()}function K6(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:u,pollingInterval:l=e.pollingInterval,strict:f}){const p=typeof u<"u"?u:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const w=Te(["watchEvent",t,n,r,e.uid,o,l,i]);return vn(w,{onLogs:a,onError:c},$=>{let E;i!==void 0&&(E=i-1n);let P,N=!1;const B=So(async()=>{var F;if(!N){try{P=await X(e,fd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}N=!0;return}try{let D;if(P)D=await X(e,ws,"getFilterChanges")({filter:P});else{const b=await X(e,$o,"getBlockNumber")({});E&&E!==b?D=await X(e,sa,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:E+1n,toBlock:b}):D=[],E=b}if(D.length===0)return;if(r)$.onLogs(D);else for(const b of D)$.onLogs([b])}catch(D){P&&D instanceof gn&&(N=!1),(F=$.onError)==null||F.call($,D)}},{emitOnBegin:!0,interval:l});return async()=>{P&&await X(e,vs,"uninstallFilter")({filter:P}),B()}})})():(()=>{let w=!0,$=()=>w=!1;return(async()=>{try{const E=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(D=>D.config.type==="webSocket"||D.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),P=s??(o?[o]:void 0);let N=[];P&&(N=[P.flatMap(D=>Hr({abi:[D],eventName:D.name,args:n}))],o&&(N=N[0]));const{unsubscribe:B}=await E.subscribe({params:["logs",{address:t,topics:N}],onData(F){var b;if(!w)return;const D=F.result;try{const{eventName:g,args:v}=fs({abi:P??[],data:D.data,topics:D.topics,strict:d}),C=Xt(D,{args:v,eventName:g});a([C])}catch(g){let v,C;if(g instanceof Jo||g instanceof $i){if(f)return;v=g.abiItem.name,C=(b=g.abiItem.inputs)==null?void 0:b.some(I=>!("name"in I&&I.name))}const O=Xt(D,{args:C?[]:{},eventName:v});a([O])}},onError(F){c==null||c(F)}});$=B,w||$()}catch(E){c==null||c(E)}})(),()=>$()})()}function X6(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Te(["watchPendingTransactions",e.uid,t,s]);return vn(u,{onTransactions:r,onError:n},l=>{let f;const p=So(async()=>{var d;try{if(!f)try{f=await X(e,dd,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await X(e,ws,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(d=l.onError)==null||d.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await X(e,vs,"uninstallFilter")({filter:f}),p()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!u)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function Q6(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(J6))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(e5))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
81
|
+
- `).slice(1);return{...r,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const J6=/^(?:(?<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)?/,e5=/(?: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 t5(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||!at(r.address,{strict:!1})||t&&!go(r.address,t))return!1}catch{return!1}return!0}async function n5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=Q6(o);if(!l.address||!t5({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const p=bd(o);return Os(e,{address:l.address,hash:p,signature:c,...u})}async function r5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var c,a,u;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,Q(r)]:[t]},{retryCount:0}),i=(((u=(a=(c=e.chain)==null?void 0:c.formatters)==null?void 0:a.transactionReceipt)==null?void 0:u.format)||td)(o);if(i.status==="reverted"&&n)throw new mg({receipt:i});return i}function o5(e){return{call:t=>Po(e,t),createAccessList:t=>ld(e,t),createBlockFilter:()=>Ew(e),createContractEventFilter:t=>Bl(e,t),createEventFilter:t=>fd(e,t),createPendingTransactionFilter:()=>dd(e),estimateContractGas:t=>ty(e,t),estimateGas:t=>ra(e,t),getBalance:t=>Pw(e,t),getBlobBaseFee:()=>Sw(e),getBlock:t=>At(e,t),getBlockNumber:t=>$o(e,t),getBlockTransactionCount:t=>$w(e,t),getBytecode:t=>Ia(e,t),getChainId:()=>ta(e),getCode:t=>Ia(e,t),getContractEvents:t=>wf(e,t),getEip712Domain:t=>Tw(e,t),getEnsAddress:t=>iw(e,t),getEnsAvatar:t=>ww(e,t),getEnsName:t=>vw(e,t),getEnsResolver:t=>xw(e,t),getEnsText:t=>ud(e,t),getFeeHistory:t=>Cw(e,t),estimateFeesPerGas:t=>Dg(e,t),getFilterChanges:t=>ws(e,t),getFilterLogs:t=>Iw(e,t),getGasPrice:()=>Qi(e),getLogs:t=>sa(e,t),getProof:t=>S6(e,t),estimateMaxPriorityFeePerGas:t=>Fg(e,t),fillTransaction:t=>mf(e,t),getStorageAt:t=>$6(e,t),getTransaction:t=>tc(e,t),getTransactionConfirmations:t=>A6(e,t),getTransactionCount:t=>af(e,t),getTransactionReceipt:t=>$s(e,t),multicall:t=>T6(e,t),prepareTransactionRequest:t=>gf(e,t),readContract:t=>Nt(e,t),sendRawTransaction:t=>Qy(e,t),sendRawTransactionSync:t=>r5(e,t),simulate:t=>nc(e,t),simulateBlocks:t=>nc(e,t),simulateCalls:t=>D6(e,t),simulateContract:t=>Wy(e,t),verifyHash:t=>Os(e,t),verifyMessage:t=>G6(e,t),verifySiweMessage:t=>n5(e,t),verifyTypedData:t=>q6(e,t),uninstallFilter:t=>vs(e,t),waitForTransactionReceipt:t=>Z6(e,t),watchBlocks:t=>Y6(e,t),watchBlockNumber:t=>i0(e,t),watchContractEvent:t=>Xy(e,t),watchEvent:t=>K6(e,t),watchPendingTransactions:t=>X6(e,t)}}function s5(e){const{key:t="public",name:n="Public Client"}=e;return ew({...e,key:t,name:n,type:"publicClient"}).extend(o5)}function i5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=nd();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:Bw(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class a5 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 c5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:c="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:u,retryDelay:l,raw:f}=t;return({chain:p,retryCount:d,timeout:h})=>{const{batchSize:m=1e3,wait:w=0}=typeof n=="object"?n:{},$=t.retryCount??d,E=h??t.timeout??1e4,P=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!P)throw new a5;const N=Vw(P,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:u,timeout:E});return i5({key:s,methods:i,name:c,async request({method:B,params:F}){const D={method:B,params:F},{schedule:b}=Qf({id:P,wait:w,shouldSplitBatch(O){return O.length>m},fn:O=>N.request({body:O}),sort:(O,I)=>O.id-I.id}),g=async O=>n?b(O):[await N.request({body:O})],[{error:v,result:C}]=await g(D);if(f)return{error:v,result:C};if(v)throw new _i({body:D,error:v,url:P});return C},retryCount:$,retryDelay:l,timeout:E,type:"http"},{fetchOptions:o,url:P})}}const u5=zw({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 l5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=x.useState(null),[a,u]=x.useState(o);return x.useEffect(()=>{let l,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:yr,functionName:"balanceOf",args:[n]});c(d),u(Di(d,r))}catch{u(o)}};p();try{l=e.watchContractEvent({address:t,abi:yr,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:yr,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const f5=()=>({openDeposit:x.useCallback(t=>{},[])}),d5=()=>({openWithdraw:x.useCallback(t=>{},[])}),Hn="MPC",sc="EVM",p5="spot",a0="perpetual";/**
|
|
82
82
|
* @license lucide-react v0.540.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const h5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),m5=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),
|
|
86
|
+
*/const h5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),m5=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),c0=e=>{const t=m5(e);return t.charAt(0).toUpperCase()+t.slice(1)},u0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),b5=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
87
87
|
* @license lucide-react v0.540.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
@@ -93,20 +93,20 @@ ${fg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const y5=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>x.createElement("svg",{ref:a,...g5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:
|
|
96
|
+
*/const y5=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>x.createElement("svg",{ref:a,...g5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:u0("lucide",o),...!s&&!b5(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>x.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
|
|
97
97
|
* @license lucide-react v0.540.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const w5=(e,t)=>{const n=x.forwardRef(({className:r,...o},s)=>x.createElement(y5,{ref:s,iconNode:t,className:
|
|
101
|
+
*/const w5=(e,t)=>{const n=x.forwardRef(({className:r,...o},s)=>x.createElement(y5,{ref:s,iconNode:t,className:u0(`lucide-${h5(c0(e))}`,`lucide-${e}`,r),...o}));return n.displayName=c0(e),n};/**
|
|
102
102
|
* @license lucide-react v0.540.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const u0=w5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),l0=typeof document<"u"?x.useLayoutEffect:()=>{};var ic;const v5=(ic=x.useInsertionEffect)!==null&&ic!==void 0?ic:l0;function x5(e){const t=x.useRef(null);return v5(()=>{t.current=e},[e]),x.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const xn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Wn=e=>e&&"window"in e&&e.window===e?e:xn(e).defaultView||window;function E5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function P5(e){return E5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let S5=!1;function ac(){return S5}function f0(e,t){if(!ac())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:P5(n)?n=n.host:n=n.parentNode}return!1}const cc=(e=document)=>{var t;if(!ac())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 d0(e){return ac()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Ns(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 uc(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 rn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const lc=rn(function(){return uc(/^Mac/i)}),$5=rn(function(){return uc(/^iPhone/i)}),A5=rn(function(){return uc(/^iPad/i)||lc()&&navigator.maxTouchPoints>1}),T5=rn(function(){return $5()||A5()});rn(function(){return lc()||T5()}),rn(function(){return Ns(/AppleWebKit/i)&&!O5()});const O5=rn(function(){return Ns(/Chrome/i)}),N5=rn(function(){return Ns(/Android/i)});rn(function(){return Ns(/Firefox/i)});function p0(){let e=x.useRef(new Map),t=x.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...u)=>{e.current.delete(i),i(...u)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=x.useCallback((o,s,i,c)=>{var a;let u=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,u,c),e.current.delete(i)},[]),r=x.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return x.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function C5(e){return e.pointerType===""&&e.isTrusted?!0:N5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function h0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function I5(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function m0(e){let t=x.useRef({isFocused:!1,observer:null});l0(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=x5(r=>{e==null||e(r)});return x.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=h0(i);n(c)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let M5=!1,No=null,fc=new Set,Co=new Map,Vn=!1,dc=!1;const k5={Tab:!0,Escape:!0};function pc(e,t){for(let n of fc)n(e,t)}function B5(e){return!(e.metaKey||!lc()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Cs(e){Vn=!0,B5(e)&&(No="keyboard",pc("keyboard",e))}function lt(e){No="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Vn=!0,pc("pointer",e))}function b0(e){C5(e)&&(Vn=!0,No="virtual")}function g0(e){e.target===window||e.target===document||M5||!e.isTrusted||(!Vn&&!dc&&(No="virtual",pc("virtual",e)),Vn=!1,dc=!1)}function y0(){Vn=!1,dc=!0}function hc(e){if(typeof window>"u"||typeof document>"u"||Co.get(Wn(e)))return;const t=Wn(e),n=xn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Vn=!0,r.apply(this,arguments)},n.addEventListener("keydown",Cs,!0),n.addEventListener("keyup",Cs,!0),n.addEventListener("click",b0,!0),t.addEventListener("focus",g0,!0),t.addEventListener("blur",y0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",lt,!0),n.addEventListener("pointermove",lt,!0),n.addEventListener("pointerup",lt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",lt,!0),n.addEventListener("mousemove",lt,!0),n.addEventListener("mouseup",lt,!0)),t.addEventListener("beforeunload",()=>{w0(e)},{once:!0}),Co.set(t,{focus:r})}const w0=(e,t)=>{const n=Wn(e),r=xn(e);t&&r.removeEventListener("DOMContentLoaded",t),Co.has(n)&&(n.HTMLElement.prototype.focus=Co.get(n).focus,r.removeEventListener("keydown",Cs,!0),r.removeEventListener("keyup",Cs,!0),r.removeEventListener("click",b0,!0),n.removeEventListener("focus",g0,!0),n.removeEventListener("blur",y0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",lt,!0),r.removeEventListener("pointermove",lt,!0),r.removeEventListener("pointerup",lt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",lt,!0),r.removeEventListener("mousemove",lt,!0),r.removeEventListener("mouseup",lt,!0)),Co.delete(n))};function L5(e){const t=xn(e);let n;return t.readyState!=="loading"?hc(e):(n=()=>{hc(e)},t.addEventListener("DOMContentLoaded",n)),()=>w0(e,n)}typeof document<"u"&&L5();function v0(){return No!=="pointer"}const F5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function D5(e,t,n){let r=xn(n==null?void 0:n.target);const o=typeof window<"u"?Wn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Wn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Wn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?Wn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!F5.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!k5[n.key])}function R5(e,t,n){hc(),x.useEffect(()=>{let r=(o,s)=>{D5(!!(n!=null&&n.isTextInput),o,s)&&e(v0())};return fc.add(r),()=>{fc.delete(r)}},t)}function j5(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=x.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=m0(s),c=x.useCallback(a=>{const u=xn(a.target),l=u?cc(u):cc();a.target===a.currentTarget&&l===d0(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function _5(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=x.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=p0(),a=x.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),u=m0(a),l=x.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=xn(f.target),d=cc(p);if(!s.current.isFocusWithin&&d===d0(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,u(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!f0(h,m.target)){let w=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});I5(w,h);let $=h0(w);a($)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let Is=!1,Ms=0;function mc(){Is=!0,setTimeout(()=>{Is=!1},50)}function x0(e){e.pointerType==="touch"&&mc()}function U5(){if(!(typeof document>"u"))return Ms===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",x0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",mc)),Ms++,()=>{Ms--,!(Ms>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",x0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",mc))}}function z5(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=x.useState(!1),c=x.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;x.useEffect(U5,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=p0(),{hoverProps:l,triggerHoverEnd:f}=x.useMemo(()=>{let p=(m,w)=>{if(c.pointerType=w,o||w==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let $=m.currentTarget;c.target=$,a(xn(m.target),"pointerover",E=>{c.isHovered&&c.target&&!f0(c.target,E.target)&&d(E,E.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:$,pointerType:w}),n&&n(!0),i(!0)},d=(m,w)=>{let $=c.target;c.pointerType="",c.target=null,!(w==="touch"||!c.isHovered||!$)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:$,pointerType:w}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Is&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!Is&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,u]);return x.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function H5(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=x.useRef({isFocused:!1,isFocusVisible:t||v0()}),[s,i]=x.useState(!1),[c,a]=x.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=x.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=x.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);R5(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=j5({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=_5({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var W5=Object.defineProperty,V5=(e,t,n)=>t in e?W5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bc=(e,t,n)=>(V5(e,typeof t!="symbol"?t+"":t,n),n);let G5=class{constructor(){bc(this,"current",this.detect()),bc(this,"handoffState","pending"),bc(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"}},Rt=new G5;function ks(e){var t;return Rt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Bs(e){var t,n;return Rt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function E0(e){var t,n;return(n=(t=Bs(e))==null?void 0:t.activeElement)!=null?n:null}function q5(e){return E0(e)===e}function P0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function nt(){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 P0(()=>{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=nt();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 Gn(){let[e]=x.useState(nt);return x.useEffect(()=>()=>e.dispose(),[e]),e}let Ee=(e,t)=>{Rt.isServer?x.useEffect(e,t):x.useLayoutEffect(e,t)};function qn(e){let t=x.useRef(e);return Ee(()=>{t.current=e},[e]),t}let le=function(e){let t=qn(e);return x.useCallback((...n)=>t.current(...n),[t])};function Z5(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 Y5(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function K5({disabled:e=!1}={}){let t=x.useRef(null),[n,r]=x.useState(!1),o=Gn(),s=le(()=>{t.current=null,r(!1),o.dispose()}),i=le(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=ks(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Z5(u);r(Y5(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function En(e){return x.useMemo(()=>e,Object.values(e))}let X5=x.createContext(void 0);function gc(){return x.useContext(X5)}function yc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ft(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,ft),r}var Ls=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ls||{}),Pn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Pn||{});function rt(){let e=J5();return x.useCallback(t=>Q5({mergeRefs:e,...t}),[e])}function Q5({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??ex;let a=S0(t,e);if(s)return Fs(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return Fs(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return ft(l?0:1,{0(){return null},1(){return Fs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return Fs(a,n,r,i,c)}function Fs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=wc(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,w=>`-${w.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(Io(s)&&(Object.keys(Sn(a)).length>0||Object.keys(Sn(f)).length>0))if(!x.isValidElement(l)||Array.isArray(l)&&l.length>1||nx(l)){if(Object.keys(Sn(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(Sn(a)).concat(Object.keys(Sn(f))).map(p=>` - ${p}`).join(`
|
|
106
|
+
*/const l0=w5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),f0=typeof document<"u"?x.useLayoutEffect:()=>{};var ic;const v5=(ic=x.useInsertionEffect)!==null&&ic!==void 0?ic:f0;function x5(e){const t=x.useRef(null);return v5(()=>{t.current=e},[e]),x.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const xn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Wn=e=>e&&"window"in e&&e.window===e?e:xn(e).defaultView||window;function E5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function P5(e){return E5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let S5=!1;function ac(){return S5}function d0(e,t){if(!ac())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:P5(n)?n=n.host:n=n.parentNode}return!1}const cc=(e=document)=>{var t;if(!ac())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 p0(e){return ac()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Ns(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 uc(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 rn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const lc=rn(function(){return uc(/^Mac/i)}),$5=rn(function(){return uc(/^iPhone/i)}),A5=rn(function(){return uc(/^iPad/i)||lc()&&navigator.maxTouchPoints>1}),T5=rn(function(){return $5()||A5()});rn(function(){return lc()||T5()}),rn(function(){return Ns(/AppleWebKit/i)&&!O5()});const O5=rn(function(){return Ns(/Chrome/i)}),N5=rn(function(){return Ns(/Android/i)});rn(function(){return Ns(/Firefox/i)});function h0(){let e=x.useRef(new Map),t=x.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...u)=>{e.current.delete(i),i(...u)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=x.useCallback((o,s,i,c)=>{var a;let u=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,u,c),e.current.delete(i)},[]),r=x.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return x.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function C5(e){return e.pointerType===""&&e.isTrusted?!0:N5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function m0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function I5(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function b0(e){let t=x.useRef({isFocused:!1,observer:null});f0(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=x5(r=>{e==null||e(r)});return x.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=m0(i);n(c)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let M5=!1,No=null,fc=new Set,Co=new Map,Vn=!1,dc=!1;const k5={Tab:!0,Escape:!0};function pc(e,t){for(let n of fc)n(e,t)}function B5(e){return!(e.metaKey||!lc()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Cs(e){Vn=!0,B5(e)&&(No="keyboard",pc("keyboard",e))}function lt(e){No="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Vn=!0,pc("pointer",e))}function g0(e){C5(e)&&(Vn=!0,No="virtual")}function y0(e){e.target===window||e.target===document||M5||!e.isTrusted||(!Vn&&!dc&&(No="virtual",pc("virtual",e)),Vn=!1,dc=!1)}function w0(){Vn=!1,dc=!0}function hc(e){if(typeof window>"u"||typeof document>"u"||Co.get(Wn(e)))return;const t=Wn(e),n=xn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Vn=!0,r.apply(this,arguments)},n.addEventListener("keydown",Cs,!0),n.addEventListener("keyup",Cs,!0),n.addEventListener("click",g0,!0),t.addEventListener("focus",y0,!0),t.addEventListener("blur",w0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",lt,!0),n.addEventListener("pointermove",lt,!0),n.addEventListener("pointerup",lt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",lt,!0),n.addEventListener("mousemove",lt,!0),n.addEventListener("mouseup",lt,!0)),t.addEventListener("beforeunload",()=>{v0(e)},{once:!0}),Co.set(t,{focus:r})}const v0=(e,t)=>{const n=Wn(e),r=xn(e);t&&r.removeEventListener("DOMContentLoaded",t),Co.has(n)&&(n.HTMLElement.prototype.focus=Co.get(n).focus,r.removeEventListener("keydown",Cs,!0),r.removeEventListener("keyup",Cs,!0),r.removeEventListener("click",g0,!0),n.removeEventListener("focus",y0,!0),n.removeEventListener("blur",w0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",lt,!0),r.removeEventListener("pointermove",lt,!0),r.removeEventListener("pointerup",lt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",lt,!0),r.removeEventListener("mousemove",lt,!0),r.removeEventListener("mouseup",lt,!0)),Co.delete(n))};function L5(e){const t=xn(e);let n;return t.readyState!=="loading"?hc(e):(n=()=>{hc(e)},t.addEventListener("DOMContentLoaded",n)),()=>v0(e,n)}typeof document<"u"&&L5();function x0(){return No!=="pointer"}const F5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function D5(e,t,n){let r=xn(n==null?void 0:n.target);const o=typeof window<"u"?Wn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Wn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Wn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?Wn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!F5.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!k5[n.key])}function R5(e,t,n){hc(),x.useEffect(()=>{let r=(o,s)=>{D5(!!(n!=null&&n.isTextInput),o,s)&&e(x0())};return fc.add(r),()=>{fc.delete(r)}},t)}function j5(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=x.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=b0(s),c=x.useCallback(a=>{const u=xn(a.target),l=u?cc(u):cc();a.target===a.currentTarget&&l===p0(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function _5(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=x.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=h0(),a=x.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),u=b0(a),l=x.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=xn(f.target),d=cc(p);if(!s.current.isFocusWithin&&d===p0(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,u(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!d0(h,m.target)){let w=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});I5(w,h);let $=m0(w);a($)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let Is=!1,Ms=0;function mc(){Is=!0,setTimeout(()=>{Is=!1},50)}function E0(e){e.pointerType==="touch"&&mc()}function U5(){if(!(typeof document>"u"))return Ms===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",E0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",mc)),Ms++,()=>{Ms--,!(Ms>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",E0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",mc))}}function z5(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=x.useState(!1),c=x.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;x.useEffect(U5,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=h0(),{hoverProps:l,triggerHoverEnd:f}=x.useMemo(()=>{let p=(m,w)=>{if(c.pointerType=w,o||w==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let $=m.currentTarget;c.target=$,a(xn(m.target),"pointerover",E=>{c.isHovered&&c.target&&!d0(c.target,E.target)&&d(E,E.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:$,pointerType:w}),n&&n(!0),i(!0)},d=(m,w)=>{let $=c.target;c.pointerType="",c.target=null,!(w==="touch"||!c.isHovered||!$)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:$,pointerType:w}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Is&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!Is&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,u]);return x.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function H5(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=x.useRef({isFocused:!1,isFocusVisible:t||x0()}),[s,i]=x.useState(!1),[c,a]=x.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=x.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=x.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);R5(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=j5({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=_5({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var W5=Object.defineProperty,V5=(e,t,n)=>t in e?W5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bc=(e,t,n)=>(V5(e,typeof t!="symbol"?t+"":t,n),n);let G5=class{constructor(){bc(this,"current",this.detect()),bc(this,"handoffState","pending"),bc(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"}},Rt=new G5;function ks(e){var t;return Rt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Bs(e){var t,n;return Rt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function P0(e){var t,n;return(n=(t=Bs(e))==null?void 0:t.activeElement)!=null?n:null}function q5(e){return P0(e)===e}function S0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function nt(){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 S0(()=>{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=nt();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 Gn(){let[e]=x.useState(nt);return x.useEffect(()=>()=>e.dispose(),[e]),e}let Ee=(e,t)=>{Rt.isServer?x.useEffect(e,t):x.useLayoutEffect(e,t)};function qn(e){let t=x.useRef(e);return Ee(()=>{t.current=e},[e]),t}let le=function(e){let t=qn(e);return x.useCallback((...n)=>t.current(...n),[t])};function Z5(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 Y5(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function K5({disabled:e=!1}={}){let t=x.useRef(null),[n,r]=x.useState(!1),o=Gn(),s=le(()=>{t.current=null,r(!1),o.dispose()}),i=le(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=ks(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Z5(u);r(Y5(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function En(e){return x.useMemo(()=>e,Object.values(e))}let X5=x.createContext(void 0);function gc(){return x.useContext(X5)}function yc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ft(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,ft),r}var Ls=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ls||{}),Pn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Pn||{});function rt(){let e=J5();return x.useCallback(t=>Q5({mergeRefs:e,...t}),[e])}function Q5({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??ex;let a=$0(t,e);if(s)return Fs(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return Fs(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return ft(l?0:1,{0(){return null},1(){return Fs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return Fs(a,n,r,i,c)}function Fs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=wc(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,w=>`-${w.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(Io(s)&&(Object.keys(Sn(a)).length>0||Object.keys(Sn(f)).length>0))if(!x.isValidElement(l)||Array.isArray(l)&&l.length>1||nx(l)){if(Object.keys(Sn(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(Sn(a)).concat(Object.keys(Sn(f))).map(p=>` - ${p}`).join(`
|
|
107
107
|
`),"","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(`
|
|
108
108
|
`)].join(`
|
|
109
|
-
`))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...$)=>yc(d(...$),a.className):yc(d,a.className),m=h?{className:h}:{},w=S0(l.props,Sn(wc(a,["ref"])));for(let $ in f)$ in w&&delete f[$];return x.cloneElement(l,Object.assign({},w,f,u,{ref:o(tx(l),u.ref)},m))}return x.createElement(s,Object.assign({},wc(a,["ref"]),!Io(s)&&u,!Io(s)&&f),l)}function J5(){let e=x.useRef([]),t=x.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function ex(...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 S0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function $0(...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 Ge(e){var t;return Object.assign(x.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Sn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function wc(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function tx(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function Io(e){return e===x.Fragment||e===Symbol.for("react.fragment")}function nx(e){return Io(e.type)}function rx(e,t,n){let[r,o]=x.useState(n),s=e!==void 0,i=x.useRef(s),c=x.useRef(!1),a=x.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,le(u=>(s||je.flushSync(()=>o(u)),t==null?void 0:t(u)))]}function ox(e){let[t]=x.useState(e);return t}function A0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))O0(n,T0(t,r),o);return n}function T0(e,t){return e?e+"["+t+"]":t}function O0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())O0(e,T0(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,""]):ix(n)&&!x.isValidElement(n)&&A0(n,t,e)}function sx(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 ix(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let ax="span";var vc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(vc||{});function cx(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 rt()({ourProps:s,theirProps:o,slot:{},defaultTag:ax,name:"Hidden"})}let N0=Ge(cx),ux=x.createContext(null);function lx({children:e}){let t=x.useContext(ux);if(!t)return x.createElement(x.Fragment,null,e);let{target:n}=t;return n?je.createPortal(x.createElement(x.Fragment,null,e),n):null}function fx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=x.useState(null),c=Gn();return x.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),x.createElement(lx,null,x.createElement(dx,{setForm:i,formId:t}),A0(e).map(([a,u])=>x.createElement(N0,{features:vc.Hidden,...Sn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function dx({setForm:e,formId:t}){return x.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:x.createElement(N0,{features:vc.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let px=x.createContext(void 0);function C0(){return x.useContext(px)}function I0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ds(e){return I0(e)&&"tagName"in e}function on(e){return Ds(e)&&"accessKey"in e}function Pr(e){return Ds(e)&&"tabIndex"in e}function hx(e){return Ds(e)&&"style"in e}function mx(e){return on(e)&&e.nodeName==="IFRAME"}function M0(e){return on(e)&&e.nodeName==="INPUT"}function k0(e){return on(e)&&e.nodeName==="LABEL"}function bx(e){return on(e)&&e.nodeName==="FIELDSET"}function B0(e){return on(e)&&e.nodeName==="LEGEND"}function gx(e){return Ds(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function L0(e){let t=e.parentElement,n=null;for(;t&&!bx(t);)B0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&yx(n)?!1:r}function yx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(B0(t))return!1;t=t.previousElementSibling}return!0}let F0=Symbol();function wx(e,t=!0){return Object.assign(e,{[F0]:t})}function dt(...e){let t=x.useRef(e);x.useEffect(()=>{t.current=e},[e]);let n=le(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[F0]))?void 0:n}let xc=x.createContext(null);xc.displayName="DescriptionContext";function D0(){let e=x.useContext(xc);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,D0),t}return e}function vx(){var e,t;return(t=(e=x.useContext(xc))==null?void 0:e.value)!=null?t:void 0}let xx="p";function Ex(e,t){let n=x.useId(),r=gc(),{id:o=`headlessui-description-${n}`,...s}=e,i=D0(),c=dt(t);Ee(()=>i.register(o),[o,i.register]);let a=En({...i.slot,disabled:r||!1}),u={ref:c,...i.props,id:o};return rt()({ourProps:u,theirProps:s,slot:a,defaultTag:xx,name:i.name||"Description"})}let Px=Ge(Ex);Object.assign(Px,{});var Ce=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ce||{});let Rs=x.createContext(null);Rs.displayName="LabelContext";function R0(){let e=x.useContext(Rs);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,R0),t}return e}function j0(e){var t,n,r;let o=(n=(t=x.useContext(Rs))==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 Sx({inherit:e=!1}={}){let t=j0(),[n,r]=x.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,x.useMemo(()=>function(s){let i=le(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=x.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return x.createElement(Rs.Provider,{value:c},s.children)},[r])]}let $x="label";function Ax(e,t){var n;let r=x.useId(),o=R0(),s=C0(),i=gc(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=dt(t);Ee(()=>o.register(c),[c,o.register]);let p=le(m=>{let w=m.currentTarget;if(!(m.target!==m.currentTarget&&gx(m.target))&&(k0(w)&&m.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(m),k0(w))){let $=document.getElementById(w.htmlFor);if($){let E=$.getAttribute("disabled");if(E==="true"||E==="")return;let P=$.getAttribute("aria-disabled");if(P==="true"||P==="")return;(M0($)&&($.type==="file"||$.type==="radio"||$.type==="checkbox")||$.role==="radio"||$.role==="checkbox"||$.role==="switch")&&$.click(),$.focus({preventScroll:!0})}}}),d=En({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return u&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in l&&delete l.onClick),rt()({ourProps:h,theirProps:l,slot:d,defaultTag:a?$x:"div",name:o.name||"Label"})}let Tx=Ge(Ax),Ox=Object.assign(Tx,{});function Nx(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 Cx(e=Nx){return x.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function _0(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ix(e,t,n=!1){let[r,o]=x.useState(()=>_0(t));return Ee(()=>{if(!t||!e)return;let s=nt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(c=>{let a=_0(t);return a.width===c.width&&a.height===c.height?c:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var U0=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(U0||{});function Mx(e){let t=x.useRef(null),n=le(o=>{t.current=o.pointerType,!L0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===U0.Left&&(o.preventDefault(),e(o))}),r=le(o=>{t.current!=="mouse"&&(L0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let z0=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 kx=Object.defineProperty,Bx=(e,t,n)=>t in e?kx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lx=(e,t,n)=>(Bx(e,t+"",n),n),H0=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pt=(e,t,n)=>(H0(e,t,"read from private field"),n?n.call(e):t.get(e)),Ec=(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)},W0=(e,t,n,r)=>(H0(e,t,"write to private field"),t.set(e,n),n),jt,Mo,ko;let V0=class{constructor(t){Ec(this,jt,{}),Ec(this,Mo,new z0(()=>new Set)),Ec(this,ko,new Set),Lx(this,"disposables",nt()),W0(this,jt,t),Rt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return pt(this,jt)}subscribe(t,n){if(Rt.isServer)return()=>{};let r={selector:t,callback:n,current:t(pt(this,jt))};return pt(this,ko).add(r),this.disposables.add(()=>{pt(this,ko).delete(r)})}on(t,n){return Rt.isServer?()=>{}:(pt(this,Mo).get(t).add(n),this.disposables.add(()=>{pt(this,Mo).get(t).delete(n)}))}send(t){let n=this.reduce(pt(this,jt),t);if(n!==pt(this,jt)){W0(this,jt,n);for(let r of pt(this,ko)){let o=r.selector(pt(this,jt));G0(r.current,o)||(r.current=o,r.callback(o))}for(let r of pt(this,Mo).get(t.type))r(pt(this,jt),t)}}};jt=new WeakMap,Mo=new WeakMap,ko=new WeakMap;function G0(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:Pc(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Pc(e.entries(),t.entries()):q0(e)&&q0(t)?Pc(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Pc(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 q0(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Sc(e){let[t,n]=e(),r=nt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Fx=Object.defineProperty,Dx=(e,t,n)=>t in e?Fx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Z0=(e,t,n)=>(Dx(e,typeof t!="symbol"?t+"":t,n),n),Y0=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Y0||{});let Rx={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}}},jx=class km extends V0{constructor(){super(...arguments),Z0(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Z0(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new km({stack:[]})}reduce(t,n){return ft(n.type,Rx,t,n)}};const $c=new z0(()=>jx.new());var Ac={exports:{}},Tc={};/**
|
|
109
|
+
`))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...$)=>yc(d(...$),a.className):yc(d,a.className),m=h?{className:h}:{},w=$0(l.props,Sn(wc(a,["ref"])));for(let $ in f)$ in w&&delete f[$];return x.cloneElement(l,Object.assign({},w,f,u,{ref:o(tx(l),u.ref)},m))}return x.createElement(s,Object.assign({},wc(a,["ref"]),!Io(s)&&u,!Io(s)&&f),l)}function J5(){let e=x.useRef([]),t=x.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function ex(...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 $0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function A0(...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 Ge(e){var t;return Object.assign(x.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Sn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function wc(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function tx(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function Io(e){return e===x.Fragment||e===Symbol.for("react.fragment")}function nx(e){return Io(e.type)}function rx(e,t,n){let[r,o]=x.useState(n),s=e!==void 0,i=x.useRef(s),c=x.useRef(!1),a=x.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,le(u=>(s||je.flushSync(()=>o(u)),t==null?void 0:t(u)))]}function ox(e){let[t]=x.useState(e);return t}function T0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))N0(n,O0(t,r),o);return n}function O0(e,t){return e?e+"["+t+"]":t}function N0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())N0(e,O0(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,""]):ix(n)&&!x.isValidElement(n)&&T0(n,t,e)}function sx(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 ix(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let ax="span";var vc=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(vc||{});function cx(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 rt()({ourProps:s,theirProps:o,slot:{},defaultTag:ax,name:"Hidden"})}let C0=Ge(cx),ux=x.createContext(null);function lx({children:e}){let t=x.useContext(ux);if(!t)return x.createElement(x.Fragment,null,e);let{target:n}=t;return n?je.createPortal(x.createElement(x.Fragment,null,e),n):null}function fx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=x.useState(null),c=Gn();return x.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),x.createElement(lx,null,x.createElement(dx,{setForm:i,formId:t}),T0(e).map(([a,u])=>x.createElement(C0,{features:vc.Hidden,...Sn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function dx({setForm:e,formId:t}){return x.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:x.createElement(C0,{features:vc.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let px=x.createContext(void 0);function I0(){return x.useContext(px)}function M0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ds(e){return M0(e)&&"tagName"in e}function on(e){return Ds(e)&&"accessKey"in e}function Pr(e){return Ds(e)&&"tabIndex"in e}function hx(e){return Ds(e)&&"style"in e}function mx(e){return on(e)&&e.nodeName==="IFRAME"}function k0(e){return on(e)&&e.nodeName==="INPUT"}function B0(e){return on(e)&&e.nodeName==="LABEL"}function bx(e){return on(e)&&e.nodeName==="FIELDSET"}function L0(e){return on(e)&&e.nodeName==="LEGEND"}function gx(e){return Ds(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function F0(e){let t=e.parentElement,n=null;for(;t&&!bx(t);)L0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&yx(n)?!1:r}function yx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(L0(t))return!1;t=t.previousElementSibling}return!0}let D0=Symbol();function wx(e,t=!0){return Object.assign(e,{[D0]:t})}function dt(...e){let t=x.useRef(e);x.useEffect(()=>{t.current=e},[e]);let n=le(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[D0]))?void 0:n}let xc=x.createContext(null);xc.displayName="DescriptionContext";function R0(){let e=x.useContext(xc);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,R0),t}return e}function vx(){var e,t;return(t=(e=x.useContext(xc))==null?void 0:e.value)!=null?t:void 0}let xx="p";function Ex(e,t){let n=x.useId(),r=gc(),{id:o=`headlessui-description-${n}`,...s}=e,i=R0(),c=dt(t);Ee(()=>i.register(o),[o,i.register]);let a=En({...i.slot,disabled:r||!1}),u={ref:c,...i.props,id:o};return rt()({ourProps:u,theirProps:s,slot:a,defaultTag:xx,name:i.name||"Description"})}let Px=Ge(Ex);Object.assign(Px,{});var Ce=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ce||{});let Rs=x.createContext(null);Rs.displayName="LabelContext";function j0(){let e=x.useContext(Rs);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,j0),t}return e}function _0(e){var t,n,r;let o=(n=(t=x.useContext(Rs))==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 Sx({inherit:e=!1}={}){let t=_0(),[n,r]=x.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,x.useMemo(()=>function(s){let i=le(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=x.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return x.createElement(Rs.Provider,{value:c},s.children)},[r])]}let $x="label";function Ax(e,t){var n;let r=x.useId(),o=j0(),s=I0(),i=gc(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=dt(t);Ee(()=>o.register(c),[c,o.register]);let p=le(m=>{let w=m.currentTarget;if(!(m.target!==m.currentTarget&&gx(m.target))&&(B0(w)&&m.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(m),B0(w))){let $=document.getElementById(w.htmlFor);if($){let E=$.getAttribute("disabled");if(E==="true"||E==="")return;let P=$.getAttribute("aria-disabled");if(P==="true"||P==="")return;(k0($)&&($.type==="file"||$.type==="radio"||$.type==="checkbox")||$.role==="radio"||$.role==="checkbox"||$.role==="switch")&&$.click(),$.focus({preventScroll:!0})}}}),d=En({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return u&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in l&&delete l.onClick),rt()({ourProps:h,theirProps:l,slot:d,defaultTag:a?$x:"div",name:o.name||"Label"})}let Tx=Ge(Ax),Ox=Object.assign(Tx,{});function Nx(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 Cx(e=Nx){return x.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function U0(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ix(e,t,n=!1){let[r,o]=x.useState(()=>U0(t));return Ee(()=>{if(!t||!e)return;let s=nt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(c=>{let a=U0(t);return a.width===c.width&&a.height===c.height?c:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var z0=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(z0||{});function Mx(e){let t=x.useRef(null),n=le(o=>{t.current=o.pointerType,!F0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===z0.Left&&(o.preventDefault(),e(o))}),r=le(o=>{t.current!=="mouse"&&(F0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let H0=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 kx=Object.defineProperty,Bx=(e,t,n)=>t in e?kx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lx=(e,t,n)=>(Bx(e,t+"",n),n),W0=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pt=(e,t,n)=>(W0(e,t,"read from private field"),n?n.call(e):t.get(e)),Ec=(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)},V0=(e,t,n,r)=>(W0(e,t,"write to private field"),t.set(e,n),n),jt,Mo,ko;let G0=class{constructor(t){Ec(this,jt,{}),Ec(this,Mo,new H0(()=>new Set)),Ec(this,ko,new Set),Lx(this,"disposables",nt()),V0(this,jt,t),Rt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return pt(this,jt)}subscribe(t,n){if(Rt.isServer)return()=>{};let r={selector:t,callback:n,current:t(pt(this,jt))};return pt(this,ko).add(r),this.disposables.add(()=>{pt(this,ko).delete(r)})}on(t,n){return Rt.isServer?()=>{}:(pt(this,Mo).get(t).add(n),this.disposables.add(()=>{pt(this,Mo).get(t).delete(n)}))}send(t){let n=this.reduce(pt(this,jt),t);if(n!==pt(this,jt)){V0(this,jt,n);for(let r of pt(this,ko)){let o=r.selector(pt(this,jt));q0(r.current,o)||(r.current=o,r.callback(o))}for(let r of pt(this,Mo).get(t.type))r(pt(this,jt),t)}}};jt=new WeakMap,Mo=new WeakMap,ko=new WeakMap;function q0(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:Pc(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Pc(e.entries(),t.entries()):Z0(e)&&Z0(t)?Pc(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Pc(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 Z0(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Sc(e){let[t,n]=e(),r=nt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Fx=Object.defineProperty,Dx=(e,t,n)=>t in e?Fx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y0=(e,t,n)=>(Dx(e,typeof t!="symbol"?t+"":t,n),n),K0=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(K0||{});let Rx={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}}},jx=class Bm extends G0{constructor(){super(...arguments),Y0(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Y0(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Bm({stack:[]})}reduce(t,n){return ft(n.type,Rx,t,n)}};const $c=new H0(()=>jx.new());var Ac={exports:{}},Tc={};/**
|
|
110
110
|
* @license React
|
|
111
111
|
* use-sync-external-store-with-selector.production.js
|
|
112
112
|
*
|
|
@@ -114,7 +114,7 @@ ${fg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
114
114
|
*
|
|
115
115
|
* This source code is licensed under the MIT license found in the
|
|
116
116
|
* LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/var
|
|
117
|
+
*/var X0;function _x(){if(X0)return Tc;X0=1;var e=x;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return Tc.useSyncExternalStoreWithSelector=function(a,u,l,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function w(B){if(!$){if($=!0,E=B,B=f(B),p!==void 0&&h.hasValue){var F=h.value;if(p(F,B))return P=F}return P=B}if(F=P,n(E,B))return F;var D=f(B);return p!==void 0&&p(F,D)?(E=B,F):(E=B,P=D)}var $=!1,E,P,N=l===void 0?null:l;return[function(){return w(u())},N===null?void 0:function(){return w(N())}]},[u,l,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},Tc}var Oc={};/**
|
|
118
118
|
* @license React
|
|
119
119
|
* use-sync-external-store-with-selector.development.js
|
|
120
120
|
*
|
|
@@ -122,11 +122,11 @@ ${fg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
122
122
|
*
|
|
123
123
|
* This source code is licensed under the MIT license found in the
|
|
124
124
|
* LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/var X0;function Ux(){return X0||(X0=1,process.env.NODE_ENV!=="production"&&function(){function e(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=x,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Oc.useSyncExternalStoreWithSelector=function(a,u,l,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function w(B){if(!$){if($=!0,E=B,B=f(B),p!==void 0&&h.hasValue){var F=h.value;if(p(F,B))return P=F}return P=B}if(F=P,n(E,B))return F;var D=f(B);return p!==void 0&&p(F,D)?(E=B,F):(E=B,P=D)}var $=!1,E,P,N=l===void 0?null:l;return[function(){return w(u())},N===null?void 0:function(){return w(N())}]},[u,l,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Oc}process.env.NODE_ENV==="production"?Ac.exports=_x():Ac.exports=Ux();var zx=Ac.exports;function qe(e,t,n=G0){return zx.useSyncExternalStoreWithSelector(le(r=>e.subscribe(Hx,r)),le(()=>e.state),le(()=>e.state),le(t),n)}function Hx(e){return e}function Q0(e,t){let n=x.useId(),r=$c.get(t),[o,s]=qe(r,x.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Ee(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Nc=new Map,Bo=new Map;function J0(e){var t;let n=(t=Bo.get(e))!=null?t:0;return Bo.set(e,n+1),n!==0?()=>ep(e):(Nc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>ep(e))}function ep(e){var t;let n=(t=Bo.get(e))!=null?t:1;if(n===1?Bo.delete(e):Bo.set(e,n-1),n!==1)return;let r=Nc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Nc.delete(e))}function Wx(e,{allowed:t,disallowed:n}={}){let r=Q0(e,"inert-others");Ee(()=>{var o,s;if(!r)return;let i=nt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(J0(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=ks(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let f of l.children)c.some(p=>f.contains(p))||i.add(J0(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Vx(e,t,n){let r=qn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});x.useEffect(()=>{if(!e)return;let o=t===null?null:on(t)?t:t.current;if(!o)return;let s=nt();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 Cc=["[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(","),Gx=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ic=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Ic||{}),qx=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(qx||{}),Zx=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Zx||{});function tp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Cc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Yx(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Gx)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Mc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Mc||{});function np(e,t=0){var n;return e===((n=ks(e))==null?void 0:n.body)?!1:ft(t,{0(){return e.matches(Cc)},1(){let r=e;for(;r!==null;){if(r.matches(Cc))return!0;r=r.parentElement}return!1}})}var Kx=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Kx||{});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 Xx=["textarea","input"].join(",");function Qx(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Xx))!=null?n:!1}function rp(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 Jx(e,t,n=e===null?document.body:Bs(e)){return e2(tp(n),t,{relativeTo:e})}function e2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?Bs(e[0]):document:Bs(e),i=Array.isArray(e)?n?rp(e):e:t&64?Yx(e):tp(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,p;do{if(l>=f||l+f<=0)return 0;let d=a+l;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(u),l+=c}while(p!==E0(p));return t&6&&Qx(p)&&p.select(),2}function op(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function t2(){return/Android/gi.test(window.navigator.userAgent)}function sp(){return op()||t2()}function Sr(e,t,n,r){let o=qn(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function n2(e,t,n,r){let o=qn(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const ip=30;function r2(e,t,n){let r=qn(n),o=x.useCallback(function(c,a){if(c.defaultPrevented)return;let u=a(c);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let l=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of l)if(f!==null&&(f.contains(u)||c.composed&&c.composedPath().includes(f)))return;return!np(u,Mc.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=x.useRef(null);Sr(e,"pointerdown",c=>{var a,u;sp()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),Sr(e,"pointerup",c=>{if(sp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=x.useRef({x:0,y:0});Sr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Sr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=ip||Math.abs(a.y-i.current.y)>=ip))return o(c,()=>Pr(c.target)?c.target:null)},!0),n2(e,"blur",c=>o(c,()=>mx(window.document.activeElement)?window.document.activeElement:null),!0)}function kc(...e){return x.useMemo(()=>ks(...e),[...e])}var o2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(o2||{});const js={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},s2=200,ap=5;function i2(e,{trigger:t,action:n,close:r,select:o}){let s=x.useRef(null),i=x.useRef(null),c=x.useRef(null);Sr(e&&t!==null,"pointerdown",a=>{I0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Sr(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Pr(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<ap&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<ap)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>s2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function a2(e,t){return x.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function c2(e){return x.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function u2(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function 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 op()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=nt();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(Pr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Pr(l)&&!r(l)&&(i=l)}catch{}},!0),t.group(c=>{t.addEventListener(e,"touchstart",a=>{if(c.dispose(),Pr(a.target)&&hx(a.target))if(r(a.target)){let u=a.target;for(;u.parentElement&&r(u.parentElement);)u=u.parentElement;c.style(u,"overscrollBehavior","contain")}else c.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",c=>{if(Pr(c.target)){if(M0(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function d2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function cp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Zn=u2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:nt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=cp(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=cp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[f2(),l2(),d2()];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)}});Zn.subscribe(()=>{let e=Zn.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)&&Zn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Zn.dispatch("TEARDOWN",n)}});function p2(e,t,n=()=>({containers:[]})){let r=c2(Zn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Ee(()=>{if(!(!t||!e))return Zn.dispatch("PUSH",t,n),()=>Zn.dispatch("POP",t,n)},[e,t]),s}function h2(e,t,n=()=>[document.body]){let r=Q0(e,"scroll-lock");p2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function up(e){return[e.screenX,e.screenY]}function m2(){let e=x.useRef([-1,-1]);return{wasMoved(t){let n=up(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=up(t)}}}function b2(e=0){let[t,n]=x.useState(e),r=x.useCallback(a=>n(a),[]),o=x.useCallback(a=>n(u=>u|a),[]),s=x.useCallback(a=>(t&a)===a,[t]),i=x.useCallback(a=>n(u=>u&~a),[]),c=x.useCallback(a=>n(u=>u^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var lp,fp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((lp=process==null?void 0:process.env)==null?void 0:lp.NODE_ENV)==="test"&&typeof((fp=Element==null?void 0:Element.prototype)==null?void 0:fp.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(`
|
|
126
|
-
`)),[]});var g2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(g2||{});function
|
|
125
|
+
*/var Q0;function Ux(){return Q0||(Q0=1,process.env.NODE_ENV!=="production"&&function(){function e(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=x,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Oc.useSyncExternalStoreWithSelector=function(a,u,l,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function w(B){if(!$){if($=!0,E=B,B=f(B),p!==void 0&&h.hasValue){var F=h.value;if(p(F,B))return P=F}return P=B}if(F=P,n(E,B))return F;var D=f(B);return p!==void 0&&p(F,D)?(E=B,F):(E=B,P=D)}var $=!1,E,P,N=l===void 0?null:l;return[function(){return w(u())},N===null?void 0:function(){return w(N())}]},[u,l,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Oc}process.env.NODE_ENV==="production"?Ac.exports=_x():Ac.exports=Ux();var zx=Ac.exports;function qe(e,t,n=q0){return zx.useSyncExternalStoreWithSelector(le(r=>e.subscribe(Hx,r)),le(()=>e.state),le(()=>e.state),le(t),n)}function Hx(e){return e}function J0(e,t){let n=x.useId(),r=$c.get(t),[o,s]=qe(r,x.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Ee(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Nc=new Map,Bo=new Map;function ep(e){var t;let n=(t=Bo.get(e))!=null?t:0;return Bo.set(e,n+1),n!==0?()=>tp(e):(Nc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>tp(e))}function tp(e){var t;let n=(t=Bo.get(e))!=null?t:1;if(n===1?Bo.delete(e):Bo.set(e,n-1),n!==1)return;let r=Nc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Nc.delete(e))}function Wx(e,{allowed:t,disallowed:n}={}){let r=J0(e,"inert-others");Ee(()=>{var o,s;if(!r)return;let i=nt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(ep(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=ks(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let f of l.children)c.some(p=>f.contains(p))||i.add(ep(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Vx(e,t,n){let r=qn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});x.useEffect(()=>{if(!e)return;let o=t===null?null:on(t)?t:t.current;if(!o)return;let s=nt();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 Cc=["[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(","),Gx=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ic=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Ic||{}),qx=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(qx||{}),Zx=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Zx||{});function np(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Cc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Yx(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Gx)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Mc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Mc||{});function rp(e,t=0){var n;return e===((n=ks(e))==null?void 0:n.body)?!1:ft(t,{0(){return e.matches(Cc)},1(){let r=e;for(;r!==null;){if(r.matches(Cc))return!0;r=r.parentElement}return!1}})}var Kx=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Kx||{});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 Xx=["textarea","input"].join(",");function Qx(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Xx))!=null?n:!1}function op(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 Jx(e,t,n=e===null?document.body:Bs(e)){return e2(np(n),t,{relativeTo:e})}function e2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?Bs(e[0]):document:Bs(e),i=Array.isArray(e)?n?op(e):e:t&64?Yx(e):np(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,p;do{if(l>=f||l+f<=0)return 0;let d=a+l;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(u),l+=c}while(p!==P0(p));return t&6&&Qx(p)&&p.select(),2}function sp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function t2(){return/Android/gi.test(window.navigator.userAgent)}function ip(){return sp()||t2()}function Sr(e,t,n,r){let o=qn(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function n2(e,t,n,r){let o=qn(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const ap=30;function r2(e,t,n){let r=qn(n),o=x.useCallback(function(c,a){if(c.defaultPrevented)return;let u=a(c);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let l=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of l)if(f!==null&&(f.contains(u)||c.composed&&c.composedPath().includes(f)))return;return!rp(u,Mc.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=x.useRef(null);Sr(e,"pointerdown",c=>{var a,u;ip()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),Sr(e,"pointerup",c=>{if(ip()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=x.useRef({x:0,y:0});Sr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Sr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=ap||Math.abs(a.y-i.current.y)>=ap))return o(c,()=>Pr(c.target)?c.target:null)},!0),n2(e,"blur",c=>o(c,()=>mx(window.document.activeElement)?window.document.activeElement:null),!0)}function kc(...e){return x.useMemo(()=>ks(...e),[...e])}var o2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(o2||{});const js={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},s2=200,cp=5;function i2(e,{trigger:t,action:n,close:r,select:o}){let s=x.useRef(null),i=x.useRef(null),c=x.useRef(null);Sr(e&&t!==null,"pointerdown",a=>{M0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Sr(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Pr(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<cp&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<cp)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>s2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function a2(e,t){return x.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function c2(e){return x.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function u2(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function 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 sp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=nt();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(Pr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Pr(l)&&!r(l)&&(i=l)}catch{}},!0),t.group(c=>{t.addEventListener(e,"touchstart",a=>{if(c.dispose(),Pr(a.target)&&hx(a.target))if(r(a.target)){let u=a.target;for(;u.parentElement&&r(u.parentElement);)u=u.parentElement;c.style(u,"overscrollBehavior","contain")}else c.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",c=>{if(Pr(c.target)){if(k0(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function d2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function up(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Zn=u2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:nt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=up(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=up(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[f2(),l2(),d2()];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)}});Zn.subscribe(()=>{let e=Zn.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)&&Zn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Zn.dispatch("TEARDOWN",n)}});function p2(e,t,n=()=>({containers:[]})){let r=c2(Zn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Ee(()=>{if(!(!t||!e))return Zn.dispatch("PUSH",t,n),()=>Zn.dispatch("POP",t,n)},[e,t]),s}function h2(e,t,n=()=>[document.body]){let r=J0(e,"scroll-lock");p2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function lp(e){return[e.screenX,e.screenY]}function m2(){let e=x.useRef([-1,-1]);return{wasMoved(t){let n=lp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=lp(t)}}}function b2(e=0){let[t,n]=x.useState(e),r=x.useCallback(a=>n(a),[]),o=x.useCallback(a=>n(u=>u|a),[]),s=x.useCallback(a=>(t&a)===a,[t]),i=x.useCallback(a=>n(u=>u&~a),[]),c=x.useCallback(a=>n(u=>u^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var fp,dp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((fp=process==null?void 0:process.env)==null?void 0:fp.NODE_ENV)==="test"&&typeof((dp=Element==null?void 0:Element.prototype)==null?void 0:dp.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(`
|
|
126
|
+
`)),[]});var g2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(g2||{});function pp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function hp(e,t,n,r){let[o,s]=x.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=b2(e&&o?3:0),u=x.useRef(!1),l=x.useRef(!1),f=Gn();return Ee(()=>{var p;if(e){if(n&&s(!0),!t){n&&c(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),y2(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;l.current&&x2(t)||(u.current=!1,a(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function y2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=nt();return v2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(w2(e,r))})}),s.dispose}function w2(e,t){var n,r;let o=nt();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(c=>c instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(c=>c.finished)).then(()=>{s||t()}),o.dispose)}function v2(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 x2(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 _s(){return typeof window<"u"}function $r(e){return Bc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ze(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _t(e){var t;return(t=(Bc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bc(e){return _s()?e instanceof Node||e instanceof Ze(e).Node:!1}function fe(e){return _s()?e instanceof Element||e instanceof Ze(e).Element:!1}function De(e){return _s()?e instanceof HTMLElement||e instanceof Ze(e).HTMLElement:!1}function Lc(e){return!_s()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ze(e).ShadowRoot}const E2=new Set(["inline","contents"]);function Lo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ht(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!E2.has(o)}const P2=new Set(["table","td","th"]);function S2(e){return P2.has($r(e))}const $2=[":popover-open",":modal"];function Us(e){return $2.some(t=>{try{return e.matches(t)}catch{return!1}})}const A2=["transform","translate","scale","rotate","perspective"],T2=["transform","translate","scale","rotate","perspective","filter"],O2=["paint","layout","strict","content"];function Fc(e){const t=zs(),n=fe(e)?ht(e):e;return A2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||T2.some(r=>(n.willChange||"").includes(r))||O2.some(r=>(n.contain||"").includes(r))}function N2(e){let t=an(e);for(;De(t)&&!sn(t);){if(Fc(t))return t;if(Us(t))return null;t=an(t)}return null}function zs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const C2=new Set(["html","body","#document"]);function sn(e){return C2.has($r(e))}function ht(e){return Ze(e).getComputedStyle(e)}function Hs(e){return fe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function an(e){if($r(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Lc(e)&&e.host||_t(e);return Lc(t)?t.host:t}function mp(e){const t=an(e);return sn(t)?e.ownerDocument?e.ownerDocument.body:e.body:De(t)&&Lo(t)?t:mp(t)}function $n(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=mp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ze(o);if(s){const c=Dc(i);return t.concat(i,i.visualViewport||[],Lo(o)?o:[],c&&n?$n(c):[])}return t.concat(o,$n(o,[],n))}function Dc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function I2(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const cn=Math.min,ke=Math.max,Fo=Math.round,Ws=Math.floor,Ut=e=>({x:e,y:e}),M2={left:"right",right:"left",bottom:"top",top:"bottom"},k2={start:"end",end:"start"};function Rc(e,t,n){return ke(e,cn(t,n))}function Yn(e,t){return typeof e=="function"?e(t):e}function An(e){return e.split("-")[0]}function Ar(e){return e.split("-")[1]}function bp(e){return e==="x"?"y":"x"}function jc(e){return e==="y"?"height":"width"}const B2=new Set(["top","bottom"]);function un(e){return B2.has(An(e))?"y":"x"}function _c(e){return bp(un(e))}function L2(e,t,n){n===void 0&&(n=!1);const r=Ar(e),o=_c(e),s=jc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Vs(i)),[i,Vs(i)]}function F2(e){const t=Vs(e);return[Uc(e),t,Uc(t)]}function Uc(e){return e.replace(/start|end/g,t=>k2[t])}const gp=["left","right"],yp=["right","left"],D2=["top","bottom"],R2=["bottom","top"];function j2(e,t,n){switch(e){case"top":case"bottom":return n?t?yp:gp:t?gp:yp;case"left":case"right":return t?D2:R2;default:return[]}}function _2(e,t,n,r){const o=Ar(e);let s=j2(An(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Uc)))),s}function Vs(e){return e.replace(/left|right|bottom|top/g,t=>M2[t])}function U2(e){return{top:0,right:0,bottom:0,left:0,...e}}function wp(e){return typeof e!="number"?U2(e):{top:e,right:e,bottom:e,left:e}}function Gs(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}}/*!
|
|
127
127
|
* tabbable 6.3.0
|
|
128
128
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
129
|
-
*/var z2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],zc=z2.join(","),wp=typeof Element>"u",Do=wp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qs=!wp&&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},Ro=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&&Ro(t.parentNode);return i},H2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},W2=function(t,n,r){if(Ro(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(zc));return n&&Do.call(t,zc)&&o.unshift(t),o=o.filter(r),o},Hc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Ro(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=Hc(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=Do.call(i,zc);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Ro(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=Hc(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},vp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},xp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||H2(t))&&!vp(t)?0:t.tabIndex},V2=function(t,n){var r=xp(t);return r<0&&n&&!vp(t)?0:r},G2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Ep=function(t){return t.tagName==="INPUT"},q2=function(t){return Ep(t)&&t.type==="hidden"},Z2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Y2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},K2=function(t){if(!t.name)return!0;var n=t.form||qs(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Y2(o,t.form);return!s||s===t},X2=function(t){return Ep(t)&&t.type==="radio"},Q2=function(t){return X2(t)&&!K2(t)},J2=function(t){var n,r=t&&qs(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,f;r=qs(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Pp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},eE=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=Do.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(Do.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var u=t.parentElement,l=qs(t);if(u&&!u.shadowRoot&&o(u)===!0)return Pp(t);t.assignedSlot?t=t.assignedSlot:!u&&l!==t.ownerDocument?t=l.host:t=u}t=a}if(J2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Pp(t);return!1},tE=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 Do.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},nE=function(t,n){return!(n.disabled||Ro(n)||q2(n)||eE(n,t)||Z2(n)||tE(n))},Sp=function(t,n){return!(Q2(n)||xp(n)<0||!nE(t,n))},rE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},$p=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=V2(c,i),u=i?$p(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(G2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Ap=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hc([t],n.includeContainer,{filter:Sp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:rE}):r=W2(t,n.includeContainer,Sp.bind(null,n)),$p(r)};function Tp(e,t,n){let{reference:r,floating:o}=e;const s=un(t),i=_c(t),c=jc(i),a=An(t),u=s==="y",l=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:l,y:r.y-o.height};break;case"bottom":d={x:l,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Ar(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const oE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:f}=Tp(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:w,fn:$}=c[m],{x:E,y:P,data:N,reset:B}=await $({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=E??l,f=P??f,d={...d,[w]:{...d[w],...N}},B&&h<=50&&(h++,typeof B=="object"&&(B.placement&&(p=B.placement),B.rects&&(u=B.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):B.rects),{x:l,y:f}=Tp(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function Zs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Yn(t,e),h=yp(d),w=c[p?f==="floating"?"reference":"floating":f],$=Gs(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(c.floating)),boundary:u,rootBoundary:l,strategy:a})),E=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),N=await(s.isElement==null?void 0:s.isElement(P))?await(s.getScale==null?void 0:s.getScale(P))||{x:1,y:1}:{x:1,y:1},B=Gs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:P,strategy:a}):E);return{top:($.top-B.top+h.top)/N.y,bottom:(B.bottom-$.bottom+h.bottom)/N.y,left:($.left-B.left+h.left)/N.x,right:(B.right-$.right+h.right)/N.x}}const sE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=Yn(e,t)||{};if(u==null)return{};const f=yp(l),p={x:n,y:r},d=_c(o),h=jc(d),m=await i.getDimensions(u),w=d==="y",$=w?"top":"left",E=w?"bottom":"right",P=w?"clientHeight":"clientWidth",N=s.reference[h]+s.reference[d]-p[d]-s.floating[h],B=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let D=F?F[P]:0;(!D||!await(i.isElement==null?void 0:i.isElement(F)))&&(D=c.floating[P]||s.floating[h]);const b=N/2-B/2,g=D/2-m[h]/2-1,v=cn(f[$],g),C=cn(f[E],g),O=v,I=D-m[h]-C,M=D/2-m[h]/2+b,y=Rc(O,M,I),T=!a.arrow&&Ar(o)!=null&&M!==y&&s.reference[h]/2-(M<O?v:C)-m[h]/2<0,A=T?M<O?M-O:M-I:0;return{[d]:p[d]+A,data:{[d]:y,centerOffset:M-y-A,...T&&{alignmentOffset:A}},reset:T}}}),iE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...w}=Yn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const $=An(o),E=un(c),P=An(c)===c,N=await(a.isRTL==null?void 0:a.isRTL(u.floating)),B=p||(P||!m?[Vs(c)]:F2(c)),F=h!=="none";!p&&F&&B.push(..._2(c,m,h,N));const D=[c,...B],b=await Zs(t,w),g=[];let v=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&g.push(b[$]),f){const M=L2(o,i,N);g.push(b[M[0]],b[M[1]])}if(v=[...v,{placement:o,overflows:g}],!g.every(M=>M<=0)){var C,O;const M=(((C=s.flip)==null?void 0:C.index)||0)+1,y=D[M];if(y&&(!(f==="alignment"?E!==un(y):!1)||v.every(S=>un(S.placement)===E?S.overflows[0]>0:!0)))return{data:{index:M,overflows:v},reset:{placement:y}};let T=(O=v.filter(A=>A.overflows[0]<=0).sort((A,S)=>A.overflows[1]-S.overflows[1])[0])==null?void 0:O.placement;if(!T)switch(d){case"bestFit":{var I;const A=(I=v.filter(S=>{if(F){const L=un(S.placement);return L===E||L==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(L=>L>0).reduce((L,j)=>L+j,0)]).sort((S,L)=>S[1]-L[1])[0])==null?void 0:I[0];A&&(T=A);break}case"initialPlacement":T=c;break}if(o!==T)return{reset:{placement:T}}}return{}}}},aE=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=An(n),c=Ar(n),a=un(n)==="y",u=aE.has(i)?-1:1,l=s&&a?-1:1,f=Yn(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*l,y:p*u}:{x:p*u,y:d*l}}const uE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await cE(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},lE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:$,y:E}=w;return{x:$,y:E}}},...a}=Yn(e,t),u={x:n,y:r},l=await Zs(t,a),f=un(An(o)),p=mp(f);let d=u[p],h=u[f];if(s){const w=p==="y"?"top":"left",$=p==="y"?"bottom":"right",E=d+l[w],P=d-l[$];d=Rc(E,d,P)}if(i){const w=f==="y"?"top":"left",$=f==="y"?"bottom":"right",E=h+l[w],P=h-l[$];h=Rc(E,h,P)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},fE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...u}=Yn(e,t),l=await Zs(t,u),f=An(o),p=Ar(o),d=un(o)==="y",{width:h,height:m}=s.floating;let w,$;f==="top"||f==="bottom"?(w=f,$=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):($=f,w=p==="end"?"top":"bottom");const E=m-l.top-l.bottom,P=h-l.left-l.right,N=cn(m-l[w],E),B=cn(h-l[$],P),F=!t.middlewareData.shift;let D=N,b=B;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=P),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=E),F&&!p){const v=ke(l.left,0),C=ke(l.right,0),O=ke(l.top,0),I=ke(l.bottom,0);d?b=h-2*(v!==0||C!==0?v+C:ke(l.left,l.right)):D=m-2*(O!==0||I!==0?O+I:ke(l.top,l.bottom))}await a({...t,availableWidth:b,availableHeight:D});const g=await i.getDimensions(c.floating);return h!==g.width||m!==g.height?{reset:{rects:!0}}:{}}}};function Op(e){const t=ht(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=De(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Fo(n)!==s||Fo(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Wc(e){return fe(e)?e:e.contextElement}function Tr(e){const t=Wc(e);if(!De(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Op(t);let i=(s?Fo(n.width):n.width)/r,c=(s?Fo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const dE=Ut(0);function Np(e){const t=Ze(e);return!zs()||!t.visualViewport?dE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ze(e)?!1:t}function Kn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Wc(e);let i=Ut(1);t&&(r?fe(r)&&(i=Tr(r)):i=Tr(e));const c=pE(s,n,r)?Np(s):Ut(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,f=o.height/i.y;if(s){const p=Ze(s),d=r&&fe(r)?Ze(r):r;let h=p,m=Dc(h);for(;m&&r&&d!==h;){const w=Tr(m),$=m.getBoundingClientRect(),E=ht(m),P=$.left+(m.clientLeft+parseFloat(E.paddingLeft))*w.x,N=$.top+(m.clientTop+parseFloat(E.paddingTop))*w.y;a*=w.x,u*=w.y,l*=w.x,f*=w.y,a+=P,u+=N,h=Ze(m),m=Dc(h)}}return Gs({width:l,height:f,x:a,y:u})}function Ys(e,t){const n=Hs(e).scrollLeft;return t?t.left+n:Kn(_t(e)).left+n}function Cp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ys(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function hE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=_t(r),c=t?Us(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Ut(1);const l=Ut(0),f=De(r);if((f||!f&&!s)&&(($r(r)!=="body"||Lo(i))&&(a=Hs(r)),De(r))){const d=Kn(r);u=Tr(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?Cp(i,a):Ut(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-a.scrollTop*u.y+l.y+p.y}}function mE(e){return Array.from(e.getClientRects())}function bE(e){const t=_t(e),n=Hs(e),r=e.ownerDocument.body,o=ke(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ke(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ys(e);const c=-n.scrollTop;return ht(r).direction==="rtl"&&(i+=ke(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Ip=25;function gE(e,t){const n=Ze(e),r=_t(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=zs();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Ys(r);if(u<=0){const l=r.ownerDocument,f=l.body,p=getComputedStyle(f),d=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Ip&&(s-=h)}else u<=Ip&&(s+=u);return{width:s,height:i,x:c,y:a}}const yE=new Set(["absolute","fixed"]);function wE(e,t){const n=Kn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=De(e)?Tr(e):Ut(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:i,height:c,x:a,y:u}}function Mp(e,t,n){let r;if(t==="viewport")r=gE(e,n);else if(t==="document")r=bE(_t(e));else if(fe(t))r=wE(t,n);else{const o=Np(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Gs(r)}function kp(e,t){const n=an(e);return n===t||!fe(n)||sn(n)?!1:ht(n).position==="fixed"||kp(n,t)}function vE(e,t){const n=t.get(e);if(n)return n;let r=$n(e,[],!1).filter(c=>fe(c)&&$r(c)!=="body"),o=null;const s=ht(e).position==="fixed";let i=s?an(e):e;for(;fe(i)&&!sn(i);){const c=ht(i),a=Fc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&yE.has(o.position)||Lo(i)&&!a&&kp(e,i))?r=r.filter(l=>l!==i):o=c,i=an(i)}return t.set(e,r),r}function xE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Us(t)?[]:vE(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Mp(t,l,o);return u.top=ke(f.top,u.top),u.right=cn(f.right,u.right),u.bottom=cn(f.bottom,u.bottom),u.left=ke(f.left,u.left),u},Mp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function EE(e){const{width:t,height:n}=Op(e);return{width:t,height:n}}function PE(e,t,n){const r=De(t),o=_t(t),s=n==="fixed",i=Kn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ut(0);function u(){a.x=Ys(o)}if(r||!r&&!s)if(($r(t)!=="body"||Lo(o))&&(c=Hs(t)),r){const d=Kn(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?Cp(o,c):Ut(0),f=i.left+c.scrollLeft-a.x-l.x,p=i.top+c.scrollTop-a.y-l.y;return{x:f,y:p,width:i.width,height:i.height}}function Vc(e){return ht(e).position==="static"}function Bp(e,t){if(!De(e)||ht(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return _t(e)===n&&(n=n.ownerDocument.body),n}function Lp(e,t){const n=Ze(e);if(Us(e))return n;if(!De(e)){let o=an(e);for(;o&&!sn(o);){if(fe(o)&&!Vc(o))return o;o=an(o)}return n}let r=Bp(e,t);for(;r&&S2(r)&&Vc(r);)r=Bp(r,t);return r&&sn(r)&&Vc(r)&&!Fc(r)?n:r||N2(e)||n}const SE=async function(e){const t=this.getOffsetParent||Lp,n=this.getDimensions,r=await n(e.floating);return{reference:PE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $E(e){return ht(e).direction==="rtl"}const AE={convertOffsetParentRelativeRectToViewportRelativeRect:hE,getDocumentElement:_t,getClippingRect:xE,getOffsetParent:Lp,getElementRects:SE,getClientRects:mE,getDimensions:EE,getScale:Tr,isElement:fe,isRTL:$E};function Fp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function TE(e,t){let n=null,r;const o=_t(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:f,width:p,height:d}=u;if(c||t(),!p||!d)return;const h=Ws(f),m=Ws(o.clientWidth-(l+p)),w=Ws(o.clientHeight-(f+d)),$=Ws(l),P={rootMargin:-h+"px "+-m+"px "+-w+"px "+-$+"px",threshold:ke(0,cn(1,a))||1};let N=!0;function B(F){const D=F[0].intersectionRatio;if(D!==a){if(!N)return i();D?i(!1,D):r=setTimeout(()=>{i(!1,1e-7)},1e3)}D===1&&!Fp(u,e.getBoundingClientRect())&&i(),N=!1}try{n=new IntersectionObserver(B,{...P,root:o.ownerDocument})}catch{n=new IntersectionObserver(B,P)}n.observe(e)}return i(!0),s}function Dp(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Wc(e),l=o||s?[...u?$n(u):[],...$n(t)]:[];l.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),s&&$.addEventListener("resize",n)});const f=u&&c?TE(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver($=>{let[E]=$;E&&E.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=d)==null||P.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?Kn(e):null;a&&w();function w(){const $=Kn(e);m&&!Fp(m,$)&&n(),m=$,h=requestAnimationFrame(w)}return n(),()=>{var $;l.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),f==null||f(),($=d)==null||$.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const Gc=Zs,OE=uE,NE=lE,CE=iE,IE=fE,Rp=sE,ME=(e,t,n)=>{const r=new Map,o={platform:AE,...n},s={...o.platform,_c:r};return oE(e,t,{...o,platform:s})};var kE=typeof document<"u",BE=function(){},Ks=kE?x.useLayoutEffect:BE;function Xs(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(!Xs(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)&&!Xs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function jp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _p(e,t){const n=jp(e);return Math.round(t*n)/n}function qc(e){const t=U.useRef(e);return Ks(()=>{t.current=e}),t}function Up(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=U.useState(r);Xs(p,r)||d(r);const[h,m]=U.useState(null),[w,$]=U.useState(null),E=U.useCallback(S=>{S!==F.current&&(F.current=S,m(S))},[]),P=U.useCallback(S=>{S!==D.current&&(D.current=S,$(S))},[]),N=s||h,B=i||w,F=U.useRef(null),D=U.useRef(null),b=U.useRef(l),g=a!=null,v=qc(a),C=qc(o),O=qc(u),I=U.useCallback(()=>{if(!F.current||!D.current)return;const S={placement:t,strategy:n,middleware:p};C.current&&(S.platform=C.current),ME(F.current,D.current,S).then(L=>{const j={...L,isPositioned:O.current!==!1};M.current&&!Xs(b.current,j)&&(b.current=j,Br.flushSync(()=>{f(j)}))})},[p,t,n,C,O]);Ks(()=>{u===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,f(S=>({...S,isPositioned:!1})))},[u]);const M=U.useRef(!1);Ks(()=>(M.current=!0,()=>{M.current=!1}),[]),Ks(()=>{if(N&&(F.current=N),B&&(D.current=B),N&&B){if(v.current)return v.current(N,B,I);I()}},[N,B,I,v,g]);const y=U.useMemo(()=>({reference:F,floating:D,setReference:E,setFloating:P}),[E,P]),T=U.useMemo(()=>({reference:N,floating:B}),[N,B]),A=U.useMemo(()=>{const S={position:n,left:0,top:0};if(!T.floating)return S;const L=_p(T.floating,l.x),j=_p(T.floating,l.y);return c?{...S,transform:"translate("+L+"px, "+j+"px)",...jp(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:j}},[n,c,T.floating,l.x,l.y]);return U.useMemo(()=>({...l,update:I,refs:y,elements:T,floatingStyles:A}),[l,I,y,T,A])}const LE=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?Rp({element:r.current,padding:o}).fn(n):{}:r?Rp({element:r,padding:o}).fn(n):{}}}},Zc=(e,t)=>({...OE(e),options:[e,t]}),zp=(e,t)=>({...NE(e),options:[e,t]}),Hp=(e,t)=>({...CE(e),options:[e,t]}),FE=(e,t)=>({...IE(e),options:[e,t]}),DE=(e,t)=>({...LE(e),options:[e,t]}),Wp={...U},RE=Wp.useInsertionEffect||(e=>e());function Vp(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return RE(()=>{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 Yc=typeof document<"u"?x.useLayoutEffect:x.useEffect;let Gp=!1,jE=0;const qp=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+jE++;function _E(){const[e,t]=U.useState(()=>Gp?qp():void 0);return Yc(()=>{e==null&&t(qp())},[]),U.useEffect(()=>{Gp=!0},[]),e}const UE=Wp.useId||_E;let jo;process.env.NODE_ENV!=="production"&&(jo=new Set);function zE(){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=jo)!=null&&e.has(o))){var s;(s=jo)==null||s.add(o),console.warn(o)}}function HE(){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=jo)!=null&&e.has(o))){var s;(s=jo)==null||s.add(o),console.error(o)}}function WE(){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 VE=U.createContext(null),GE=U.createContext(null),qE=()=>{var e;return((e=U.useContext(VE))==null?void 0:e.id)||null},ZE=()=>U.useContext(GE),YE="data-floating-ui-focusable";function KE(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=UE(),s=U.useRef({}),[i]=U.useState(()=>WE()),c=qE()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&HE("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=Vp((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function XE(e){e===void 0&&(e={});const{nodeId:t}=e,n=KE({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=ZE();Yc(()=>{l&&(f.current=l)},[l]);const d=Up({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(P=>{const N=fe(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;a(N),d.refs.setReference(N)},[d.refs]),m=U.useCallback(P=>{(fe(P)||P===null)&&(f.current=P,i(P)),(fe(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!fe(P))&&d.refs.setReference(P)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),$=U.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),E=U.useMemo(()=>({...d,...r,refs:w,elements:$,nodeId:t}),[d,w,$,t,r]);return Yc(()=>{r.dataRef.current.floatingContext=E;const P=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);P&&(P.context=E)}),U.useMemo(()=>({...d,context:E,refs:w,elements:$}),[d,w,$,E])}const Zp="active",Yp="selected";function Kc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Zp]:i,[Yp]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[YE]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Zp,Yp].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function QE(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>Kc(c,e,"reference"),t),s=U.useCallback(c=>Kc(c,e,"floating"),n),i=U.useCallback(c=>Kc(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Kp(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const JE=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Yn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(u==null?void 0:u.current)||p,m=p.clientTop||h.clientTop,w=p.clientTop!==0,$=h.clientTop!==0,E=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||zE('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const P={...t,...await Zc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},N=await Gc(Kp(P,h.scrollHeight+m+p.clientTop),l),B=await Gc(P,{...l,elementContext:"reference"}),F=ke(0,N.top),D=P.y+F,v=(h.scrollHeight>h.clientHeight?C=>C:Fo)(ke(0,h.scrollHeight+(w&&E||$?m*2:0)-F-ke(0,N.bottom)));if(h.style.maxHeight=v+"px",h.scrollTop=F,o){const C=h.offsetHeight<d.offsetHeight*cn(c,n.current.length)-1||B.top>=-a||B.bottom>=-a;Br.flushSync(()=>o(C))}return r&&(r.current=await Gc(Kp({...P,y:D},h.offsetHeight+m+p.clientTop),l)),{y:D}}});function e8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Vp(c),u=U.useRef(!1),l=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const w=m.deltaY,$=s.current.top>=-.5,E=s.current.bottom>=-.5,P=h.scrollHeight-h.clientHeight,N=w<0?-1:1,B=w<0?"max":"min";h.scrollHeight<=h.clientHeight||(!$&&w>0||!E&&w<0?(m.preventDefault(),Br.flushSync(()=>{a(F=>F+Math[B](w,P*N))})):/firefox/i.test(I2())&&(h.scrollTop+=w))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{l.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=U.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!u.current)){if(l.current!==null){const h=d.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Br.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let Or=x.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Or.displayName="FloatingContext";let Xc=x.createContext(null);Xc.displayName="PlacementContext";function t8(e){return x.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function n8(){return x.useContext(Or).setReference}function r8(){return x.useContext(Or).getReferenceProps}function o8(){let{getFloatingProps:e,slot:t}=x.useContext(Or);return x.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function s8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=x.useContext(Xc),n=x.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Ee(()=>{t==null||t(n??null)},[t,n]);let r=x.useContext(Or);return x.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Xp=4;function i8({children:e,enabled:t=!0}){let[n,r]=x.useState(null),[o,s]=x.useState(0),i=x.useRef(null),[c,a]=x.useState(null);a8(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=c8(n,c),[m,w="center"]=l.split(" ");Ee(()=>{u&&s(0)},[u]);let{refs:$,floatingStyles:E,context:P}=XE({open:u,placement:m==="selection"?w==="center"?"bottom":`bottom-${w}`:w==="center"?`${m}`:`${m}-${w}`,strategy:"absolute",transform:!1,middleware:[Zc({mainAxis:m==="selection"?0:f,crossAxis:p}),zp({padding:d}),m!=="selection"&&Hp({padding:d}),m==="selection"&&h?JE({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:Xp,referenceOverflowThreshold:d,onFallbackChange(C){var O,I;if(!C)return;let M=P.elements.floating;if(!M)return;let y=parseFloat(getComputedStyle(M).scrollPaddingBottom)||0,T=Math.min(Xp,M.childElementCount),A=0,S=0;for(let L of(I=(O=P.elements.floating)==null?void 0:O.childNodes)!=null?I:[])if(on(L)){let j=L.offsetTop,z=j+L.clientHeight+y,_=M.scrollTop,W=_+M.clientHeight;if(j>=_&&z<=W)T--;else{S=Math.max(0,Math.min(z,W)-Math.max(j,_)),A=L.clientHeight;break}}T>=1&&s(L=>{let j=A*T-S+y;return L>=j?L:j})}}):null,FE({padding:d,apply({availableWidth:C,availableHeight:O,elements:I}){Object.assign(I.floating.style,{overflow:"auto",maxWidth:`${C}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${O}px)`})}})].filter(Boolean),whileElementsMounted:Dp}),[N=m,B=w]=P.placement.split("-");m==="selection"&&(N="selection");let F=x.useMemo(()=>({anchor:[N,B].filter(Boolean).join(" ")}),[N,B]),D=e8(P,{overflowRef:i,onChange:s}),{getReferenceProps:b,getFloatingProps:g}=QE([D]),v=le(C=>{a(C),$.setFloating(C)});return U.createElement(Xc.Provider,{value:r},U.createElement(Or.Provider,{value:{setFloating:v,setReference:$.setReference,styles:E,getReferenceProps:b,getFloatingProps:g,slot:F}},e))}function a8(e){Ee(()=>{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 c8(e,t){var n,r,o;let s=Qc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Qc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Qc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Qc(e,t,n=void 0){let r=Gn(),o=le((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=Jp(a,u);return[l,f=>{let p=Qp(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[$,E]of p.entries()){let P=window.getComputedStyle(u).getPropertyValue(E);if(d[$]!==P){d[$]=P,m=!0;break}}if(!m)return;let w=Jp(a,u);l!==w&&(f(w),l=w)})}return r.dispose}]}return[n,null]}),s=x.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=x.useState();return Ee(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Qp(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,...Qp(o)]:[r]}return[]}function Jp(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 u8({children:e,freeze:t},n){let r=eh(t,e);return x.isValidElement(r)?x.cloneElement(r,{ref:n}):x.createElement(x.Fragment,null,r)}x.forwardRef(u8);function eh(e,t){let[n,r]=x.useState(t);return!e&&n!==t&&r(t),e?n:t}let Jc=x.createContext(null);Jc.displayName="OpenClosedContext";var Ct=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ct||{});function eu(){return x.useContext(Jc)}function th({value:e,children:t}){return x.createElement(Jc.Provider,{value:e},t)}function l8(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function Qs(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:l8(e)}}function nh(e){let t=le(e),n=x.useRef(!1);x.useEffect(()=>(n.current=!1,()=>{n.current=!0,P0(()=>{n.current&&t()})}),[t])}let f8=x.createContext(!1);function d8(){return x.useContext(f8)}function p8(e){let t=d8(),n=x.useContext(oh),[r,o]=x.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Rt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return x.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),x.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let rh=x.Fragment,h8=Ge(function(e,t){let{ownerDocument:n=null,...r}=e,o=x.useRef(null),s=dt(wx(p=>{o.current=p}),t),i=kc(o.current),c=n??i,a=p8(c),u=x.useContext(y8),l=Gn(),f=rt();return nh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?je.createPortal(x.createElement("div",{"data-headlessui-portal":"",ref:p=>{l.dispose(),u&&p&&l.add(u.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:rh,name:"Portal"})),a):null});function m8(e,t){let n=dt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=rt();return r?x.createElement(h8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:rh,name:"Portal"})}let b8=x.Fragment,oh=x.createContext(null);function g8(e,t){let{target:n,...r}=e,o={ref:dt(t)},s=rt();return x.createElement(oh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:b8,name:"Popover.Group"}))}let y8=x.createContext(null),w8=Ge(m8),v8=Ge(g8),x8=Object.assign(w8,{Group:v8});const Js={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function sh(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function E8(e,t,n){let r=nt();if(t.kind==="Tracked"){let o=function(){s!==sh(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 P8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function ih(){let e=P8(),[t,n]=U.useState(Rt.isHandoffComplete);return t&&Rt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>Rt.handoff(),[]),e?!1:t}function S8(){let e=x.useRef(!1);return Ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ah(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!Io((t=e.as)!=null?t:uh)||x.Children.count(e.children)===1}let ei=x.createContext(null);ei.displayName="TransitionContext";var $8=(e=>(e.Visible="visible",e.Hidden="hidden",e))($8||{});function A8(){let e=x.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 T8(){let e=x.useContext(ti);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let ti=x.createContext(null);ti.displayName="NestingContext";function ni(e){return"children"in e?ni(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function ch(e,t){let n=qn(e),r=x.useRef([]),o=S8(),s=Gn(),i=le((d,h=Pn.Hidden)=>{let m=r.current.findIndex(({el:w})=>w===d);m!==-1&&(ft(h,{[Pn.Unmount](){r.current.splice(m,1)},[Pn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var w;!ni(r)&&o.current&&((w=n.current)==null||w.call(n))}))}),c=le(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,Pn.Unmount)}),a=x.useRef([]),u=x.useRef(Promise.resolve()),l=x.useRef({enter:[],leave:[]}),f=le((d,h,m)=>{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(l.current[h].map(([$,E])=>E)).then(()=>w())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=le((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([w,$])=>$)).then(()=>{var w;(w=a.current.shift())==null||w()}).then(()=>m(h))});return x.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let uh=x.Fragment,lh=Ls.RenderStrategy;function O8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...w}=e,[$,E]=x.useState(null),P=x.useRef(null),N=ah(e),B=dt(...N?[P,t,E]:t===null?[]:[t]),F=(n=w.unmount)==null||n?Pn.Unmount:Pn.Hidden,{show:D,appear:b,initial:g}=A8(),[v,C]=x.useState(D?"visible":"hidden"),O=T8(),{register:I,unregister:M}=O;Ee(()=>I(P),[I,P]),Ee(()=>{if(F===Pn.Hidden&&P.current){if(D&&v!=="visible"){C("visible");return}return ft(v,{hidden:()=>M(P),visible:()=>I(P)})}},[v,P,I,M,D,F]);let y=ih();Ee(()=>{if(N&&y&&v==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,v,y,N]);let T=g&&!b,A=b&&D&&g,S=x.useRef(!1),L=ch(()=>{S.current||(C("hidden"),M(P))},O),j=le(Z=>{S.current=!0;let J=Z?"enter":"leave";L.onStart(P,J,oe=>{oe==="enter"?s==null||s():oe==="leave"&&(c==null||c())})}),z=le(Z=>{let J=Z?"enter":"leave";S.current=!1,L.onStop(P,J,oe=>{oe==="enter"?i==null||i():oe==="leave"&&(a==null||a())}),J==="leave"&&!ni(L)&&(C("hidden"),M(P))});x.useEffect(()=>{N&&o||(j(D),z(D))},[D,N,o]);let _=!(!o||!N||!y||T),[,W]=pp(_,$,D,{start:j,end:z}),K=Sn({ref:B,className:((r=yc(w.className,A&&u,A&&l,W.enter&&u,W.enter&&W.closed&&l,W.enter&&!W.closed&&f,W.leave&&d,W.leave&&!W.closed&&h,W.leave&&W.closed&&m,!W.transition&&D&&p))==null?void 0:r.trim())||void 0,...dp(W)}),G=0;v==="visible"&&(G|=Ct.Open),v==="hidden"&&(G|=Ct.Closed),D&&v==="hidden"&&(G|=Ct.Opening),!D&&v==="visible"&&(G|=Ct.Closing);let H=rt();return x.createElement(ti.Provider,{value:L},x.createElement(th,{value:G},H({ourProps:K,theirProps:w,defaultTag:uh,features:lh,visible:v==="visible",name:"Transition.Child"})))}function N8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=x.useRef(null),c=ah(e),a=dt(...c?[i,t]:t===null?[]:[t]);ih();let u=eu();if(n===void 0&&u!==null&&(n=(u&Ct.Open)===Ct.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=x.useState(n?"visible":"hidden"),p=ch(()=>{n||f("hidden")}),[d,h]=x.useState(!0),m=x.useRef([n]);Ee(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let w=x.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Ee(()=>{n?f("visible"):!ni(p)&&i.current!==null&&f("hidden")},[n,p]);let $={unmount:o},E=le(()=>{var B;d&&h(!1),(B=e.beforeEnter)==null||B.call(e)}),P=le(()=>{var B;d&&h(!1),(B=e.beforeLeave)==null||B.call(e)}),N=rt();return x.createElement(ti.Provider,{value:p},x.createElement(ei.Provider,{value:w},N({ourProps:{...$,as:x.Fragment,children:x.createElement(fh,{ref:a,...$,...s,beforeEnter:E,beforeLeave:P})},theirProps:{},defaultTag:x.Fragment,features:lh,visible:l==="visible",name:"Transition"})))}function C8(e,t){let n=x.useContext(ei)!==null,r=eu()!==null;return x.createElement(x.Fragment,null,!n&&r?x.createElement(tu,{ref:t,...e}):x.createElement(fh,{ref:t,...e}))}let tu=Ge(N8),fh=Ge(O8),I8=Ge(C8),nu=Object.assign(tu,{Child:I8,Root:tu}),dh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ph(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!on(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return dh.test(i)&&(i=i.replace(dh,"")),i}function M8(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():ph(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ph(e).trim()}function k8(e){let t=x.useRef(""),n=x.useRef("");return le(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=M8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var B8=Object.defineProperty,L8=(e,t,n)=>t in e?B8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hh=(e,t,n)=>(L8(e,typeof t!="symbol"?t+"":t,n),n),Be=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Be||{}),Tn=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Tn||{}),ri=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(ri||{}),mh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.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))(mh||{});function bh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=rp(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 F8={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?Js.Tracked(sh(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:ve.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:Js.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ve.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Qs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===ve.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Qs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=bh(e),u=Qs(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){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!==ve.Nothing&&(r=Qs(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},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,...bh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:Js.Moved}}};class ru extends V0{constructor(t){super(t),hh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return ft(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:Sc(()=>{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:Sc(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Sc(()=>{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})}}),hh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=$c.get(null);this.disposables.add(r.on(Y0.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(E8(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 ru({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:Js.Idle})}reduce(t,n){return ft(n.type,F8,t,n)}}const gh=x.createContext(null);function ou(e){let t=x.useContext(gh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,yh),n}return t}function yh({id:e,__demoMode:t=!1}){let n=x.useMemo(()=>ru.new({id:e,__demoMode:t}),[]);return nh(()=>n.dispose()),n}let oi=x.createContext(null);oi.displayName="ListboxDataContext";function _o(e){let t=x.useContext(oi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,_o),n}return t}let D8=x.Fragment;function R8(e,t){let n=x.useId(),r=gc(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const w=p?"horizontal":"vertical";let $=dt(t),E=ox(s),[P=d?[]:void 0,N]=rx(o,a,E),B=yh({id:n,__demoMode:h}),F=x.useRef({static:!1,hold:!1}),D=x.useRef(new Map),b=Cx(u),g=x.useCallback(_=>ft(v.mode,{[Tn.Multi]:()=>P.some(W=>b(W,_)),[Tn.Single]:()=>b(P,_)}),[P]),v=En({value:P,disabled:f,invalid:l,mode:d?Tn.Multi:Tn.Single,orientation:w,onChange:N,compare:b,isSelected:g,optionsPropsRef:F,listRef:D});Ee(()=>{B.state.dataRef.current=v},[v]);let C=qe(B,_=>_.listboxState),O=$c.get(null),I=qe(O,x.useCallback(_=>O.selectors.isTop(_,n),[O,n])),[M,y]=qe(B,_=>[_.buttonElement,_.optionsElement]);r2(I,[M,y],(_,W)=>{B.send({type:mh.CloseListbox}),np(W,Mc.Loose)||(_.preventDefault(),M==null||M.focus())});let T=En({open:C===Be.Open,disabled:f,invalid:l,value:P}),[A,S]=Sx({inherit:!0}),L={ref:$},j=x.useCallback(()=>{if(E!==void 0)return N==null?void 0:N(E)},[N,E]),z=rt();return x.createElement(S,{value:A,props:{htmlFor:M==null?void 0:M.id},slot:{open:C===Be.Open,disabled:f}},x.createElement(i8,null,x.createElement(gh.Provider,{value:B},x.createElement(oi.Provider,{value:v},x.createElement(th,{value:ft(C,{[Be.Open]:Ct.Open,[Be.Closed]:Ct.Closed})},c!=null&&P!=null&&x.createElement(fx,{disabled:f,data:{[c]:P},form:i,onReset:j}),z({ourProps:L,theirProps:m,slot:T,defaultTag:D8,name:"Listbox"}))))))}let j8="button";function _8(e,t){let n=x.useId(),r=C0(),o=_o("Listbox.Button"),s=ou("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=dt(t,n8(),s.actions.setButtonElement),f=r8(),[p,d,h]=qe(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=p===Be.Open;i2(m,{trigger:d,action:x.useCallback(y=>{if(d!=null&&d.contains(y.target))return js.Ignore;let T=y.target.closest('[role="option"]:not([data-disabled])');return on(T)?js.Select(T):h!=null&&h.contains(y.target)?js.Ignore:js.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let w=le(y=>{switch(y.key){case Ce.Enter:sx(y.currentTarget);break;case Ce.Space:case Ce.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ce.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),$=le(y=>{switch(y.key){case Ce.Space:y.preventDefault();break}}),E=Mx(y=>{var T;s.state.listboxState===Be.Open?(je.flushSync(()=>s.actions.closeListbox()),(T=s.state.buttonElement)==null||T.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}),P=le(y=>y.preventDefault()),N=j0([i]),B=vx(),{isFocusVisible:F,focusProps:D}=H5({autoFocus:a}),{isHovered:b,hoverProps:g}=z5({isDisabled:c}),{pressed:v,pressProps:C}=K5({disabled:c}),O=En({open:p===Be.Open,active:v||p===Be.Open,disabled:c,invalid:o.invalid,value:o.value,hover:b,focus:F,autofocus:a}),I=qe(s,y=>y.listboxState===Be.Open),M=$0(f(),{ref:l,id:i,type:a2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":I,"aria-labelledby":N,"aria-describedby":B,disabled:c||void 0,autoFocus:a,onKeyDown:w,onKeyUp:$,onKeyPress:P},E,D,g,C);return rt()({ourProps:M,theirProps:u,slot:O,defaultTag:j8,name:"Listbox.Button"})}let wh=x.createContext(!1),U8="div",z8=Ls.RenderStrategy|Ls.Static;function H8(e,t){let n=x.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=t8(o),[l,f]=x.useState(null);u&&(s=!0);let p=_o("Listbox.Options"),d=ou("Listbox.Options"),[h,m,w,$]=qe(d,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),E=kc(m),P=kc(w),N=eu(),[B,F]=pp(c,l,N!==null?(N&Ct.Open)===Ct.Open:h===Be.Open);Vx(B,m,d.actions.closeListbox);let D=$?!1:i&&h===Be.Open;h2(D,P);let b=$?!1:i&&h===Be.Open;Wx(b,{allowed:x.useCallback(()=>[m,w],[m,w])});let g=qe(d,d.selectors.didButtonMove)?!1:B,v=qe(d,d.selectors.hasFrozenValue)&&!e.static,C=eh(v,p.value),O=x.useCallback(H=>p.compare(C,H),[p.compare,C]),I=qe(d,H=>{var Z;if(u==null||!((Z=u==null?void 0:u.to)!=null&&Z.includes("selection")))return null;let J=H.options.findIndex(oe=>O(oe.dataRef.current.value));return J===-1&&(J=0),J}),M=(()=>{if(u==null)return;if(I===null)return{...u,inner:void 0};let H=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:H},index:I}}})(),[y,T]=s8(M),A=o8(),S=dt(t,u?y:null,d.actions.setOptionsElement,f),L=Gn();x.useEffect(()=>{let H=w;H&&h===Be.Open&&(q5(H)||H==null||H.focus({preventScroll:!0}))},[h,w]);let j=le(H=>{var Z;switch(L.dispose(),H.key){case Ce.Space:if(d.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),d.actions.search(H.key);case Ce.Enter:H.preventDefault(),H.stopPropagation(),d.actions.selectActiveOption();break;case ft(p.orientation,{vertical:Ce.ArrowDown,horizontal:Ce.ArrowRight}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Next});case ft(p.orientation,{vertical:Ce.ArrowUp,horizontal:Ce.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ce.Home:case Ce.PageUp:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ce.End:case Ce.PageDown:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ce.Escape:H.preventDefault(),H.stopPropagation(),je.flushSync(()=>d.actions.closeListbox()),(Z=d.state.buttonElement)==null||Z.focus({preventScroll:!0});return;case Ce.Tab:H.preventDefault(),H.stopPropagation(),je.flushSync(()=>d.actions.closeListbox()),Jx(d.state.buttonElement,H.shiftKey?Ic.Previous:Ic.Next);break;default:H.key.length===1&&(d.actions.search(H.key),L.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=qe(d,H=>{var Z;return(Z=H.buttonElement)==null?void 0:Z.id}),_=En({open:h===Be.Open}),W=$0(u?A():{},{id:r,ref:S,"aria-activedescendant":qe(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Tn.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Be.Open?0:void 0,style:{...a.style,...T,"--button-width":Ix(B,m,!0).width},...dp(F)}),K=rt(),G=x.useMemo(()=>p.mode===Tn.Multi?p:{...p,isSelected:O},[p,O]);return x.createElement(x8,{enabled:s?e.static||B:!1,ownerDocument:E},x.createElement(oi.Provider,{value:G},K({ourProps:W,theirProps:a,slot:_,defaultTag:U8,features:z8,visible:g,name:"Listbox.Options"})))}let W8="div";function V8(e,t){let n=x.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=x.useContext(wh)===!0,a=_o("Listbox.Option"),u=ou("Listbox.Option"),l=qe(u,v=>u.selectors.isActive(v,r)),f=a.isSelected(s),p=x.useRef(null),d=k8(p),h=qn({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=dt(t,p,v=>{v?a.listRef.current.set(r,v):a.listRef.current.delete(r)}),w=qe(u,v=>u.selectors.shouldScrollIntoView(v,r));Ee(()=>{if(w)return nt().requestAnimationFrame(()=>{var v,C;(C=(v=p.current)==null?void 0:v.scrollIntoView)==null||C.call(v,{block:"nearest"})})},[w,p]),Ee(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let $=le(v=>{if(o)return v.preventDefault();u.actions.selectOption(s)}),E=le(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),P=m2(),N=le(v=>P.update(v)),B=le(v=>{P.wasMoved(v)&&(o||l&&u.state.activationTrigger===ri.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},ri.Pointer))}),F=le(v=>{P.wasMoved(v)&&(o||l&&u.state.activationTrigger===ri.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),D=En({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),b=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:$,onFocus:E,onPointerEnter:N,onMouseEnter:N,onPointerMove:B,onMouseMove:B,onPointerLeave:F,onMouseLeave:F},g=rt();return!f&&c?null:g({ourProps:b,theirProps:i,slot:D,defaultTag:W8,name:"Listbox.Option"})}let G8=x.Fragment;function q8(e,t){let{options:n,placeholder:r,...o}=e,s={ref:dt(t)},i=_o("ListboxSelectedOption"),c=En({}),a=i.value===void 0||i.value===null||i.mode===Tn.Multi&&Array.isArray(i.value)&&i.value.length===0,u=rt();return x.createElement(wh.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:x.createElement(x.Fragment,null,r&&a?r:n)},slot:c,defaultTag:G8,name:"ListboxSelectedOption"}))}let Z8=Ge(R8),Y8=Ge(_8),K8=Ox,X8=Ge(H8),Q8=Ge(V8),J8=Ge(q8),mt=Object.assign(Z8,{Button:Y8,Label:K8,Options:X8,Option:Q8,SelectedOption:J8});const e3=()=>k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[k.jsx("g",{clipPath:"url(#clip0_active)",children:k.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"})}),k.jsx("defs",{children:k.jsx("clipPath",{id:"clip0_active",children:k.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),t3=()=>k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[k.jsx("g",{clipPath:"url(#clip0_inactive)",children:k.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"})}),k.jsx("defs",{children:k.jsx("clipPath",{id:"clip0_inactive",children:k.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Uo=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return k.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>k.jsx("div",{className:"flex items-center justify-center",children:o>t-e?k.jsx(e3,{}):k.jsx(t3,{})},o))})};class It{}Go(It,"FAST",3),Go(It,"Medium",2),Go(It,"SLOW",1),Go(It,"NONE",0);const n3=Object.values({MAINNET:1,SEPOLIA:11155111}),ln=e=>{const t=typeof e=="string"?parseInt(e,10):e;return n3.includes(t)},r3={USDT:!0},vh=(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:!r3[t.toUpperCase()]:!0},o3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=vt();return k.jsx("div",{className:`relative ${o}`,children:k.jsx(mt,{value:t,onChange:n,disabled:r,children:({open:c})=>k.jsxs(k.Fragment,{children:[k.jsxs(mt.Button,{className:`
|
|
129
|
+
*/var z2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],zc=z2.join(","),vp=typeof Element>"u",Do=vp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qs=!vp&&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},Ro=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&&Ro(t.parentNode);return i},H2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},W2=function(t,n,r){if(Ro(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(zc));return n&&Do.call(t,zc)&&o.unshift(t),o=o.filter(r),o},Hc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Ro(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=Hc(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=Do.call(i,zc);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Ro(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=Hc(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},xp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Ep=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||H2(t))&&!xp(t)?0:t.tabIndex},V2=function(t,n){var r=Ep(t);return r<0&&n&&!xp(t)?0:r},G2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Pp=function(t){return t.tagName==="INPUT"},q2=function(t){return Pp(t)&&t.type==="hidden"},Z2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Y2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},K2=function(t){if(!t.name)return!0;var n=t.form||qs(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Y2(o,t.form);return!s||s===t},X2=function(t){return Pp(t)&&t.type==="radio"},Q2=function(t){return X2(t)&&!K2(t)},J2=function(t){var n,r=t&&qs(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,f;r=qs(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Sp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},eE=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=Do.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(Do.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var u=t.parentElement,l=qs(t);if(u&&!u.shadowRoot&&o(u)===!0)return Sp(t);t.assignedSlot?t=t.assignedSlot:!u&&l!==t.ownerDocument?t=l.host:t=u}t=a}if(J2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Sp(t);return!1},tE=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 Do.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},nE=function(t,n){return!(n.disabled||Ro(n)||q2(n)||eE(n,t)||Z2(n)||tE(n))},$p=function(t,n){return!(Q2(n)||Ep(n)<0||!nE(t,n))},rE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ap=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=V2(c,i),u=i?Ap(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(G2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Tp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hc([t],n.includeContainer,{filter:$p.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:rE}):r=W2(t,n.includeContainer,$p.bind(null,n)),Ap(r)};function Op(e,t,n){let{reference:r,floating:o}=e;const s=un(t),i=_c(t),c=jc(i),a=An(t),u=s==="y",l=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:l,y:r.y-o.height};break;case"bottom":d={x:l,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Ar(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const oE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:f}=Op(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:w,fn:$}=c[m],{x:E,y:P,data:N,reset:B}=await $({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=E??l,f=P??f,d={...d,[w]:{...d[w],...N}},B&&h<=50&&(h++,typeof B=="object"&&(B.placement&&(p=B.placement),B.rects&&(u=B.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):B.rects),{x:l,y:f}=Op(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function Zs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Yn(t,e),h=wp(d),w=c[p?f==="floating"?"reference":"floating":f],$=Gs(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(c.floating)),boundary:u,rootBoundary:l,strategy:a})),E=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),N=await(s.isElement==null?void 0:s.isElement(P))?await(s.getScale==null?void 0:s.getScale(P))||{x:1,y:1}:{x:1,y:1},B=Gs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:P,strategy:a}):E);return{top:($.top-B.top+h.top)/N.y,bottom:(B.bottom-$.bottom+h.bottom)/N.y,left:($.left-B.left+h.left)/N.x,right:(B.right-$.right+h.right)/N.x}}const sE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=Yn(e,t)||{};if(u==null)return{};const f=wp(l),p={x:n,y:r},d=_c(o),h=jc(d),m=await i.getDimensions(u),w=d==="y",$=w?"top":"left",E=w?"bottom":"right",P=w?"clientHeight":"clientWidth",N=s.reference[h]+s.reference[d]-p[d]-s.floating[h],B=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let D=F?F[P]:0;(!D||!await(i.isElement==null?void 0:i.isElement(F)))&&(D=c.floating[P]||s.floating[h]);const b=N/2-B/2,g=D/2-m[h]/2-1,v=cn(f[$],g),C=cn(f[E],g),O=v,I=D-m[h]-C,M=D/2-m[h]/2+b,y=Rc(O,M,I),T=!a.arrow&&Ar(o)!=null&&M!==y&&s.reference[h]/2-(M<O?v:C)-m[h]/2<0,A=T?M<O?M-O:M-I:0;return{[d]:p[d]+A,data:{[d]:y,centerOffset:M-y-A,...T&&{alignmentOffset:A}},reset:T}}}),iE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...w}=Yn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const $=An(o),E=un(c),P=An(c)===c,N=await(a.isRTL==null?void 0:a.isRTL(u.floating)),B=p||(P||!m?[Vs(c)]:F2(c)),F=h!=="none";!p&&F&&B.push(..._2(c,m,h,N));const D=[c,...B],b=await Zs(t,w),g=[];let v=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&g.push(b[$]),f){const M=L2(o,i,N);g.push(b[M[0]],b[M[1]])}if(v=[...v,{placement:o,overflows:g}],!g.every(M=>M<=0)){var C,O;const M=(((C=s.flip)==null?void 0:C.index)||0)+1,y=D[M];if(y&&(!(f==="alignment"?E!==un(y):!1)||v.every(S=>un(S.placement)===E?S.overflows[0]>0:!0)))return{data:{index:M,overflows:v},reset:{placement:y}};let T=(O=v.filter(A=>A.overflows[0]<=0).sort((A,S)=>A.overflows[1]-S.overflows[1])[0])==null?void 0:O.placement;if(!T)switch(d){case"bestFit":{var I;const A=(I=v.filter(S=>{if(F){const L=un(S.placement);return L===E||L==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(L=>L>0).reduce((L,j)=>L+j,0)]).sort((S,L)=>S[1]-L[1])[0])==null?void 0:I[0];A&&(T=A);break}case"initialPlacement":T=c;break}if(o!==T)return{reset:{placement:T}}}return{}}}},aE=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=An(n),c=Ar(n),a=un(n)==="y",u=aE.has(i)?-1:1,l=s&&a?-1:1,f=Yn(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*l,y:p*u}:{x:p*u,y:d*l}}const uE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await cE(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},lE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:$,y:E}=w;return{x:$,y:E}}},...a}=Yn(e,t),u={x:n,y:r},l=await Zs(t,a),f=un(An(o)),p=bp(f);let d=u[p],h=u[f];if(s){const w=p==="y"?"top":"left",$=p==="y"?"bottom":"right",E=d+l[w],P=d-l[$];d=Rc(E,d,P)}if(i){const w=f==="y"?"top":"left",$=f==="y"?"bottom":"right",E=h+l[w],P=h-l[$];h=Rc(E,h,P)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},fE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...u}=Yn(e,t),l=await Zs(t,u),f=An(o),p=Ar(o),d=un(o)==="y",{width:h,height:m}=s.floating;let w,$;f==="top"||f==="bottom"?(w=f,$=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):($=f,w=p==="end"?"top":"bottom");const E=m-l.top-l.bottom,P=h-l.left-l.right,N=cn(m-l[w],E),B=cn(h-l[$],P),F=!t.middlewareData.shift;let D=N,b=B;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=P),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=E),F&&!p){const v=ke(l.left,0),C=ke(l.right,0),O=ke(l.top,0),I=ke(l.bottom,0);d?b=h-2*(v!==0||C!==0?v+C:ke(l.left,l.right)):D=m-2*(O!==0||I!==0?O+I:ke(l.top,l.bottom))}await a({...t,availableWidth:b,availableHeight:D});const g=await i.getDimensions(c.floating);return h!==g.width||m!==g.height?{reset:{rects:!0}}:{}}}};function Np(e){const t=ht(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=De(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Fo(n)!==s||Fo(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Wc(e){return fe(e)?e:e.contextElement}function Tr(e){const t=Wc(e);if(!De(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Np(t);let i=(s?Fo(n.width):n.width)/r,c=(s?Fo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const dE=Ut(0);function Cp(e){const t=Ze(e);return!zs()||!t.visualViewport?dE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ze(e)?!1:t}function Kn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Wc(e);let i=Ut(1);t&&(r?fe(r)&&(i=Tr(r)):i=Tr(e));const c=pE(s,n,r)?Cp(s):Ut(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,f=o.height/i.y;if(s){const p=Ze(s),d=r&&fe(r)?Ze(r):r;let h=p,m=Dc(h);for(;m&&r&&d!==h;){const w=Tr(m),$=m.getBoundingClientRect(),E=ht(m),P=$.left+(m.clientLeft+parseFloat(E.paddingLeft))*w.x,N=$.top+(m.clientTop+parseFloat(E.paddingTop))*w.y;a*=w.x,u*=w.y,l*=w.x,f*=w.y,a+=P,u+=N,h=Ze(m),m=Dc(h)}}return Gs({width:l,height:f,x:a,y:u})}function Ys(e,t){const n=Hs(e).scrollLeft;return t?t.left+n:Kn(_t(e)).left+n}function Ip(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ys(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function hE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=_t(r),c=t?Us(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Ut(1);const l=Ut(0),f=De(r);if((f||!f&&!s)&&(($r(r)!=="body"||Lo(i))&&(a=Hs(r)),De(r))){const d=Kn(r);u=Tr(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?Ip(i,a):Ut(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-a.scrollTop*u.y+l.y+p.y}}function mE(e){return Array.from(e.getClientRects())}function bE(e){const t=_t(e),n=Hs(e),r=e.ownerDocument.body,o=ke(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ke(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ys(e);const c=-n.scrollTop;return ht(r).direction==="rtl"&&(i+=ke(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Mp=25;function gE(e,t){const n=Ze(e),r=_t(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=zs();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Ys(r);if(u<=0){const l=r.ownerDocument,f=l.body,p=getComputedStyle(f),d=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Mp&&(s-=h)}else u<=Mp&&(s+=u);return{width:s,height:i,x:c,y:a}}const yE=new Set(["absolute","fixed"]);function wE(e,t){const n=Kn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=De(e)?Tr(e):Ut(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:i,height:c,x:a,y:u}}function kp(e,t,n){let r;if(t==="viewport")r=gE(e,n);else if(t==="document")r=bE(_t(e));else if(fe(t))r=wE(t,n);else{const o=Cp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Gs(r)}function Bp(e,t){const n=an(e);return n===t||!fe(n)||sn(n)?!1:ht(n).position==="fixed"||Bp(n,t)}function vE(e,t){const n=t.get(e);if(n)return n;let r=$n(e,[],!1).filter(c=>fe(c)&&$r(c)!=="body"),o=null;const s=ht(e).position==="fixed";let i=s?an(e):e;for(;fe(i)&&!sn(i);){const c=ht(i),a=Fc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&yE.has(o.position)||Lo(i)&&!a&&Bp(e,i))?r=r.filter(l=>l!==i):o=c,i=an(i)}return t.set(e,r),r}function xE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Us(t)?[]:vE(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=kp(t,l,o);return u.top=ke(f.top,u.top),u.right=cn(f.right,u.right),u.bottom=cn(f.bottom,u.bottom),u.left=ke(f.left,u.left),u},kp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function EE(e){const{width:t,height:n}=Np(e);return{width:t,height:n}}function PE(e,t,n){const r=De(t),o=_t(t),s=n==="fixed",i=Kn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ut(0);function u(){a.x=Ys(o)}if(r||!r&&!s)if(($r(t)!=="body"||Lo(o))&&(c=Hs(t)),r){const d=Kn(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?Ip(o,c):Ut(0),f=i.left+c.scrollLeft-a.x-l.x,p=i.top+c.scrollTop-a.y-l.y;return{x:f,y:p,width:i.width,height:i.height}}function Vc(e){return ht(e).position==="static"}function Lp(e,t){if(!De(e)||ht(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return _t(e)===n&&(n=n.ownerDocument.body),n}function Fp(e,t){const n=Ze(e);if(Us(e))return n;if(!De(e)){let o=an(e);for(;o&&!sn(o);){if(fe(o)&&!Vc(o))return o;o=an(o)}return n}let r=Lp(e,t);for(;r&&S2(r)&&Vc(r);)r=Lp(r,t);return r&&sn(r)&&Vc(r)&&!Fc(r)?n:r||N2(e)||n}const SE=async function(e){const t=this.getOffsetParent||Fp,n=this.getDimensions,r=await n(e.floating);return{reference:PE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $E(e){return ht(e).direction==="rtl"}const AE={convertOffsetParentRelativeRectToViewportRelativeRect:hE,getDocumentElement:_t,getClippingRect:xE,getOffsetParent:Fp,getElementRects:SE,getClientRects:mE,getDimensions:EE,getScale:Tr,isElement:fe,isRTL:$E};function Dp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function TE(e,t){let n=null,r;const o=_t(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:f,width:p,height:d}=u;if(c||t(),!p||!d)return;const h=Ws(f),m=Ws(o.clientWidth-(l+p)),w=Ws(o.clientHeight-(f+d)),$=Ws(l),P={rootMargin:-h+"px "+-m+"px "+-w+"px "+-$+"px",threshold:ke(0,cn(1,a))||1};let N=!0;function B(F){const D=F[0].intersectionRatio;if(D!==a){if(!N)return i();D?i(!1,D):r=setTimeout(()=>{i(!1,1e-7)},1e3)}D===1&&!Dp(u,e.getBoundingClientRect())&&i(),N=!1}try{n=new IntersectionObserver(B,{...P,root:o.ownerDocument})}catch{n=new IntersectionObserver(B,P)}n.observe(e)}return i(!0),s}function Rp(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Wc(e),l=o||s?[...u?$n(u):[],...$n(t)]:[];l.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),s&&$.addEventListener("resize",n)});const f=u&&c?TE(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver($=>{let[E]=$;E&&E.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=d)==null||P.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?Kn(e):null;a&&w();function w(){const $=Kn(e);m&&!Dp(m,$)&&n(),m=$,h=requestAnimationFrame(w)}return n(),()=>{var $;l.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),f==null||f(),($=d)==null||$.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const Gc=Zs,OE=uE,NE=lE,CE=iE,IE=fE,jp=sE,ME=(e,t,n)=>{const r=new Map,o={platform:AE,...n},s={...o.platform,_c:r};return oE(e,t,{...o,platform:s})};var kE=typeof document<"u",BE=function(){},Ks=kE?x.useLayoutEffect:BE;function Xs(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(!Xs(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)&&!Xs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function _p(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Up(e,t){const n=_p(e);return Math.round(t*n)/n}function qc(e){const t=U.useRef(e);return Ks(()=>{t.current=e}),t}function zp(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=U.useState(r);Xs(p,r)||d(r);const[h,m]=U.useState(null),[w,$]=U.useState(null),E=U.useCallback(S=>{S!==F.current&&(F.current=S,m(S))},[]),P=U.useCallback(S=>{S!==D.current&&(D.current=S,$(S))},[]),N=s||h,B=i||w,F=U.useRef(null),D=U.useRef(null),b=U.useRef(l),g=a!=null,v=qc(a),C=qc(o),O=qc(u),I=U.useCallback(()=>{if(!F.current||!D.current)return;const S={placement:t,strategy:n,middleware:p};C.current&&(S.platform=C.current),ME(F.current,D.current,S).then(L=>{const j={...L,isPositioned:O.current!==!1};M.current&&!Xs(b.current,j)&&(b.current=j,Br.flushSync(()=>{f(j)}))})},[p,t,n,C,O]);Ks(()=>{u===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,f(S=>({...S,isPositioned:!1})))},[u]);const M=U.useRef(!1);Ks(()=>(M.current=!0,()=>{M.current=!1}),[]),Ks(()=>{if(N&&(F.current=N),B&&(D.current=B),N&&B){if(v.current)return v.current(N,B,I);I()}},[N,B,I,v,g]);const y=U.useMemo(()=>({reference:F,floating:D,setReference:E,setFloating:P}),[E,P]),T=U.useMemo(()=>({reference:N,floating:B}),[N,B]),A=U.useMemo(()=>{const S={position:n,left:0,top:0};if(!T.floating)return S;const L=Up(T.floating,l.x),j=Up(T.floating,l.y);return c?{...S,transform:"translate("+L+"px, "+j+"px)",..._p(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:j}},[n,c,T.floating,l.x,l.y]);return U.useMemo(()=>({...l,update:I,refs:y,elements:T,floatingStyles:A}),[l,I,y,T,A])}const LE=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?jp({element:r.current,padding:o}).fn(n):{}:r?jp({element:r,padding:o}).fn(n):{}}}},Zc=(e,t)=>({...OE(e),options:[e,t]}),Hp=(e,t)=>({...NE(e),options:[e,t]}),Wp=(e,t)=>({...CE(e),options:[e,t]}),FE=(e,t)=>({...IE(e),options:[e,t]}),DE=(e,t)=>({...LE(e),options:[e,t]}),Vp={...U},RE=Vp.useInsertionEffect||(e=>e());function Gp(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return RE(()=>{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 Yc=typeof document<"u"?x.useLayoutEffect:x.useEffect;let qp=!1,jE=0;const Zp=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+jE++;function _E(){const[e,t]=U.useState(()=>qp?Zp():void 0);return Yc(()=>{e==null&&t(Zp())},[]),U.useEffect(()=>{qp=!0},[]),e}const UE=Vp.useId||_E;let jo;process.env.NODE_ENV!=="production"&&(jo=new Set);function zE(){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=jo)!=null&&e.has(o))){var s;(s=jo)==null||s.add(o),console.warn(o)}}function HE(){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=jo)!=null&&e.has(o))){var s;(s=jo)==null||s.add(o),console.error(o)}}function WE(){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 VE=U.createContext(null),GE=U.createContext(null),qE=()=>{var e;return((e=U.useContext(VE))==null?void 0:e.id)||null},ZE=()=>U.useContext(GE),YE="data-floating-ui-focusable";function KE(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=UE(),s=U.useRef({}),[i]=U.useState(()=>WE()),c=qE()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&HE("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=Gp((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function XE(e){e===void 0&&(e={});const{nodeId:t}=e,n=KE({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=ZE();Yc(()=>{l&&(f.current=l)},[l]);const d=zp({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(P=>{const N=fe(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;a(N),d.refs.setReference(N)},[d.refs]),m=U.useCallback(P=>{(fe(P)||P===null)&&(f.current=P,i(P)),(fe(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!fe(P))&&d.refs.setReference(P)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),$=U.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),E=U.useMemo(()=>({...d,...r,refs:w,elements:$,nodeId:t}),[d,w,$,t,r]);return Yc(()=>{r.dataRef.current.floatingContext=E;const P=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);P&&(P.context=E)}),U.useMemo(()=>({...d,context:E,refs:w,elements:$}),[d,w,$,E])}const Yp="active",Kp="selected";function Kc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Yp]:i,[Kp]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[YE]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Yp,Kp].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function QE(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>Kc(c,e,"reference"),t),s=U.useCallback(c=>Kc(c,e,"floating"),n),i=U.useCallback(c=>Kc(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Xp(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const JE=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Yn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(u==null?void 0:u.current)||p,m=p.clientTop||h.clientTop,w=p.clientTop!==0,$=h.clientTop!==0,E=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||zE('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const P={...t,...await Zc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},N=await Gc(Xp(P,h.scrollHeight+m+p.clientTop),l),B=await Gc(P,{...l,elementContext:"reference"}),F=ke(0,N.top),D=P.y+F,v=(h.scrollHeight>h.clientHeight?C=>C:Fo)(ke(0,h.scrollHeight+(w&&E||$?m*2:0)-F-ke(0,N.bottom)));if(h.style.maxHeight=v+"px",h.scrollTop=F,o){const C=h.offsetHeight<d.offsetHeight*cn(c,n.current.length)-1||B.top>=-a||B.bottom>=-a;Br.flushSync(()=>o(C))}return r&&(r.current=await Gc(Xp({...P,y:D},h.offsetHeight+m+p.clientTop),l)),{y:D}}});function e8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Gp(c),u=U.useRef(!1),l=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const w=m.deltaY,$=s.current.top>=-.5,E=s.current.bottom>=-.5,P=h.scrollHeight-h.clientHeight,N=w<0?-1:1,B=w<0?"max":"min";h.scrollHeight<=h.clientHeight||(!$&&w>0||!E&&w<0?(m.preventDefault(),Br.flushSync(()=>{a(F=>F+Math[B](w,P*N))})):/firefox/i.test(I2())&&(h.scrollTop+=w))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{l.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=U.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!u.current)){if(l.current!==null){const h=d.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Br.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let Or=x.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Or.displayName="FloatingContext";let Xc=x.createContext(null);Xc.displayName="PlacementContext";function t8(e){return x.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function n8(){return x.useContext(Or).setReference}function r8(){return x.useContext(Or).getReferenceProps}function o8(){let{getFloatingProps:e,slot:t}=x.useContext(Or);return x.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function s8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=x.useContext(Xc),n=x.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Ee(()=>{t==null||t(n??null)},[t,n]);let r=x.useContext(Or);return x.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Qp=4;function i8({children:e,enabled:t=!0}){let[n,r]=x.useState(null),[o,s]=x.useState(0),i=x.useRef(null),[c,a]=x.useState(null);a8(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=c8(n,c),[m,w="center"]=l.split(" ");Ee(()=>{u&&s(0)},[u]);let{refs:$,floatingStyles:E,context:P}=XE({open:u,placement:m==="selection"?w==="center"?"bottom":`bottom-${w}`:w==="center"?`${m}`:`${m}-${w}`,strategy:"absolute",transform:!1,middleware:[Zc({mainAxis:m==="selection"?0:f,crossAxis:p}),Hp({padding:d}),m!=="selection"&&Wp({padding:d}),m==="selection"&&h?JE({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:Qp,referenceOverflowThreshold:d,onFallbackChange(C){var O,I;if(!C)return;let M=P.elements.floating;if(!M)return;let y=parseFloat(getComputedStyle(M).scrollPaddingBottom)||0,T=Math.min(Qp,M.childElementCount),A=0,S=0;for(let L of(I=(O=P.elements.floating)==null?void 0:O.childNodes)!=null?I:[])if(on(L)){let j=L.offsetTop,z=j+L.clientHeight+y,_=M.scrollTop,W=_+M.clientHeight;if(j>=_&&z<=W)T--;else{S=Math.max(0,Math.min(z,W)-Math.max(j,_)),A=L.clientHeight;break}}T>=1&&s(L=>{let j=A*T-S+y;return L>=j?L:j})}}):null,FE({padding:d,apply({availableWidth:C,availableHeight:O,elements:I}){Object.assign(I.floating.style,{overflow:"auto",maxWidth:`${C}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${O}px)`})}})].filter(Boolean),whileElementsMounted:Rp}),[N=m,B=w]=P.placement.split("-");m==="selection"&&(N="selection");let F=x.useMemo(()=>({anchor:[N,B].filter(Boolean).join(" ")}),[N,B]),D=e8(P,{overflowRef:i,onChange:s}),{getReferenceProps:b,getFloatingProps:g}=QE([D]),v=le(C=>{a(C),$.setFloating(C)});return U.createElement(Xc.Provider,{value:r},U.createElement(Or.Provider,{value:{setFloating:v,setReference:$.setReference,styles:E,getReferenceProps:b,getFloatingProps:g,slot:F}},e))}function a8(e){Ee(()=>{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 c8(e,t){var n,r,o;let s=Qc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Qc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Qc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Qc(e,t,n=void 0){let r=Gn(),o=le((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=eh(a,u);return[l,f=>{let p=Jp(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[$,E]of p.entries()){let P=window.getComputedStyle(u).getPropertyValue(E);if(d[$]!==P){d[$]=P,m=!0;break}}if(!m)return;let w=eh(a,u);l!==w&&(f(w),l=w)})}return r.dispose}]}return[n,null]}),s=x.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=x.useState();return Ee(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Jp(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,...Jp(o)]:[r]}return[]}function eh(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 u8({children:e,freeze:t},n){let r=th(t,e);return x.isValidElement(r)?x.cloneElement(r,{ref:n}):x.createElement(x.Fragment,null,r)}x.forwardRef(u8);function th(e,t){let[n,r]=x.useState(t);return!e&&n!==t&&r(t),e?n:t}let Jc=x.createContext(null);Jc.displayName="OpenClosedContext";var Ct=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ct||{});function eu(){return x.useContext(Jc)}function nh({value:e,children:t}){return x.createElement(Jc.Provider,{value:e},t)}function l8(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function Qs(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:l8(e)}}function rh(e){let t=le(e),n=x.useRef(!1);x.useEffect(()=>(n.current=!1,()=>{n.current=!0,S0(()=>{n.current&&t()})}),[t])}let f8=x.createContext(!1);function d8(){return x.useContext(f8)}function p8(e){let t=d8(),n=x.useContext(sh),[r,o]=x.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Rt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return x.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),x.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let oh=x.Fragment,h8=Ge(function(e,t){let{ownerDocument:n=null,...r}=e,o=x.useRef(null),s=dt(wx(p=>{o.current=p}),t),i=kc(o.current),c=n??i,a=p8(c),u=x.useContext(y8),l=Gn(),f=rt();return rh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?je.createPortal(x.createElement("div",{"data-headlessui-portal":"",ref:p=>{l.dispose(),u&&p&&l.add(u.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:oh,name:"Portal"})),a):null});function m8(e,t){let n=dt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=rt();return r?x.createElement(h8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:oh,name:"Portal"})}let b8=x.Fragment,sh=x.createContext(null);function g8(e,t){let{target:n,...r}=e,o={ref:dt(t)},s=rt();return x.createElement(sh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:b8,name:"Popover.Group"}))}let y8=x.createContext(null),w8=Ge(m8),v8=Ge(g8),x8=Object.assign(w8,{Group:v8});const Js={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function ih(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function E8(e,t,n){let r=nt();if(t.kind==="Tracked"){let o=function(){s!==ih(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 P8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function ah(){let e=P8(),[t,n]=U.useState(Rt.isHandoffComplete);return t&&Rt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>Rt.handoff(),[]),e?!1:t}function S8(){let e=x.useRef(!1);return Ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ch(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!Io((t=e.as)!=null?t:lh)||x.Children.count(e.children)===1}let ei=x.createContext(null);ei.displayName="TransitionContext";var $8=(e=>(e.Visible="visible",e.Hidden="hidden",e))($8||{});function A8(){let e=x.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 T8(){let e=x.useContext(ti);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let ti=x.createContext(null);ti.displayName="NestingContext";function ni(e){return"children"in e?ni(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function uh(e,t){let n=qn(e),r=x.useRef([]),o=S8(),s=Gn(),i=le((d,h=Pn.Hidden)=>{let m=r.current.findIndex(({el:w})=>w===d);m!==-1&&(ft(h,{[Pn.Unmount](){r.current.splice(m,1)},[Pn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var w;!ni(r)&&o.current&&((w=n.current)==null||w.call(n))}))}),c=le(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,Pn.Unmount)}),a=x.useRef([]),u=x.useRef(Promise.resolve()),l=x.useRef({enter:[],leave:[]}),f=le((d,h,m)=>{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(l.current[h].map(([$,E])=>E)).then(()=>w())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=le((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([w,$])=>$)).then(()=>{var w;(w=a.current.shift())==null||w()}).then(()=>m(h))});return x.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let lh=x.Fragment,fh=Ls.RenderStrategy;function O8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...w}=e,[$,E]=x.useState(null),P=x.useRef(null),N=ch(e),B=dt(...N?[P,t,E]:t===null?[]:[t]),F=(n=w.unmount)==null||n?Pn.Unmount:Pn.Hidden,{show:D,appear:b,initial:g}=A8(),[v,C]=x.useState(D?"visible":"hidden"),O=T8(),{register:I,unregister:M}=O;Ee(()=>I(P),[I,P]),Ee(()=>{if(F===Pn.Hidden&&P.current){if(D&&v!=="visible"){C("visible");return}return ft(v,{hidden:()=>M(P),visible:()=>I(P)})}},[v,P,I,M,D,F]);let y=ah();Ee(()=>{if(N&&y&&v==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,v,y,N]);let T=g&&!b,A=b&&D&&g,S=x.useRef(!1),L=uh(()=>{S.current||(C("hidden"),M(P))},O),j=le(Z=>{S.current=!0;let J=Z?"enter":"leave";L.onStart(P,J,oe=>{oe==="enter"?s==null||s():oe==="leave"&&(c==null||c())})}),z=le(Z=>{let J=Z?"enter":"leave";S.current=!1,L.onStop(P,J,oe=>{oe==="enter"?i==null||i():oe==="leave"&&(a==null||a())}),J==="leave"&&!ni(L)&&(C("hidden"),M(P))});x.useEffect(()=>{N&&o||(j(D),z(D))},[D,N,o]);let _=!(!o||!N||!y||T),[,W]=hp(_,$,D,{start:j,end:z}),K=Sn({ref:B,className:((r=yc(w.className,A&&u,A&&l,W.enter&&u,W.enter&&W.closed&&l,W.enter&&!W.closed&&f,W.leave&&d,W.leave&&!W.closed&&h,W.leave&&W.closed&&m,!W.transition&&D&&p))==null?void 0:r.trim())||void 0,...pp(W)}),G=0;v==="visible"&&(G|=Ct.Open),v==="hidden"&&(G|=Ct.Closed),D&&v==="hidden"&&(G|=Ct.Opening),!D&&v==="visible"&&(G|=Ct.Closing);let H=rt();return x.createElement(ti.Provider,{value:L},x.createElement(nh,{value:G},H({ourProps:K,theirProps:w,defaultTag:lh,features:fh,visible:v==="visible",name:"Transition.Child"})))}function N8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=x.useRef(null),c=ch(e),a=dt(...c?[i,t]:t===null?[]:[t]);ah();let u=eu();if(n===void 0&&u!==null&&(n=(u&Ct.Open)===Ct.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=x.useState(n?"visible":"hidden"),p=uh(()=>{n||f("hidden")}),[d,h]=x.useState(!0),m=x.useRef([n]);Ee(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let w=x.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Ee(()=>{n?f("visible"):!ni(p)&&i.current!==null&&f("hidden")},[n,p]);let $={unmount:o},E=le(()=>{var B;d&&h(!1),(B=e.beforeEnter)==null||B.call(e)}),P=le(()=>{var B;d&&h(!1),(B=e.beforeLeave)==null||B.call(e)}),N=rt();return x.createElement(ti.Provider,{value:p},x.createElement(ei.Provider,{value:w},N({ourProps:{...$,as:x.Fragment,children:x.createElement(dh,{ref:a,...$,...s,beforeEnter:E,beforeLeave:P})},theirProps:{},defaultTag:x.Fragment,features:fh,visible:l==="visible",name:"Transition"})))}function C8(e,t){let n=x.useContext(ei)!==null,r=eu()!==null;return x.createElement(x.Fragment,null,!n&&r?x.createElement(tu,{ref:t,...e}):x.createElement(dh,{ref:t,...e}))}let tu=Ge(N8),dh=Ge(O8),I8=Ge(C8),nu=Object.assign(tu,{Child:I8,Root:tu}),ph=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function hh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!on(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return ph.test(i)&&(i=i.replace(ph,"")),i}function M8(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():hh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return hh(e).trim()}function k8(e){let t=x.useRef(""),n=x.useRef("");return le(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=M8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var B8=Object.defineProperty,L8=(e,t,n)=>t in e?B8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mh=(e,t,n)=>(L8(e,typeof t!="symbol"?t+"":t,n),n),Be=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Be||{}),Tn=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Tn||{}),ri=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(ri||{}),bh=(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))(bh||{});function gh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=op(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 F8={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?Js.Tracked(ih(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:ve.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:Js.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ve.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Qs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===ve.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Qs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=gh(e),u=Qs(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){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!==ve.Nothing&&(r=Qs(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},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,...gh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:Js.Moved}}};class ru extends G0{constructor(t){super(t),mh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return ft(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:Sc(()=>{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:Sc(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Sc(()=>{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})}}),mh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=$c.get(null);this.disposables.add(r.on(K0.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(E8(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 ru({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:Js.Idle})}reduce(t,n){return ft(n.type,F8,t,n)}}const yh=x.createContext(null);function ou(e){let t=x.useContext(yh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,wh),n}return t}function wh({id:e,__demoMode:t=!1}){let n=x.useMemo(()=>ru.new({id:e,__demoMode:t}),[]);return rh(()=>n.dispose()),n}let oi=x.createContext(null);oi.displayName="ListboxDataContext";function _o(e){let t=x.useContext(oi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,_o),n}return t}let D8=x.Fragment;function R8(e,t){let n=x.useId(),r=gc(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const w=p?"horizontal":"vertical";let $=dt(t),E=ox(s),[P=d?[]:void 0,N]=rx(o,a,E),B=wh({id:n,__demoMode:h}),F=x.useRef({static:!1,hold:!1}),D=x.useRef(new Map),b=Cx(u),g=x.useCallback(_=>ft(v.mode,{[Tn.Multi]:()=>P.some(W=>b(W,_)),[Tn.Single]:()=>b(P,_)}),[P]),v=En({value:P,disabled:f,invalid:l,mode:d?Tn.Multi:Tn.Single,orientation:w,onChange:N,compare:b,isSelected:g,optionsPropsRef:F,listRef:D});Ee(()=>{B.state.dataRef.current=v},[v]);let C=qe(B,_=>_.listboxState),O=$c.get(null),I=qe(O,x.useCallback(_=>O.selectors.isTop(_,n),[O,n])),[M,y]=qe(B,_=>[_.buttonElement,_.optionsElement]);r2(I,[M,y],(_,W)=>{B.send({type:bh.CloseListbox}),rp(W,Mc.Loose)||(_.preventDefault(),M==null||M.focus())});let T=En({open:C===Be.Open,disabled:f,invalid:l,value:P}),[A,S]=Sx({inherit:!0}),L={ref:$},j=x.useCallback(()=>{if(E!==void 0)return N==null?void 0:N(E)},[N,E]),z=rt();return x.createElement(S,{value:A,props:{htmlFor:M==null?void 0:M.id},slot:{open:C===Be.Open,disabled:f}},x.createElement(i8,null,x.createElement(yh.Provider,{value:B},x.createElement(oi.Provider,{value:v},x.createElement(nh,{value:ft(C,{[Be.Open]:Ct.Open,[Be.Closed]:Ct.Closed})},c!=null&&P!=null&&x.createElement(fx,{disabled:f,data:{[c]:P},form:i,onReset:j}),z({ourProps:L,theirProps:m,slot:T,defaultTag:D8,name:"Listbox"}))))))}let j8="button";function _8(e,t){let n=x.useId(),r=I0(),o=_o("Listbox.Button"),s=ou("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=dt(t,n8(),s.actions.setButtonElement),f=r8(),[p,d,h]=qe(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=p===Be.Open;i2(m,{trigger:d,action:x.useCallback(y=>{if(d!=null&&d.contains(y.target))return js.Ignore;let T=y.target.closest('[role="option"]:not([data-disabled])');return on(T)?js.Select(T):h!=null&&h.contains(y.target)?js.Ignore:js.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let w=le(y=>{switch(y.key){case Ce.Enter:sx(y.currentTarget);break;case Ce.Space:case Ce.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ce.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),$=le(y=>{switch(y.key){case Ce.Space:y.preventDefault();break}}),E=Mx(y=>{var T;s.state.listboxState===Be.Open?(je.flushSync(()=>s.actions.closeListbox()),(T=s.state.buttonElement)==null||T.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}),P=le(y=>y.preventDefault()),N=_0([i]),B=vx(),{isFocusVisible:F,focusProps:D}=H5({autoFocus:a}),{isHovered:b,hoverProps:g}=z5({isDisabled:c}),{pressed:v,pressProps:C}=K5({disabled:c}),O=En({open:p===Be.Open,active:v||p===Be.Open,disabled:c,invalid:o.invalid,value:o.value,hover:b,focus:F,autofocus:a}),I=qe(s,y=>y.listboxState===Be.Open),M=A0(f(),{ref:l,id:i,type:a2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":I,"aria-labelledby":N,"aria-describedby":B,disabled:c||void 0,autoFocus:a,onKeyDown:w,onKeyUp:$,onKeyPress:P},E,D,g,C);return rt()({ourProps:M,theirProps:u,slot:O,defaultTag:j8,name:"Listbox.Button"})}let vh=x.createContext(!1),U8="div",z8=Ls.RenderStrategy|Ls.Static;function H8(e,t){let n=x.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=t8(o),[l,f]=x.useState(null);u&&(s=!0);let p=_o("Listbox.Options"),d=ou("Listbox.Options"),[h,m,w,$]=qe(d,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),E=kc(m),P=kc(w),N=eu(),[B,F]=hp(c,l,N!==null?(N&Ct.Open)===Ct.Open:h===Be.Open);Vx(B,m,d.actions.closeListbox);let D=$?!1:i&&h===Be.Open;h2(D,P);let b=$?!1:i&&h===Be.Open;Wx(b,{allowed:x.useCallback(()=>[m,w],[m,w])});let g=qe(d,d.selectors.didButtonMove)?!1:B,v=qe(d,d.selectors.hasFrozenValue)&&!e.static,C=th(v,p.value),O=x.useCallback(H=>p.compare(C,H),[p.compare,C]),I=qe(d,H=>{var Z;if(u==null||!((Z=u==null?void 0:u.to)!=null&&Z.includes("selection")))return null;let J=H.options.findIndex(oe=>O(oe.dataRef.current.value));return J===-1&&(J=0),J}),M=(()=>{if(u==null)return;if(I===null)return{...u,inner:void 0};let H=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:H},index:I}}})(),[y,T]=s8(M),A=o8(),S=dt(t,u?y:null,d.actions.setOptionsElement,f),L=Gn();x.useEffect(()=>{let H=w;H&&h===Be.Open&&(q5(H)||H==null||H.focus({preventScroll:!0}))},[h,w]);let j=le(H=>{var Z;switch(L.dispose(),H.key){case Ce.Space:if(d.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),d.actions.search(H.key);case Ce.Enter:H.preventDefault(),H.stopPropagation(),d.actions.selectActiveOption();break;case ft(p.orientation,{vertical:Ce.ArrowDown,horizontal:Ce.ArrowRight}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Next});case ft(p.orientation,{vertical:Ce.ArrowUp,horizontal:Ce.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ce.Home:case Ce.PageUp:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ce.End:case Ce.PageDown:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ce.Escape:H.preventDefault(),H.stopPropagation(),je.flushSync(()=>d.actions.closeListbox()),(Z=d.state.buttonElement)==null||Z.focus({preventScroll:!0});return;case Ce.Tab:H.preventDefault(),H.stopPropagation(),je.flushSync(()=>d.actions.closeListbox()),Jx(d.state.buttonElement,H.shiftKey?Ic.Previous:Ic.Next);break;default:H.key.length===1&&(d.actions.search(H.key),L.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=qe(d,H=>{var Z;return(Z=H.buttonElement)==null?void 0:Z.id}),_=En({open:h===Be.Open}),W=A0(u?A():{},{id:r,ref:S,"aria-activedescendant":qe(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Tn.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Be.Open?0:void 0,style:{...a.style,...T,"--button-width":Ix(B,m,!0).width},...pp(F)}),K=rt(),G=x.useMemo(()=>p.mode===Tn.Multi?p:{...p,isSelected:O},[p,O]);return x.createElement(x8,{enabled:s?e.static||B:!1,ownerDocument:E},x.createElement(oi.Provider,{value:G},K({ourProps:W,theirProps:a,slot:_,defaultTag:U8,features:z8,visible:g,name:"Listbox.Options"})))}let W8="div";function V8(e,t){let n=x.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=x.useContext(vh)===!0,a=_o("Listbox.Option"),u=ou("Listbox.Option"),l=qe(u,v=>u.selectors.isActive(v,r)),f=a.isSelected(s),p=x.useRef(null),d=k8(p),h=qn({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=dt(t,p,v=>{v?a.listRef.current.set(r,v):a.listRef.current.delete(r)}),w=qe(u,v=>u.selectors.shouldScrollIntoView(v,r));Ee(()=>{if(w)return nt().requestAnimationFrame(()=>{var v,C;(C=(v=p.current)==null?void 0:v.scrollIntoView)==null||C.call(v,{block:"nearest"})})},[w,p]),Ee(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let $=le(v=>{if(o)return v.preventDefault();u.actions.selectOption(s)}),E=le(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),P=m2(),N=le(v=>P.update(v)),B=le(v=>{P.wasMoved(v)&&(o||l&&u.state.activationTrigger===ri.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},ri.Pointer))}),F=le(v=>{P.wasMoved(v)&&(o||l&&u.state.activationTrigger===ri.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),D=En({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),b=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:$,onFocus:E,onPointerEnter:N,onMouseEnter:N,onPointerMove:B,onMouseMove:B,onPointerLeave:F,onMouseLeave:F},g=rt();return!f&&c?null:g({ourProps:b,theirProps:i,slot:D,defaultTag:W8,name:"Listbox.Option"})}let G8=x.Fragment;function q8(e,t){let{options:n,placeholder:r,...o}=e,s={ref:dt(t)},i=_o("ListboxSelectedOption"),c=En({}),a=i.value===void 0||i.value===null||i.mode===Tn.Multi&&Array.isArray(i.value)&&i.value.length===0,u=rt();return x.createElement(vh.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:x.createElement(x.Fragment,null,r&&a?r:n)},slot:c,defaultTag:G8,name:"ListboxSelectedOption"}))}let Z8=Ge(R8),Y8=Ge(_8),K8=Ox,X8=Ge(H8),Q8=Ge(V8),J8=Ge(q8),mt=Object.assign(Z8,{Button:Y8,Label:K8,Options:X8,Option:Q8,SelectedOption:J8});const e3=()=>k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[k.jsx("g",{clipPath:"url(#clip0_active)",children:k.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"})}),k.jsx("defs",{children:k.jsx("clipPath",{id:"clip0_active",children:k.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),t3=()=>k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[k.jsx("g",{clipPath:"url(#clip0_inactive)",children:k.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"})}),k.jsx("defs",{children:k.jsx("clipPath",{id:"clip0_inactive",children:k.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Uo=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return k.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>k.jsx("div",{className:"flex items-center justify-center",children:o>t-e?k.jsx(e3,{}):k.jsx(t3,{})},o))})};class It{}Go(It,"FAST",3),Go(It,"Medium",2),Go(It,"SLOW",1),Go(It,"NONE",0);const n3=Object.values({MAINNET:1,SEPOLIA:11155111}),ln=e=>{const t=typeof e=="string"?parseInt(e,10):e;return n3.includes(t)},r3={USDT:!0},xh=(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:!r3[t.toUpperCase()]:!0},o3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=vt();return k.jsx("div",{className:`relative ${o}`,children:k.jsx(mt,{value:t,onChange:n,disabled:r,children:({open:c})=>k.jsxs(k.Fragment,{children:[k.jsxs(mt.Button,{className:`
|
|
130
130
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
131
131
|
items-center justify-between flex px-3 rounded-lg
|
|
132
132
|
focus:outline-none
|
|
@@ -146,7 +146,7 @@ ${fg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
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-none
|
|
149
|
-
`,children:e.map(a=>k.jsx(mt.Option,{value:a,className:({active:u,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:l})=>k.jsxs("div",{className:"flex items-center space-x-3",children:[k.jsx("img",{src:a.iconUrl,alt:i(a),className:"w-5 h-5 rounded-full"}),k.jsx("div",{className:"flex flex-col",children:k.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:i(a)})})]})},i(a)))})})]})})})},
|
|
149
|
+
`,children:e.map(a=>k.jsx(mt.Option,{value:a,className:({active:u,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:l})=>k.jsxs("div",{className:"flex items-center space-x-3",children:[k.jsx("img",{src:a.iconUrl,alt:i(a),className:"w-5 h-5 rounded-full"}),k.jsx("div",{className:"flex flex-col",children:k.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:i(a)})})]})},i(a)))})})]})})})},Eh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=Hn,txType:i="deposit",accountType:c})=>{const a=x.useCallback(w=>i==="withdraw"?s===Hn?w.allowAaWithdraw!==!1:w.allowWithdraw!==!1:s===Hn?w.allowAaDeposit!==!1:w.allowDeposit!==!1,[i,s]),u=x.useMemo(()=>{const w=new Set,$=[];for(const E of t)if(a(E))for(const P of E.tokenList||[]){const N=P.symbol||P.token;!N||!(i!=="withdraw"||P.withdrawEnable===!0&&P.pullOff===!1)||w.has(N)||(w.add(N),$.push({token:N,symbol:N,iconUrl:P.iconUrl,decimals:P.decimals,tokenAddress:P.tokenAddress}))}return $},[t,a,i]),l=w=>{n(w.chainId)},f=w=>{const $=w.symbol||w.token;o($);const E=[];for(const P of t){if(!a(P))continue;(P.tokenList||[]).some(B=>(B.symbol||B.token)===$)&&E.push(P.chainId)}!E.includes(e.chainId)&&E[0]!==void 0&&n(E[0])},p=x.useMemo(()=>{var E,P;const w=r||((E=u[0])==null?void 0:E.symbol)||((P=u[0])==null?void 0:P.token);if(!w)return[];const $=[];for(const N of t){if(!a(N))continue;const B=(N.tokenList||[]).find(F=>(F.symbol||F.token)===w?i==="withdraw"?F.withdrawEnable===!0&&F.pullOff===!1:!0:!1);B&&$.push({...N,tokenList:[{token:B.token,symbol:B.symbol,iconUrl:B.iconUrl,decimals:B.decimals,tokenAddress:B.tokenAddress}]})}return $},[t,r,u,a,i]),d=x.useMemo(()=>p.find(w=>w.chainId===e.chainId)||p[0],[p,e.chainId]),h=x.useMemo(()=>u,[u]),m=x.useMemo(()=>{if(h.length!==0)return h.find(w=>w.token===r||w.symbol===r)||h[0]},[h,r]);return x.useEffect(()=>{if(h.length===0)return;if(!h.some($=>($.symbol||$.token)===r)){const $=h[0];o($.symbol||$.token)}},[h,r,o]),x.useEffect(()=>{if(p.length===0)return;p.some($=>$.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),k.jsxs("div",{className:"space-y-4",children:[h.length>0&&m&&k.jsx(s3,{tokens:h,selectedToken:m,onTokenChange:f}),k.jsx(o3,{chains:p,selectedChain:d,onChainChange:w=>{const $=t.find(E=>E.chainId===w.chainId);$&&l($)},walletType:s,className:"w-full"})]})},i3=({options:e})=>k.jsx(k.Fragment,{children:e.map(t=>k.jsx(mt.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})=>k.jsx("div",{className:"flex items-center justify-between",children:k.jsx("div",{className:"flex items-center space-x-3",children:k.jsx("div",{className:"flex flex-col",children:k.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),Ph=({selectedAccount:e,onAccountChange:t,disabled:n=!1,className:r=""})=>{var f;const{t:o}=vt(),s=x.useMemo(()=>[{value:"spot",label:o("account.spot")},{value:"perpetual",label:o("account.perpetual")}],[o]),i=((f=s.find(p=>p.value===(e??"spot")))==null?void 0:f.label)||"",[c,a]=x.useState(e??"spot"),u=e??c,l=p=>{t==null||t(p),e||a(p)};return k.jsx("div",{className:`relative mb-4 ${r}`,children:k.jsx(mt,{value:u,onChange:l,disabled:n,children:({open:p})=>k.jsxs(k.Fragment,{children:[k.jsxs(mt.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-none
|
|
@@ -156,7 +156,7 @@ ${fg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
156
156
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
157
157
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
158
158
|
focus:outline-none
|
|
159
|
-
`,children:k.jsx(i3,{options:s})})})]})})})};var si={},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()}},c3=a3,
|
|
159
|
+
`,children:k.jsx(i3,{options:s})})})]})})})};var si={},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()}},c3=a3,Sh={"text/plain":"Text","text/html":"Url",default:"Text"},u3="Copy to clipboard: #{key}, Enter";function l3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function f3(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=c3(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Sh[t.format]||Sh.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");a=!0}catch(l){n&&console.error("unable to copy using execCommand: ",l),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=l3("message"in t?t.message:u3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var d3=f3;function su(e){"@babel/helpers - typeof";return su=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},su(e)}Object.defineProperty(si,"__esModule",{value:!0}),si.CopyToClipboard=void 0;var ii=$h(x),p3=$h(d3),h3=["text","onCopy","options","children"];function $h(e){return e&&e.__esModule?e:{default:e}}function Ah(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 Th(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ah(Object(n),!0).forEach(function(r){au(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ah(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function m3(e,t){if(e==null)return{};var n=b3(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function b3(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function g3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y3(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w3(e,t,n){return t&&y3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function v3(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&&iu(e,t)}function iu(e,t){return iu=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},iu(e,t)}function x3(e){var t=P3();return function(){var r=ai(e),o;if(t){var s=ai(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return E3(this,o)}}function E3(e,t){if(t&&(su(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oh(e)}function Oh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P3(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ai(e){return ai=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ai(e)}function au(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Nh=function(e){v3(n,e);var t=x3(n);function n(){var r;g3(this,n);for(var o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),au(Oh(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,p=a.options,d=ii.default.Children.only(f),h=(0,p3.default)(u,p);l&&l(u,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return w3(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=m3(o,h3),c=ii.default.Children.only(s);return ii.default.cloneElement(c,Th(Th({},i),{},{onClick:this.onClick}))}}]),n}(ii.default.PureComponent);si.CopyToClipboard=Nh,au(Nh,"defaultProps",{onCopy:void 0,options:void 0});var S3=si,cu=S3.CopyToClipboard;cu.CopyToClipboard=cu;var $3=cu;const A3=Lm($3);var T3=Object.defineProperty,ci=Object.getOwnPropertySymbols,Ch=Object.prototype.hasOwnProperty,Ih=Object.prototype.propertyIsEnumerable,Mh=(e,t,n)=>t in e?T3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uu=(e,t)=>{for(var n in t||(t={}))Ch.call(t,n)&&Mh(e,n,t[n]);if(ci)for(var n of ci(t))Ih.call(t,n)&&Mh(e,n,t[n]);return e},lu=(e,t)=>{var n={};for(var r in e)Ch.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ci)for(var r of ci(e))t.indexOf(r)<0&&Ih.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
160
160
|
* @license QR Code generator library (TypeScript)
|
|
161
161
|
* Copyright (c) Project Nayuki.
|
|
162
162
|
* SPDX-License-Identifier: MIT
|
|
@@ -164,7 +164,7 @@ ${fg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
164
164
|
* @license qrcode.react
|
|
165
165
|
* Copyright (c) Paul O'Shannessy
|
|
166
166
|
* SPDX-License-Identifier: ISC
|
|
167
|
-
*/var O3={L:Nr.QrCode.Ecc.LOW,M:Nr.QrCode.Ecc.MEDIUM,Q:Nr.QrCode.Ecc.QUARTILE,H:Nr.QrCode.Ecc.HIGH},Mh=128,kh="L",Bh="#FFFFFF",Lh="#000000",Fh=!1,Dh=1,N3=4,C3=0,I3=.1;function Rh(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function jh(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 M3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*I3),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,u=r.x==null?e.length/2-c/2:r.x*i,l=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),w=Math.ceil(c+u-h),$=Math.ceil(a+l-m);p={x:h,y:m,w,h:$}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function k3(e,t){return t!=null?Math.max(Math.floor(t),0):e?N3:C3}function _h({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=x.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,w)=>(m.push(...Nr.QrSegment.makeSegments(w)),m),[]);return Nr.QrCode.encodeSegments(h,O3[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=x.useMemo(()=>{let d=a.getModules();const h=k3(r,o),m=d.length+h*2,w=M3(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:w}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:p}}var B3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),L3=x.forwardRef(function(t,n){const r=t,{value:o,size:s=Mh,level:i=kh,bgColor:c=Bh,fgColor:a=Lh,includeMargin:u=Fh,minVersion:l=Dh,boostLevel:f,marginSize:p,imageSettings:d}=r,m=lu(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=m,$=lu(m,["style"]),E=d==null?void 0:d.src,P=x.useRef(null),N=x.useRef(null),B=x.useCallback(M=>{P.current=M,typeof n=="function"?n(M):n&&(n.current=M)},[n]),[F,D]=x.useState(!1),{margin:b,cells:g,numCells:v,calculatedImageSettings:C}=_h({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});x.useEffect(()=>{if(P.current!=null){const M=P.current,y=M.getContext("2d");if(!y)return;let T=g;const A=N.current,S=C!=null&&A!==null&&A.complete&&A.naturalHeight!==0&&A.naturalWidth!==0;S&&C.excavation!=null&&(T=jh(g,C.excavation));const L=window.devicePixelRatio||1;M.height=M.width=s*L;const j=s/v*L;y.scale(j,j),y.fillStyle=c,y.fillRect(0,0,v,v),y.fillStyle=a,B3?y.fill(new Path2D(Rh(T,b))):g.forEach(function(z,_){z.forEach(function(W,K){W&&y.fillRect(K+b,_+b,1,1)})}),C&&(y.globalAlpha=C.opacity),S&&y.drawImage(A,C.x+b,C.y+b,C.w,C.h)}}),x.useEffect(()=>{D(!1)},[E]);const O=uu({height:s,width:s},w);let I=null;return E!=null&&(I=x.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{D(!0)},ref:N,crossOrigin:C==null?void 0:C.crossOrigin})),x.createElement(x.Fragment,null,x.createElement("canvas",uu({style:O,height:s,width:s,ref:B,role:"img"},$)),I)});L3.displayName="QRCodeCanvas";var Uh=x.forwardRef(function(t,n){const r=t,{value:o,size:s=Mh,level:i=kh,bgColor:c=Bh,fgColor:a=Lh,includeMargin:u=Fh,minVersion:l=Dh,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=lu(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:$,numCells:E,calculatedImageSettings:P}=_h({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let N=$,B=null;h!=null&&P!=null&&(P.excavation!=null&&(N=jh($,P.excavation)),B=x.createElement("image",{href:h.src,height:P.h,width:P.w,x:P.x+w,y:P.y+w,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const F=Rh(N,w);return x.createElement("svg",uu({height:s,width:s,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},m),!!p&&x.createElement("title",null,p),x.createElement("path",{fill:c,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),x.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),B)});Uh.displayName="QRCodeSVG";function F3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function D3(){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 zh(){return/apple/i.test(navigator.vendor)}function R3(){return F3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function j3(){return D3().includes("jsdom/")}const Hh="data-floating-ui-focusable",_3="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fu(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 Cr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Lc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Ir(e){return"composedPath"in e?e.composedPath()[0]:e.target}function du(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 U3(e){return e.matches("html,body")}function zt(e){return(e==null?void 0:e.ownerDocument)||document}function Wh(e){return De(e)&&e.matches(_3)}function z3(e){if(!e||j3())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function H3(e){return e?e.hasAttribute(Hh)?e:e.querySelector("["+Hh+"]")||e:null}function ui(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,...ui(e,o.id,n)])}function W3(e){return"nativeEvent"in e}function zo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var V3=typeof document<"u",G3=function(){},Ht=V3?x.useLayoutEffect:G3;const q3={...U};function li(e){const t=U.useRef(e);return Ht(()=>{t.current=e}),t}const Z3=q3.useInsertionEffect||(e=>e());function Wt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Z3(()=>{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 Vh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Gh(e,t){const n=Ap(e,Vh()),r=n.length;if(r===0)return;const o=fu(zt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Y3(e){return Gh(zt(e).body,1)||e}function K3(e){return Gh(zt(e).body,-1)||e}function pu(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Cr(n,r)}function X3(e){Ap(e,Vh()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function qh(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 Q3="data-floating-ui-focusable",Zh="active",Yh="selected",J3={...U};let Kh=!1,e4=0;const Xh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+e4++;function t4(){const[e,t]=U.useState(()=>Kh?Xh():void 0);return Ht(()=>{e==null&&t(Xh())},[]),U.useEffect(()=>{Kh=!0},[]),e}const hu=J3.useId||t4;let mu;process.env.NODE_ENV!=="production"&&(mu=new Set);function n4(){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=mu)!=null&&e.has(o))){var s;(s=mu)==null||s.add(o),console.error(o)}}function r4(){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 o4=U.createContext(null),s4=U.createContext(null),bu=()=>{var e;return((e=U.useContext(o4))==null?void 0:e.id)||null},gu=()=>U.useContext(s4);function Ho(e){return"data-floating-ui-"+e}function bt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Qh=Ho("safe-polygon");function yu(e,t,n){if(n&&!zo(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 wu(e){return typeof e=="function"?e():e}function i4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:p=!0}=t,d=gu(),h=bu(),m=li(u),w=li(a),$=li(n),E=li(f),P=U.useRef(),N=U.useRef(-1),B=U.useRef(),F=U.useRef(-1),D=U.useRef(!0),b=U.useRef(!1),g=U.useRef(()=>{}),v=U.useRef(!1),C=Wt(()=>{var A;const S=(A=o.current.openEvent)==null?void 0:A.type;return(S==null?void 0:S.includes("mouse"))&&S!=="mousedown"});U.useEffect(()=>{if(!c)return;function A(S){let{open:L}=S;L||(bt(N),bt(F),D.current=!0,v.current=!1)}return s.on("openchange",A),()=>{s.off("openchange",A)}},[c,s]),U.useEffect(()=>{if(!c||!m.current||!n)return;function A(L){C()&&r(!1,L,"hover")}const S=zt(i.floating).documentElement;return S.addEventListener("mouseleave",A),()=>{S.removeEventListener("mouseleave",A)}},[i.floating,n,r,c,m,C]);const O=U.useCallback(function(A,S,L){S===void 0&&(S=!0),L===void 0&&(L="hover");const j=yu(w.current,"close",P.current);j&&!B.current?(bt(N),N.current=window.setTimeout(()=>r(!1,A,L),j)):S&&(bt(N),r(!1,A,L))},[w,r]),I=Wt(()=>{g.current(),B.current=void 0}),M=Wt(()=>{if(b.current){const A=zt(i.floating).body;A.style.pointerEvents="",A.removeAttribute(Qh),b.current=!1}}),y=Wt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function A(_){if(bt(N),D.current=!1,l&&!zo(P.current)||wu(E.current)>0&&!yu(w.current,"open"))return;const W=yu(w.current,"open",P.current);W?N.current=window.setTimeout(()=>{$.current||r(!0,_,"hover")},W):n||r(!0,_,"hover")}function S(_){if(y()){M();return}g.current();const W=zt(i.floating);if(bt(F),v.current=!1,m.current&&o.current.floatingContext){n||bt(N),B.current=m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){M(),I(),y()||O(_,!0,"safe-polygon")}});const G=B.current;W.addEventListener("mousemove",G),g.current=()=>{W.removeEventListener("mousemove",G)};return}(P.current==="touch"?!Cr(i.floating,_.relatedTarget):!0)&&O(_)}function L(_){y()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){M(),I(),y()||O(_)}})(_))}function j(){bt(N)}function z(_){y()||O(_,!1)}if(fe(i.domReference)){const _=i.domReference,W=i.floating;return n&&_.addEventListener("mouseleave",L),p&&_.addEventListener("mousemove",A,{once:!0}),_.addEventListener("mouseenter",A),_.addEventListener("mouseleave",S),W&&(W.addEventListener("mouseleave",L),W.addEventListener("mouseenter",j),W.addEventListener("mouseleave",z)),()=>{n&&_.removeEventListener("mouseleave",L),p&&_.removeEventListener("mousemove",A),_.removeEventListener("mouseenter",A),_.removeEventListener("mouseleave",S),W&&(W.removeEventListener("mouseleave",L),W.removeEventListener("mouseenter",j),W.removeEventListener("mouseleave",z))}}},[i,c,e,l,p,O,I,M,r,n,$,d,w,m,o,y,E]),Ht(()=>{var A;if(c&&n&&(A=m.current)!=null&&(A=A.__options)!=null&&A.blockPointerEvents&&C()){b.current=!0;const L=i.floating;if(fe(i.domReference)&&L){var S;const j=zt(i.floating).body;j.setAttribute(Qh,"");const z=i.domReference,_=d==null||(S=d.nodesRef.current.find(W=>W.id===h))==null||(S=S.context)==null?void 0:S.elements.floating;return _&&(_.style.pointerEvents=""),j.style.pointerEvents="none",z.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{j.style.pointerEvents="",z.style.pointerEvents="",L.style.pointerEvents=""}}}},[c,n,h,i,d,m,C]),Ht(()=>{n||(P.current=void 0,v.current=!1,I(),M())},[n,I,M]),U.useEffect(()=>()=>{I(),bt(N),bt(F),M()},[c,i.domReference,I,M]);const T=U.useMemo(()=>{function A(S){P.current=S.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(S){const{nativeEvent:L}=S;function j(){!D.current&&!$.current&&r(!0,L,"hover")}l&&!zo(P.current)||n||wu(E.current)===0||v.current&&S.movementX**2+S.movementY**2<2||(bt(F),P.current==="touch"?j():(v.current=!0,F.current=window.setTimeout(j,wu(E.current))))}}},[l,r,n,$,E]);return U.useMemo(()=>c?{reference:T}:{},[c,T])}const Jh={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},em=U.forwardRef(function(t,n){const[r,o]=U.useState();Ht(()=>{zh()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ho("focus-guard")]:"",style:Jh};return k.jsx("span",{...t,...s})}),tm=U.createContext(null),nm=Ho("portal");function a4(e){e===void 0&&(e={});const{id:t,root:n}=e,r=hu(),o=u4(),[s,i]=U.useState(null),c=U.useRef(null);return Ht(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Ht(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(nm,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Ht(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Bc(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(nm,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function c4(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=a4({id:n,root:r}),[i,c]=U.useState(null),a=U.useRef(null),u=U.useRef(null),l=U.useRef(null),f=U.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||p)return;function m(w){s&&pu(w)&&(w.type==="focusin"?qh:X3)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),U.useEffect(()=>{s&&(d||qh(s))},[d,s]),k.jsxs(tm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&k.jsx(em,{"data-type":"outside",ref:a,onFocus:m=>{if(pu(m,s)){var w;(w=l.current)==null||w.focus()}else{const $=i?i.domReference:null,E=K3($);E==null||E.focus()}}}),h&&s&&k.jsx("span",{"aria-owns":s.id,style:Jh}),s&&Br.createPortal(t,s),h&&s&&k.jsx(em,{"data-type":"outside",ref:u,onFocus:m=>{if(pu(m,s)){var w;(w=f.current)==null||w.focus()}else{const $=i?i.domReference:null,E=Y3($);E==null||E.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const u4=()=>U.useContext(tm);function rm(e){return De(e.target)&&e.target.tagName==="BUTTON"}function l4(e){return De(e.target)&&e.target.tagName==="A"}function om(e){return Wh(e)}function f4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:l=!0,stickIfOpen:f=!0}=t,p=U.useRef(),d=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const w=p.current;m.button===0&&c!=="click"&&(zo(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const w=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}zo(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!l||rm(m))&&(m.key===" "&&!om(s)&&(m.preventDefault(),d.current=!0),!l4(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||rm(m)||om(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const d4={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},p4={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},sm=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 h4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=gu(),w=Wt(typeof a=="function"?a:()=>!1),$=typeof a=="function"?w:a,E=U.useRef(!1),{escapeKey:P,outsidePress:N}=sm(d),{escapeKey:B,outsidePress:F}=sm(h),D=U.useRef(!1),b=Wt(M=>{var y;if(!n||!i||!c||M.key!=="Escape"||D.current)return;const T=(y=s.current.floatingContext)==null?void 0:y.nodeId,A=m?ui(m.nodesRef.current,T):[];if(!P&&(M.stopPropagation(),A.length>0)){let S=!0;if(A.forEach(L=>{var j;if((j=L.context)!=null&&j.open&&!L.context.dataRef.current.__escapeKeyBubbles){S=!1;return}}),!S)return}r(!1,W3(M)?M.nativeEvent:M,"escape-key")}),g=Wt(M=>{var y;const T=()=>{var A;b(M),(A=Ir(M))==null||A.removeEventListener("keydown",T)};(y=Ir(M))==null||y.addEventListener("keydown",T)}),v=Wt(M=>{var y;const T=s.current.insideReactTree;s.current.insideReactTree=!1;const A=E.current;if(E.current=!1,u==="click"&&A||T||typeof $=="function"&&!$(M))return;const S=Ir(M),L="["+Ho("inert")+"]",j=zt(o.floating).querySelectorAll(L);let z=fe(S)?S:null;for(;z&&!sn(z);){const G=an(z);if(sn(G)||!fe(G))break;z=G}if(j.length&&fe(S)&&!U3(S)&&!Cr(S,o.floating)&&Array.from(j).every(G=>!Cr(z,G)))return;if(De(S)&&I){const G=sn(S),H=ht(S),Z=/auto|scroll/,J=G||Z.test(H.overflowX),oe=G||Z.test(H.overflowY),me=J&&S.clientWidth>0&&S.scrollWidth>S.clientWidth,ge=oe&&S.clientHeight>0&&S.scrollHeight>S.clientHeight,de=H.direction==="rtl",se=ge&&(de?M.offsetX<=S.offsetWidth-S.clientWidth:M.offsetX>S.clientWidth),pe=me&&M.offsetY>S.clientHeight;if(se||pe)return}const _=(y=s.current.floatingContext)==null?void 0:y.nodeId,W=m&&ui(m.nodesRef.current,_).some(G=>{var H;return du(M,(H=G.context)==null?void 0:H.elements.floating)});if(du(M,o.floating)||du(M,o.domReference)||W)return;const K=m?ui(m.nodesRef.current,_):[];if(K.length>0){let G=!0;if(K.forEach(H=>{var Z;if((Z=H.context)!=null&&Z.open&&!H.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}r(!1,M,"outside-press")}),C=Wt(M=>{var y;const T=()=>{var A;v(M),(A=Ir(M))==null||A.removeEventListener(u,T)};(y=Ir(M))==null||y.addEventListener(u,T)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=P,s.current.__outsidePressBubbles=N;let M=-1;function y(j){r(!1,j,"ancestor-scroll")}function T(){window.clearTimeout(M),D.current=!0}function A(){M=window.setTimeout(()=>{D.current=!1},zs()?5:0)}const S=zt(o.floating);c&&(S.addEventListener("keydown",B?g:b,B),S.addEventListener("compositionstart",T),S.addEventListener("compositionend",A)),$&&S.addEventListener(u,F?C:v,F);let L=[];return p&&(fe(o.domReference)&&(L=$n(o.domReference)),fe(o.floating)&&(L=L.concat($n(o.floating))),!fe(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat($n(o.reference.contextElement)))),L=L.filter(j=>{var z;return j!==((z=S.defaultView)==null?void 0:z.visualViewport)}),L.forEach(j=>{j.addEventListener("scroll",y,{passive:!0})}),()=>{c&&(S.removeEventListener("keydown",B?g:b,B),S.removeEventListener("compositionstart",T),S.removeEventListener("compositionend",A)),$&&S.removeEventListener(u,F?C:v,F),L.forEach(j=>{j.removeEventListener("scroll",y)}),window.clearTimeout(M)}},[s,o,c,$,u,n,r,p,i,P,N,b,B,g,v,F,C]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,$,u]);const O=U.useMemo(()=>({onKeyDown:b,...l&&{[d4[f]]:M=>{r(!1,M.nativeEvent,"reference-press")},...f!=="click"&&{onClick(M){r(!1,M.nativeEvent,"reference-press")}}}}),[b,r,l,f]),I=U.useMemo(()=>({onKeyDown:b,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[p4[u]]:()=>{s.current.insideReactTree=!0}}),[b,u,s]);return U.useMemo(()=>i?{reference:O,floating:I}:{},[i,O,I])}function m4(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=hu(),s=U.useRef({}),[i]=U.useState(()=>r4()),c=bu()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&n4("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=Wt((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function b4(e){e===void 0&&(e={});const{nodeId:t}=e,n=m4({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=gu();Ht(()=>{l&&(f.current=l)},[l]);const d=Up({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(P=>{const N=fe(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(N),d.refs.setReference(N)},[d.refs]),m=U.useCallback(P=>{(fe(P)||P===null)&&(f.current=P,i(P)),(fe(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!fe(P))&&d.refs.setReference(P)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),$=U.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),E=U.useMemo(()=>({...d,...r,refs:w,elements:$,nodeId:t}),[d,w,$,t,r]);return Ht(()=>{r.dataRef.current.floatingContext=E;const P=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);P&&(P.context=E)}),U.useMemo(()=>({...d,context:E,refs:w,elements:$}),[d,w,$,E])}function vu(){return R3()&&zh()}function g4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,u=U.useRef(!1),l=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!c)return;const d=Ze(i.domReference);function h(){!n&&De(i.domReference)&&i.domReference===fu(zt(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function w(){f.current=!1}return d.addEventListener("blur",h),vu()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",w,!0)),()=>{d.removeEventListener("blur",h),vu()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",w,!0))}},[i.domReference,n,c]),U.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),U.useEffect(()=>()=>{bt(l)},[]);const p=U.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=Ir(d.nativeEvent);if(a&&fe(h)){if(vu()&&!d.relatedTarget){if(!f.current&&!Wh(h))return}else if(!z3(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,w=fe(h)&&h.hasAttribute(Ho("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var $;const E=fu(i.domReference?i.domReference.ownerDocument:document);!h&&E===i.domReference||Cr(($=s.current.floatingContext)==null?void 0:$.refs.floating.current,E)||Cr(i.domReference,E)||w||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:p}:{},[c,p])}function xu(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Zh]:i,[Yh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Q3]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Zh,Yh].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function y4(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>xu(c,e,"reference"),t),s=U.useCallback(c=>xu(c,e,"floating"),n),i=U.useCallback(c=>xu(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const w4=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function v4(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=hu(),l=((n=s.domReference)==null?void 0:n.id)||u,f=U.useMemo(()=>{var E;return((E=H3(s.floating))==null?void 0:E.id)||i},[s.floating,i]),p=(r=w4.get(a))!=null?r:a,h=bu()!=null,m=U.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:l},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,l,a]),w=U.useMemo(()=>{const E={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?E:{...E,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),$=U.useCallback(E=>{let{active:P,selected:N}=E;const B={role:"option",...P&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...B,"aria-selected":N}}return{}},[f,a]);return U.useMemo(()=>c?{reference:m,floating:w,item:$}:{},[c,m,w,$])}const im=x.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return k.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});im.displayName="TooltipArrow";const Qn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[u,l]=x.useState(!1),f=x.useRef(null),{refs:p,floatingStyles:d,context:h}=b4({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:Dp,middleware:[Zc(o?12:8),Hp({fallbackAxisSideDirection:"start",padding:8}),zp({padding:8}),...o?[DE({element:f})]:[]]}),m=i4(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),w=g4(h,{enabled:a.includes("focus")}),$=f4(h,{enabled:a.includes("click")}),E=h4(h),P=v4(h,{role:"tooltip"}),{getReferenceProps:N,getFloatingProps:B}=y4([m,w,$,E,P]);return i?k.jsx(k.Fragment,{children:e}):k.jsxs(k.Fragment,{children:[k.jsx("div",{ref:p.setReference,...N(),className:"cursor-help",children:e}),u&&k.jsx(c4,{children:k.jsxs("div",{ref:p.setFloating,...B(),style:{...d,zIndex:101},className:`
|
|
167
|
+
*/var O3={L:Nr.QrCode.Ecc.LOW,M:Nr.QrCode.Ecc.MEDIUM,Q:Nr.QrCode.Ecc.QUARTILE,H:Nr.QrCode.Ecc.HIGH},kh=128,Bh="L",Lh="#FFFFFF",Fh="#000000",Dh=!1,Rh=1,N3=4,C3=0,I3=.1;function jh(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function _h(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 M3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*I3),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,u=r.x==null?e.length/2-c/2:r.x*i,l=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),w=Math.ceil(c+u-h),$=Math.ceil(a+l-m);p={x:h,y:m,w,h:$}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function k3(e,t){return t!=null?Math.max(Math.floor(t),0):e?N3:C3}function Uh({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=x.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,w)=>(m.push(...Nr.QrSegment.makeSegments(w)),m),[]);return Nr.QrCode.encodeSegments(h,O3[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=x.useMemo(()=>{let d=a.getModules();const h=k3(r,o),m=d.length+h*2,w=M3(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:w}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:p}}var B3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),L3=x.forwardRef(function(t,n){const r=t,{value:o,size:s=kh,level:i=Bh,bgColor:c=Lh,fgColor:a=Fh,includeMargin:u=Dh,minVersion:l=Rh,boostLevel:f,marginSize:p,imageSettings:d}=r,m=lu(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=m,$=lu(m,["style"]),E=d==null?void 0:d.src,P=x.useRef(null),N=x.useRef(null),B=x.useCallback(M=>{P.current=M,typeof n=="function"?n(M):n&&(n.current=M)},[n]),[F,D]=x.useState(!1),{margin:b,cells:g,numCells:v,calculatedImageSettings:C}=Uh({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});x.useEffect(()=>{if(P.current!=null){const M=P.current,y=M.getContext("2d");if(!y)return;let T=g;const A=N.current,S=C!=null&&A!==null&&A.complete&&A.naturalHeight!==0&&A.naturalWidth!==0;S&&C.excavation!=null&&(T=_h(g,C.excavation));const L=window.devicePixelRatio||1;M.height=M.width=s*L;const j=s/v*L;y.scale(j,j),y.fillStyle=c,y.fillRect(0,0,v,v),y.fillStyle=a,B3?y.fill(new Path2D(jh(T,b))):g.forEach(function(z,_){z.forEach(function(W,K){W&&y.fillRect(K+b,_+b,1,1)})}),C&&(y.globalAlpha=C.opacity),S&&y.drawImage(A,C.x+b,C.y+b,C.w,C.h)}}),x.useEffect(()=>{D(!1)},[E]);const O=uu({height:s,width:s},w);let I=null;return E!=null&&(I=x.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{D(!0)},ref:N,crossOrigin:C==null?void 0:C.crossOrigin})),x.createElement(x.Fragment,null,x.createElement("canvas",uu({style:O,height:s,width:s,ref:B,role:"img"},$)),I)});L3.displayName="QRCodeCanvas";var zh=x.forwardRef(function(t,n){const r=t,{value:o,size:s=kh,level:i=Bh,bgColor:c=Lh,fgColor:a=Fh,includeMargin:u=Dh,minVersion:l=Rh,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=lu(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:$,numCells:E,calculatedImageSettings:P}=Uh({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let N=$,B=null;h!=null&&P!=null&&(P.excavation!=null&&(N=_h($,P.excavation)),B=x.createElement("image",{href:h.src,height:P.h,width:P.w,x:P.x+w,y:P.y+w,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const F=jh(N,w);return x.createElement("svg",uu({height:s,width:s,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},m),!!p&&x.createElement("title",null,p),x.createElement("path",{fill:c,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),x.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),B)});zh.displayName="QRCodeSVG";function F3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function D3(){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 Hh(){return/apple/i.test(navigator.vendor)}function R3(){return F3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function j3(){return D3().includes("jsdom/")}const Wh="data-floating-ui-focusable",_3="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fu(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 Cr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Lc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Ir(e){return"composedPath"in e?e.composedPath()[0]:e.target}function du(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 U3(e){return e.matches("html,body")}function zt(e){return(e==null?void 0:e.ownerDocument)||document}function Vh(e){return De(e)&&e.matches(_3)}function z3(e){if(!e||j3())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function H3(e){return e?e.hasAttribute(Wh)?e:e.querySelector("["+Wh+"]")||e:null}function ui(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,...ui(e,o.id,n)])}function W3(e){return"nativeEvent"in e}function zo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var V3=typeof document<"u",G3=function(){},Ht=V3?x.useLayoutEffect:G3;const q3={...U};function li(e){const t=U.useRef(e);return Ht(()=>{t.current=e}),t}const Z3=q3.useInsertionEffect||(e=>e());function Wt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Z3(()=>{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 Gh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function qh(e,t){const n=Tp(e,Gh()),r=n.length;if(r===0)return;const o=fu(zt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Y3(e){return qh(zt(e).body,1)||e}function K3(e){return qh(zt(e).body,-1)||e}function pu(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Cr(n,r)}function X3(e){Tp(e,Gh()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Zh(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 Q3="data-floating-ui-focusable",Yh="active",Kh="selected",J3={...U};let Xh=!1,e4=0;const Qh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+e4++;function t4(){const[e,t]=U.useState(()=>Xh?Qh():void 0);return Ht(()=>{e==null&&t(Qh())},[]),U.useEffect(()=>{Xh=!0},[]),e}const hu=J3.useId||t4;let mu;process.env.NODE_ENV!=="production"&&(mu=new Set);function n4(){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=mu)!=null&&e.has(o))){var s;(s=mu)==null||s.add(o),console.error(o)}}function r4(){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 o4=U.createContext(null),s4=U.createContext(null),bu=()=>{var e;return((e=U.useContext(o4))==null?void 0:e.id)||null},gu=()=>U.useContext(s4);function Ho(e){return"data-floating-ui-"+e}function bt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Jh=Ho("safe-polygon");function yu(e,t,n){if(n&&!zo(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 wu(e){return typeof e=="function"?e():e}function i4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:p=!0}=t,d=gu(),h=bu(),m=li(u),w=li(a),$=li(n),E=li(f),P=U.useRef(),N=U.useRef(-1),B=U.useRef(),F=U.useRef(-1),D=U.useRef(!0),b=U.useRef(!1),g=U.useRef(()=>{}),v=U.useRef(!1),C=Wt(()=>{var A;const S=(A=o.current.openEvent)==null?void 0:A.type;return(S==null?void 0:S.includes("mouse"))&&S!=="mousedown"});U.useEffect(()=>{if(!c)return;function A(S){let{open:L}=S;L||(bt(N),bt(F),D.current=!0,v.current=!1)}return s.on("openchange",A),()=>{s.off("openchange",A)}},[c,s]),U.useEffect(()=>{if(!c||!m.current||!n)return;function A(L){C()&&r(!1,L,"hover")}const S=zt(i.floating).documentElement;return S.addEventListener("mouseleave",A),()=>{S.removeEventListener("mouseleave",A)}},[i.floating,n,r,c,m,C]);const O=U.useCallback(function(A,S,L){S===void 0&&(S=!0),L===void 0&&(L="hover");const j=yu(w.current,"close",P.current);j&&!B.current?(bt(N),N.current=window.setTimeout(()=>r(!1,A,L),j)):S&&(bt(N),r(!1,A,L))},[w,r]),I=Wt(()=>{g.current(),B.current=void 0}),M=Wt(()=>{if(b.current){const A=zt(i.floating).body;A.style.pointerEvents="",A.removeAttribute(Jh),b.current=!1}}),y=Wt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function A(_){if(bt(N),D.current=!1,l&&!zo(P.current)||wu(E.current)>0&&!yu(w.current,"open"))return;const W=yu(w.current,"open",P.current);W?N.current=window.setTimeout(()=>{$.current||r(!0,_,"hover")},W):n||r(!0,_,"hover")}function S(_){if(y()){M();return}g.current();const W=zt(i.floating);if(bt(F),v.current=!1,m.current&&o.current.floatingContext){n||bt(N),B.current=m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){M(),I(),y()||O(_,!0,"safe-polygon")}});const G=B.current;W.addEventListener("mousemove",G),g.current=()=>{W.removeEventListener("mousemove",G)};return}(P.current==="touch"?!Cr(i.floating,_.relatedTarget):!0)&&O(_)}function L(_){y()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){M(),I(),y()||O(_)}})(_))}function j(){bt(N)}function z(_){y()||O(_,!1)}if(fe(i.domReference)){const _=i.domReference,W=i.floating;return n&&_.addEventListener("mouseleave",L),p&&_.addEventListener("mousemove",A,{once:!0}),_.addEventListener("mouseenter",A),_.addEventListener("mouseleave",S),W&&(W.addEventListener("mouseleave",L),W.addEventListener("mouseenter",j),W.addEventListener("mouseleave",z)),()=>{n&&_.removeEventListener("mouseleave",L),p&&_.removeEventListener("mousemove",A),_.removeEventListener("mouseenter",A),_.removeEventListener("mouseleave",S),W&&(W.removeEventListener("mouseleave",L),W.removeEventListener("mouseenter",j),W.removeEventListener("mouseleave",z))}}},[i,c,e,l,p,O,I,M,r,n,$,d,w,m,o,y,E]),Ht(()=>{var A;if(c&&n&&(A=m.current)!=null&&(A=A.__options)!=null&&A.blockPointerEvents&&C()){b.current=!0;const L=i.floating;if(fe(i.domReference)&&L){var S;const j=zt(i.floating).body;j.setAttribute(Jh,"");const z=i.domReference,_=d==null||(S=d.nodesRef.current.find(W=>W.id===h))==null||(S=S.context)==null?void 0:S.elements.floating;return _&&(_.style.pointerEvents=""),j.style.pointerEvents="none",z.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{j.style.pointerEvents="",z.style.pointerEvents="",L.style.pointerEvents=""}}}},[c,n,h,i,d,m,C]),Ht(()=>{n||(P.current=void 0,v.current=!1,I(),M())},[n,I,M]),U.useEffect(()=>()=>{I(),bt(N),bt(F),M()},[c,i.domReference,I,M]);const T=U.useMemo(()=>{function A(S){P.current=S.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(S){const{nativeEvent:L}=S;function j(){!D.current&&!$.current&&r(!0,L,"hover")}l&&!zo(P.current)||n||wu(E.current)===0||v.current&&S.movementX**2+S.movementY**2<2||(bt(F),P.current==="touch"?j():(v.current=!0,F.current=window.setTimeout(j,wu(E.current))))}}},[l,r,n,$,E]);return U.useMemo(()=>c?{reference:T}:{},[c,T])}const em={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},tm=U.forwardRef(function(t,n){const[r,o]=U.useState();Ht(()=>{Hh()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ho("focus-guard")]:"",style:em};return k.jsx("span",{...t,...s})}),nm=U.createContext(null),rm=Ho("portal");function a4(e){e===void 0&&(e={});const{id:t,root:n}=e,r=hu(),o=u4(),[s,i]=U.useState(null),c=U.useRef(null);return Ht(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Ht(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(rm,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Ht(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Bc(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(rm,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function c4(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=a4({id:n,root:r}),[i,c]=U.useState(null),a=U.useRef(null),u=U.useRef(null),l=U.useRef(null),f=U.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||p)return;function m(w){s&&pu(w)&&(w.type==="focusin"?Zh:X3)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),U.useEffect(()=>{s&&(d||Zh(s))},[d,s]),k.jsxs(nm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&k.jsx(tm,{"data-type":"outside",ref:a,onFocus:m=>{if(pu(m,s)){var w;(w=l.current)==null||w.focus()}else{const $=i?i.domReference:null,E=K3($);E==null||E.focus()}}}),h&&s&&k.jsx("span",{"aria-owns":s.id,style:em}),s&&Br.createPortal(t,s),h&&s&&k.jsx(tm,{"data-type":"outside",ref:u,onFocus:m=>{if(pu(m,s)){var w;(w=f.current)==null||w.focus()}else{const $=i?i.domReference:null,E=Y3($);E==null||E.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const u4=()=>U.useContext(nm);function om(e){return De(e.target)&&e.target.tagName==="BUTTON"}function l4(e){return De(e.target)&&e.target.tagName==="A"}function sm(e){return Vh(e)}function f4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:l=!0,stickIfOpen:f=!0}=t,p=U.useRef(),d=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const w=p.current;m.button===0&&c!=="click"&&(zo(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const w=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}zo(w,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!l||om(m))&&(m.key===" "&&!sm(s)&&(m.preventDefault(),d.current=!0),!l4(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||om(m)||sm(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const d4={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},p4={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},im=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 h4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=gu(),w=Wt(typeof a=="function"?a:()=>!1),$=typeof a=="function"?w:a,E=U.useRef(!1),{escapeKey:P,outsidePress:N}=im(d),{escapeKey:B,outsidePress:F}=im(h),D=U.useRef(!1),b=Wt(M=>{var y;if(!n||!i||!c||M.key!=="Escape"||D.current)return;const T=(y=s.current.floatingContext)==null?void 0:y.nodeId,A=m?ui(m.nodesRef.current,T):[];if(!P&&(M.stopPropagation(),A.length>0)){let S=!0;if(A.forEach(L=>{var j;if((j=L.context)!=null&&j.open&&!L.context.dataRef.current.__escapeKeyBubbles){S=!1;return}}),!S)return}r(!1,W3(M)?M.nativeEvent:M,"escape-key")}),g=Wt(M=>{var y;const T=()=>{var A;b(M),(A=Ir(M))==null||A.removeEventListener("keydown",T)};(y=Ir(M))==null||y.addEventListener("keydown",T)}),v=Wt(M=>{var y;const T=s.current.insideReactTree;s.current.insideReactTree=!1;const A=E.current;if(E.current=!1,u==="click"&&A||T||typeof $=="function"&&!$(M))return;const S=Ir(M),L="["+Ho("inert")+"]",j=zt(o.floating).querySelectorAll(L);let z=fe(S)?S:null;for(;z&&!sn(z);){const G=an(z);if(sn(G)||!fe(G))break;z=G}if(j.length&&fe(S)&&!U3(S)&&!Cr(S,o.floating)&&Array.from(j).every(G=>!Cr(z,G)))return;if(De(S)&&I){const G=sn(S),H=ht(S),Z=/auto|scroll/,J=G||Z.test(H.overflowX),oe=G||Z.test(H.overflowY),me=J&&S.clientWidth>0&&S.scrollWidth>S.clientWidth,ge=oe&&S.clientHeight>0&&S.scrollHeight>S.clientHeight,de=H.direction==="rtl",se=ge&&(de?M.offsetX<=S.offsetWidth-S.clientWidth:M.offsetX>S.clientWidth),pe=me&&M.offsetY>S.clientHeight;if(se||pe)return}const _=(y=s.current.floatingContext)==null?void 0:y.nodeId,W=m&&ui(m.nodesRef.current,_).some(G=>{var H;return du(M,(H=G.context)==null?void 0:H.elements.floating)});if(du(M,o.floating)||du(M,o.domReference)||W)return;const K=m?ui(m.nodesRef.current,_):[];if(K.length>0){let G=!0;if(K.forEach(H=>{var Z;if((Z=H.context)!=null&&Z.open&&!H.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}r(!1,M,"outside-press")}),C=Wt(M=>{var y;const T=()=>{var A;v(M),(A=Ir(M))==null||A.removeEventListener(u,T)};(y=Ir(M))==null||y.addEventListener(u,T)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=P,s.current.__outsidePressBubbles=N;let M=-1;function y(j){r(!1,j,"ancestor-scroll")}function T(){window.clearTimeout(M),D.current=!0}function A(){M=window.setTimeout(()=>{D.current=!1},zs()?5:0)}const S=zt(o.floating);c&&(S.addEventListener("keydown",B?g:b,B),S.addEventListener("compositionstart",T),S.addEventListener("compositionend",A)),$&&S.addEventListener(u,F?C:v,F);let L=[];return p&&(fe(o.domReference)&&(L=$n(o.domReference)),fe(o.floating)&&(L=L.concat($n(o.floating))),!fe(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat($n(o.reference.contextElement)))),L=L.filter(j=>{var z;return j!==((z=S.defaultView)==null?void 0:z.visualViewport)}),L.forEach(j=>{j.addEventListener("scroll",y,{passive:!0})}),()=>{c&&(S.removeEventListener("keydown",B?g:b,B),S.removeEventListener("compositionstart",T),S.removeEventListener("compositionend",A)),$&&S.removeEventListener(u,F?C:v,F),L.forEach(j=>{j.removeEventListener("scroll",y)}),window.clearTimeout(M)}},[s,o,c,$,u,n,r,p,i,P,N,b,B,g,v,F,C]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,$,u]);const O=U.useMemo(()=>({onKeyDown:b,...l&&{[d4[f]]:M=>{r(!1,M.nativeEvent,"reference-press")},...f!=="click"&&{onClick(M){r(!1,M.nativeEvent,"reference-press")}}}}),[b,r,l,f]),I=U.useMemo(()=>({onKeyDown:b,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[p4[u]]:()=>{s.current.insideReactTree=!0}}),[b,u,s]);return U.useMemo(()=>i?{reference:O,floating:I}:{},[i,O,I])}function m4(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=hu(),s=U.useRef({}),[i]=U.useState(()=>r4()),c=bu()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&n4("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=U.useState(r.reference),l=Wt((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function b4(e){e===void 0&&(e={});const{nodeId:t}=e,n=m4({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=gu();Ht(()=>{l&&(f.current=l)},[l]);const d=zp({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(P=>{const N=fe(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(N),d.refs.setReference(N)},[d.refs]),m=U.useCallback(P=>{(fe(P)||P===null)&&(f.current=P,i(P)),(fe(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!fe(P))&&d.refs.setReference(P)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),$=U.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),E=U.useMemo(()=>({...d,...r,refs:w,elements:$,nodeId:t}),[d,w,$,t,r]);return Ht(()=>{r.dataRef.current.floatingContext=E;const P=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);P&&(P.context=E)}),U.useMemo(()=>({...d,context:E,refs:w,elements:$}),[d,w,$,E])}function vu(){return R3()&&Hh()}function g4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,u=U.useRef(!1),l=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!c)return;const d=Ze(i.domReference);function h(){!n&&De(i.domReference)&&i.domReference===fu(zt(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function w(){f.current=!1}return d.addEventListener("blur",h),vu()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",w,!0)),()=>{d.removeEventListener("blur",h),vu()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",w,!0))}},[i.domReference,n,c]),U.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),U.useEffect(()=>()=>{bt(l)},[]);const p=U.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=Ir(d.nativeEvent);if(a&&fe(h)){if(vu()&&!d.relatedTarget){if(!f.current&&!Vh(h))return}else if(!z3(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,w=fe(h)&&h.hasAttribute(Ho("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var $;const E=fu(i.domReference?i.domReference.ownerDocument:document);!h&&E===i.domReference||Cr(($=s.current.floatingContext)==null?void 0:$.refs.floating.current,E)||Cr(i.domReference,E)||w||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:p}:{},[c,p])}function xu(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Yh]:i,[Kh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Q3]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Yh,Kh].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[u]=l}),i),{})}}function y4(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=U.useCallback(c=>xu(c,e,"reference"),t),s=U.useCallback(c=>xu(c,e,"floating"),n),i=U.useCallback(c=>xu(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const w4=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function v4(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=hu(),l=((n=s.domReference)==null?void 0:n.id)||u,f=U.useMemo(()=>{var E;return((E=H3(s.floating))==null?void 0:E.id)||i},[s.floating,i]),p=(r=w4.get(a))!=null?r:a,h=bu()!=null,m=U.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:l},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,l,a]),w=U.useMemo(()=>{const E={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?E:{...E,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),$=U.useCallback(E=>{let{active:P,selected:N}=E;const B={role:"option",...P&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...B,"aria-selected":N}}return{}},[f,a]);return U.useMemo(()=>c?{reference:m,floating:w,item:$}:{},[c,m,w,$])}const am=x.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return k.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});am.displayName="TooltipArrow";const Qn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[u,l]=x.useState(!1),f=x.useRef(null),{refs:p,floatingStyles:d,context:h}=b4({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:Rp,middleware:[Zc(o?12:8),Wp({fallbackAxisSideDirection:"start",padding:8}),Hp({padding:8}),...o?[DE({element:f})]:[]]}),m=i4(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),w=g4(h,{enabled:a.includes("focus")}),$=f4(h,{enabled:a.includes("click")}),E=h4(h),P=v4(h,{role:"tooltip"}),{getReferenceProps:N,getFloatingProps:B}=y4([m,w,$,E,P]);return i?k.jsx(k.Fragment,{children:e}):k.jsxs(k.Fragment,{children:[k.jsx("div",{ref:p.setReference,...N(),className:"cursor-help",children:e}),u&&k.jsx(c4,{children:k.jsxs("div",{ref:p.setFloating,...B(),style:{...d,zIndex:101},className:`
|
|
168
168
|
z-[101] px-3 py-2 cursor-help
|
|
169
169
|
bg-fill-page-secondary
|
|
170
170
|
text-text-primary text-sm font-medium
|
|
@@ -172,5 +172,5 @@ ${fg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
172
172
|
relative
|
|
173
173
|
${c}
|
|
174
174
|
${s}
|
|
175
|
-
`,children:[t,o&&k.jsx(im,{ref:f,placement:h.placement||n})]})})]})},Wo="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=",x4=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=vt(),a=x.useMemo(()=>{if(!e)return!1;const f=r===d5,p=Number(e.chainId),d=!Number.isNaN(p)&&(p===42161||p===421614),h=(t||"").toUpperCase()==="ETH";return f&&d&&h},[r,e,t]),u=x.useMemo(()=>{var f;return(f=e==null?void 0:e.tokenList)==null?void 0:f.find(p=>p.token===t||p.symbol===t)},[e,t]),l=(u==null?void 0:u.minDepositSize)||"10";return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&k.jsx("div",{className:"bg-white rounded-lg",children:k.jsx(Uh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&k.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[k.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),k.jsx(A3,{onCopy:()=>{s&&s(n)},text:n,children:k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[k.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),k.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")]}),k.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[k.jsxs("div",{className:"flex items-start",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1",children:k.jsx("p",{className:"text-xs text-functional-orange-1",children:c(a?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),r===p5&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.addressUpdatedNotice")})]})]}),k.jsxs("div",{className:"text-sm",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),k.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:[l," ",t]})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),k.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},Vo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return k.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},E4=(e,t)=>Number(e)>Number(t),Mt=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"},fi=(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 fi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Mt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},P4=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Mt(Math.max(0,s).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(e),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Mt(e)} ${n}`},S4=(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)},$4=(e,t,n)=>{if(!vh(e,n))return!1;try{const r=new Ie(t||"0"),o=new Ie("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},A4=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&vh(e,n))try{const i=new Ie(o),c=new Ie("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Ie(o||"0");return console.log("bn:",i),console.log("bn:",i.isNaN()),i.isNaN()?o:i.decimalPlaces(6,Ie.ROUND_DOWN).toString()}catch{return o}},am={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let Ye=null;const cm=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState(am),a=x.useCallback(h=>{c(h),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ye={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{Ye=null}),[a,l,u,f,p,d]),n?k.jsx(hm,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});cm.displayName="DepositManager";const um=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.openDeposit(e||am)},lm=()=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.closeDeposit()},fm=e=>{Ye&&Ye.updateDepositOptions(e)},di=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.setDepositLoading(e)},T4=()=>Ye?Ye.isOpen():!1,dm=()=>Ye?Ye.isLoading():!1,O4=()=>({openDeposit:um,closeDeposit:lm,updateDepositOptions:fm,setDepositLoading:di,isOpen:T4,isLoading:dm}),N4=e=>{const{t}=vt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return x.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=a,f=S4(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<l?{text:t("deposit.minDepositParsed",{amount:l,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function C4(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),$=i({address:l,abi:yr,functionName:"allowance",args:[mn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&l&&p)}}),E=$!=null&&$.isSuccess?$.data:void 0,P=x.useMemo(()=>{if(d)return!0;if(!$.isSuccess||E===void 0||E===0n)return!1;try{const B=v6(String(Number(s||"0")||0),Number(f));return E>=B}catch{return!1}},[d,$.isSuccess,E,s,f]),N=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!p)return;const F=mn(l),D=mn(p);if((E||0n)>0n){const v=await m({abi:yr,address:F,functionName:"approve",args:[D,0n]});await w.waitForTransactionReceipt({hash:v})}const g=await m({abi:yr,address:F,functionName:"approve",args:[D,ef]});await w.waitForTransactionReceipt({hash:g}),$!=null&&$.refetch&&await $.refetch()}catch(B){console.error("[useApprove] onApprove failed:",B)}},[r,n,l,p,E,$,m,w,h]);return{approve:P,onApprove:N}}const I4=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return x.useEffect(()=>{o(mn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},M4=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var E;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=x.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",N="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(B=>{const F=B.tokenAddress;if(!F)return!1;const D=F.toLowerCase();return!(F===P||D===N)})},[r]),[c,a]=x.useState({}),u=x.useCallback((P,N)=>{a(B=>({...B,[P]:N}))},[]),l=(E=o==null?void 0:o.useBalance)==null?void 0:E.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=x.useState(0),d=x.useMemo(()=>i.map(P=>x.createElement(I4,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:u})),[i,e,s,n,o,u,f]),h=x.useMemo(()=>{const P=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=i.map(F=>{const D=c[mn(F.tokenAddress)],b=D==null?void 0:D.balance,g=b==null?void 0:b.data;return{address:mn(F.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||F.decimals}}).filter(F=>F.address),B=N.reduce((F,D)=>({...F,[D.address]:{balance:D}}),{});return{balanceList:N,baseTokenBalance:P,combinedData:B}},[l,c,i]),m=x.useCallback(async()=>h,[h]),w=x.useMemo(()=>{const P=(l==null?void 0:l.isLoading)||!1,N=Object.values(c).some(B=>{var F;return(F=B.balance)==null?void 0:F.isLoading});return P||N},[l==null?void 0:l.isLoading,c]),$=x.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:$,multicallResult:h,validErcTokens:i,isLoading:w,queryComponents:d}},k4=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:u}=vt(),l=i.useAccount(),f=t.tokenList.find(_=>_.token===n||_.symbol===n),p=t.chainId,[d,h]=x.useState("");x.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:w}=M4({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),$=x.useMemo(()=>{var W;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const _=m.combinedData[f.tokenAddress];return((W=_==null?void 0:_.balance)==null?void 0:W.formatted)||"0"},[f,m]),E="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",P="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",N=x.useMemo(()=>{var _,W;return o5({chain:c5,transport:a5(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((W=window==null?void 0:window.ENV)==null?void 0:W.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),B="1000000000000",{formatted:F}=u5({client:N,tokenAddress:E,holder:P,decimals:6,fallbackFormatted:B,pollingInterval:12e3}),[D,b]=x.useState(!1),{approve:g,onApprove:v}=C4({account:e,accountChainId:l.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),C=x.useCallback(async()=>{if(!D)try{b(!0),await v()}catch(_){console.error("Approve failed:",_)}finally{b(!1)}},[D,v]),O=x.useMemo(()=>+l.chainId!=+t.chainId,[l.chainId,t.chainId]),I=x.useCallback(async()=>{c&&c(p)},[c,p]);x.useEffect(()=>{O&&I()},[O,I]);const{showLayerZeroTip:M,layerZeroTipKey:y}=x.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,W=(n==null?void 0:n.toUpperCase())==="USDT",K=new Ie(d||"0"),G=new Ie("200000");let H=!1,Z;if(_&&W&&d)if(K.gte(G))H=!0,Z="deposit.layerZeroDepositTipGte200k";else{const J=F;if(typeof J=="string"&&J.length>0){const me=new Ie(J);!me.isNaN()&&K.gte(me)&&(H=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:H,layerZeroTipKey:Z}},[t.chainId,n,d,F]),T=x.useCallback(()=>A4(+t.chainId,$||"0",n,r),[$,t==null?void 0:t.chainId,n,r]),A=x.useMemo(()=>r!=="spot"&&$4(+t.chainId,d,n),[r,t==null?void 0:t.chainId,d,n]),S=x.useMemo(()=>"deposit.maxDepositSplitTip",[]),L=N4({isNetworkMismatch:O,depositAmount:d,approved:g,currentTokenBalance:$,selectedToken:n,showLayerZeroTip:M,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),j=_=>{const W=_.target.value,K=T(),G=fi(W,K);if(G.isValid)h(G.formattedValue),G.errorType;else return G.errorType==="exceed_balance",void 0},z=x.useCallback(async()=>{di(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(_){console.error("Deposit error:",_),di(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return k.jsxs(k.Fragment,{children:[w,k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:u("deposit.amount"),value:d,onChange:j,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:()=>{const _=T();h(_)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:u("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:u("deposit.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:u("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:P4($||"0",d,n)})]})]}),!g&&E4(d||"0",0)&&k.jsxs("div",{className:"flex justify-center flex-col items-center",children:[k.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:u("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),k.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:u("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),k.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:C,disabled:D,children:D?k.jsx(Vo,{size:"xs",inline:!0}):u("deposit.enableWithToken",{token:n})})]}),M&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(y||"deposit.layerZeroDepositTip")})]}),k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),A&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(S)})]}),A&&k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:!(A||M)&&k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u("deposit.noPrivateKeyWalletWarning")})]}),k.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:u("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),k.jsx("p",{children:u("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:u("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.equity")}),k.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Mt((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${Mt(o)} ${n}`})]})]}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${L.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:L.disabled||s,children:[(s||O)&&k.jsx(Vo,{size:"xs"}),L.text]})]})},pm=e=>e.toLocaleUpperCase()===Hn?Hn:sc,Eu=e=>pm(e.wallet)===Hn,B4=e=>pm(e.wallet)===sc,hm=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:u,wagmiHooks:l,onDeposit:f,onCopy:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=vt(),[w,$]=x.useState(a),E=x.useCallback(A=>A==="spot"&&s&&s.length>0?s:o,[o,s]),P=E(a),[N,B]=x.useState(()=>{var A;return!P||P.length===0?1:i||((A=P[0])==null?void 0:A.chainId)||1}),F=x.useMemo(()=>E(w),[w,E]),D=F.find(A=>A.chainId===N)||F[0],[b,g]=x.useState(()=>{var _;if(!P||P.length===0)return"";const A=i||((_=P[0])==null?void 0:_.chainId),S=P.find(W=>W.chainId===A)||P[0],L=((S==null?void 0:S.tokenList)||[]).length>0?S:P.find(W=>(W.tokenList||[]).length>0),j=(L==null?void 0:L.tokenList)||[];if(c&&j.length>0){const W=c.toUpperCase(),K=j.find(G=>(G.token||G.symbol||"").toUpperCase()===W);if(K)return K.token||K.symbol||""}const z=j[0];return(z==null?void 0:z.token)||(z==null?void 0:z.symbol)||""}),v=x.useCallback(A=>{B(A),d==null||d(A)},[d]),C=x.useCallback(A=>{g(A),h==null||h(A)},[h]),O=x.useMemo(()=>{const A=(b||"").toLowerCase();if(!A)return"0";const S=w==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,L=S==null?void 0:S[A];return typeof L=="string"&&L.length>0?L:"0"},[u,w,b]),[I,M]=x.useState(!1),y=A=>{A.target===A.currentTarget?M(!0):M(!1)},T=A=>{I&&A.target===A.currentTarget&&n(),M(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:y,onMouseUp:T,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:A=>{A.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(u0,{className:"h-4 w-4"})})]}),k.jsx(Eh,{selectedAccount:w,onAccountChange:A=>{var H,Z;const S=A||"perpetual";$(S);const L=E(S);if(!L||L.length===0)return;const j=L.find(J=>J.chainId===N),z=j?j.chainId:L[0].chainId;B(z),d==null||d(z);const _=L.find(J=>J.chainId===z),W=(_==null?void 0:_.tokenList)||[],G=W.some(J=>(J.symbol||J.token)===b)?b:((H=W[0])==null?void 0:H.symbol)||((Z=W[0])==null?void 0:Z.token)||"";G&&(g(G),h==null||h(G))},className:"w-full"}),k.jsx(xh,{currentActiveChain:D,chainList:F,onChainChange:v,curSelectToken:b,onTokenChange:C,walletType:Eu(r)?Hn:sc,accountType:w}),Eu(r)&&k.jsx(x4,{address:r.smartWalletAddress,currentActiveChain:D,selectedToken:b,accountType:w,onDeposit:f,onCopy:p,onClose:n}),B4(r)&&k.jsx(k4,{address:r.ethAddress,currentActiveChain:D,selectedToken:b,accountType:w,platformBalance:O,isLoading:t,wagmiHooks:l,onChainChange:v,onDeposit:f,onClose:n})]})})}),document.body):null},L4=e=>{if(e==null||e==="")return 2;const t=String(e),n=t.indexOf(".");if(n===-1)return 0;const r=t.length-n-1;return r>0?r:2},F4=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:l,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=vt(),h=x.useMemo(()=>{const F=L4(n==null?void 0:n.showStepSize);if(a==="spot"||!ln(r==null?void 0:r.chainId)){const D=new Ie(e||"0").minus(s||"0").decimalPlaces(F,Ie.ROUND_DOWN);return D.isNegative()?"0.00":D.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=x.useMemo(()=>o||"0",[o]),w=x.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ie(F||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),$=x.useMemo(()=>w==="0",[w]),E=x.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),P=F=>{const D=F.target.value,g=fi(D,m||"0");if(g.isValid)u(g.formattedValue),g.errorType;else return g.errorType==="exceed_balance",void 0;f==null||f(g.formattedValue)},N=()=>{const F=m||"0",b=fi(F,F).formattedValue;u(b),f==null||f(b)},B=()=>{const F=parseFloat(o||"0"),D=parseFloat(e||"0");if(D>0){const b=F-D,g=Mt(Math.max(0,b).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o||"0"),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),g," ",t]})}return`${Mt(o||"0")} ${t}`};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:P,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:N,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:d("withdraw.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:B()})]})]}),i==="mpc"&&(a==="spot"||!ln(r==null?void 0:r.chainId))?k.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:k.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:F=>l==null?void 0:l(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,k.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:ln(r==null?void 0:r.chainId)?k.jsxs(k.Fragment,{children:[k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),k.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")})]}):k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),k.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[k.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[k.jsx(Qn,{content:k.jsxs("div",{children:[k.jsx("div",{children:d("withdraw.speedNote")}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.FAST,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.Medium,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.SLOW,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:k.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),k.jsx("div",{className:"flex items-center",children:k.jsx(Uo,{selectedLevel:ln(r==null?void 0:r.chainId)?It.SLOW:It.FAST,maxLevel:3})})]}),(a==="spot"||!ln(r==null?void 0:r.chainId))&&k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[$||!E?k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:$?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):k.jsx(Qn,{className:"w-[320px] font-normal flex items-center justify-center",content:k.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:k.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")}`})}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!$&&` / ${w}%`]})]}),k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(ln(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Mt(h)," ",t]})]})]})]})},D4=[];let Ke=null;const mm=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=x.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ke={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ke=null}),[a,l,u,f,p,d]),n?k.jsx(vm,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||D4,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});mm.displayName="WithdrawManager";const bm=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},gm=()=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.closeWithdraw()},ym=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.updateWithdrawOptions(e)},pi=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.setWithdrawLoading(e)},R4=()=>Ke?Ke.isOpen():!1,wm=()=>Ke?Ke.isLoading():!1,j4=()=>({openWithdraw:bm,closeWithdraw:gm,updateWithdrawOptions:ym,setWithdrawLoading:pi,isOpen:R4,isLoading:wm}),_4=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:u,fee:l="0.00",isLoading:f=!1,onWithdraw:p,onClose:d,onChainChange:h,onTokenChange:m,onAmountChanged:w,onAccountChange:$})=>{var H;const{t:E}=vt(),[P,N]=x.useState(i),B=x.useCallback(Z=>Z==="spot"&&n&&n.length>0?n:t,[t,n]),F=x.useMemo(()=>B(P),[P,B]),D=x.useMemo(()=>{if(!F||F.length===0)return{chainId:1,tokenSymbol:""};const Z=de=>{const se=de||[];if(!se.length)return"";const ee="USDC".toUpperCase(),On=se.find(gt=>(gt.token||gt.symbol||"").toUpperCase()===ee)||se[0];return On.token||On.symbol||""};if(o){const de=o==null?void 0:o.toUpperCase();for(const se of F){const pe=se.tokenList||[];let ee;if(de&&(ee=pe.find(Pe=>(Pe.token||Pe.symbol||"").toUpperCase()===de)),ee){const Pe=ee.token||ee.symbol||o||"";return{chainId:se.chainId,tokenSymbol:Pe}}}}if(r){const de=F.find(ee=>ee.chainId===r)||F[0],se=de.tokenList||[],pe=Z(se);return{chainId:de.chainId,tokenSymbol:pe}}const J="USDC",oe=de=>Array.isArray(de.tokenList)&&de.tokenList.some(se=>(se.token||se.symbol||"").toUpperCase()===J),me=F.find(oe)||F[0];if(!me)return{chainId:1,tokenSymbol:""};const ge=Z(me.tokenList);return{chainId:me.chainId,tokenSymbol:ge}},[F,r,o]),[b,g]=x.useState(()=>D.chainId),[v,C]=x.useState(()=>D.tokenSymbol),[O,I]=x.useState(s),[M,y]=x.useState(""),T=x.useCallback(Z=>{g(Z),h==null||h(Z)},[h]),A=x.useCallback(Z=>{C(Z),m==null||m(Z)},[m]),S=x.useRef(!0),L=x.useRef(v),j=x.useRef(b);x.useEffect(()=>{if(S.current){S.current=!1,L.current=v,j.current=b;return}(L.current!==v||j.current!==b)&&(I(""),L.current=v,j.current=b)},[v,b]);const z=F&&F.length>0?F.find(Z=>Z.chainId===b)||F[0]:null,_=(H=z==null?void 0:z.tokenList)==null?void 0:H.find(Z=>Z.token===v),W=x.useMemo(()=>{const Z=new Ie(O||"0"),J=new Ie(l||"0"),oe=ln(b);return _!=null&&_.minWithdrawSize&&Z.lt(_.minWithdrawSize)?{text:E("withdraw.minWithdrawParsed",{amount:_.minWithdrawSize,token:_.symbol||_.token}),disabled:!0}:!O||Z.isZero()||!oe&&Z.isLessThan(J)?{text:E("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!oe||P==="spot")&&!M.trim()?{text:E("withdraw.invalidReceiverAddress"),disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,b,O,e,M,l,P,_]),K=x.useMemo(()=>{const Z=(v||"").toLowerCase();if(!Z)return a||"0";const J=P==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,oe=J==null?void 0:J[Z];return typeof oe=="string"&&oe.length>0?oe:a||"0"},[u,P,v,a]),G=x.useCallback(async()=>{pi(!0);try{if(p){const J={amount:new Ie(O||"0").toString(),chainId:b,tokenAddress:(_==null?void 0:_.tokenAddress)||"",coinId:(_==null?void 0:_.coinId)||"",tokenSymbol:v,accountType:P,selectedToken:_};e==="mpc"&&(!ln(b)||P==="spot")&&(J.receiverAddress=M),p(J)}}catch{pi(!1)}},[p,P,_,O,b,v,e,M]);return!F||F.length===0?k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"No chains available"})}):z?k.jsxs(k.Fragment,{children:[k.jsx(Eh,{selectedAccount:P,onAccountChange:Z=>{var Pe,On;const J=Z||"perpetual";N(J),$==null||$(J);const oe=B(J);if(!oe||oe.length===0)return;const me=oe.find(gt=>gt.chainId===b),ge=me?me.chainId:oe[0].chainId;g(ge),h==null||h(ge);const de=oe.find(gt=>gt.chainId===ge),se=(de==null?void 0:de.tokenList)||[],ee=se.some(gt=>(gt.symbol||gt.token)===v)?v:((Pe=se[0])==null?void 0:Pe.symbol)||((On=se[0])==null?void 0:On.token)||"";ee&&(C(ee),m==null||m(ee))},className:"w-full"}),k.jsx(xh,{currentActiveChain:z,chainList:F,onChainChange:T,curSelectToken:v,onTokenChange:A,walletType:"EVM",txType:"withdraw"}),k.jsx(F4,{withdrawAmount:O,curSelectToken:v,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:z,currentEquity:c||0,decimals:(_==null?void 0:_.decimals)||6,platformBalance:K,fee:l,walletType:e,accountType:P,receiverAddress:M,onWithdrawAmountChange:I,onReceiverAddressChange:y,onAmountChanged:w}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:G,disabled:W.disabled||f,children:[f&&k.jsx(Vo,{size:"xs"}),W.text]})]}):k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"Loading..."})})},vm=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:u,defaultAmount:l="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:w,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})=>{const{t:B}=vt(),[F,D]=x.useState(!1),b=v=>{v.target===v.currentTarget?D(!0):D(!1)},g=v=>{F&&v.target===v.currentTarget&&r(),D(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:b,onMouseUp:g,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:v=>{v.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:B("withdraw.withdraw")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:k.jsx(u0,{className:"h-4 w-4"})})]}),k.jsx(_4,{chains:i,spotChains:c,walletType:Eu(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:u,defaultAmount:l,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:w,onClose:r,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})]})})}),document.body):null};re.ChromeLoader=Vo,re.ComponentProvider=Vm,re.DEFAULT_LOCALE=qo,re.Deposit=hm,re.DepositManager=cm,re.LOCALE_NAMES=zm,re.LoadingSpinner=Vo,re.SUPPORTED_LOCALES=bi,re.Tooltip=Qn,re.Withdraw=vm,re.WithdrawManager=mm,re.closeDeposit=lm,re.closeWithdraw=gm,re.formatThousands=qm,re.isDepositLoading=dm,re.isWithdrawLoading=wm,re.openDeposit=um,re.openWithdraw=bm,re.setDepositLoading=di,re.setWithdrawLoading=pi,re.updateDepositOptions=fm,re.updateWithdrawOptions=ym,re.useComponentConfig=Lu,re.useDeposit=l5,re.useDepositManager=O4,re.useTranslation=vt,re.useWithdraw=f5,re.useWithdrawManager=j4,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|
|
175
|
+
`,children:[t,o&&k.jsx(am,{ref:f,placement:h.placement||n})]})})]})},Wo="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=",x4=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=vt(),a=x.useMemo(()=>{if(!e)return!1;const f=r===p5,p=Number(e.chainId),d=!Number.isNaN(p)&&(p===42161||p===421614),h=(t||"").toUpperCase()==="ETH";return f&&d&&h},[r,e,t]),u=x.useMemo(()=>{var f;return(f=e==null?void 0:e.tokenList)==null?void 0:f.find(p=>p.token===t||p.symbol===t)},[e,t]),l=(u==null?void 0:u.minDepositSize)||"10";return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&k.jsx("div",{className:"bg-white rounded-lg",children:k.jsx(zh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&k.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[k.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),k.jsx(A3,{onCopy:()=>{s&&s(n)},text:n,children:k.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[k.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),k.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")]}),k.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[k.jsxs("div",{className:"flex items-start",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1",children:k.jsx("p",{className:"text-xs text-functional-orange-1",children:c(a?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),r===a0&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.addressUpdatedNotice")})]})]}),k.jsxs("div",{className:"text-sm",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),k.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:[l," ",t]})]}),r===a0&&k.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),k.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},Vo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return k.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},E4=(e,t)=>Number(e)>Number(t),Mt=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"},fi=(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 fi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Mt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},P4=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Mt(Math.max(0,s).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(e),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Mt(e)} ${n}`},S4=(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)},$4=(e,t,n)=>{if(!xh(e,n))return!1;try{const r=new Ie(t||"0"),o=new Ie("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},A4=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&xh(e,n))try{const i=new Ie(o),c=new Ie("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Ie(o||"0");return console.log("bn:",i),console.log("bn:",i.isNaN()),i.isNaN()?o:i.decimalPlaces(6,Ie.ROUND_DOWN).toString()}catch{return o}},cm={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let Ye=null;const um=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState(cm),a=x.useCallback(h=>{c(h),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ye={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{Ye=null}),[a,l,u,f,p,d]),n?k.jsx(mm,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});um.displayName="DepositManager";const lm=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.openDeposit(e||cm)},fm=()=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.closeDeposit()},dm=e=>{Ye&&Ye.updateDepositOptions(e)},di=e=>{if(!Ye){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ye.setDepositLoading(e)},T4=()=>Ye?Ye.isOpen():!1,pm=()=>Ye?Ye.isLoading():!1,O4=()=>({openDeposit:lm,closeDeposit:fm,updateDepositOptions:dm,setDepositLoading:di,isOpen:T4,isLoading:pm}),N4=e=>{const{t}=vt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return x.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=a,f=S4(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<l?{text:t("deposit.minDepositParsed",{amount:l,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function C4(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),w=a(),$=i({address:l,abi:yr,functionName:"allowance",args:[mn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&l&&p)}}),E=$!=null&&$.isSuccess?$.data:void 0,P=x.useMemo(()=>{if(d)return!0;if(!$.isSuccess||E===void 0||E===0n)return!1;try{const B=x6(String(Number(s||"0")||0),Number(f));return E>=B}catch{return!1}},[d,$.isSuccess,E,s,f]),N=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!w||!l||!p)return;const F=mn(l),D=mn(p);if((E||0n)>0n){const v=await m({abi:yr,address:F,functionName:"approve",args:[D,0n]});await w.waitForTransactionReceipt({hash:v})}const g=await m({abi:yr,address:F,functionName:"approve",args:[D,ef]});await w.waitForTransactionReceipt({hash:g}),$!=null&&$.refetch&&await $.refetch()}catch(B){console.error("[useApprove] onApprove failed:",B)}},[r,n,l,p,E,$,m,w,h]);return{approve:P,onApprove:N}}const I4=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return x.useEffect(()=>{o(mn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},M4=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var E;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=x.useMemo(()=>{const P="0x0000000000000000000000000000000000000000",N="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(B=>{const F=B.tokenAddress;if(!F)return!1;const D=F.toLowerCase();return!(F===P||D===N)})},[r]),[c,a]=x.useState({}),u=x.useCallback((P,N)=>{a(B=>({...B,[P]:N}))},[]),l=(E=o==null?void 0:o.useBalance)==null?void 0:E.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=x.useState(0),d=x.useMemo(()=>i.map(P=>x.createElement(I4,{key:`${P.tokenAddress}-${f}`,token:P,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:u})),[i,e,s,n,o,u,f]),h=x.useMemo(()=>{const P=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=i.map(F=>{const D=c[mn(F.tokenAddress)],b=D==null?void 0:D.balance,g=b==null?void 0:b.data;return{address:mn(F.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||F.decimals}}).filter(F=>F.address),B=N.reduce((F,D)=>({...F,[D.address]:{balance:D}}),{});return{balanceList:N,baseTokenBalance:P,combinedData:B}},[l,c,i]),m=x.useCallback(async()=>h,[h]),w=x.useMemo(()=>{const P=(l==null?void 0:l.isLoading)||!1,N=Object.values(c).some(B=>{var F;return(F=B.balance)==null?void 0:F.isLoading});return P||N},[l==null?void 0:l.isLoading,c]),$=x.useCallback(()=>p(P=>P+1),[]);return{multicallRun:m,multicallRefresh:$,multicallResult:h,validErcTokens:i,isLoading:w,queryComponents:d}},k4=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:u}=vt(),l=i.useAccount(),f=t.tokenList.find(_=>_.token===n||_.symbol===n),p=t.chainId,[d,h]=x.useState("");x.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:w}=M4({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),$=x.useMemo(()=>{var W;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const _=m.combinedData[f.tokenAddress];return((W=_==null?void 0:_.balance)==null?void 0:W.formatted)||"0"},[f,m]),E="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",P="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",N=x.useMemo(()=>{var _,W;return s5({chain:u5,transport:c5(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((W=window==null?void 0:window.ENV)==null?void 0:W.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),B="1000000000000",{formatted:F}=l5({client:N,tokenAddress:E,holder:P,decimals:6,fallbackFormatted:B,pollingInterval:12e3}),[D,b]=x.useState(!1),{approve:g,onApprove:v}=C4({account:e,accountChainId:l.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),C=x.useCallback(async()=>{if(!D)try{b(!0),await v()}catch(_){console.error("Approve failed:",_)}finally{b(!1)}},[D,v]),O=x.useMemo(()=>+l.chainId!=+t.chainId,[l.chainId,t.chainId]),I=x.useCallback(async()=>{c&&c(p)},[c,p]);x.useEffect(()=>{O&&I()},[O,I]);const{showLayerZeroTip:M,layerZeroTipKey:y}=x.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,W=(n==null?void 0:n.toUpperCase())==="USDT",K=new Ie(d||"0"),G=new Ie("200000");let H=!1,Z;if(_&&W&&d)if(K.gte(G))H=!0,Z="deposit.layerZeroDepositTipGte200k";else{const J=F;if(typeof J=="string"&&J.length>0){const me=new Ie(J);!me.isNaN()&&K.gte(me)&&(H=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:H,layerZeroTipKey:Z}},[t.chainId,n,d,F]),T=x.useCallback(()=>A4(+t.chainId,$||"0",n,r),[$,t==null?void 0:t.chainId,n,r]),A=x.useMemo(()=>r!=="spot"&&$4(+t.chainId,d,n),[r,t==null?void 0:t.chainId,d,n]),S=x.useMemo(()=>"deposit.maxDepositSplitTip",[]),L=N4({isNetworkMismatch:O,depositAmount:d,approved:g,currentTokenBalance:$,selectedToken:n,showLayerZeroTip:M,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),j=_=>{const W=_.target.value,K=T(),G=fi(W,K);if(G.isValid)h(G.formattedValue),G.errorType;else return G.errorType==="exceed_balance",void 0},z=x.useCallback(async()=>{di(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(_){console.error("Deposit error:",_),di(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return k.jsxs(k.Fragment,{children:[w,k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:u("deposit.amount"),value:d,onChange:j,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:()=>{const _=T();h(_)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:u("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:u("deposit.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:u("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:P4($||"0",d,n)})]})]}),!g&&E4(d||"0",0)&&k.jsxs("div",{className:"flex justify-center flex-col items-center",children:[k.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:u("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),k.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:u("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),k.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:C,disabled:D,children:D?k.jsx(Vo,{size:"xs",inline:!0}):u("deposit.enableWithToken",{token:n})})]}),M&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(y||"deposit.layerZeroDepositTip")})]}),k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),A&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(S)})]}),A&&k.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:!(A||M)&&k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u("deposit.noPrivateKeyWalletWarning")})]}),k.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.arrivalTime")}),k.jsx(Qn,{content:k.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[k.jsx("p",{children:u("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),k.jsx("p",{children:u("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:k.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:u("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),k.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[k.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.equity")}),k.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Mt((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${Mt(o)} ${n}`})]})]}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${L.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:L.disabled||s,children:[(s||O)&&k.jsx(Vo,{size:"xs"}),L.text]})]})},hm=e=>e.toLocaleUpperCase()===Hn?Hn:sc,Eu=e=>hm(e.wallet)===Hn,B4=e=>hm(e.wallet)===sc,mm=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:u,wagmiHooks:l,onDeposit:f,onCopy:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=vt(),[w,$]=x.useState(a),E=x.useCallback(A=>A==="spot"&&s&&s.length>0?s:o,[o,s]),P=E(a),[N,B]=x.useState(()=>{var A;return!P||P.length===0?1:i||((A=P[0])==null?void 0:A.chainId)||1}),F=x.useMemo(()=>E(w),[w,E]),D=F.find(A=>A.chainId===N)||F[0],[b,g]=x.useState(()=>{var _;if(!P||P.length===0)return"";const A=i||((_=P[0])==null?void 0:_.chainId),S=P.find(W=>W.chainId===A)||P[0],L=((S==null?void 0:S.tokenList)||[]).length>0?S:P.find(W=>(W.tokenList||[]).length>0),j=(L==null?void 0:L.tokenList)||[];if(c&&j.length>0){const W=c.toUpperCase(),K=j.find(G=>(G.token||G.symbol||"").toUpperCase()===W);if(K)return K.token||K.symbol||""}const z=j[0];return(z==null?void 0:z.token)||(z==null?void 0:z.symbol)||""}),v=x.useCallback(A=>{B(A),d==null||d(A)},[d]),C=x.useCallback(A=>{g(A),h==null||h(A)},[h]),O=x.useMemo(()=>{const A=(b||"").toLowerCase();if(!A)return"0";const S=w==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,L=S==null?void 0:S[A];return typeof L=="string"&&L.length>0?L:"0"},[u,w,b]),[I,M]=x.useState(!1),y=A=>{A.target===A.currentTarget?M(!0):M(!1)},T=A=>{I&&A.target===A.currentTarget&&n(),M(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:y,onMouseUp:T,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:A=>{A.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:k.jsx(l0,{className:"h-4 w-4"})})]}),k.jsx(Ph,{selectedAccount:w,onAccountChange:A=>{var H,Z;const S=A||"perpetual";$(S);const L=E(S);if(!L||L.length===0)return;const j=L.find(J=>J.chainId===N),z=j?j.chainId:L[0].chainId;B(z),d==null||d(z);const _=L.find(J=>J.chainId===z),W=(_==null?void 0:_.tokenList)||[],G=W.some(J=>(J.symbol||J.token)===b)?b:((H=W[0])==null?void 0:H.symbol)||((Z=W[0])==null?void 0:Z.token)||"";G&&(g(G),h==null||h(G))},className:"w-full"}),k.jsx(Eh,{currentActiveChain:D,chainList:F,onChainChange:v,curSelectToken:b,onTokenChange:C,walletType:Eu(r)?Hn:sc,accountType:w}),Eu(r)&&k.jsx(x4,{address:r.smartWalletAddress,currentActiveChain:D,selectedToken:b,accountType:w,onDeposit:f,onCopy:p,onClose:n}),B4(r)&&k.jsx(k4,{address:r.ethAddress,currentActiveChain:D,selectedToken:b,accountType:w,platformBalance:O,isLoading:t,wagmiHooks:l,onChainChange:v,onDeposit:f,onClose:n})]})})}),document.body):null},L4=e=>{if(e==null||e==="")return 2;const t=String(e),n=t.indexOf(".");if(n===-1)return 0;const r=t.length-n-1;return r>0?r:2},F4=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:l,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=vt(),h=x.useMemo(()=>{const F=L4(n==null?void 0:n.showStepSize);if(a==="spot"||!ln(r==null?void 0:r.chainId)){const D=new Ie(e||"0").minus(s||"0").decimalPlaces(F,Ie.ROUND_DOWN);return D.isNegative()?"0.00":D.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=x.useMemo(()=>o||"0",[o]),w=x.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ie(F||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),$=x.useMemo(()=>w==="0",[w]),E=x.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),P=F=>{const D=F.target.value,g=fi(D,m||"0");if(g.isValid)u(g.formattedValue),g.errorType;else return g.errorType==="exceed_balance",void 0;f==null||f(g.formattedValue)},N=()=>{const F=m||"0",b=fi(F,F).formattedValue;u(b),f==null||f(b)},B=()=>{const F=parseFloat(o||"0"),D=parseFloat(e||"0");if(D>0){const b=F-D,g=Mt(Math.max(0,b).toString());return k.jsxs("span",{className:"flex items-center gap-1",children:[Mt(o||"0"),k.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),g," ",t]})}return`${Mt(o||"0")} ${t}`};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[k.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[k.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:P,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),k.jsx("button",{onClick:N,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),k.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),k.jsxs("div",{className:"flex justify-between items-center",children:[k.jsx(Qn,{content:d("withdraw.availableDesc"),children:k.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),k.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:B()})]})]}),i==="mpc"&&(a==="spot"||!ln(r==null?void 0:r.chainId))?k.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:k.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:F=>l==null?void 0:l(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,k.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:ln(r==null?void 0:r.chainId)?k.jsxs(k.Fragment,{children:[k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),k.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")})]}):k.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&k.jsxs("div",{className:"flex mb-4",children:[k.jsx("div",{className:"w-5",children:k.jsx("img",{src:Wo,className:"w-4 h-4",alt:"Warning"})}),k.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),k.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[k.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[k.jsx(Qn,{content:k.jsxs("div",{children:[k.jsx("div",{children:d("withdraw.speedNote")}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.FAST,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.Medium,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),k.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[k.jsx(Uo,{selectedLevel:It.SLOW,maxLevel:3}),k.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:k.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),k.jsx("div",{className:"flex items-center",children:k.jsx(Uo,{selectedLevel:ln(r==null?void 0:r.chainId)?It.SLOW:It.FAST,maxLevel:3})})]}),(a==="spot"||!ln(r==null?void 0:r.chainId))&&k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[$||!E?k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:$?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):k.jsx(Qn,{className:"w-[320px] font-normal flex items-center justify-center",content:k.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:k.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")}`})}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!$&&` / ${w}%`]})]}),k.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[k.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(ln(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),k.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Mt(h)," ",t]})]})]})]})},D4=[];let Ke=null;const bm=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=x.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ke={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ke=null}),[a,l,u,f,p,d]),n?k.jsx(xm,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||D4,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});bm.displayName="WithdrawManager";const gm=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},ym=()=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.closeWithdraw()},wm=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.updateWithdrawOptions(e)},pi=e=>{if(!Ke){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ke.setWithdrawLoading(e)},R4=()=>Ke?Ke.isOpen():!1,vm=()=>Ke?Ke.isLoading():!1,j4=()=>({openWithdraw:gm,closeWithdraw:ym,updateWithdrawOptions:wm,setWithdrawLoading:pi,isOpen:R4,isLoading:vm}),_4=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:u,fee:l="0.00",isLoading:f=!1,onWithdraw:p,onClose:d,onChainChange:h,onTokenChange:m,onAmountChanged:w,onAccountChange:$})=>{var H;const{t:E}=vt(),[P,N]=x.useState(i),B=x.useCallback(Z=>Z==="spot"&&n&&n.length>0?n:t,[t,n]),F=x.useMemo(()=>B(P),[P,B]),D=x.useMemo(()=>{if(!F||F.length===0)return{chainId:1,tokenSymbol:""};const Z=de=>{const se=de||[];if(!se.length)return"";const ee="USDC".toUpperCase(),On=se.find(gt=>(gt.token||gt.symbol||"").toUpperCase()===ee)||se[0];return On.token||On.symbol||""};if(o){const de=o==null?void 0:o.toUpperCase();for(const se of F){const pe=se.tokenList||[];let ee;if(de&&(ee=pe.find(Pe=>(Pe.token||Pe.symbol||"").toUpperCase()===de)),ee){const Pe=ee.token||ee.symbol||o||"";return{chainId:se.chainId,tokenSymbol:Pe}}}}if(r){const de=F.find(ee=>ee.chainId===r)||F[0],se=de.tokenList||[],pe=Z(se);return{chainId:de.chainId,tokenSymbol:pe}}const J="USDC",oe=de=>Array.isArray(de.tokenList)&&de.tokenList.some(se=>(se.token||se.symbol||"").toUpperCase()===J),me=F.find(oe)||F[0];if(!me)return{chainId:1,tokenSymbol:""};const ge=Z(me.tokenList);return{chainId:me.chainId,tokenSymbol:ge}},[F,r,o]),[b,g]=x.useState(()=>D.chainId),[v,C]=x.useState(()=>D.tokenSymbol),[O,I]=x.useState(s),[M,y]=x.useState(""),T=x.useCallback(Z=>{g(Z),h==null||h(Z)},[h]),A=x.useCallback(Z=>{C(Z),m==null||m(Z)},[m]),S=x.useRef(!0),L=x.useRef(v),j=x.useRef(b);x.useEffect(()=>{if(S.current){S.current=!1,L.current=v,j.current=b;return}(L.current!==v||j.current!==b)&&(I(""),L.current=v,j.current=b)},[v,b]);const z=F&&F.length>0?F.find(Z=>Z.chainId===b)||F[0]:null,_=(H=z==null?void 0:z.tokenList)==null?void 0:H.find(Z=>Z.token===v),W=x.useMemo(()=>{const Z=new Ie(O||"0"),J=new Ie(l||"0"),oe=ln(b);return _!=null&&_.minWithdrawSize&&Z.lt(_.minWithdrawSize)?{text:E("withdraw.minWithdrawParsed",{amount:_.minWithdrawSize,token:_.symbol||_.token}),disabled:!0}:!O||Z.isZero()||!oe&&Z.isLessThan(J)?{text:E("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!oe||P==="spot")&&!M.trim()?{text:E("withdraw.invalidReceiverAddress"),disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,b,O,e,M,l,P,_]),K=x.useMemo(()=>{const Z=(v||"").toLowerCase();if(!Z)return a||"0";const J=P==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,oe=J==null?void 0:J[Z];return typeof oe=="string"&&oe.length>0?oe:a||"0"},[u,P,v,a]),G=x.useCallback(async()=>{pi(!0);try{if(p){const J={amount:new Ie(O||"0").toString(),chainId:b,tokenAddress:(_==null?void 0:_.tokenAddress)||"",coinId:(_==null?void 0:_.coinId)||"",tokenSymbol:v,accountType:P,selectedToken:_};e==="mpc"&&(!ln(b)||P==="spot")&&(J.receiverAddress=M),p(J)}}catch{pi(!1)}},[p,P,_,O,b,v,e,M]);return!F||F.length===0?k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"No chains available"})}):z?k.jsxs(k.Fragment,{children:[k.jsx(Ph,{selectedAccount:P,onAccountChange:Z=>{var Pe,On;const J=Z||"perpetual";N(J),$==null||$(J);const oe=B(J);if(!oe||oe.length===0)return;const me=oe.find(gt=>gt.chainId===b),ge=me?me.chainId:oe[0].chainId;g(ge),h==null||h(ge);const de=oe.find(gt=>gt.chainId===ge),se=(de==null?void 0:de.tokenList)||[],ee=se.some(gt=>(gt.symbol||gt.token)===v)?v:((Pe=se[0])==null?void 0:Pe.symbol)||((On=se[0])==null?void 0:On.token)||"";ee&&(C(ee),m==null||m(ee))},className:"w-full"}),k.jsx(Eh,{currentActiveChain:z,chainList:F,onChainChange:T,curSelectToken:v,onTokenChange:A,walletType:"EVM",txType:"withdraw"}),k.jsx(F4,{withdrawAmount:O,curSelectToken:v,tokenInfo:_,curSelectTokenData:{balance:_==null?void 0:_.balance,allowance:_==null?void 0:_.allowance},currentActiveChain:z,currentEquity:c||0,decimals:(_==null?void 0:_.decimals)||6,platformBalance:K,fee:l,walletType:e,accountType:P,receiverAddress:M,onWithdrawAmountChange:I,onReceiverAddressChange:y,onAmountChanged:w}),k.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:G,disabled:W.disabled||f,children:[f&&k.jsx(Vo,{size:"xs"}),W.text]})]}):k.jsx("div",{className:"text-center py-8",children:k.jsx("p",{className:"text-gray-400",children:"Loading..."})})},xm=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:u,defaultAmount:l="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:w,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})=>{const{t:B}=vt(),[F,D]=x.useState(!1),b=v=>{v.target===v.currentTarget?D(!0):D(!1)},g=v=>{F&&v.target===v.currentTarget&&r(),D(!1)};return e?je.createPortal(k.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:k.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:b,onMouseUp:g,"aria-hidden":"true",children:k.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:v=>{v.stopPropagation()},children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsx("h2",{className:"text-lg font-semibold text-white",children:B("withdraw.withdraw")}),k.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:k.jsx(l0,{className:"h-4 w-4"})})]}),k.jsx(_4,{chains:i,spotChains:c,walletType:Eu(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:u,defaultAmount:l,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:w,onClose:r,onChainChange:$,onTokenChange:E,onAmountChanged:P,onAccountChange:N})]})})}),document.body):null};re.ChromeLoader=Vo,re.ComponentProvider=Gm,re.DEFAULT_LOCALE=qo,re.Deposit=mm,re.DepositManager=um,re.LOCALE_NAMES=Hm,re.LoadingSpinner=Vo,re.SUPPORTED_LOCALES=bi,re.Tooltip=Qn,re.Withdraw=xm,re.WithdrawManager=bm,re.closeDeposit=fm,re.closeWithdraw=ym,re.formatThousands=Zm,re.isDepositLoading=pm,re.isWithdrawLoading=vm,re.openDeposit=lm,re.openWithdraw=gm,re.setDepositLoading=di,re.setWithdrawLoading=pi,re.updateDepositOptions=dm,re.updateWithdrawOptions=wm,re.useComponentConfig=Lu,re.useDeposit=f5,re.useDepositManager=O4,re.useTranslation=vt,re.useWithdraw=d5,re.useWithdrawManager=j4,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|
|
176
176
|
//# sourceMappingURL=index.umd.js.map
|