@edgex-web/components 0.2.0-beta.2 → 0.2.0-beta.21
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-DwnoqfOJ.mjs → ccip-CXThzMMs.mjs} +2 -2
- package/dist/{ccip-DwnoqfOJ.mjs.map → ccip-CXThzMMs.mjs.map} +1 -1
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/hooks/useDepositButtonState.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/utils/index.d.ts +1 -1
- package/dist/components/Deposit/src/components/evm/utils/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/mpc/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/mpc/types/index.d.ts +1 -0
- package/dist/components/Deposit/src/components/mpc/types/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/index.d.ts.map +1 -1
- package/dist/components/Deposit/types/index.d.ts +2 -0
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/components/Tooltip/src/Tooltip.d.ts.map +1 -1
- package/dist/components/Withdraw/src/WithdrawManager.d.ts.map +1 -1
- package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -1
- package/dist/components/Withdraw/src/evm/index.d.ts +2 -1
- package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
- package/dist/components/Withdraw/src/index.d.ts.map +1 -1
- package/dist/components/Withdraw/types/index.d.ts +4 -2
- package/dist/components/Withdraw/types/index.d.ts.map +1 -1
- package/dist/components/shared/components/selector/Asset.d.ts.map +1 -1
- package/dist/components/shared/components/selector/index.d.ts.map +1 -1
- package/dist/components/shared/components/selector/types/index.d.ts +4 -0
- package/dist/components/shared/components/selector/types/index.d.ts.map +1 -1
- package/dist/components/shared/constants/index.d.ts +2 -0
- package/dist/components/shared/constants/index.d.ts.map +1 -1
- package/dist/hooks/useTranslation.d.ts +14 -0
- package/dist/hooks/useTranslation.d.ts.map +1 -1
- package/dist/index-geNBCKUf.mjs +21533 -0
- package/dist/index-geNBCKUf.mjs.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +80 -73
- package/dist/index.umd.js.map +1 -1
- package/dist/locales/en-US.d.ts +7 -0
- package/dist/locales/en-US.d.ts.map +1 -1
- package/dist/locales/ja-JP.d.ts +7 -0
- package/dist/locales/ja-JP.d.ts.map +1 -1
- package/dist/locales/ru-RU.d.ts +7 -0
- package/dist/locales/ru-RU.d.ts.map +1 -1
- package/dist/locales/zh-CN.d.ts +7 -0
- package/dist/locales/zh-CN.d.ts.map +1 -1
- package/dist/locales/zh-TW.d.ts +7 -0
- package/dist/locales/zh-TW.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-BlKfiodh.mjs +0 -20385
- package/dist/index-BlKfiodh.mjs.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(re,
|
|
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 uS=Object.defineProperty;var lS=(re,x,je)=>x in re?uS(re,x,{enumerable:!0,configurable:!0,writable:!0,value:je}):re[x]=je;var Go=(re,x,je)=>lS(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
|
|
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,95 +14,101 @@
|
|
|
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
|
|
18
|
-
`+
|
|
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];S("error",R,Y)}}function S(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,A,T,P,L,j,z,_;function W(){}W.__reactDisabledLog=!0;function K(){{if(y===0){A=console.log,T=console.info,P=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:A}),info:M({},R,{value:T}),warn:M({},R,{value:P}),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
|
+
`+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
|
-
`),
|
|
21
|
-
`+
|
|
20
|
+
`),Pe=ce.length-1,$e=Re.length-1;Pe>=1&&$e>=0&&ce[Pe]!==Re[$e];)$e--;for(;Pe>=1&&$e>=0;Pe--,$e--)if(ce[Pe]!==Re[$e]){if(Pe!==1||$e!==1)do if(Pe--,$e--,$e<0||ce[Pe]!==Re[$e]){var yt=`
|
|
21
|
+
`+ce[Pe].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(Pe>=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 Se=Object.prototype.hasOwnProperty,Nn={},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(Se);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(Pe){ce=Pe}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 Nn)&&(Nn[ce.message]=!0,hi(he),E("Failed %s type: %s",Y,ce.message),hi(null))}}}var z4=Array.isArray;function Su(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 Sm(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 Pm=$.ReactCurrentOwner,V4={key:!0,ref:!0,__self:!0,__source:!0},$m,Tm;function G4(R){if(Se.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(Se.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"&&Pm.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(){Tm||(Tm=!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&&(Sm(Y),ce=""+Y),q4(q)&&(Sm(q.key),ce=""+q.key),G4(q)&&(Re=q.ref,Z4(q,he));for(be in q)Se.call(q,be)&&!V4.hasOwnProperty(be)&&(ue[be]=q[be]);if(R&&R.defaultProps){var Pe=R.defaultProps;for(be in Pe)ue[be]===void 0&&(ue[be]=Pe[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,Pm.current,ue)}}var Pu=$.ReactCurrentOwner,Am=$.ReactDebugCurrentFrame;function Mr(R){if(R){var q=R._owner,Y=ee(R.type,R._source,q?q.type:null);Am.setExtraStackFrame(Y)}else Am.setExtraStackFrame(null)}var $u;$u=!1;function Tu(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Om(){{if(Pu.current){var R=I(Pu.current.type);if(R)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+R+"`."}return""}}function J4(R){return""}var Nm={};function eS(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 <`+
|
|
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=eS(q);if(Nm[Y])return;Nm[Y]=!0;var te="";R&&R._owner&&R._owner!==Pu.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(Su(R))for(var Y=0;Y<R.length;Y++){var te=R[Y];Tu(te)&&Cm(te,q)}else if(Tu(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;)Tu(ue.value)&&Cm(ue.value,q)}}}function tS(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 nS(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 Pe;R===null?Pe="null":Su(R)?Pe="array":R!==void 0&&R.$$typeof===t?(Pe="<"+(I(R.type)||"Unknown")+" />",ce=" Did you accidentally export a JSX literal instead of a component?"):Pe=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",Pe,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(Su(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(Se.call(q,"key")){var Jn=I(R),Xe=Object.keys(q).filter(function(cS){return cS!=="key"}),Au=Xe.length>0?"{key: someKey, "+Xe.join(": ..., ")+": ...}":"{key: someKey}";if(!Mm[Jn+Au]){var aS=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} />`,
|
|
31
|
-
充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},ei=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],uu={"en-US":nm,"ja-JP":rm,"ru-RU":om,"zh-CN":tm,"zh-TW":sm},Bo="en-US",im={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},am=e=>ei.includes(e)?uu[e]:uu[Bo],cm=e=>ei.includes(e),lu=v.createContext(null),um=({config:e,children:t})=>{const n=v.useMemo(()=>{const r=e.locale||Bo,o=cm(r)?r:Bo,s=am(o);return{...e,currentLocale:o,translations:s}},[e]);return M.jsx(lu.Provider,{value:n,children:t})},fu=()=>{const e=v.useContext(lu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var lm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ti=Math.ceil,Ye=Math.floor,De="[BigNumber Error] ",du=De+"Number primitive has more than 15 significant digits: ",ft=1e14,ne=14,ni=9007199254740991,ri=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],un=1e7,Te=1e9;function pu(e){var t,n,r,o=y.prototype={constructor:y,toString:null,valueOf:null},s=new y(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function y(g,w){var $,I,C,P,S,E,O,N,b=this;if(!(b instanceof y))return new y(g,w);if(w==null){if(g&&g._isBigNumber===!0){b.s=g.s,!g.c||g.e>f?b.c=b.e=null:g.e<l?b.c=[b.e=0]:(b.e=g.e,b.c=g.c.slice());return}if((E=typeof g=="number")&&g*0==0){if(b.s=1/g<0?(g=-g,-1):1,g===~~g){for(P=0,S=g;S>=10;S/=10,P++);P>f?b.c=b.e=null:(b.e=P,b.c=[g]);return}N=String(g)}else{if(!lm.test(N=String(g)))return r(b,N,E);b.s=N.charCodeAt(0)==45?(N=N.slice(1),-1):1}(P=N.indexOf("."))>-1&&(N=N.replace(".","")),(S=N.search(/e/i))>0?(P<0&&(P=S),P+=+N.slice(S+1),N=N.substring(0,S)):P<0&&(P=N.length)}else{if(ye(w,2,x.length,"Base"),w==10&&T)return b=new y(g),_(b,i+b.e+1,c);if(N=String(g),E=typeof g=="number"){if(g*0!=0)return r(b,N,E,w);if(b.s=1/g<0?(N=N.slice(1),-1):1,y.DEBUG&&N.replace(/^0\.0*|\./,"").length>15)throw Error(du+g)}else b.s=N.charCodeAt(0)===45?(N=N.slice(1),-1):1;for($=x.slice(0,w),P=S=0,O=N.length;S<O;S++)if($.indexOf(I=N.charAt(S))<0){if(I=="."){if(S>P){P=O;continue}}else if(!C&&(N==N.toUpperCase()&&(N=N.toLowerCase())||N==N.toLowerCase()&&(N=N.toUpperCase()))){C=!0,S=-1,P=0;continue}return r(b,String(g),E,w)}E=!1,N=n(N,w,10,b.s),(P=N.indexOf("."))>-1?N=N.replace(".",""):P=N.length}for(S=0;N.charCodeAt(S)===48;S++);for(O=N.length;N.charCodeAt(--O)===48;);if(N=N.slice(S,++O)){if(O-=S,E&&y.DEBUG&&O>15&&(g>ni||g!==Ye(g)))throw Error(du+b.s*g);if((P=P-S-1)>f)b.c=b.e=null;else if(P<l)b.c=[b.e=0];else{if(b.e=P,b.c=[],S=(P+1)%ne,P<0&&(S+=ne),S<O){for(S&&b.c.push(+N.slice(0,S)),O-=ne;S<O;)b.c.push(+N.slice(S,S+=ne));S=ne-(N=N.slice(S)).length}else S-=O;for(;S--;N+="0");b.c.push(+N)}}else b.c=[b.e=0]}y.clone=pu,y.ROUND_UP=0,y.ROUND_DOWN=1,y.ROUND_CEIL=2,y.ROUND_FLOOR=3,y.ROUND_HALF_UP=4,y.ROUND_HALF_DOWN=5,y.ROUND_HALF_EVEN=6,y.ROUND_HALF_CEIL=7,y.ROUND_HALF_FLOOR=8,y.EUCLID=9,y.config=y.set=function(g){var w,$;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(w="DECIMAL_PLACES")&&($=g[w],ye($,0,Te,w),i=$),g.hasOwnProperty(w="ROUNDING_MODE")&&($=g[w],ye($,0,8,w),c=$),g.hasOwnProperty(w="EXPONENTIAL_AT")&&($=g[w],$&&$.pop?(ye($[0],-Te,0,w),ye($[1],0,Te,w),a=$[0],u=$[1]):(ye($,-Te,Te,w),a=-(u=$<0?-$:$))),g.hasOwnProperty(w="RANGE"))if($=g[w],$&&$.pop)ye($[0],-Te,-1,w),ye($[1],1,Te,w),l=$[0],f=$[1];else if(ye($,-Te,Te,w),$)l=-(f=$<0?-$:$);else throw Error(De+w+" cannot be zero: "+$);if(g.hasOwnProperty(w="CRYPTO"))if($=g[w],$===!!$)if($)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=$;else throw p=!$,Error(De+"crypto unavailable");else p=$;else throw Error(De+w+" not true or false: "+$);if(g.hasOwnProperty(w="MODULO_MODE")&&($=g[w],ye($,0,9,w),d=$),g.hasOwnProperty(w="POW_PRECISION")&&($=g[w],ye($,0,Te,w),h=$),g.hasOwnProperty(w="FORMAT"))if($=g[w],typeof $=="object")m=$;else throw Error(De+w+" not an object: "+$);if(g.hasOwnProperty(w="ALPHABET"))if($=g[w],typeof $=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test($))T=$.slice(0,10)=="0123456789",x=$;else throw Error(De+w+" invalid: "+$)}else throw Error(De+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:x}},y.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!y.DEBUG)return!0;var w,$,I=g.c,C=g.e,P=g.s;e:if({}.toString.call(I)=="[object Array]"){if((P===1||P===-1)&&C>=-Te&&C<=Te&&C===Ye(C)){if(I[0]===0){if(C===0&&I.length===1)return!0;break e}if(w=(C+1)%ne,w<1&&(w+=ne),String(I[0]).length==w){for(w=0;w<I.length;w++)if($=I[w],$<0||$>=ft||$!==Ye($))break e;if($!==0)return!0}}}else if(I===null&&C===null&&(P===null||P===1||P===-1))return!0;throw Error(De+"Invalid BigNumber: "+g)},y.maximum=y.max=function(){return B(arguments,-1)},y.minimum=y.min=function(){return B(arguments,1)},y.random=function(){var g=9007199254740992,w=Math.random()*g&2097151?function(){return Ye(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function($){var I,C,P,S,E,O=0,N=[],b=new y(s);if($==null?$=i:ye($,0,Te),S=ti($/ne),p)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(S*=2));O<S;)E=I[O]*131072+(I[O+1]>>>11),E>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),I[O]=C[0],I[O+1]=C[1]):(N.push(E%1e14),O+=2);O=S/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(S*=7);O<S;)E=(I[O]&31)*281474976710656+I[O+1]*1099511627776+I[O+2]*4294967296+I[O+3]*16777216+(I[O+4]<<16)+(I[O+5]<<8)+I[O+6],E>=9e15?crypto.randomBytes(7).copy(I,O):(N.push(E%1e14),O+=7);O=S/7}else throw p=!1,Error(De+"crypto unavailable");if(!p)for(;O<S;)E=w(),E<9e15&&(N[O++]=E%1e14);for(S=N[--O],$%=ne,S&&$&&(E=ri[ne-$],N[O]=Ye(S/E)*E);N[O]===0;N.pop(),O--);if(O<0)N=[P=0];else{for(P=-1;N[0]===0;N.splice(0,1),P-=ne);for(O=1,E=N[0];E>=10;E/=10,O++);O<ne&&(P-=ne-O)}return b.e=P,b.c=N,b}}(),y.sum=function(){for(var g=1,w=arguments,$=new y(w[0]);g<w.length;)$=$.plus(w[g++]);return $},n=function(){var g="0123456789";function w($,I,C,P){for(var S,E=[0],O,N=0,b=$.length;N<b;){for(O=E.length;O--;E[O]*=I);for(E[0]+=P.indexOf($.charAt(N++)),S=0;S<E.length;S++)E[S]>C-1&&(E[S+1]==null&&(E[S+1]=0),E[S+1]+=E[S]/C|0,E[S]%=C)}return E.reverse()}return function($,I,C,P,S){var E,O,N,b,k,R,D,U,W=$.indexOf("."),K=i,G=c;for(W>=0&&(b=h,h=0,$=$.replace(".",""),U=new y(I),R=U.pow($.length-W),h=b,U.c=w(_t(Qe(R.c),R.e,"0"),10,C,g),U.e=U.c.length),D=w($,I,C,S?(E=x,g):(E=g,x)),N=b=D.length;D[--b]==0;D.pop());if(!D[0])return E.charAt(0);if(W<0?--N:(R.c=D,R.e=N,R.s=P,R=t(R,U,K,G,C),D=R.c,k=R.r,N=R.e),O=N+K+1,W=D[O],b=C/2,k=k||O<0||D[O+1]!=null,k=G<4?(W!=null||k)&&(G==0||G==(R.s<0?3:2)):W>b||W==b&&(G==4||k||G==6&&D[O-1]&1||G==(R.s<0?8:7)),O<1||!D[0])$=k?_t(E.charAt(1),-K,E.charAt(0)):E.charAt(0);else{if(D.length=O,k)for(--C;++D[--O]>C;)D[O]=0,O||(++N,D=[1].concat(D));for(b=D.length;!D[--b];);for(W=0,$="";W<=b;$+=E.charAt(D[W++]));$=_t($,N,E.charAt(0))}return $}}(),t=function(){function g(I,C,P){var S,E,O,N,b=0,k=I.length,R=C%un,D=C/un|0;for(I=I.slice();k--;)O=I[k]%un,N=I[k]/un|0,S=D*O+N*R,E=R*O+S%un*un+b,b=(E/P|0)+(S/un|0)+D*N,I[k]=E%P;return b&&(I=[b].concat(I)),I}function w(I,C,P,S){var E,O;if(P!=S)O=P>S?1:-1;else for(E=O=0;E<P;E++)if(I[E]!=C[E]){O=I[E]>C[E]?1:-1;break}return O}function $(I,C,P,S){for(var E=0;P--;)I[P]-=E,E=I[P]<C[P]?1:0,I[P]=E*S+I[P]-C[P];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,C,P,S,E){var O,N,b,k,R,D,U,W,K,G,H,V,Y,Q,oe,pe,Se,he=I.s==C.s?1:-1,me=I.c,le=C.c;if(!me||!me[0]||!le||!le[0])return new y(!I.s||!C.s||(me?le&&me[0]==le[0]:!le)?NaN:me&&me[0]==0||!le?he*0:he/0);for(W=new y(he),K=W.c=[],N=I.e-C.e,he=P+N+1,E||(E=ft,N=Xe(I.e/ne)-Xe(C.e/ne),he=he/ne|0),b=0;le[b]==(me[b]||0);b++);if(le[b]>(me[b]||0)&&N--,he<0)K.push(1),k=!0;else{for(Q=me.length,pe=le.length,b=0,he+=2,R=Ye(E/(le[0]+1)),R>1&&(le=g(le,R,E),me=g(me,R,E),pe=le.length,Q=me.length),Y=pe,G=me.slice(0,pe),H=G.length;H<pe;G[H++]=0);Se=le.slice(),Se=[0].concat(Se),oe=le[0],le[1]>=E/2&&oe++;do{if(R=0,O=w(le,G,pe,H),O<0){if(V=G[0],pe!=H&&(V=V*E+(G[1]||0)),R=Ye(V/oe),R>1)for(R>=E&&(R=E-1),D=g(le,R,E),U=D.length,H=G.length;w(D,G,U,H)==1;)R--,$(D,pe<U?Se:le,U,E),U=D.length,O=1;else R==0&&(O=R=1),D=le.slice(),U=D.length;if(U<H&&(D=[0].concat(D)),$(G,D,H,E),H=G.length,O==-1)for(;w(le,G,pe,H)<1;)R++,$(G,pe<H?Se:le,H,E),H=G.length}else O===0&&(R++,G=[0]);K[b++]=R,G[0]?G[H++]=me[Y]||0:(G=[me[Y]],H=1)}while((Y++<Q||G[0]!=null)&&he--);k=G[0]!=null,K[0]||K.splice(0,1)}if(E==ft){for(b=1,he=K[0];he>=10;he/=10,b++);_(W,P+(W.e=b+N*ne-1)+1,S,k)}else W.e=N,W.r=+k;return W}}();function A(g,w,$,I){var C,P,S,E,O;if($==null?$=c:ye($,0,8),!g.c)return g.toString();if(C=g.c[0],S=g.e,w==null)O=Qe(g.c),O=I==1||I==2&&(S<=a||S>=u)?Fo(O,S):_t(O,S,"0");else if(g=_(new y(g),w,$),P=g.e,O=Qe(g.c),E=O.length,I==1||I==2&&(w<=P||P<=a)){for(;E<w;O+="0",E++);O=Fo(O,P)}else if(w-=S+(I===2&&P>S),O=_t(O,P,"0"),P+1>E){if(--w>0)for(O+=".";w--;O+="0");}else if(w+=P-E,w>0)for(P+1==E&&(O+=".");w--;O+="0");return g.s<0&&C?"-"+O:O}function B(g,w){for(var $,I,C=1,P=new y(g[0]);C<g.length;C++)I=new y(g[C]),(!I.s||($=En(P,I))===w||$===0&&P.s===w)&&(P=I);return P}function L(g,w,$){for(var I=1,C=w.length;!w[--C];w.pop());for(C=w[0];C>=10;C/=10,I++);return($=I+$*ne-1)>f?g.c=g.e=null:$<l?g.c=[g.e=0]:(g.e=$,g.c=w),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,$=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,S,E,O){var N,b=E?S:S.replace(C,"");if(I.test(b))P.s=isNaN(b)?null:b<0?-1:1;else{if(!E&&(b=b.replace(g,function(k,R,D){return N=(D=D.toLowerCase())=="x"?16:D=="b"?2:8,!O||O==N?R:k}),O&&(N=O,b=b.replace(w,"$1").replace($,"0.$1")),S!=b))return new y(b,N);if(y.DEBUG)throw Error(De+"Not a"+(O?" base "+O:"")+" number: "+S);P.s=null}P.c=P.e=null}}();function _(g,w,$,I){var C,P,S,E,O,N,b,k=g.c,R=ri;if(k){e:{for(C=1,E=k[0];E>=10;E/=10,C++);if(P=w-C,P<0)P+=ne,S=w,O=k[N=0],b=Ye(O/R[C-S-1]%10);else if(N=ti((P+1)/ne),N>=k.length)if(I){for(;k.length<=N;k.push(0));O=b=0,C=1,P%=ne,S=P-ne+1}else break e;else{for(O=E=k[N],C=1;E>=10;E/=10,C++);P%=ne,S=P-ne+C,b=S<0?0:Ye(O/R[C-S-1]%10)}if(I=I||w<0||k[N+1]!=null||(S<0?O:O%R[C-S-1]),I=$<4?(b||I)&&($==0||$==(g.s<0?3:2)):b>5||b==5&&($==4||I||$==6&&(P>0?S>0?O/R[C-S]:0:k[N-1])%10&1||$==(g.s<0?8:7)),w<1||!k[0])return k.length=0,I?(w-=g.e+1,k[0]=R[(ne-w%ne)%ne],g.e=-w||0):k[0]=g.e=0,g;if(P==0?(k.length=N,E=1,N--):(k.length=N+1,E=R[ne-P],k[N]=S>0?Ye(O/R[C-S]%R[S])*E:0),I)for(;;)if(N==0){for(P=1,S=k[0];S>=10;S/=10,P++);for(S=k[0]+=E,E=1;S>=10;S/=10,E++);P!=E&&(g.e++,k[0]==ft&&(k[0]=1));break}else{if(k[N]+=E,k[N]!=ft)break;k[N--]=0,E=1}for(P=k.length;k[--P]===0;k.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var w,$=g.e;return $===null?g.toString():(w=Qe(g.c),w=$<=a||$>=u?Fo(w,$):_t(w,$,"0"),g.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var g=new y(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,w){return En(this,new y(g,w))},o.decimalPlaces=o.dp=function(g,w){var $,I,C,P=this;if(g!=null)return ye(g,0,Te),w==null?w=c:ye(w,0,8),_(new y(P),g+P.e+1,w);if(!($=P.c))return null;if(I=((C=$.length-1)-Xe(this.e/ne))*ne,C=$[C])for(;C%10==0;C/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(g,w){return t(this,new y(g,w),i,c)},o.dividedToIntegerBy=o.idiv=function(g,w){return t(this,new y(g,w),0,1)},o.exponentiatedBy=o.pow=function(g,w){var $,I,C,P,S,E,O,N,b,k=this;if(g=new y(g),g.c&&!g.isInteger())throw Error(De+"Exponent not an integer: "+j(g));if(w!=null&&(w=new y(w)),E=g.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!g.c||!g.c[0])return b=new y(Math.pow(+j(k),E?g.s*(2-Lo(g)):+j(g))),w?b.mod(w):b;if(O=g.s<0,w){if(w.c?!w.c[0]:!w.s)return new y(NaN);I=!O&&k.isInteger()&&w.isInteger(),I&&(k=k.mod(w))}else{if(g.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||E&&k.c[1]>=24e7:k.c[0]<8e13||E&&k.c[0]<=9999975e7)))return P=k.s<0&&Lo(g)?-0:0,k.e>-1&&(P=1/P),new y(O?1/P:P);h&&(P=ti(h/ne+2))}for(E?($=new y(.5),O&&(g.s=1),N=Lo(g)):(C=Math.abs(+j(g)),N=C%2),b=new y(s);;){if(N){if(b=b.times(k),!b.c)break;P?b.c.length>P&&(b.c.length=P):I&&(b=b.mod(w))}if(C){if(C=Ye(C/2),C===0)break;N=C%2}else if(g=g.times($),_(g,g.e+1,1),g.e>14)N=Lo(g);else{if(C=+j(g),C===0)break;N=C%2}k=k.times(k),P?k.c&&k.c.length>P&&(k.c.length=P):I&&(k=k.mod(w))}return I?b:(O&&(b=s.div(b)),w?b.mod(w):P?_(b,h,c,S):b)},o.integerValue=function(g){var w=new y(this);return g==null?g=c:ye(g,0,8),_(w,w.e+1,g)},o.isEqualTo=o.eq=function(g,w){return En(this,new y(g,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,w){return En(this,new y(g,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,w){return(w=En(this,new y(g,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Xe(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,w){return En(this,new y(g,w))<0},o.isLessThanOrEqualTo=o.lte=function(g,w){return(w=En(this,new y(g,w)))===-1||w===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(g,w){var $,I,C,P,S=this,E=S.s;if(g=new y(g,w),w=g.s,!E||!w)return new y(NaN);if(E!=w)return g.s=-w,S.plus(g);var O=S.e/ne,N=g.e/ne,b=S.c,k=g.c;if(!O||!N){if(!b||!k)return b?(g.s=-w,g):new y(k?S:NaN);if(!b[0]||!k[0])return k[0]?(g.s=-w,g):new y(b[0]?S:c==3?-0:0)}if(O=Xe(O),N=Xe(N),b=b.slice(),E=O-N){for((P=E<0)?(E=-E,C=b):(N=O,C=k),C.reverse(),w=E;w--;C.push(0));C.reverse()}else for(I=(P=(E=b.length)<(w=k.length))?E:w,E=w=0;w<I;w++)if(b[w]!=k[w]){P=b[w]<k[w];break}if(P&&(C=b,b=k,k=C,g.s=-g.s),w=(I=k.length)-($=b.length),w>0)for(;w--;b[$++]=0);for(w=ft-1;I>E;){if(b[--I]<k[I]){for($=I;$&&!b[--$];b[$]=w);--b[$],b[I]+=ft}b[I]-=k[I]}for(;b[0]==0;b.splice(0,1),--N);return b[0]?L(g,b,N):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,w){var $,I,C=this;return g=new y(g,w),!C.c||!g.s||g.c&&!g.c[0]?new y(NaN):!g.c||C.c&&!C.c[0]?new y(C):(d==9?(I=g.s,g.s=1,$=t(C,g,0,3),g.s=I,$.s*=I):$=t(C,g,0,d),g=C.minus($.times(g)),!g.c[0]&&d==1&&(g.s=C.s),g)},o.multipliedBy=o.times=function(g,w){var $,I,C,P,S,E,O,N,b,k,R,D,U,W,K,G=this,H=G.c,V=(g=new y(g,w)).c;if(!H||!V||!H[0]||!V[0])return!G.s||!g.s||H&&!H[0]&&!V||V&&!V[0]&&!H?g.c=g.e=g.s=null:(g.s*=G.s,!H||!V?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(I=Xe(G.e/ne)+Xe(g.e/ne),g.s*=G.s,O=H.length,k=V.length,O<k&&(U=H,H=V,V=U,C=O,O=k,k=C),C=O+k,U=[];C--;U.push(0));for(W=ft,K=un,C=k;--C>=0;){for($=0,R=V[C]%K,D=V[C]/K|0,S=O,P=C+S;P>C;)N=H[--S]%K,b=H[S]/K|0,E=D*N+b*R,N=R*N+E%K*K+U[P]+$,$=(N/W|0)+(E/K|0)+D*b,U[P--]=N%W;U[P]=$}return $?++I:U.splice(0,1),L(g,U,I)},o.negated=function(){var g=new y(this);return g.s=-g.s||null,g},o.plus=function(g,w){var $,I=this,C=I.s;if(g=new y(g,w),w=g.s,!C||!w)return new y(NaN);if(C!=w)return g.s=-w,I.minus(g);var P=I.e/ne,S=g.e/ne,E=I.c,O=g.c;if(!P||!S){if(!E||!O)return new y(C/0);if(!E[0]||!O[0])return O[0]?g:new y(E[0]?I:C*0)}if(P=Xe(P),S=Xe(S),E=E.slice(),C=P-S){for(C>0?(S=P,$=O):(C=-C,$=E),$.reverse();C--;$.push(0));$.reverse()}for(C=E.length,w=O.length,C-w<0&&($=O,O=E,E=$,w=C),C=0;w;)C=(E[--w]=E[w]+O[w]+C)/ft|0,E[w]=ft===E[w]?0:E[w]%ft;return C&&(E=[C].concat(E),++S),L(g,E,S)},o.precision=o.sd=function(g,w){var $,I,C,P=this;if(g!=null&&g!==!!g)return ye(g,1,Te),w==null?w=c:ye(w,0,8),_(new y(P),g,w);if(!($=P.c))return null;if(C=$.length-1,I=C*ne+1,C=$[C]){for(;C%10==0;C/=10,I--);for(C=$[0];C>=10;C/=10,I++);}return g&&P.e+1>I&&(I=P.e+1),I},o.shiftedBy=function(g){return ye(g,-ni,ni),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,w,$,I,C,P=this,S=P.c,E=P.s,O=P.e,N=i+4,b=new y("0.5");if(E!==1||!S||!S[0])return new y(!E||E<0&&(!S||S[0])?NaN:S?P:1/0);if(E=Math.sqrt(+j(P)),E==0||E==1/0?(w=Qe(S),(w.length+O)%2==0&&(w+="0"),E=Math.sqrt(+w),O=Xe((O+1)/2)-(O<0||O%2),E==1/0?w="5e"+O:(w=E.toExponential(),w=w.slice(0,w.indexOf("e")+1)+O),$=new y(w)):$=new y(E+""),$.c[0]){for(O=$.e,E=O+N,E<3&&(E=0);;)if(C=$,$=b.times(C.plus(t(P,C,N,1))),Qe(C.c).slice(0,E)===(w=Qe($.c)).slice(0,E))if($.e<O&&--E,w=w.slice(E-3,E+1),w=="9999"||!I&&w=="4999"){if(!I&&(_(C,C.e+i+2,0),C.times(C).eq(P))){$=C;break}N+=4,E+=4,I=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(_($,$.e+i+2,1),g=!$.times($).eq(P));break}}return _($,$.e+i+1,c,g)},o.toExponential=function(g,w){return g!=null&&(ye(g,0,Te),g++),A(this,g,w,1)},o.toFixed=function(g,w){return g!=null&&(ye(g,0,Te),g=g+this.e+1),A(this,g,w)},o.toFormat=function(g,w,$){var I,C=this;if($==null)g!=null&&w&&typeof w=="object"?($=w,w=null):g&&typeof g=="object"?($=g,g=w=null):$=m;else if(typeof $!="object")throw Error(De+"Argument not an object: "+$);if(I=C.toFixed(g,w),C.c){var P,S=I.split("."),E=+$.groupSize,O=+$.secondaryGroupSize,N=$.groupSeparator||"",b=S[0],k=S[1],R=C.s<0,D=R?b.slice(1):b,U=D.length;if(O&&(P=E,E=O,O=P,U-=P),E>0&&U>0){for(P=U%E||E,b=D.substr(0,P);P<U;P+=E)b+=N+D.substr(P,E);O>0&&(b+=N+D.slice(P)),R&&(b="-"+b)}I=k?b+($.decimalSeparator||"")+((O=+$.fractionGroupSize)?k.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+($.fractionGroupSeparator||"")):k):b}return($.prefix||"")+I+($.suffix||"")},o.toFraction=function(g){var w,$,I,C,P,S,E,O,N,b,k,R,D=this,U=D.c;if(g!=null&&(E=new y(g),!E.isInteger()&&(E.c||E.s!==1)||E.lt(s)))throw Error(De+"Argument "+(E.isInteger()?"out of range: ":"not an integer: ")+j(E));if(!U)return new y(D);for(w=new y(s),N=$=new y(s),I=O=new y(s),R=Qe(U),P=w.e=R.length-D.e-1,w.c[0]=ri[(S=P%ne)<0?ne+S:S],g=!g||E.comparedTo(w)>0?P>0?w:N:E,S=f,f=1/0,E=new y(R),O.c[0]=0;b=t(E,w,0,1),C=$.plus(b.times(I)),C.comparedTo(g)!=1;)$=I,I=C,N=O.plus(b.times(C=N)),O=C,w=E.minus(b.times(C=w)),E=C;return C=t(g.minus($),I,0,1),O=O.plus(C.times(N)),$=$.plus(C.times(I)),O.s=N.s=D.s,P=P*2,k=t(N,I,P,c).minus(D).abs().comparedTo(t(O,$,P,c).minus(D).abs())<1?[N,I]:[O,$],f=S,k},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,w){return g!=null&&ye(g,1,Te),A(this,g,w,2)},o.toString=function(g){var w,$=this,I=$.s,C=$.e;return C===null?I?(w="Infinity",I<0&&(w="-"+w)):w="NaN":(g==null?w=C<=a||C>=u?Fo(Qe($.c),C):_t(Qe($.c),C,"0"):g===10&&T?($=_(new y($),i+C+1,c),w=_t(Qe($.c),$.e,"0")):(ye(g,2,x.length,"Base"),w=n(_t(Qe($.c),C,"0"),10,g,I,!0)),I<0&&$.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return j(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&y.set(e),y}function Xe(e){var t=e|0;return e>0||e===t?t:t-1}function Qe(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function En(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function ye(e,t,n,r){if(e<t||e>n||e!==Ye(e))throw Error(De+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Lo(e){var t=e.c.length-1;return Xe(e.e/ne)==t&&e.c[t]%2!=0}function Fo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _t(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Ne=pu();const fm=(e,t=6)=>{try{const n=new Ne(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ne.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"}},dt=()=>{const{translations:e,currentLocale:t}=fu();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},dm="1.0.8";let qe=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@${dm}`].join(`
|
|
36
|
-
`);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 Ut(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const hu=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,mu=/^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)?$/,gu=/^\(.+?\).*?$/,bu=/^tuple(?<array>(\[(\d*)\])*)$/;function oi(e){let t=e.type;if(bu.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=oi(s),o<n-1&&(t+=", ")}const r=Ut(bu,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,oi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Ir(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=oi(o),r!==n-1&&(t+=", ")}return t}function Ro(e){var t;return e.type==="function"?`function ${e.name}(${Ir(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Ir(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Ir(e.inputs)})`:e.type==="error"?`error ${e.name}(${Ir(e.inputs)})`:e.type==="constructor"?`constructor(${Ir(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const yu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function pm(e){return yu.test(e)}function hm(e){return Ut(yu,e)}const wu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function mm(e){return wu.test(e)}function gm(e){return Ut(wu,e)}const vu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function bm(e){return vu.test(e)}function ym(e){return Ut(vu,e)}const xu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function si(e){return xu.test(e)}function wm(e){return Ut(xu,e)}const Eu=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function vm(e){return Eu.test(e)}function xm(e){return Ut(Eu,e)}const Su=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Em(e){return Su.test(e)}function Sm(e){return Ut(Su,e)}const Pm=/^receive\(\) external payable$/;function $m(e){return Pm.test(e)}const Am=new Set(["indexed"]),ii=new Set(["calldata","memory","storage"]);class Tm extends qe{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Om extends qe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Cm extends qe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Nm extends qe{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Im extends qe{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Mm extends qe{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class km extends qe{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Bm extends qe{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Zn extends qe{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Lm extends qe{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Fm extends qe{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Rm extends qe{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Dm extends qe{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function jm(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const ai=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function ci(e,t={}){if(bm(e))return _m(e,t);if(mm(e))return Um(e,t);if(pm(e))return zm(e,t);if(vm(e))return Hm(e,t);if(Em(e))return Wm(e);if($m(e))return{type:"receive",stateMutability:"payable"};throw new Lm({signature:e})}function _m(e,t={}){const n=ym(e);if(!n)throw new Zn({signature:e,type:"function"});const r=pt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Sn(r[c],{modifiers:ii,structs:t,type:"function"}));const i=[];if(n.returns){const c=pt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(Sn(c[u],{modifiers:ii,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Um(e,t={}){const n=gm(e);if(!n)throw new Zn({signature:e,type:"event"});const r=pt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{modifiers:Am,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function zm(e,t={}){const n=hm(e);if(!n)throw new Zn({signature:e,type:"error"});const r=pt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Hm(e,t={}){const n=xm(e);if(!n)throw new Zn({signature:e,type:"constructor"});const r=pt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Sn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Wm(e){const t=Sm(e);if(!t)throw new Zn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Vm=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Gm=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,qm=/^u?int$/;function Sn(e,t){var f,p;const n=jm(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(ai.has(n))return ai.get(n);const r=gu.test(e),o=Ut(r?Gm:Vm,e);if(!o)throw new Nm({param:e});if(o.name&&Km(o.name))throw new Im({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=pt(o.type),h=[],m=d.length;for(let x=0;x<m;x++)h.push(Sn(d[x],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(qm.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!Pu(a))throw new Cm({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 Mm({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(ii.has(o.modifier)&&!Ym(a,!!o.array))throw new km({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return ai.set(n,l),l}function pt(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?pt(c,[...t,n.trim()]):pt(c,t,`${n}${i}`,r);case"(":return pt(c,t,`${n}${i}`,r+1);case")":return pt(c,t,`${n}${i}`,r-1);default:return pt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Dm({current:n,depth:r});return t.push(n.trim()),t}function Pu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||hu.test(e)||mu.test(e)}const Zm=/^(?: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 Km(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||hu.test(e)||mu.test(e)||Zm.test(e)}function Ym(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function $u(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!si(c))continue;const a=wm(c);if(!a)throw new Zn({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=Sn(h,{type:"struct"});l.push(m)}if(!l.length)throw new Fm({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]=Au(a,t)}return r}const Xm=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Au(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(gu.test(i.type))r.push(i);else{const a=Ut(Xm,i.type);if(!(a!=null&&a.type))throw new Bm({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Rm({type:l});r.push({...i,type:`tuple${u??""}`,components:Au(t[l]??[],t,new Set([...n,l]))})}else if(Pu(l))r.push(i);else throw new Om({type:l})}}return r}function Tu(e){const t=$u(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];si(s)||n.push(ci(s,t))}return n}function Ou(e){let t;if(typeof e=="string")t=ci(e);else{const n=$u(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!si(s)){t=ci(s,n);break}}}if(!t)throw new Tm({signature:e});return t}function ee(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function ht(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new lg(e.type);return`${e.name}(${Do(e.inputs,{includeName:t})})`}function Do(e,{includeName:t=!1}={}){return e?e.map(n=>Qm(n,{includeName:t})).join(t?", ":","):""}function Qm(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Do(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function mt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ve(e){return mt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Cu="2.34.0";let Mr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Cu}`},q=class su extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof su?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof su&&n.cause.docsPath||n.docsPath,s=(c=Mr.getDocsUrl)==null?void 0:c.call(Mr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Mr.version?[`Version: ${Mr.version}`]:[]].join(`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`),{name:"AbiEncodingLengthMismatchError"})}}class rg extends q{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(`
|
|
43
|
-
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class ku extends q{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(`
|
|
44
|
-
`),{
|
|
45
|
-
`),{docsPath:
|
|
46
|
-
`),{docsPath:
|
|
47
|
-
`),{
|
|
48
|
-
`),{
|
|
49
|
-
`),{
|
|
50
|
-
`),{docsPath:n,name:"
|
|
51
|
-
`),{
|
|
52
|
-
`),{name:"
|
|
53
|
-
`),{docsPath:n,name:"
|
|
54
|
-
`),{docsPath:n,name:"
|
|
55
|
-
`),{name:"
|
|
56
|
-
`),{name:"InvalidDefinitionTypeError"})}}class fg extends q{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let ju=class extends q{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},_u=class extends q{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 Uu extends q{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 Yn(e,{dir:t,size:n=32}={}){return typeof e=="string"?ln(e,{dir:t,size:n}):dg(e,{dir:t,size:n})}function ln(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new _u({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function dg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new _u({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 zu=class extends q{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class pg extends q{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 hg extends q{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let mg=class extends q{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Pn(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 gt(e,{size:t}){if(ve(e)>t)throw new mg({givenSize:ve(e),maxSize:t})}function At(e,t={}){const{signed:n}=t;t.size&>(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 gg(e,t={}){let n=e;if(t.size&&(gt(n,{size:t.size}),n=Pn(n)),Pn(n)==="0x00")return!1;if(Pn(n)==="0x01")return!0;throw new hg(n)}function zt(e,t={}){return Number(At(e,t))}const bg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ht(e,t={}){return typeof e=="number"||typeof e=="bigint"?J(e,t):typeof e=="string"?Lr(e,t):typeof e=="boolean"?Hu(e,t):$e(e,t)}function Hu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(gt(n,{size:t.size}),Yn(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=bg[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(gt(r,{size:t.size}),Yn(r,{dir:"right",size:t.size})):r}function J(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new zu({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?Yn(c,{size:r}):c}const yg=new TextEncoder;function Lr(e,t={}){const n=yg.encode(e);return $e(n,t)}const wg=new TextEncoder;function Xn(e,t={}){return typeof e=="number"||typeof e=="bigint"?xg(e,t):typeof e=="boolean"?vg(e,t):mt(e)?bt(e,t):$n(e,t)}function vg(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(gt(n,{size:t.size}),Yn(n,{size:t.size})):n}const Wt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Wu(e){if(e>=Wt.zero&&e<=Wt.nine)return e-Wt.zero;if(e>=Wt.A&&e<=Wt.F)return e-(Wt.A-10);if(e>=Wt.a&&e<=Wt.f)return e-(Wt.a-10)}function bt(e,t={}){let n=e;t.size&&(gt(n,{size:t.size}),n=Yn(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=Wu(r.charCodeAt(c++)),u=Wu(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new q(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function xg(e,t){const n=J(e,t);return bt(n)}function $n(e,t={}){const n=wg.encode(e);return typeof t.size=="number"?(gt(n,{size:t.size}),Yn(n,{dir:"right",size:t.size})):n}const _o=BigInt(2**32-1),Vu=BigInt(32);function Eg(e,t=!1){return t?{h:Number(e&_o),l:Number(e>>Vu&_o)}:{h:Number(e>>Vu&_o)|0,l:Number(e&_o)|0}}function Sg(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}=Eg(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Pg=(e,t,n)=>e<<n|t>>>32-n,$g=(e,t,n)=>t<<n|e>>>32-n,Ag=(e,t,n)=>t<<n-32|e>>>64-n,Tg=(e,t,n)=>e<<n-32|t>>>64-n,Qn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Uo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Fr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Vt(e,...t){if(!Uo(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 Gu(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Fr(e.outputLen),Fr(e.blockLen)}function Jn(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 qu(e,t){Vt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Og(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function er(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ui(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Tt(e,t){return e<<32-t|e>>>t}const Cg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ng(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ig(e){for(let t=0;t<e.length;t++)e[t]=Ng(e[t]);return e}const Zu=Cg?e=>e:Ig,Ku=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Mg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tr(e){if(Vt(e),Ku)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Mg[e[n]];return t}const Gt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yu(e){if(e>=Gt._0&&e<=Gt._9)return e-Gt._0;if(e>=Gt.A&&e<=Gt.F)return e-(Gt.A-10);if(e>=Gt.a&&e<=Gt.f)return e-(Gt.a-10)}function zo(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Ku)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=Yu(e.charCodeAt(s)),c=Yu(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 kg(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ho(e){return typeof e=="string"&&(e=kg(e)),Vt(e),e}function fn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Vt(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 li{}function Xu(e){const t=r=>e().update(Ho(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Qu(e=32){if(Qn&&typeof Qn.getRandomValues=="function")return Qn.getRandomValues(new Uint8Array(e));if(Qn&&typeof Qn.randomBytes=="function")return Uint8Array.from(Qn.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Bg=BigInt(0),Rr=BigInt(1),Lg=BigInt(2),Fg=BigInt(7),Rg=BigInt(256),Dg=BigInt(113),Ju=[],el=[],tl=[];for(let e=0,t=Rr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ju.push(2*(5*r+n)),el.push((e+1)*(e+2)/2%64);let o=Bg;for(let s=0;s<7;s++)t=(t<<Rr^(t>>Fg)*Dg)%Rg,t&Lg&&(o^=Rr<<(Rr<<BigInt(s))-Rr);tl.push(o)}const nl=Sg(tl,!0),jg=nl[0],_g=nl[1],rl=(e,t,n)=>n>32?Ag(e,t,n):Pg(e,t,n),ol=(e,t,n)=>n>32?Tg(e,t,n):$g(e,t,n);function Ug(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=rl(u,l,1)^n[c],p=ol(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=el[i],a=rl(o,s,c),u=ol(o,s,c),l=Ju[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]^=jg[r],e[1]^=_g[r]}er(n)}class fi extends li{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,Fr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Og(this.state)}clone(){return this._cloneInto()}keccak(){Zu(this.state32),Ug(this.state32,this.rounds),Zu(this.state32),this.posOut=0,this.pos=0}update(t){Jn(this),t=Ho(t),Vt(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){Jn(this,!1),Vt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Fr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(qu(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,er(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new fi(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const zg=(e,t,n)=>Xu(()=>new fi(t,e,n)),sl=zg(1,136,256/8);function Ie(e,t){const n=t||"hex",r=sl(mt(e,{strict:!1})?Xn(e):e);return n==="bytes"?r:Ht(r)}const Hg=e=>Ie(Xn(e));function Wg(e){return Hg(e)}function Vg(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 q("Unable to normalize signature.");return o}const Gg=e=>{const t=typeof e=="string"?e:Ro(e);return Vg(t)};function il(e){return Wg(Gg(e))}const Wo=il;let dn=class extends q{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},di=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const pi=new di(8192);function Vo(e,t){if(pi.has(`${e}.${t}`))return pi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ie($n(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return pi.set(`${e}.${t}`,s),s}function An(e,t){if(!Je(e,{strict:!1}))throw new dn({address:e});return Vo(e,t)}const qg=/^0x[a-fA-F0-9]{40}$/,hi=new di(8192);function Je(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(hi.has(r))return hi.get(r);const o=qg.test(e)?e.toLowerCase()===e?!0:n?Vo(e)===e:!0:!1;return hi.set(r,o),o}function yt(e){return typeof e[0]=="string"?nr(e):Zg(e)}function Zg(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 nr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function rr(e,t,n,{strict:r}={}){return mt(e,{strict:!1})?ll(e,t,n,{strict:r}):ul(e,t,n,{strict:r})}function al(e,t){if(typeof t=="number"&&t>0&&t>ve(e)-1)throw new ju({offset:t,position:"start",size:ve(e)})}function cl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ve(e)!==n-t)throw new ju({offset:n,position:"end",size:ve(e)})}function ul(e,t,n,{strict:r}={}){al(e,t);const o=e.slice(t,n);return r&&cl(o,t,n),o}function ll(e,t,n,{strict:r}={}){al(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&cl(o,t,n),o}const Kg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,fl=/^(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 qt(e,t){if(e.length!==t.length)throw new ng({expectedLength:e.length,givenLength:t.length});const n=Yg({params:e,values:t}),r=gi(n);return r.length===0?"0x":r}function Yg({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(mi({param:e[r],value:t[r]}));return n}function mi({param:e,value:t}){const n=bi(e.type);if(n){const[r,o]=n;return Qg(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return rb(t,{param:e});if(e.type==="address")return Xg(t);if(e.type==="bool")return eb(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=fl.exec(e.type)??[];return tb(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return Jg(t,{param:e});if(e.type==="string")return nb(t);throw new cg(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function gi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ve(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(J(t+o,{size:32})),r.push(c),o+=ve(c)):n.push(c)}return yt([...n,...r])}function Xg(e){if(!Je(e))throw new dn({address:e});return{dynamic:!1,encoded:ln(e.toLowerCase())}}function Qg(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Du(e);if(!r&&e.length!==t)throw new eg({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=mi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=gi(s);if(r){const c=J(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?yt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:yt(s.map(({encoded:i})=>i))}}function Jg(e,{param:t}){const[,n]=t.type.split("bytes"),r=ve(e);if(!n){let o=e;return r%32!==0&&(o=ln(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:yt([ln(J(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new tg({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:ln(e,{dir:"right"})}}function eb(e){if(typeof e!="boolean")throw new q(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:ln(Hu(e))}}function tb(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 zu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:J(e,{size:32,signed:t})}}function nb(e){const t=Lr(e),n=Math.ceil(ve(t)/32),r=[];for(let o=0;o<n;o++)r.push(ln(rr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:yt([ln(J(ve(t),{size:32})),...r])}}function rb(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=mi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?gi(r):yt(r.map(({encoded:o})=>o))}}function bi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Dr=e=>rr(il(e),0,4);function Tn(e){const{abi:t,args:n=[],name:r}=e,o=mt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Dr(c)===r:c.type==="event"?Wo(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?yi(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=dl(c.inputs,i.inputs,n);if(u)throw new ig({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function yi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Je(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>yi(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>yi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function dl(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 dl(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")?Je(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Je(n[r],{strict:!1}):!1)return i}}const pl="/docs/contract/encodeEventTopics";function jr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=Tn({abi:t,name:n});if(!u)throw new Fu(n,{docsPath:pl});o=u}if(o.type!=="event")throw new Fu(void 0,{docsPath:pl});const s=ht(o),i=Wo(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)=>hl({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?hl({param:f,value:l[p]}):null))??[])}return[i,...c]}function hl({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ie(Xn(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new fg(e.type);return qt([e],[t])}function Go(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 ml(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=Go(e,{method:"eth_newFilter"}),l=s?jr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?J(i):i,toBlock:typeof a=="bigint"?J(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function wt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const gl="/docs/contract/encodeFunctionData";function ob(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Tn({abi:t,args:n,name:r});if(!s)throw new Kn(r,{docsPath:gl});o=s}if(o.type!=="function")throw new Kn(void 0,{docsPath:gl});return{abi:[o],functionName:Dr(ht(o))}}function Ot(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:ob(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?qt(o.inputs,t??[]):void 0;return nr([s,i??"0x"])}const bl={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."},yl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},sb={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class wl extends q{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class vl extends q{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class ib extends q{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ab={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 ib({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new vl({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new wl({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 wl({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function wi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ab);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function cb(e,t={}){typeof t.size<"u"&>(e,{size:t.size});const n=$e(e,t);return At(n,t)}function ub(e,t={}){let n=e;if(typeof t.size<"u"&&(gt(n,{size:t.size}),n=Pn(n)),n.length>1||n[0]>1)throw new pg(n);return!!n[0]}function Zt(e,t={}){typeof t.size<"u"&>(e,{size:t.size});const n=$e(e,t);return zt(n,t)}function lb(e,t={}){let n=e;return typeof t.size<"u"&&(gt(n,{size:t.size}),n=Pn(n,{dir:"right"})),new TextDecoder().decode(n)}function _r(e,t){const n=typeof t=="string"?bt(t):t,r=wi(n);if(ve(n)===0&&e.length>0)throw new kr;if(ve(t)&&ve(t)<32)throw new Mu({data:typeof t=="string"?t:$e(t),params:e,size:ve(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=or(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function or(e,t,{staticPosition:n}){const r=bi(t.type);if(r){const[o,s]=r;return db(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return gb(e,t,{staticPosition:n});if(t.type==="address")return fb(e);if(t.type==="bool")return pb(e);if(t.type.startsWith("bytes"))return hb(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return mb(e,t);if(t.type==="string")return bb(e,{staticPosition:n});throw new ug(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const xl=32,vi=32;function fb(e){const t=e.readBytes(32);return[Vo($e(ul(t,-20))),32]}function db(e,t,{length:n,staticPosition:r}){if(!n){const i=Zt(e.readBytes(vi)),c=r+i,a=c+xl;e.setPosition(c);const u=Zt(e.readBytes(xl)),l=Ur(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=or(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Ur(t)){const i=Zt(e.readBytes(vi)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=or(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]=or(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function pb(e){return[ub(e.readBytes(32),{size:32}),32]}function hb(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Zt(e.readBytes(32));e.setPosition(n+i);const c=Zt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o),32)),32]}function mb(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?cb(o,{signed:n}):Zt(o,{signed:n}),32]}function gb(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Ur(t)){const i=Zt(e.readBytes(vi)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=or(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]=or(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function bb(e,{staticPosition:t}){const n=Zt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Zt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=lb(Pn(s));return e.setPosition(t+32),[i,32]}function Ur(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(Ur);const n=bi(e.type);return!!(n&&Ur({...e,type:n[1]}))}function El(e){const{abi:t,data:n}=e,r=rr(n,0,4);if(r==="0x")throw new kr;const s=[...t||[],yl,sb].find(i=>i.type==="error"&&r===Dr(ht(i)));if(!s)throw new Bu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?_r(s.inputs,rr(n,4)):void 0,errorName:s.name}}const Ae=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Sl({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Ae(t[s]):t[s]}`).join(", ")})`}const yb={gwei:9,wei:18},wb={ether:-9,wei:9};function xi(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${s?`.${s}`:""}`}function Pl(e,t="wei"){return xi(e,yb[t])}function vt(e,t="wei"){return xi(e,wb[t])}class vb extends q{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class xb extends q{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function $l(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
57
|
-
|
|
30
|
+
<%s key={someKey} {...props} />`,Au,Jn,aS,Jn),Mm[Jn+Au]=!0}}return R===r?nS($e):tS($e),$e}}function rS(R,q,Y){return km(R,q,Y,!0)}function oS(R,q,Y){return km(R,q,Y,!1)}var sS=oS,iS=rS;Fr.Fragment=r,Fr.jsx=sS,Fr.jsxs=iS}()),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
|
+
充值金额大于 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充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。"},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
|
+
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",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account."},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
|
+
入金金額が 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で入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。"},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
|
+
Если сумма депозита превышает 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:`Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.
|
|
39
|
+
|
|
40
|
+
Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный."},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}}) 資產到此位址。
|
|
41
|
+
充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
42
|
+
跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。"},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,A,T,P=this;if(!(P instanceof E))return new E(b,g);if(g==null){if(b&&b._isBigNumber===!0){P.s=b.s,!b.c||b.e>f?P.c=P.e=null:b.e<l?P.c=[P.e=0]:(P.e=b.e,P.c=b.c.slice());return}if((y=typeof b=="number")&&b*0==0){if(P.s=1/b<0?(b=-b,-1):1,b===~~b){for(I=0,M=b;M>=10;M/=10,I++);I>f?P.c=P.e=null:(P.e=I,P.c=[b]);return}T=String(b)}else{if(!qm.test(T=String(b)))return r(P,T,y);P.s=T.charCodeAt(0)==45?(T=T.slice(1),-1):1}(I=T.indexOf("."))>-1&&(T=T.replace(".","")),(M=T.search(/e/i))>0?(I<0&&(I=M),I+=+T.slice(M+1),T=T.substring(0,M)):I<0&&(I=T.length)}else{if(ye(g,2,w.length,"Base"),g==10&&$)return P=new E(b),F(P,i+P.e+1,c);if(T=String(b),y=typeof b=="number"){if(b*0!=0)return r(P,T,y,g);if(P.s=1/b<0?(T=T.slice(1),-1):1,E.DEBUG&&T.replace(/^0\.0*|\./,"").length>15)throw Error(Fu+b)}else P.s=T.charCodeAt(0)===45?(T=T.slice(1),-1):1;for(v=w.slice(0,g),I=M=0,A=T.length;M<A;M++)if(v.indexOf(C=T.charAt(M))<0){if(C=="."){if(M>I){I=A;continue}}else if(!O&&(T==T.toUpperCase()&&(T=T.toLowerCase())||T==T.toLowerCase()&&(T=T.toUpperCase()))){O=!0,M=-1,I=0;continue}return r(P,String(b),y,g)}y=!1,T=n(T,g,10,P.s),(I=T.indexOf("."))>-1?T=T.replace(".",""):I=T.length}for(M=0;T.charCodeAt(M)===48;M++);for(A=T.length;T.charCodeAt(--A)===48;);if(T=T.slice(M,++A)){if(A-=M,y&&E.DEBUG&&A>15&&(b>yi||b!==ot(b)))throw Error(Fu+P.s*b);if((I=I-M-1)>f)P.c=P.e=null;else if(I<l)P.c=[P.e=0];else{if(P.e=I,P.c=[],M=(I+1)%ne,I<0&&(M+=ne),M<A){for(M&&P.c.push(+T.slice(0,M)),A-=ne;M<A;)P.c.push(+T.slice(M,M+=ne));M=ne-(T=T.slice(M)).length}else M-=A;for(;M--;T+="0");P.c.push(+T)}}else P.c=[P.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,A=0,T=[],P=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));A<M;)y=C[A]*131072+(C[A+1]>>>11),y>=9e15?(O=crypto.getRandomValues(new Uint32Array(2)),C[A]=O[0],C[A+1]=O[1]):(T.push(y%1e14),A+=2);A=M/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(M*=7);A<M;)y=(C[A]&31)*281474976710656+C[A+1]*1099511627776+C[A+2]*4294967296+C[A+3]*16777216+(C[A+4]<<16)+(C[A+5]<<8)+C[A+6],y>=9e15?crypto.randomBytes(7).copy(C,A):(T.push(y%1e14),A+=7);A=M/7}else throw p=!1,Error(_e+"crypto unavailable");if(!p)for(;A<M;)y=g(),y<9e15&&(T[A++]=y%1e14);for(M=T[--A],v%=ne,M&&v&&(y=wi[ne-v],T[A]=ot(M/y)*y);T[A]===0;T.pop(),A--);if(A<0)T=[I=0];else{for(I=-1;T[0]===0;T.splice(0,1),I-=ne);for(A=1,y=T[0];y>=10;y/=10,A++);A<ne&&(I-=ne-A)}return P.e=I,P.c=T,P}}(),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],A,T=0,P=v.length;T<P;){for(A=y.length;A--;y[A]*=C);for(y[0]+=I.indexOf(v.charAt(T++)),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,A,T,P,L,j,z,_,W=v.indexOf("."),K=i,G=c;for(W>=0&&(P=h,h=0,v=v.replace(".",""),_=new E(C),j=_.pow(v.length-W),h=P,_.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)),T=P=z.length;z[--P]==0;z.pop());if(!z[0])return y.charAt(0);if(W<0?--T:(j.c=z,j.e=T,j.s=I,j=t(j,_,K,G,O),z=j.c,L=j.r,T=j.e),A=T+K+1,W=z[A],P=O/2,L=L||A<0||z[A+1]!=null,L=G<4?(W!=null||L)&&(G==0||G==(j.s<0?3:2)):W>P||W==P&&(G==4||L||G==6&&z[A-1]&1||G==(j.s<0?8:7)),A<1||!z[0])v=L?Vt(y.charAt(1),-K,y.charAt(0)):y.charAt(0);else{if(z.length=A,L)for(--O;++z[--A]>O;)z[A]=0,A||(++T,z=[1].concat(z));for(P=z.length;!z[--P];);for(W=0,v="";W<=P;v+=y.charAt(z[W++]));v=Vt(v,T,y.charAt(0))}return v}}(),t=function(){function b(C,O,I){var M,y,A,T,P=0,L=C.length,j=O%fn,z=O/fn|0;for(C=C.slice();L--;)A=C[L]%fn,T=C[L]/fn|0,M=z*A+T*j,y=j*A+M%fn*fn+P,P=(y/I|0)+(M/fn|0)+z*T,C[L]=y%I;return P&&(C=[P].concat(C)),C}function g(C,O,I,M){var y,A;if(I!=M)A=I>M?1:-1;else for(y=A=0;y<I;y++)if(C[y]!=O[y]){A=C[y]>O[y]?1:-1;break}return A}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 A,T,P,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=[],T=C.e-O.e,se=I+T+1,y||(y=wt,T=st(C.e/ne)-st(O.e/ne),se=se/ne|0),P=0;ee[P]==(pe[P]||0);P++);if(ee[P]>(pe[P]||0)&&T--,se<0)K.push(1),L=!0;else{for(oe=pe.length,ge=ee.length,P=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,A=g(ee,G,ge,H),A<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,A=1;else j==0&&(A=j=1),z=ee.slice(),_=z.length;if(_<H&&(z=[0].concat(z)),v(G,z,H,y),H=G.length,A==-1)for(;g(ee,G,ge,H)<1;)j++,v(G,ge<H?de:ee,H,y),H=G.length}else A===0&&(j++,G=[0]);K[P++]=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(P=1,se=K[0];se>=10;se/=10,P++);F(W,I+(W.e=P+T*ne-1)+1,M,L)}else W.e=T,W.r=+L;return W}}();function S(b,g,v,C){var O,I,M,y,A;if(v==null?v=c:ye(v,0,8),!b.c)return b.toString();if(O=b.c[0],M=b.e,g==null)A=it(b.c),A=C==1||C==2&&(M<=a||M>=u)?Yo(A,M):Vt(A,M,"0");else if(b=F(new E(b),g,v),I=b.e,A=it(b.c),y=A.length,C==1||C==2&&(g<=I||I<=a)){for(;y<g;A+="0",y++);A=Yo(A,I)}else if(g-=M+(C===2&&I>M),A=Vt(A,I,"0"),I+1>y){if(--g>0)for(A+=".";g--;A+="0");}else if(g+=I-y,g>0)for(I+1==y&&(A+=".");g--;A+="0");return b.s<0&&O?"-"+A:A}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=Cn(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,A){var T,P=y?M:M.replace(O,"");if(C.test(P))I.s=isNaN(P)?null:P<0?-1:1;else{if(!y&&(P=P.replace(b,function(L,j,z){return T=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!A||A==T?j:L}),A&&(T=A,P=P.replace(g,"$1").replace(v,"0.$1")),M!=P))return new E(P,T);if(E.DEBUG)throw Error(_e+"Not a"+(A?" base "+A:"")+" number: "+M);I.s=null}I.c=I.e=null}}();function F(b,g,v,C){var O,I,M,y,A,T,P,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,A=L[T=0],P=ot(A/j[O-M-1]%10);else if(T=gi((I+1)/ne),T>=L.length)if(C){for(;L.length<=T;L.push(0));A=P=0,O=1,I%=ne,M=I-ne+1}else break e;else{for(A=y=L[T],O=1;y>=10;y/=10,O++);I%=ne,M=I-ne+O,P=M<0?0:ot(A/j[O-M-1]%10)}if(C=C||g<0||L[T+1]!=null||(M<0?A:A%j[O-M-1]),C=v<4?(P||C)&&(v==0||v==(b.s<0?3:2)):P>5||P==5&&(v==4||C||v==6&&(I>0?M>0?A/j[O-M]:0:L[T-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=T,y=1,T--):(L.length=T+1,y=j[ne-I],L[T]=M>0?ot(A/j[O-M]%j[M])*y:0),C)for(;;)if(T==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[T]+=y,L[T]!=wt)break;L[T--]=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 Cn(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,A,T,P,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 P=new E(Math.pow(+D(L),y?b.s*(2-Zo(b)):+D(b))),g?P.mod(g):P;if(A=b.s<0,g){if(g.c?!g.c[0]:!g.s)return new E(NaN);C=!A&&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(A?1/I:I);h&&(I=gi(h/ne+2))}for(y?(v=new E(.5),A&&(b.s=1),T=Zo(b)):(O=Math.abs(+D(b)),T=O%2),P=new E(s);;){if(T){if(P=P.times(L),!P.c)break;I?P.c.length>I&&(P.c.length=I):C&&(P=P.mod(g))}if(O){if(O=ot(O/2),O===0)break;T=O%2}else if(b=b.times(v),F(b,b.e+1,1),b.e>14)T=Zo(b);else{if(O=+D(b),O===0)break;T=O%2}L=L.times(L),I?L.c&&L.c.length>I&&(L.c.length=I):C&&(L=L.mod(g))}return C?P:(A&&(P=s.div(P)),g?P.mod(g):I?F(P,h,c,M):P)},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 Cn(this,new E(b,g))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,g){return Cn(this,new E(b,g))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,g){return(g=Cn(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 Cn(this,new E(b,g))<0},o.isLessThanOrEqualTo=o.lte=function(b,g){return(g=Cn(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 A=M.e/ne,T=b.e/ne,P=M.c,L=b.c;if(!A||!T){if(!P||!L)return P?(b.s=-g,b):new E(L?M:NaN);if(!P[0]||!L[0])return L[0]?(b.s=-g,b):new E(P[0]?M:c==3?-0:0)}if(A=st(A),T=st(T),P=P.slice(),y=A-T){for((I=y<0)?(y=-y,O=P):(T=A,O=L),O.reverse(),g=y;g--;O.push(0));O.reverse()}else for(C=(I=(y=P.length)<(g=L.length))?y:g,y=g=0;g<C;g++)if(P[g]!=L[g]){I=P[g]<L[g];break}if(I&&(O=P,P=L,L=O,b.s=-b.s),g=(C=L.length)-(v=P.length),g>0)for(;g--;P[v++]=0);for(g=wt-1;C>y;){if(P[--C]<L[C]){for(v=C;v&&!P[--v];P[v]=g);--P[v],P[C]+=wt}P[C]-=L[C]}for(;P[0]==0;P.splice(0,1),--T);return P[0]?B(b,P,T):(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,A,T,P,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,A=H.length,L=Z.length,A<L&&(_=H,H=Z,Z=_,O=A,A=L,L=O),O=A+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=A,I=O+M;I>O;)T=H[--M]%K,P=H[M]/K|0,y=z*T+P*j,T=j*T+y%K*K+_[I]+v,v=(T/W|0)+(y/K|0)+z*P,_[I--]=T%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,A=b.c;if(!I||!M){if(!y||!A)return new E(O/0);if(!y[0]||!A[0])return A[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=A):(O=-O,v=y),v.reverse();O--;v.push(0));v.reverse()}for(O=y.length,g=A.length,O-g<0&&(v=A,A=y,y=v,g=O),O=0;g;)O=(y[--g]=y[g]+A[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,A=I.e,T=i+4,P=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+A)%2==0&&(g+="0"),y=Math.sqrt(+g),A=st((A+1)/2)-(A<0||A%2),y==1/0?g="5e"+A:(g=y.toExponential(),g=g.slice(0,g.indexOf("e")+1)+A),v=new E(g)):v=new E(y+""),v.c[0]){for(A=v.e,y=A+T,y<3&&(y=0);;)if(O=v,v=P.times(O.plus(t(I,O,T,1))),it(O.c).slice(0,y)===(g=it(v.c)).slice(0,y))if(v.e<A&&--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}T+=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++),S(this,b,g,1)},o.toFixed=function(b,g){return b!=null&&(ye(b,0,Oe),b=b+this.e+1),S(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,A=+v.secondaryGroupSize,T=v.groupSeparator||"",P=M[0],L=M[1],j=O.s<0,z=j?P.slice(1):P,_=z.length;if(A&&(I=y,y=A,A=I,_-=I),y>0&&_>0){for(I=_%y||y,P=z.substr(0,I);I<_;I+=y)P+=T+z.substr(I,y);A>0&&(P+=T+z.slice(I)),j&&(P="-"+P)}C=L?P+(v.decimalSeparator||"")+((A=+v.fractionGroupSize)?L.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):L):P}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(b){var g,v,C,O,I,M,y,A,T,P,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),T=v=new E(s),C=A=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:T:y,M=f,f=1/0,y=new E(j),A.c[0]=0;P=t(y,g,0,1),O=v.plus(P.times(C)),O.comparedTo(b)!=1;)v=C,C=O,T=A.plus(P.times(O=T)),A=O,g=y.minus(P.times(O=g)),y=O;return O=t(b.minus(v),C,0,1),A=A.plus(O.times(T)),v=v.plus(O.times(C)),A.s=T.s=z.s,I=I*2,L=t(T,C,I,c).minus(z).abs().comparedTo(t(A,v,I,c).minus(z).abs())<1?[T,C]:[A,v],f=M,L},o.toNumber=function(){return+D(this)},o.toPrecision=function(b,g){return b!=null&&ye(b,1,Oe),S(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 Cn(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(`
|
|
43
|
+
`);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 Sb(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 Si(e,t={}){if(eb(e))return Pb(e,t);if(Qm(e))return $b(e,t);if(Km(e))return Tb(e,t);if(rb(e))return Ab(e,t);if(sb(e))return Ob(e);if(cb(e))return{type:"receive",stateMutability:"payable"};throw new wb({signature:e})}function Pb(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 Tb(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 Ab(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=Sb(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 Pi(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=Pi(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];Xo(s)||n.push(Si(s,t))}return n}function Qu(e){let t;if(typeof e=="string")t=Si(e);else{const n=Pi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!Xo(s)){t=Si(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=Pi(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(`
|
|
44
|
+
`);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(`
|
|
45
|
+
`),{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(`
|
|
46
|
+
`),{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(`
|
|
47
|
+
`),{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(`
|
|
48
|
+
`),{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(`
|
|
49
|
+
`),{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(`
|
|
50
|
+
`),{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(`
|
|
51
|
+
`),{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(`
|
|
52
|
+
`),{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(`
|
|
53
|
+
`),{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(`
|
|
54
|
+
`),{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(`
|
|
55
|
+
`),{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(`
|
|
56
|
+
`),{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(`
|
|
57
|
+
`),{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(`
|
|
58
|
+
`),{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(`
|
|
59
|
+
`),{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(`
|
|
60
|
+
`),{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(`
|
|
61
|
+
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let cl=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
62
|
+
`),{name:"InvalidArrayError"})}};class Yb extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
63
|
+
`),{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 In(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function St(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&&St(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&&(St(n,{size:t.size}),n=In(n)),In(n)==="0x00")return!1;if(In(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):Te(e,t)}function pl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(St(n,{size:t.size}),rr(n,{size:t.size})):n}function Te(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"?(St(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 Te(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):Mn(e,t)}function s1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(St(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&&(St(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 Mn(e,t={}){const n=o1.encode(e);return typeof t.size=="number"?(St(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 kn(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){kn(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 Ti(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)),kn(e),e}function v1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];kn(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class Ai{}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),S1=BigInt(2),P1=BigInt(7),$1=BigInt(256),T1=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>>P1)*T1)%$1,t&S1&&(o^=Ur<<(Ur<<BigInt(s))-Ur);xl.push(o)}const El=c1(xl,!0),A1=El[0],O1=El[1],Sl=(e,t,n)=>n>32?f1(e,t,n):u1(e,t,n),Pl=(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=Sl(u,l,1)^n[c],p=Pl(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=Sl(o,s,c),u=Pl(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]^=O1[r]}ar(n)}class Oi extends Ai{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),kn(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let 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),kn(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return _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 Tl(e){return M1(B1(e))}const ns=Tl;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(Mn(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return 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 Pt(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 Al(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}={}){Al(e,t);const o=e.slice(t,n);return r&&Ol(o,t,n),o}function D1(e,t,n,{strict:r}={}){Al(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 Pt([...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?Pt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Pt(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:Pt([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:Pt([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):Pt(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(Tl(e),0,4);function Bn(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=Bn({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=Bn({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"&&St(e,{size:t.size});const n=Te(e,t);return kt(n,t)}function J1(e,t={}){let n=e;if(typeof t.size<"u"&&(St(n,{size:t.size}),n=In(n)),n.length>1||n[0]>1)throw new Qb(n);return!!n[0]}function Kt(e,t={}){typeof t.size<"u"&&St(e,{size:t.size});const n=Te(e,t);return Zt(n,t)}function eg(e,t={}){let n=e;return typeof t.size<"u"&&(St(n,{size:t.size}),n=In(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:Te(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(Te(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),[Te(a),32]}return[Te(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(In(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 Ae=(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"?Ae(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}
|
|
64
|
+
`,"")}function dg(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
|
|
58
65
|
`;return r.nonce&&(o+=` nonce: ${r.nonce}
|
|
59
66
|
`),r.balance&&(o+=` balance: ${r.balance}
|
|
60
67
|
`),r.code&&(o+=` code: ${r.code}
|
|
61
68
|
`),r.state&&(o+=` state:
|
|
62
|
-
`,o
|
|
63
|
-
`,o
|
|
64
|
-
`).slice(0,-1)}function
|
|
65
|
-
`)}class
|
|
66
|
-
|
|
67
|
-
${
|
|
68
|
-
`)
|
|
69
|
-
`)})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Cn extends je{constructor(t){super(t,{code:Cn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Nn extends je{constructor(t){super(t,{code:Nn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
70
|
-
`)})}}Object.defineProperty(Nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class qr extends je{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 Zr extends je{constructor(t){super(t,{code:Zr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Kr extends je{constructor(t){super(t,{code:Kr.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class In extends je{constructor(t,{method:n}={}){super(t,{code:In.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class sr extends je{constructor(t){super(t,{code:sr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(sr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Yr extends je{constructor(t){super(t,{code:Yr.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class ir extends Ze{constructor(t){super(t,{code:ir.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(ir,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Xr extends Ze{constructor(t){super(t,{code:Xr.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Qr extends Ze{constructor(t,{method:n}={}){super(t,{code:Qr.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Jr extends Ze{constructor(t){super(t,{code:Jr.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class eo extends Ze{constructor(t){super(t,{code:eo.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class to extends Ze{constructor(t){super(t,{code:to.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class no extends Ze{constructor(t){super(t,{code:no.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class ro extends Ze{constructor(t){super(t,{code:ro.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class oo extends Ze{constructor(t){super(t,{code:oo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class so extends Ze{constructor(t){super(t,{code:so.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class io extends Ze{constructor(t){super(t,{code:io.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class ao extends Ze{constructor(t){super(t,{code:ao.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class co extends Ze{constructor(t){super(t,{code:co.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Ib extends je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Mb=3;function ar(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Zo?e:e instanceof q?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof kr?new Ob({functionName:s}):[Mb,Cn.code].includes(a)&&(u||l||f||p)?new Ei({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Si?l:p??f}):e;return new Tb(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function kb(e){const t=Ie(`0x${e.substring(4)}`).substring(26);return Vo(`0x${t}`)}async function Bb({hash:e,signature:t}){const n=mt(e)?e:Ht(e),{secp256k1:r}=await Promise.resolve().then(()=>$v);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=Nl(d);return new r.Signature(At(u),At(l)).addRecoveryBit(h)}const i=mt(t)?t:Ht(t);if(ve(i)!==65)throw new Error("invalid signature length");const c=zt(`0x${i.slice(130)}`),a=Nl(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Nl(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 Il({hash:e,signature:t}){return kb(await Bb({hash:e,signature:t}))}function Lb(e,t="hex"){const n=Ml(e),r=wi(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function Ml(e){return Array.isArray(e)?Fb(e.map(t=>Ml(t))):Rb(e)}function Fb(e){const t=e.reduce((o,s)=>o+s.length,0),n=kl(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 Rb(e){const t=typeof e=="string"?bt(e):e,n=kl(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 kl(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 q("Length is too large.")}function Db(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ie(nr(["0x05",Lb([t?J(t):"0x",o,n?J(n):"0x"])]));return r==="bytes"?bt(s):s}async function jb(e){const{authorization:t,signature:n}=e;return Il({hash:Db(t),signature:n??t})}class _b extends q{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=qo({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Pl(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${vt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${vt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${vt(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 cr extends q{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(cr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(cr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Ko extends q{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${vt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Ko,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Pi extends q{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${vt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Pi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class $i extends q{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty($i,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ai extends q{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(`
|
|
71
|
-
`),{cause:t,name:"
|
|
72
|
-
`),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Oi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ci extends q{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Ci,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ni extends q{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(Ni,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ii extends q{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Yo extends q{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${vt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${vt(r)} gwei`:""}).`].join(`
|
|
73
|
-
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Yo,"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 Xo extends q{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Mi(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof q?e.walk(o=>(o==null?void 0:o.code)===cr.code):e;return r instanceof q?new cr({cause:e,message:r.details}):cr.nodeMessage.test(n)?new cr({cause:e,message:e.details}):Ko.nodeMessage.test(n)?new Ko({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Pi.nodeMessage.test(n)?new Pi({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):$i.nodeMessage.test(n)?new $i({cause:e,nonce:t==null?void 0:t.nonce}):Ai.nodeMessage.test(n)?new Ai({cause:e,nonce:t==null?void 0:t.nonce}):Ti.nodeMessage.test(n)?new Ti({cause:e,nonce:t==null?void 0:t.nonce}):Oi.nodeMessage.test(n)?new Oi({cause:e}):Ci.nodeMessage.test(n)?new Ci({cause:e,gas:t==null?void 0:t.gas}):Ni.nodeMessage.test(n)?new Ni({cause:e,gas:t==null?void 0:t.gas}):Ii.nodeMessage.test(n)?new Ii({cause:e}):Yo.nodeMessage.test(n)?new Yo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Xo({cause:e})}function Ub(e,{docsPath:t,...n}){const r=(()=>{const o=Mi(e,n);return o instanceof Xo?e:o})();return new _b(r,{docsPath:t,...n})}function ki(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const zb={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Qo(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Hb(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>$e(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=J(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=J(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=J(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=J(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=J(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=J(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=zb[e.type]),typeof e.value<"u"&&(t.value=J(e.value)),t}function Hb(e){return e.map(t=>({address:t.address,r:t.r?J(BigInt(t.r)):t.r,s:t.s?J(BigInt(t.s)):t.s,chainId:J(t.chainId),nonce:J(t.nonce),...typeof t.yParity<"u"?{yParity:J(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:J(t.v)}:{}}))}function Bl(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Uu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Uu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Wb(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=J(t)),n!==void 0&&(i.nonce=J(n)),r!==void 0&&(i.state=Bl(r)),o!==void 0){if(i.state)throw new xb;i.stateDiff=Bl(o)}return i}function Bi(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!Je(n,{strict:!1}))throw new dn({address:n});if(t[n])throw new vb({address:n});t[n]=Wb(r)}return t}const Ll=2n**256n-1n;function uo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?wt(t):void 0;if(i&&!Je(i.address))throw new dn({address:i.address});if(s&&!Je(s))throw new dn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new Sb;if(r&&r>Ll)throw new Ko({maxFeePerGas:r});if(o&&r&&o>r)throw new Yo({maxFeePerGas:r,maxPriorityFeePerGas:o})}class Vb extends q{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Li extends q{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Gb extends q{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${vt(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Fl extends q{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 Rl={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Dl(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?zt(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?zt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Rl[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(t.authorizationList=qb(e.authorizationList)),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function qb(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 jl(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Dl(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Ct(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?J(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new Fl({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)||jl)(c)}async function Fi(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Zb(e,t){return _l(e,t)}async function _l(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 ee(e,Ct,"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 At(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):ee(e,Ct,"getBlock")({}),ee(e,Fi,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Li;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function Kb(e,t){return Ri(e,t)}async function Ri(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new Vb;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 ee(e,Ct,"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 Li;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await _l(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 ee(e,Fi,"getGasPrice")({}))}}async function Ul(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?J(r):n]},{dedupe:!!r});return zt(o)}function zl(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=>$e(s))}function Hl(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=>$e(i))}function Yb(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 Xb(e,t,n){return e&t^~e&n}function Qb(e,t,n){return e&t^e&n^t&n}class Jb extends li{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ui(this.buffer)}update(t){Jn(this),t=Ho(t),Vt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=ui(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Jn(this),qu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,er(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Yb(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=ui(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const 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 pn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ey=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]),hn=new Uint32Array(64);class ty extends Jb{constructor(t=32){super(64,t,8,!1),this.A=pn[0]|0,this.B=pn[1]|0,this.C=pn[2]|0,this.D=pn[3]|0,this.E=pn[4]|0,this.F=pn[5]|0,this.G=pn[6]|0,this.H=pn[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)hn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=hn[f-15],d=hn[f-2],h=Tt(p,7)^Tt(p,18)^p>>>3,m=Tt(d,17)^Tt(d,19)^d>>>10;hn[f]=m+hn[f-7]+h+hn[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=Tt(c,6)^Tt(c,11)^Tt(c,25),d=l+p+Xb(c,a,u)+ey[f]+hn[f]|0,m=(Tt(r,2)^Tt(r,13)^Tt(r,22))+Qb(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(){er(hn)}destroy(){this.set(0,0,0,0,0,0,0,0),er(this.buffer)}}const Wl=Xu(()=>new ty),ny=Wl;function ry(e,t){return ny(mt(e,{strict:!1})?Xn(e):e)}function oy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ry(t);return o.set([n],0),r==="bytes"?o:$e(o)}function sy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(oy({commitment:s,to:r,version:n}));return o}const Vl=6,Gl=32,Di=4096,ql=Gl*Di,Zl=ql*Vl-1-1*Di*Vl;class iy extends q{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class ay extends q{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function cy(e){const t=typeof e.data=="string"?bt(e.data):e.data,n=ve(t);if(!n)throw new ay;if(n>Zl)throw new iy({maxSize:Zl,size:n});const r=[];let o=!0,s=0;for(;o;){const i=wi(new Uint8Array(ql));let c=0;for(;c<Di;){const a=t.slice(s,s+(Gl-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>$e(i.bytes))}function uy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??cy({data:t}),s=e.commitments??zl({blobs:o,kzg:n,to:r}),i=e.proofs??Hl({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function ly(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Pb({transaction:e})}async function Kl(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return zt(t)}const fy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Yl=new Map;async function Xl(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=fy,type:l}=t,f=n&&wt(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await ee(e,Ct,"getBlock")({blockTag:"latest"}),d)}let m;async function x(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await ee(e,Kl,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const T=await x();p.nonce=await a.consume({address:f.address,chainId:T,client:e})}else p.nonce=await ee(e,Ul,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const T=zl({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const y=sy({commitments:T,to:"hex"});p.blobVersionedHashes=y}if(u.includes("sidecars")){const y=Hl({blobs:r,commitments:T,kzg:i}),A=uy({blobs:r,commitments:T,proofs:y,to:"hex"});p.sidecars=A}}if(u.includes("chainId")&&(p.chainId=await x()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{p.type=ly(p)}catch{let T=Yl.get(e.uid);if(typeof T>"u"){const y=await h();T=typeof(y==null?void 0:y.baseFeePerGas)=="bigint",Yl.set(e.uid,T)}p.type=T?"eip1559":"legacy"}if(u.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const T=await h(),{maxFeePerGas:y,maxPriorityFeePerGas:A}=await Ri(e,{block:T,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<A)throw new Gb({maxPriorityFeePerGas:A});p.maxPriorityFeePerGas=A,p.maxFeePerGas=y}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new Li;if(typeof t.gasPrice>"u"){const T=await h(),{gasPrice:y}=await Ri(e,{block:T,chain:o,request:p,type:"legacy"});p.gasPrice=y}}return u.includes("gas")&&typeof s>"u"&&(p.gas=await ee(e,ji,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),uo(p),delete p.parameters,p}async function Ql(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?J(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function ji(e,t){var o,s,i;const{account:n=e.account}=t,r=n?wt(n):void 0;try{let S=function(O){const{block:N,request:b,rpcStateOverride:k}=O;return e.request({method:"eth_estimateGas",params:k?[b,N??e.experimental_blockTag??"latest",k]:N?[b,N]:[b]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:p,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,value:B,stateOverride:L,..._}=await Xl(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?J(f):void 0)||p,w=Bi(L),$=await(async()=>{if(_.to)return _.to;if(a&&a.length>0)return await jb({authorization:a[0]}).catch(()=>{throw new q("`to` is required. Could not infer from `authorizationList`")})})();uo(t);const I=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,P=(I||Qo)({...ki(_,{format:I}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,to:$,value:B});let E=BigInt(await S({block:g,request:P,rpcStateOverride:w}));if(a){const O=await Ql(e,{address:P.from}),N=await Promise.all(a.map(async b=>{const{address:k}=b,R=await S({block:g,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:k,value:J(O)},rpcStateOverride:w}).catch(()=>100000n);return 2n*BigInt(R)}));E+=N.reduce((b,k)=>b+k,0n)}return E}catch(c){throw Ub(c,{...t,account:r,chain:e.chain})}}async function dy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Ot({abi:n,args:o,functionName:s});try{return await ee(e,ji,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?wt(c.account):void 0;throw ar(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Jo(e,t){if(!Je(e,{strict:!1}))throw new dn({address:e});if(!Je(t,{strict:!1}))throw new dn({address:t});return e.toLowerCase()===t.toLowerCase()}const Jl="/docs/contract/decodeEventLog";function _i(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new og({docsPath:Jl});const a=t.find(m=>m.type==="event"&&i===Wo(ht(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Lu(i,{docsPath:Jl});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,x)=>[m,x]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[x,T]=d[m],y=c[m];if(!y)throw new jo({abiItem:a,param:x});p[f?T:x.name||T]=py({param:x,value:y})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=_r(h,n);if(m)if(f)for(let x=0;x<l.length;x++)p[x]=p[x]??m.shift();else for(let x=0;x<h.length;x++)p[h[x].name]=m[x]}catch(m){if(s)throw m instanceof Mu||m instanceof vl?new Br({abiItem:a,data:n,params:h,size:ve(n)}):m}else if(s)throw new Br({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function py({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(_r([e],t)||[])[0]}function Ui(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var c;try{const a=t.find(l=>l.type==="event"&&i.topics[0]===Wo(l));if(!a)return null;const u=_i({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!hy({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Lu)return null;if(a instanceof Br||a instanceof jo){if(o)return null;u=a.abiItem.name,l=(c=a.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...i,args:l?[]:{},eventName:u}}}).filter(Boolean)}function hy(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"?Jo(i,c):s.type==="string"||s.type==="bytes"?Ie(Xn(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 Kt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function zi(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>jr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?J(r):r,toBlock:typeof o=="bigint"?J(o):o}]});const d=p.map(h=>Kt(h));return l?Ui({abi:l,args:c,logs:d,strict:u}):d}async function ef(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?Tn({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return ee(e,zi,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const Hi="/docs/contract/decodeFunctionResult";function Mn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Tn({abi:t,args:n,name:r});if(!c)throw new Kn(r,{docsPath:Hi});s=c}if(s.type!=="function")throw new Kn(void 0,{docsPath:Hi});if(!s.outputs)throw new Ru(s.name,{docsPath:Hi});const i=_r(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Wi=BigInt(0),Vi=BigInt(1);function es(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function kn(e,t,n=""){const r=Uo(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function ts(e){const t=e.toString(16);return t.length&1?"0"+t:t}function tf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Wi:BigInt("0x"+e)}function ns(e){return tf(tr(e))}function nf(e){return Vt(e),tf(tr(Uint8Array.from(e).reverse()))}function Gi(e,t){return zo(e.toString(16).padStart(t*2,"0"))}function rf(e,t){return Gi(e,t).reverse()}function _e(e,t,n){let r;if(typeof t=="string")try{r=zo(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(Uo(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const qi=e=>typeof e=="bigint"&&Wi<=e;function my(e,t,n){return qi(e)&&qi(t)&&qi(n)&&t<=e&&e<n}function gy(e,t,n,r){if(!my(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function of(e){let t;for(t=0;e>Wi;e>>=Vi,t+=1);return t}const lo=e=>(Vi<<BigInt(e))-Vi;function by(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=d=>new Uint8Array(d),o=d=>Uint8Array.of(d);let s=r(e),i=r(e),c=0;const a=()=>{s.fill(1),i.fill(0),c=0},u=(...d)=>n(i,s,...d),l=(d=r(0))=>{i=u(o(0),d),s=u(),d.length!==0&&(i=u(o(1),d),s=u())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){s=u();const m=s.slice();h.push(m),d+=s.length}return fn(...h)};return(d,h)=>{a(),l(d);let m;for(;!(m=h(f()));)l();return a(),m}}function Zi(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function sf(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const yy="0.1.1";function wy(){return yy}class ge extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof ge){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 ge&&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(`
|
|
74
|
-
`);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@${wy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return af(this,t)}}function af(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?af(e.cause,t):t?null:e}const vy="#__bigint";function xy(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+vy:o,n)}function Ey(e,t){if(lf(e)>t)throw new My({givenSize:lf(e),maxSize:t})}const Yt={zero:48,nine:57,A:65,F:70,a:97,f:102};function cf(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 Sy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ky({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function Ki(e,t){if(et(e)>t)throw new Dy({givenSize:et(e),maxSize:t})}function Py(e,t){if(typeof t=="number"&&t>0&&t>et(e)-1)throw new gf({offset:t,position:"start",size:et(e)})}function $y(e,t,n){if(typeof t=="number"&&typeof n=="number"&&et(e)!==n-t)throw new gf({offset:n,position:"end",size:et(e)})}function uf(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 jy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ay=new TextEncoder;function Ty(e){return e instanceof Uint8Array?e:typeof e=="string"?Cy(e):Oy(e)}function Oy(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Cy(e,t={}){const{size:n}=t;let r=e;n&&(Ki(e,n),r=Ln(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=cf(o.charCodeAt(a++)),l=cf(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new ge(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function Ny(e,t={}){const{size:n}=t,r=Ay.encode(e);return typeof n=="number"?(Ey(r,n),Iy(r,n)):r}function Iy(e,t){return Sy(e,{dir:"right",size:t})}function lf(e){return e.length}let My=class extends ge{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"})}},ky=class extends ge{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 By=new TextEncoder,Ly=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Fy(e,t={}){const{strict:n=!1}=t;if(!e)throw new hf(e);if(typeof e!="string")throw new hf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new mf(e);if(!e.startsWith("0x"))throw new mf(e)}function Nt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function ff(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Ki(n,t.size),Bn(n,t.size)):n}function df(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ly[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Ki(r,t.size),Ln(r,t.size)):r}function Be(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const u=typeof e=="bigint"?"n":"";throw new pf({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?Bn(a,r):a}function Yi(e,t={}){return df(By.encode(e),t)}function Bn(e,t){return uf(e,{dir:"left",size:t})}function Ln(e,t){return uf(e,{dir:"right",size:t})}function Xi(e,t,n,r={}){const{strict:o}=r;Py(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&$y(s,t,n),s}function et(e){return Math.ceil((e.length-2)/2)}function Ry(e,t={}){const{strict:n=!1}=t;try{return Fy(e,{strict:n}),!0}catch{return!1}}class pf extends ge{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class hf extends ge{constructor(t){super(`Value \`${typeof t=="object"?xy(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class mf extends ge{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 Dy extends ge{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class gf extends ge{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 jy extends ge{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 _y(e){return{address:e.address,amount:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function bf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Be(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Be(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Be(e.gasLimit)},...typeof e.number=="bigint"&&{number:Be(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Be(e.prevRandao)},...typeof e.time=="bigint"&&{time:Be(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(_y)}}}const Qi=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],Ji=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],yf=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],wf=[...yf,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Uy=[...yf,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],vf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],xf=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Ef=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],ur=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],zy="0x82ad56cb",Sf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Hy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Wy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ea extends q{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class Pf extends q{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const ta="/docs/contract/encodeDeployData";function na(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Jm({docsPath:ta});if(!("inputs"in o))throw new Iu({docsPath:ta});if(!o.inputs||o.inputs.length===0)throw new Iu({docsPath:ta});const s=qt(o.inputs,n);return nr([r,s])}function lr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new ea({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ea({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function $f(e,{docsPath:t,...n}){const r=(()=>{const o=Mi(e,n);return o instanceof Xo?e:o})();return new Ol(r,{docsPath:t,...n})}function Af(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const ra=new Map;function Tf({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=()=>ra.delete(t),c=()=>a().map(({args:l})=>l),a=()=>ra.get(t)||[],u=l=>ra.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=Af();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 fo(e,t){var P,S,E,O;const{account:n=e.account,authorizationList:r,batch:o=!!((P=e.batch)!=null&&P.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,to:B,value:L,stateOverride:_,...j}=t,g=n?wt(n):void 0;if(l&&(p||d))throw new q("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&B)throw new q("Cannot provide both `code` & `to` as parameters.");const w=l&&f,$=p&&d&&B&&f,I=w||$,C=w?qy({code:l,data:f}):$?Zy({data:f,factory:p,factoryData:d,to:B}):f;try{uo(t);const b=(typeof s=="bigint"?J(s):void 0)||i,k=u?bf(u):void 0,R=Bi(_),D=(O=(E=(S=e.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:O.format,W=(D||Qo)({...ki(j,{format:D}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:C,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:T,maxPriorityFeePerGas:y,nonce:A,to:I?void 0:B,value:L});if(o&&Vy({request:W})&&!R&&!k)try{return await Gy(e,{...W,blockNumber:s,blockTag:i})}catch(H){if(!(H instanceof Pf)&&!(H instanceof ea))throw H}const K=(()=>{const H=[W,b];return R&&k?[...H,R,k]:R?[...H,R]:k?[...H,{},k]:H})(),G=await e.request({method:"eth_call",params:K});return G==="0x"?{data:void 0}:{data:G}}catch(N){const b=Ky(N),{offchainLookup:k,offchainLookupSignature:R}=await Promise.resolve().then(()=>Q1);if(e.ccipRead!==!1&&(b==null?void 0:b.slice(0,10))===R&&B)return{data:await k(e,{data:b,to:B})};throw I&&(b==null?void 0:b.slice(0,10))==="0x101bb98d"?new Cb({factory:p}):$f(N,{...t,account:g,chain:e.chain})}}function Vy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(zy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Gy(e,t){var m;const{batchSize:n=1024,wait:r=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:i,multicallAddress:c,to:a}=t;let u=c;if(!u){if(!e.chain)throw new Pf;u=lr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?J(o):void 0)||s,{schedule:p}=Tf({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(x){return x.reduce((y,{data:A})=>y+(A.length-2),0)>n*2},fn:async x=>{const T=x.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),y=Ot({abi:Qi,args:[T],functionName:"aggregate3"}),A=await e.request({method:"eth_call",params:[{data:y,to:u},f]});return Mn({abi:Qi,args:[T],functionName:"aggregate3",data:A||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Zo({data:d});return d==="0x"?{data:void 0}:{data:d}}function qy(e){const{code:t,data:n}=e;return na({abi:Tu(["constructor(bytes, bytes)"]),bytecode:Sf,args:[t,n]})}function Zy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return na({abi:Tu(["constructor(address, bytes, address, bytes)"]),bytecode:Hy,args:[o,t,n,r]})}function Ky(e){var n;if(!(e instanceof q))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 Xt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Ot({abi:n,args:o,functionName:s});try{const{data:a}=await ee(e,fo,"call")({...i,data:c,to:r});return Mn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw ar(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Yy(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?wt(c.account):e.account,u=Ot({abi:n,args:o,functionName:i});try{const{data:l}=await ee(e,fo,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Mn({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 ar(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const oa=new Map,Of=new Map;let Xy=0;function mn(e,t,n){const r=++Xy,o=()=>oa.get(e)||[],s=()=>{const l=o();oa.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=Of.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(oa.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const 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"&&Of.set(e,u),i}async function sa(e){return new Promise(t=>setTimeout(t,e))}function po(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await sa(a);const u=async()=>{o&&(await e({unpoll:s}),await sa(r),u())};u()})(),s}const Qy=new Map,Jy=new Map;function e1(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,Qy),r=t(e,Jy);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function t1(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=e1(t),o=r.response.get();if(o&&n>0&&new Date().getTime()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const n1=e=>`blockNumber.${e}`;async function ho(e,{cacheTime:t=e.cacheTime}={}){const n=await t1(()=>e.request({method:"eth_blockNumber"}),{cacheKey:n1(e.uid),cacheTime:t});return BigInt(n)}async function rs(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Kt(s));return!("abi"in t)||!t.abi?o:Ui({abi:t.abi,logs:o,strict:n})}async function os(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function r1(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 x=p??!1,T=Ae(["watchContractEvent",r,o,s,e.uid,i,f,x,c]);return mn(T,{onLogs:u,onError:a},y=>{let A;c!==void 0&&(A=c-1n);let B,L=!1;const _=po(async()=>{var j;if(!L){try{B=await ee(e,ml,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:x,fromBlock:c})}catch{}L=!0;return}try{let g;if(B)g=await ee(e,rs,"getFilterChanges")({filter:B});else{const w=await ee(e,ho,"getBlockNumber")({});A&&A<w?g=await ee(e,ef,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:A+1n,toBlock:w,strict:x}):g=[],A=w}if(g.length===0)return;if(s)y.onLogs(g);else for(const w of g)y.onLogs([w])}catch(g){B&&g instanceof Nn&&(L=!1),(j=y.onError)==null||j.call(y,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await ee(e,os,"uninstallFilter")({filter:B}),_()}})})():(()=>{const x=p??!1,T=Ae(["watchContractEvent",r,o,s,e.uid,i,f,x]);let y=!0,A=()=>y=!1;return mn(T,{onLogs:u,onError:a},B=>((async()=>{try{const L=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),_=i?jr({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await L.subscribe({params:["logs",{address:r,topics:_}],onData(g){var $;if(!y)return;const w=g.result;try{const{eventName:I,args:C}=_i({abi:n,data:w.data,topics:w.topics,strict:p}),P=Kt(w,{args:C,eventName:I});B.onLogs([P])}catch(I){let C,P;if(I instanceof Br||I instanceof jo){if(p)return;C=I.abiItem.name,P=($=I.abiItem.inputs)==null?void 0:$.some(E=>!("name"in E&&E.name))}const S=Kt(w,{args:P?[]:{},eventName:C});B.onLogs([S])}},onError(g){var w;(w=B.onError)==null||w.call(B,g)}});A=j,y||A()}catch(L){a==null||a(L)}})(),()=>A()))})()}async function o1(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function ia(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await sa(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 s1={"0x0":"reverted","0x1":"success"};function i1(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>Kt(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?zt(e.transactionIndex):null,status:e.status?s1[e.status]:null,type:e.type?Rl[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const aa=256;let ss=aa,is;function Cf(e=11){if(!is||ss+e>aa*2){is="",ss=0;for(let t=0;t<aa;t++)is+=(256+Math.random()*256|0).toString(16).substring(1)}return is.substring(ss,ss+++e)}function a1(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?wt(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),x={...d,...m},T={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:x,type:i,uid:Cf(),...c?{experimental_blockTag:c}:{}};function y(A){return B=>{const L=B(A);for(const j in T)delete L[j];const _={...A,...L};return Object.assign(_,{extend:y(_)})}}return Object.assign(T,{extend:y(T)})}const as=new di(8192);function c1(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(as.get(n))return as.get(n);const r=e().finally(()=>as.delete(n));return as.set(n,r),r}function u1(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 In(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new In(new Error("method not supported"),{method:u});const l=o?Lr(`${a}.${Ae(n)}`):void 0;return c1(()=>ia(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case Hr.code:throw new Hr(d);case Wr.code:throw new Wr(d);case Vr.code:throw new Vr(d,{method:n.method});case Gr.code:throw new Gr(d);case Cn.code:throw new Cn(d);case Nn.code:throw new Nn(d);case qr.code:throw new qr(d);case Zr.code:throw new Zr(d);case Kr.code:throw new Kr(d);case In.code:throw new In(d,{method:n.method});case sr.code:throw new sr(d);case Yr.code:throw new Yr(d);case ir.code:throw new ir(d);case Xr.code:throw new Xr(d);case Qr.code:throw new Qr(d);case Jr.code:throw new Jr(d);case eo.code:throw new eo(d);case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d);case oo.code:throw new oo(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case co.code:throw new co(d);case 5e3:throw new ir(d);default:throw p instanceof q?p:new Ib(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof On){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>l1(p)}),{enabled:o,id:l})}}function l1(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===sr.code||e.code===Cn.code:e instanceof On&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function f1({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=Cf();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:u1(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class d1 extends q{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 p1(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 h1(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Nf=h1();function m1(e,t={}){return{async request(n){var f;const{body:r,onRequest:o=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,c={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:a,method:u,signal:l}=c;try{const p=await p1(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ae(r.map(A=>({jsonrpc:"2.0",id:A.id??Nf.take(),...A}))):Ae({jsonrpc:"2.0",id:r.id??Nf.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},x=new Request(e,m),T=await(o==null?void 0:o(x,m))??{...m,url:e};return await fetch(T.url??e,T)},{errorInstance:new Cl({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let d;if((f=p.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))d=await p.json();else{d=await p.text();try{d=JSON.parse(d||"{}")}catch(h){if(p.ok)throw h;d={error:d}}}if(!p.ok)throw new On({body:r,details:Ae(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof On||p instanceof Cl?p:new On({body:r,cause:p,url:e})}}}}function g1(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:u,raw:l}=t;return({chain:f,retryCount:p,timeout:d})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},x=t.retryCount??p,T=d??t.timeout??1e4,y=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!y)throw new d1;const A=m1(y,{fetchOptions:r,onRequest:c,onResponse:a,timeout:T});return f1({key:o,methods:s,name:i,async request({method:B,params:L}){const _={method:B,params:L},{schedule:j}=Tf({id:y,wait:m,shouldSplitBatch(I){return I.length>h},fn:I=>A.request({body:I}),sort:(I,C)=>I.id-C.id}),g=async I=>n?j(I):[await A.request({body:I})],[{error:w,result:$}]=await g(_);if(l)return{error:w,result:$};if(w)throw new Si({body:_,error:w,url:y});return $},retryCount:x,retryDelay:u,timeout:T,type:"http"},{fetchOptions:r,url:y})}}function ca(e,t){var r,o,s,i,c,a;if(!(e instanceof q))return!1;const n=e.walk(u=>u instanceof Ei);return n instanceof Ei?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=n.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((c=n.data)==null?void 0:c.errorName)==="HttpError"||(a=n.reason)!=null&&a.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===bl[50]):!1}function b1(e){const{abi:t,data:n}=e,r=rr(n,0,4),o=t.find(s=>s.type==="function"&&r===Dr(ht(s)));if(!o)throw new sg(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?_r(o.inputs,rr(n,4)):void 0}}const ua="/docs/contract/encodeErrorResult";function If(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Tn({abi:t,args:r,name:n});if(!a)throw new ku(n,{docsPath:ua});o=a}if(o.type!=="error")throw new ku(void 0,{docsPath:ua});const s=ht(o),i=Dr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new rg(o.name,{docsPath:ua});c=qt(o.inputs,r)}return nr([i,c])}const la="/docs/contract/encodeFunctionResult";function y1(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Tn({abi:t,name:n});if(!i)throw new Kn(n,{docsPath:la});o=i}if(o.type!=="function")throw new Kn(void 0,{docsPath:la});if(!o.outputs)throw new Ru(o.name,{docsPath:la});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Du(r)})();return qt(o.outputs,s)}const cs="x-batch-gateway:true";async function Mf(e){const{data:t,ccipRequest:n}=e,{args:[r]}=b1({abi:Ji,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(cs)?await Mf({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=w1(a)}})),y1({abi:Ji,functionName:"query",result:[o,s]})}function w1(e){return e.name==="HttpRequestError"&&e.status?If({abi:Ji,errorName:"HttpError",args:[e.status,e.shortMessage]}):If({abi:[yl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function kf(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return mt(t)?t:null}function us(e){let t=new Uint8Array(32).fill(0);if(!e)return $e(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=kf(n[r]),s=o?Xn(o):Ie($n(n[r]),"bytes");t=Ie(yt([t,s]),"bytes")}return $e(t)}function v1(e){return`[${e.slice(2)}]`}function x1(e){const t=new Uint8Array(32).fill(0);return e?kf(e)||Ie($n(e)):$e(t)}function ls(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array($n(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=$n(o[s]);i.byteLength>255&&(i=$n(v1(x1(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 E1(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 lr({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=Ot({abi:xf,functionName:"addr",...o!=null?{args:[us(s),BigInt(o)]}:{args:[us(s)]}}),p={address:u,abi:wf,functionName:"resolve",args:[Ht(ls(s)),f,i??[cs]],blockNumber:n,blockTag:r},h=await ee(e,Xt,"readContract")(p);if(h[0]==="0x")return null;const m=Mn({abi:xf,args:o!=null?[us(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Pn(m)==="0x00"?null:m}catch(f){if(c)throw f;if(ca(f,"resolve"))return null;throw f}}class S1 extends q{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 mo extends q{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class fa extends q{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 P1 extends q{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const $1=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,A1=/^(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>\/.*)?$/,T1=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,O1=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function C1(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Bf(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Lf({uri:e,gatewayUrls:t}){const n=T1.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Bf(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Bf(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match($1),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||A1.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(O1,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new fa({uri:e})}function Ff(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new S1({data:e});return e.image||e.image_url||e.image_data}async function N1({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await da({gatewayUrls:e,uri:Ff(n)})}catch{throw new fa({uri:t})}}async function da({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Lf({uri:t,gatewayUrls:e});if(r||await C1(n))return n;throw new fa({uri:t})}function I1(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 mo({reason:"Only EIP-155 supported"});if(!i)throw new mo({reason:"Chain ID not found"});if(!a)throw new mo({reason:"Contract address not found"});if(!o)throw new mo({reason:"Token ID not found"});if(!c)throw new mo({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function M1(e,{nft:t}){if(t.namespace==="erc721")return Xt(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 Xt(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 P1({namespace:t.namespace})}async function k1(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?B1(e,{gatewayUrls:t,record:n}):da({uri:n,gatewayUrls:t})}async function B1(e,{gatewayUrls:t,record:n}){const r=I1(n),o=await M1(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Lf({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return da({uri:Ff(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),N1({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Rf(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 lr({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:wf,functionName:"resolve",args:[Ht(ls(s)),Ot({abi:vf,functionName:"text",args:[us(s),o]}),i??[cs]],blockNumber:n,blockTag:r},d=await ee(e,Xt,"readContract")(f);if(d[0]==="0x")return null;const h=Mn({abi:vf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(ca(f,"resolve"))return null;throw f}}async function L1(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await ee(e,Rf,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await k1(e,{record:a,gatewayUrls:r})}catch{return null}}async function F1(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=lr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:Uy,functionName:"reverse",args:[Ht(ls(a))],blockNumber:n,blockTag:r},l=ee(e,Xt,"readContract"),[f,p]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==p.toLowerCase()?null:f}catch(u){if(s)throw u;if(ca(u,"reverse"))return null;throw u}}async function R1(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 lr({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 ee(e,Xt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Ht(ls(o))],blockNumber:n,blockTag:r});return a}async function Df(e,t){var x,T,y;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?wt(n):void 0;try{uo(t);const B=(typeof r=="bigint"?J(r):void 0)||o,L=(y=(T=(x=e.chain)==null?void 0:x.formatters)==null?void 0:T.transactionRequest)==null?void 0:y.format,j=(L||Qo)({...ki(h,{format:L}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d}),g=await e.request({method:"eth_createAccessList",params:[j,B]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(A){throw $f(A,{...t,account:m,chain:e.chain})}}async function D1(e){const t=Go(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function jf(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=Go(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>jr({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"?J(s):s,toBlock:typeof c=="bigint"?J(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 _f(e){const t=Go(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function j1(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function _1(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?J(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),zt(s)}async function Uf(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?J(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class U1 extends q{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 z1(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await ee(e,Xt,"readContract")({abi:H1,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 U1({address:n}):i}}const H1=[{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 W1(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 V1(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?J(n):void 0,i=await e.request({method:"eth_feeHistory",params:[J(t),s||r,o]},{dedupe:!!s});return W1(i)}async function G1(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Kt(s));return t.abi?Ui({abi:t.abi,logs:o,strict:n}):o}class q1 extends q{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=>` ${zr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class Z1 extends q{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${zr(n)}`,`Response: ${Ae(t)}`],name:"OffchainLookupResponseMalformedError"})}}class K1 extends q{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 Y1="0x556f1830",zf={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function X1(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=El({data:r,abi:[zf]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Hf;try{if(!Jo(o,i))throw new K1({sender:i,to:o});const d=c.includes(cs)?await Mf({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await fo(e,{blockNumber:t,blockTag:n,data:yt([u,qt([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new q1({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function Hf({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,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 On({body:a,details:f!=null&&f.error?Ae(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!mt(f)){r=new Z1({result:f,url:i});continue}return f}catch(l){r=new On({body:a,details:l.message,url:i})}}throw r}const Q1=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Hf,offchainLookup:X1,offchainLookupAbiItem:zf,offchainLookupSignature:Y1},Symbol.toStringTag,{value:"Module"}));function J1(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class ew extends q{constructor({domain:t}){super(`Invalid domain "${Ae(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class tw extends q{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 nw extends q{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function rw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:cw({domain:t}),...e.types};aw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(ow({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Wf({data:n,primaryType:r,types:o})),Ie(yt(s))}function ow({domain:e,types:t}){return Wf({data:e,primaryType:"EIP712Domain",types:t})}function Wf({data:e,primaryType:t,types:n}){const r=Vf({data:e,primaryType:t,types:n});return Ie(r)}function Vf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[sw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=qf({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return qt(r,o)}function sw({primaryType:e,types:t}){const n=Ht(iw({primaryType:e,types:t}));return Ie(n)}function iw({primaryType:e,types:t}){let n="";const r=Gf({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:c})=>`${c} ${i}`).join(",")})`;return n}function Gf({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=r==null?void 0:r[0];if(n.has(o)||t[o]===void 0)return n;n.add(o);for(const s of t[o])Gf({primaryType:s.type,types:t},n);return n}function qf({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ie(Vf({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ie(r)];if(n==="string")return[{type:"bytes32"},Ie(Ht(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>qf({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ie(qt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function aw(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(fl);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,x,T]=p;J(f,{signed:x==="int",size:Number.parseInt(T)/8})}if(l==="address"&&typeof f=="string"&&!Je(f))throw new dn({address:f});const d=l.match(Kg);if(d){const[m,x]=d;if(x&&ve(f)!==Number.parseInt(x))throw new ag({expectedSize:Number.parseInt(x),givenSize:ve(f)})}const h=o[l];h&&(uw(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new ew({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new tw({primaryType:r,types:o})}function cw({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 uw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new nw({type:e})}const lw=`Ethereum Signed Message:
|
|
75
|
-
`;function fw(e){const t=typeof e=="string"?Lr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=Lr(`${lw}${ve(t)}`);return yt([n,t])}function Zf(e,t){return Ie(fw(e),t)}const Kf="0x6492649264926492649264926492649264926492649264926492649264926492";function dw(e){return ll(e,-32)===Kf}function pw(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=nr([qt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Kf]);return o==="hex"?s:bt(s)}class hw extends q{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function mw(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new hw({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 gw(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function bw(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?zt(e.nonce):void 0,storageProof:e.storageProof?gw(e.storageProof):void 0}}async function yw(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?J(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return bw(c)}async function ww(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?J(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function pa(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,p;const i=r||"latest",c=n!==void 0?J(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,J(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,J(s)]},{dedupe:!!c}),!a)throw new Al({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((p=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.transaction)==null?void 0:p.format)||Dl)(a)}async function vw(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([ee(e,ho,"getBlockNumber")({}),t?ee(e,pa,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function fs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Tl({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||i1)(n)}async function xw(e,t){var T;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((T=e.batch)==null?void 0:T.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=lr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let y=0;y<u.length;y++){const{abi:A,address:B,args:L,functionName:_}=u[y];try{const j=Ot({abi:A,args:L,functionName:_});h+=(j.length-2)/2,l>0&&h>l&&p[d].length>0&&(d++,h=(j.length-2)/2,p[d]=[]),p[d]=[...p[d],{allowFailure:!0,callData:j,target:B}]}catch(j){const g=ar(j,{abi:A,address:B,args:L,docsPath:"/docs/contract/multicall",functionName:_,sender:n});if(!r)throw g;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(p.map(y=>ee(e,Xt,"readContract")({abi:Qi,account:n,address:f,args:[y],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),x=[];for(let y=0;y<m.length;y++){const A=m[y];if(A.status==="rejected"){if(!r)throw A.reason;for(let L=0;L<p[y].length;L++)x.push({status:"failure",error:A.reason,result:void 0});continue}const B=A.value;for(let L=0;L<B.length;L++){const{returnData:_,success:j}=B[L],{callData:g}=p[y][L],{abi:w,address:$,functionName:I,args:C}=u[x.length];try{if(g==="0x")throw new kr;if(!j)throw new Zo({data:_});const P=Mn({abi:w,args:C,data:_,functionName:I});x.push(r?{result:P,status:"success"}:P)}catch(P){const S=ar(P,{abi:w,address:$,args:C,docsPath:"/docs/contract/multicall",functionName:I});if(!r)throw S;x.push({error:S,result:void 0,status:"failure"})}}}if(x.length!==u.length)throw new q("multicall results mismatch");return x}async function ha(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?bf(p.blockOverrides):void 0,h=p.calls.map(x=>{const T=x,y=T.account?wt(T.account):void 0,A=T.abi?Ot(T):T.data,B={...T,data:T.dataSuffix?yt([A||"0x",T.dataSuffix]):A,from:T.from??(y==null?void 0:y.address)};return uo(B),Qo(B)}),m=p.stateOverrides?Bi(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?J(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((p,d)=>({...jl(p),calls:p.calls.map((h,m)=>{var $,I;const{abi:x,args:T,functionName:y,to:A}=o[d].calls[m],B=(($=h.error)==null?void 0:$.data)??h.returnData,L=BigInt(h.gasUsed),_=(I=h.logs)==null?void 0:I.map(C=>Kt(C)),j=h.status==="0x1"?"success":"failure",g=x&&j==="success"&&B!=="0x"?Mn({abi:x,data:B,functionName:y}):null,w=(()=>{var P;if(j==="success")return;let C;if(((P=h.error)==null?void 0:P.data)==="0x"?C=new kr:h.error&&(C=new Zo(h.error)),!!C)return ar(C,{abi:x??[],address:A??"0x",args:T,functionName:y??"<unknown>"})})();return{data:B,gasUsed:L,logs:_,status:j,...j==="success"?{result:g}:{error:w}}})}))}catch(a){const u=a,l=Mi(u,{});throw l instanceof Xo?u:l}}function Yf(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=sl(Ty(e));return n==="Bytes"?r:df(r)}class Ew 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 Ew(8192)}.checksum,Sw=/^0x[a-fA-F0-9]{40}$/;function ds(e,t={}){const{strict:n=!0}=t;if(!Sw.test(e))throw new Xf({address:e,cause:new $w});if(n){if(e.toLowerCase()===e)return;if(Pw(e)!==e)throw new Xf({address:e,cause:new Aw})}}function Pw(e){if(ma.has(e))return ma.get(e);ds(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Yf(Ny(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return ma.set(e,o),o}function ga(e,t={}){const{strict:n=!0}=t??{};try{return ds(e,{strict:n}),!0}catch{return!1}}class Xf extends ge{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 $w extends ge{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 Aw extends ge{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function ba(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new ge("Unable to normalize signature.");return o}function ya(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ga(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>ya(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>ya(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Qf(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return Qf(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ga(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ga(n[r],{strict:!1}):!1)return i}}function Jf(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Ou(e):e;return{...r,...n?{hash:fr(r)}:{}}}function Tw(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Ry(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?ed(u)===Xi(t,0,4):u.type==="event"?fr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new wa({name:t});if(i.length===1)return{...i[0],...o?{hash:fr(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:fr(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?ya(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Qf(u.inputs,c.inputs,r);if(f)throw new Cw({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 wa({name:t});return{...a,...o?{hash:fr(a)}:{}}}function ed(e){return Xi(fr(e),0,4)}function Ow(e){const t=typeof e=="string"?e:Ro(e);return ba(t)}function fr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Yf(Yi(Ow(e)))}class Cw extends ge{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${ba(Ro(t.abiItem))}\`, and`,`\`${n.type}\` in \`${ba(Ro(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class wa extends ge{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}const Nw=/^(.*)\[([0-9]*)\]$/,Iw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,td=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Mw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(va({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function va({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=_w(r.type);if(o){const[s,i]=o;return Bw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return jw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return kw(n,{checksum:e});if(r.type==="bool")return Fw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=td.exec(r.type)??[];return Rw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Lw(n,{type:r.type});if(r.type==="string")return Dw(n);throw new sd(r.type)}function xa(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=et(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Be(t+o,{size:32})),r.push(c),o+=et(c)):n.push(c)}return Nt(...n,...r)}function kw(e,t){const{checksum:n=!1}=t;return ds(e,{strict:n}),{dynamic:!1,encoded:Bn(e.toLowerCase())}}function Bw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new zw(e);if(!s&&e.length!==r)throw new Uw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=va({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=xa(c);if(s){const u=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Nt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Nt(...c.map(({encoded:a})=>a))}}function Lw(e,{type:t}){const[,n]=t.split("bytes"),r=et(e);if(!n){let o=e;return r%32!==0&&(o=Ln(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Nt(Bn(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new rd({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Ln(e)}}function Fw(e){if(typeof e!="boolean")throw new ge(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Bn(ff(e))}}function Rw(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new pf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Be(e,{size:32,signed:t})}}function Dw(e){const t=Yi(e),n=Math.ceil(et(t)/32),r=[];for(let o=0;o<n;o++)r.push(Ln(Xi(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Nt(Ln(Be(et(t),{size:32})),...r)}}function jw(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=va({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?xa(s):Nt(...s.map(({encoded:i})=>i))}}function _w(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function nd(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new od({expectedLength:e.length,givenLength:t.length});const o=Mw({checksumAddress:r,parameters:e,values:t}),s=xa(o);return s.length===0?"0x":s}function Ea(e,t){if(e.length!==t.length)throw new od({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(Ea.encode(o,s))}return Nt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return ds(a),Bn(a.toLowerCase(),o?32:0)}if(n==="string")return Yi(r);if(n==="bytes")return r;if(n==="bool")return Bn(ff(r),o?32:1);const s=n.match(td);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l)/8;return Be(r,{size:o?32:f,signed:u==="int"})}const i=n.match(Iw);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new rd({expectedSize:Number.parseInt(u),value:r});return Ln(r,o?32:0)}const c=n.match(Nw);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":Nt(...l)}throw new sd(n)}e.encode=t})(Ea||(Ea={}));class Uw extends ge{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class rd extends ge{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${et(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class od extends ge{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
76
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class zw extends ge{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class sd extends ge{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function Hw(e,t){var o;const{bytecode:n,args:r}=t;return Nt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?nd(e.inputs,r):"0x")}function Ww(e){return Jf(e)}function Vw(e,...t){const{overloads:n}=e,r=n?Gw([e,...n],e.name,{args:t[0]}):e,o=qw(r),s=t.length>0?nd(r.inputs,t[0]):void 0;return s?Nt(o,s):o}function dr(e,t={}){return Jf(e,t)}function Gw(e,t,n){const r=Tw(e,t,n);if(r.type!=="function")throw new wa({name:t,type:"function"});return r}function qw(e){return ed(e)}const Zw="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",It="0x0000000000000000000000000000000000000000",Kw="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function Yw(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?wt(t.account):void 0;if(i&&!u)throw new q("`account` is required when `traceAssetChanges` is true");const l=u?Hw(Ww("constructor(bytes, bytes)"),{bytecode:Sf,args:[Kw,Vw(dr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async b=>{if(!b.data&&!b.abi)return;const{accessList:k}=await Df(e,{account:u.address,...b,data:b.abi?Ot(b):b.data});return k.map(({address:R,storageKeys:D})=>D.length>0?R:null)})).then(b=>b.flat().filter(Boolean)):[],p=await ha(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((b,k)=>({abi:[dr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:It,nonce:k})),stateOverrides:[{address:It,nonce:0}]}]:[],{calls:[...o,{}].map(b=>({...b,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((b,k)=>({abi:[dr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:It,nonce:k})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((b,k)=>({to:b,abi:[dr("function decimals() returns (uint256)")],functionName:"decimals",from:It,nonce:k})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((b,k)=>({to:b,abi:[dr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:It,nonce:k})),stateOverrides:[{address:It,nonce:0}]},{calls:f.map((b,k)=>({to:b,abi:[dr("function symbol() returns (string)")],functionName:"symbol",from:It,nonce:k})),stateOverrides:[{address:It,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,x,T,y,A,B]=i?p:[],{calls:L,..._}=d,j=L.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],w=(m==null?void 0:m.calls)??[],$=[...g,...w].map(b=>b.status==="success"?At(b.data):null),I=(x==null?void 0:x.calls)??[],C=(T==null?void 0:T.calls)??[],P=[...I,...C].map(b=>b.status==="success"?At(b.data):null),S=((y==null?void 0:y.calls)??[]).map(b=>b.status==="success"?b.result:null),E=((B==null?void 0:B.calls)??[]).map(b=>b.status==="success"?b.result:null),O=((A==null?void 0:A.calls)??[]).map(b=>b.status==="success"?b.result:null),N=[];for(const[b,k]of P.entries()){const R=$[b];if(typeof k!="bigint"||typeof R!="bigint")continue;const D=S[b-1],U=E[b-1],W=O[b-1],K=b===0?{address:Zw,decimals:18,symbol:"ETH"}:{address:f[b-1],decimals:W||D?Number(D??1):void 0,symbol:U??void 0};N.some(G=>G.token.address===K.address)||N.push({token:K,value:{pre:R,post:k,diff:k-R}})}return{assetChanges:N,block:_,results:j}}class id extends li{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Gu(t);const r=Ho(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),er(s)}update(t){return Jn(this),this.iHash.update(t),this}digestInto(t){Jn(this),Vt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ad=(e,t,n)=>new id(e,t).update(n).digest();ad.create=(e,t)=>new id(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ue=BigInt(0),Le=BigInt(1),Fn=BigInt(2),cd=BigInt(3),ud=BigInt(4),ld=BigInt(5),Xw=BigInt(7),fd=BigInt(8),Qw=BigInt(9),dd=BigInt(16);function xt(e,t){const n=e%t;return n>=Ue?n:t+n}function tt(e,t,n){let r=e;for(;t-- >Ue;)r*=r,r%=n;return r}function pd(e,t){if(e===Ue)throw new Error("invert: expected non-zero number");if(t<=Ue)throw new Error("invert: expected positive modulus, got "+t);let n=xt(e,t),r=t,o=Ue,s=Le;for(;n!==Ue;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Le)throw new Error("invert: does not exist");return xt(o,t)}function Sa(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function hd(e,t){const n=(e.ORDER+Le)/ud,r=e.pow(t,n);return Sa(e,r,t),r}function Jw(e,t){const n=(e.ORDER-ld)/fd,r=e.mul(t,Fn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Fn),o),c=e.mul(s,e.sub(i,e.ONE));return Sa(e,c,t),c}function ev(e){const t=go(e),n=md(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+Xw)/dd;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const f=c.mul(u,o),p=c.mul(u,s),d=c.eql(c.sqr(l),a),h=c.eql(c.sqr(f),a);u=c.cmov(u,l,d),l=c.cmov(p,f,h);const m=c.eql(c.sqr(l),a),x=c.cmov(u,l,m);return Sa(c,x,a),x}}function md(e){if(e<cd)throw new Error("sqrt is not defined for small field");let t=e-Le,n=0;for(;t%Fn===Ue;)t/=Fn,n++;let r=Fn;const o=go(e);for(;bd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return hd;let s=o.pow(r,t);const i=(t+Le)/Fn;return function(a,u){if(a.is0(u))return u;if(bd(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 x=Le<<BigInt(l-h-1),T=a.pow(f,x);l=h,f=a.sqr(T),p=a.mul(p,f),d=a.mul(d,T)}return d}}function tv(e){return e%ud===cd?hd:e%fd===ld?Jw:e%dd===Qw?ev(e):md(e)}const nv=["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:"number",BITS:"number"},n=nv.reduce((r,o)=>(r[o]="function",r),t);return Zi(e,n),e}function ov(e,t,n){if(n<Ue)throw new Error("invalid exponent, negatives unsupported");if(n===Ue)return e.ONE;if(n===Le)return t;let r=e.ONE,o=t;for(;n>Ue;)n&Le&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Le;return r}function gd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function bd(e,t){const n=(e.ORDER-Le)/Fn,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function yd(e,t){t!==void 0&&Fr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function go(e,t,n=!1,r={}){if(e<=Ue)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=t;p.BITS&&(o=p.BITS),p.sqrt&&(s=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(i=p.modFromBytes),c=p.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=yd(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:lo(a),ZERO:Ue,ONE:Le,allowedLengths:c,create:p=>xt(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return Ue<=p&&p<e},is0:p=>p===Ue,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Le)===Le,neg:p=>xt(-p,e),eql:(p,d)=>p===d,sqr:p=>xt(p*p,e),add:(p,d)=>xt(p+d,e),sub:(p,d)=>xt(p-d,e),mul:(p,d)=>xt(p*d,e),pow:(p,d)=>ov(f,p,d),div:(p,d)=>xt(p*pd(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>pd(p,e),sqrt:s||(p=>(l||(l=tv(e)),l(f,p))),toBytes:p=>n?rf(p,u):Gi(p,u),fromBytes:(p,d=!0)=>{if(c){if(!c.includes(p.length)||p.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+p.length);const m=new Uint8Array(u);m.set(p,n?0:m.length-p.length),p=m}if(p.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+p.length);let h=n?nf(p):ns(p);if(i&&(h=xt(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>gd(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function wd(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function vd(e){const t=wd(e);return t+Math.ceil(t/2)}function sv(e,t,n=!1){const r=e.length,o=wd(t),s=vd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?nf(e):ns(e),c=xt(i,t-Le)+Le;return n?rf(c,o):Gi(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const pr=BigInt(0),Rn=BigInt(1);function ps(e,t){const n=t.negate();return e?n:t}function Pa(e,t){const n=gd(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function xd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function $a(e,t){xd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=lo(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Ed(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Rn);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 iv(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 av(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const Aa=new WeakMap,Sd=new WeakMap;function Ta(e){return Sd.get(e)||1}function Pd(e){if(e!==pr)throw new Error("invalid wNAF")}class cv{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>pr;)n&Rn&&(r=r.add(o)),o=o.double(),n>>=Rn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=$a(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let u=1;u<o;u++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=$a(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:p,offsetF:d}=Ed(r,c,i);r=a,l?s=s.add(ps(p,n[d])):o=o.add(ps(f,n[u]))}return Pd(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=$a(t,this.bits);for(let i=0;i<s.windows&&r!==pr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=Ed(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return Pd(r),o}getPrecomputes(t,n,r){let o=Aa.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Aa.set(n,o))),o}cached(t,n,r){const o=Ta(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Ta(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){xd(n,this.bits),Sd.set(t,n),Aa.delete(t)}hasCache(t){return Ta(t)!==1}}function uv(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>pr||r>pr;)n&Rn&&(s=s.add(o)),r&Rn&&(i=i.add(o)),o=o.double(),n>>=Rn,r>>=Rn;return{p1:s,p2:i}}function lv(e,t,n,r){iv(n,e),av(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,c=of(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=lo(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 x=r[m],T=Number(x>>BigInt(d)&u);l[T]=l[T].add(n[m])}let h=i;for(let m=l.length-1,x=i;m>0;m--)x=x.add(l[m]),h=h.add(x);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function $d(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return rv(t),t}else return go(e,{isLE:n})}function fv(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const u=t[a];if(!(typeof u=="bigint"&&u>pr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=$d(t.p,n.Fp,r),s=$d(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!o.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ad=(e,t)=>(e+(e>=0?t:-t)/Td)/t;function dv(e,t,n){const[[r,o],[s,i]]=t,c=Ad(i*e,n),a=Ad(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<Jt,p=l<Jt;f&&(u=-u),p&&(l=-l);const d=lo(Math.ceil(of(n)/2))+hr;if(u<Jt||u>=d||l<Jt||l>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}function Oa(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Ca(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return es(n.lowS,"lowS"),es(n.prehash,"prehash"),n.format!==void 0&&Oa(n.format),n}class pv extends Error{constructor(t=""){super(t)}}const Qt={Err:pv,_tlv:{encode:(e,t)=>{const{Err:n}=Qt;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=ts(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ts(o.length/2|128):"";return ts(e)+s+o+t},decode(e,t){const{Err:n}=Qt;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}=Qt;if(e<Jt)throw new t("integer: negative integers are not allowed");let n=ts(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}=Qt;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 ns(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Qt,o=_e("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v: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}=Qt,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},Jt=BigInt(0),hr=BigInt(1),Td=BigInt(2),hs=BigInt(3),hv=BigInt(4);function mr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=_e("private key",t);try{r=e.fromBytes(o)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function mv(e,t={}){const n=fv("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Zi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=Cd(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(C,P,S){const{x:E,y:O}=P.toAffine(),N=r.toBytes(E);if(es(S,"isCompressed"),S){l();const b=!r.isOdd(O);return fn(Od(b),N)}else return fn(Uint8Array.of(4),N,r.toBytes(O))}function p(C){kn(C,void 0,"Point");const{publicKey:P,publicKeyUncompressed:S}=u,E=C.length,O=C[0],N=C.subarray(1);if(E===P&&(O===2||O===3)){const b=r.fromBytes(N);if(!r.isValid(b))throw new Error("bad point: is not on curve, wrong x");const k=m(b);let R;try{R=r.sqrt(k)}catch(W){const K=W instanceof Error?": "+W.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}l();const D=r.isOdd(R);return(O&1)===1!==D&&(R=r.neg(R)),{x:b,y:R}}else if(E===S&&O===4){const b=r.BYTES,k=r.fromBytes(N.subarray(0,b)),R=r.fromBytes(N.subarray(b,b*2));if(!x(k,R))throw new Error("bad point: is not on curve");return{x:k,y:R}}else throw new Error(`bad point: got length ${E}, expected compressed=${P} or uncompressed=${S}`)}const d=t.toBytes||f,h=t.fromBytes||p;function m(C){const P=r.sqr(C),S=r.mul(P,C);return r.add(r.add(S,r.mul(C,s.a)),s.b)}function x(C,P){const S=r.sqr(P),E=m(C);return r.eql(S,E)}if(!x(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const T=r.mul(r.pow(s.a,hs),hv),y=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(T,y)))throw new Error("bad curve params: a or b");function A(C,P,S=!1){if(!r.isValid(P)||S&&r.is0(P))throw new Error(`bad point coordinate ${C}`);return P}function B(C){if(!(C instanceof w))throw new Error("ProjectivePoint expected")}function L(C){if(!a||!a.basises)throw new Error("no endo");return dv(C,a.basises,o.ORDER)}const _=sf((C,P)=>{const{X:S,Y:E,Z:O}=C;if(r.eql(O,r.ONE))return{x:S,y:E};const N=C.is0();P==null&&(P=N?r.ONE:r.inv(O));const b=r.mul(S,P),k=r.mul(E,P),R=r.mul(O,P);if(N)return{x:r.ZERO,y:r.ZERO};if(!r.eql(R,r.ONE))throw new Error("invZ was invalid");return{x:b,y:k}}),j=sf(C=>{if(C.is0()){if(t.allowInfinityPoint&&!r.is0(C.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:S}=C.toAffine();if(!r.isValid(P)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!x(P,S))throw new Error("bad point: equation left != right");if(!C.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(C,P,S,E,O){return S=new w(r.mul(S.X,C),S.Y,S.Z),P=ps(E,P),S=ps(O,S),P.add(S)}class w{constructor(P,S,E){this.X=A("x",P),this.Y=A("y",S,!0),this.Z=A("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine(P){const{x:S,y:E}=P||{};if(!P||!r.isValid(S)||!r.isValid(E))throw new Error("invalid affine point");if(P instanceof w)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?w.ZERO:new w(S,E,r.ONE)}static fromBytes(P){const S=w.fromAffine(h(kn(P,void 0,"point")));return S.assertValidity(),S}static fromHex(P){return w.fromBytes(_e("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,S=!0){return I.createCache(this,P),S||this.multiply(hs),this}assertValidity(){j(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){B(P);const{X:S,Y:E,Z:O}=this,{X:N,Y:b,Z:k}=P,R=r.eql(r.mul(S,k),r.mul(N,O)),D=r.eql(r.mul(E,k),r.mul(b,O));return R&&D}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:S}=s,E=r.mul(S,hs),{X:O,Y:N,Z:b}=this;let k=r.ZERO,R=r.ZERO,D=r.ZERO,U=r.mul(O,O),W=r.mul(N,N),K=r.mul(b,b),G=r.mul(O,N);return G=r.add(G,G),D=r.mul(O,b),D=r.add(D,D),k=r.mul(P,D),R=r.mul(E,K),R=r.add(k,R),k=r.sub(W,R),R=r.add(W,R),R=r.mul(k,R),k=r.mul(G,k),D=r.mul(E,D),K=r.mul(P,K),G=r.sub(U,K),G=r.mul(P,G),G=r.add(G,D),D=r.add(U,U),U=r.add(D,U),U=r.add(U,K),U=r.mul(U,G),R=r.add(R,U),K=r.mul(N,b),K=r.add(K,K),U=r.mul(K,G),k=r.sub(k,U),D=r.mul(K,W),D=r.add(D,D),D=r.add(D,D),new w(k,R,D)}add(P){B(P);const{X:S,Y:E,Z:O}=this,{X:N,Y:b,Z:k}=P;let R=r.ZERO,D=r.ZERO,U=r.ZERO;const W=s.a,K=r.mul(s.b,hs);let G=r.mul(S,N),H=r.mul(E,b),V=r.mul(O,k),Y=r.add(S,E),Q=r.add(N,b);Y=r.mul(Y,Q),Q=r.add(G,H),Y=r.sub(Y,Q),Q=r.add(S,O);let oe=r.add(N,k);return Q=r.mul(Q,oe),oe=r.add(G,V),Q=r.sub(Q,oe),oe=r.add(E,O),R=r.add(b,k),oe=r.mul(oe,R),R=r.add(H,V),oe=r.sub(oe,R),U=r.mul(W,Q),R=r.mul(K,V),U=r.add(R,U),R=r.sub(H,U),U=r.add(H,U),D=r.mul(R,U),H=r.add(G,G),H=r.add(H,G),V=r.mul(W,V),Q=r.mul(K,Q),H=r.add(H,V),V=r.sub(G,V),V=r.mul(W,V),Q=r.add(Q,V),G=r.mul(H,Q),D=r.add(D,G),G=r.mul(oe,Q),R=r.mul(Y,R),R=r.sub(R,G),G=r.mul(Y,H),U=r.mul(oe,U),U=r.add(U,G),new w(R,D,U)}subtract(P){return this.add(P.negate())}is0(){return this.equals(w.ZERO)}multiply(P){const{endo:S}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let E,O;const N=b=>I.cached(this,b,k=>Pa(w,k));if(S){const{k1neg:b,k1:k,k2neg:R,k2:D}=L(P),{p:U,f:W}=N(k),{p:K,f:G}=N(D);O=W.add(G),E=g(S.beta,U,K,b,R)}else{const{p:b,f:k}=N(P);E=b,O=k}return Pa(w,[E,O])[0]}multiplyUnsafe(P){const{endo:S}=t,E=this;if(!o.isValid(P))throw new Error("invalid scalar: out of range");if(P===Jt||E.is0())return w.ZERO;if(P===hr)return E;if(I.hasCache(this))return this.multiply(P);if(S){const{k1neg:O,k1:N,k2neg:b,k2:k}=L(P),{p1:R,p2:D}=uv(w,E,N,k);return g(S.beta,R,D,O,b)}else return I.unsafe(E,P)}multiplyAndAddUnsafe(P,S,E){const O=this.multiplyUnsafe(S).add(P.multiplyUnsafe(E));return O.is0()?void 0:O}toAffine(P){return _(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===hr?!0:P?P(w,this):I.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===hr?this:P?P(w,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return es(P,"isCompressed"),this.assertValidity(),d(w,this,P)}toHex(P=!0){return tr(this.toBytes(P))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(P=!0){return this.toBytes(P)}_setWindowSize(P){this.precompute(P)}static normalizeZ(P){return Pa(w,P)}static msm(P,S){return lv(w,o,P,S)}static fromPrivateKey(P){return w.BASE.multiply(mr(o,P))}}w.BASE=new w(s.Gx,s.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO),w.Fp=r,w.Fn=o;const $=o.BITS,I=new cv(w,t.endo?Math.ceil($/2):$);return w.BASE.precompute(8),w}function Od(e){return Uint8Array.of(e?2:3)}function Cd(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function gv(e,t={}){const{Fn:n}=e,r=t.randomBytes||Qu,o=Object.assign(Cd(e.Fp,n),{seed:vd(n.ORDER)});function s(d){try{return!!mr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:x}=o;try{const T=d.length;return h===!0&&T!==m||h===!1&&T!==x?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return sv(kn(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(mr(n,d)).toBytes(h)}function u(d){const h=c(d);return{secretKey:h,publicKey:a(h)}}function l(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:x}=o;if(n.allowedLengths||h===m)return;const T=_e("key",d).length;return T===m||T===x}function f(d,h,m=!0){if(l(d)===!0)throw new Error("first arg must be private key");if(l(h)===!1)throw new Error("second arg must be public key");const x=mr(n,d);return e.fromHex(h).multiply(x).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:d=>mr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function bv(e,t,n={}){Gu(t),Zi(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Qu,o=n.hmac||((S,...E)=>ad(t,S,fn(...E))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d}=gv(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function x(S){const E=c>>hr;return S>E}function T(S,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return E}function y(S,E){Oa(E);const O=d.signature,N=E==="compact"?O:E==="recovered"?O+1:void 0;return kn(S,N,`${E} signature`)}class A{constructor(E,O,N){this.r=T("r",E),this.s=T("s",O),N!=null&&(this.recovery=N),Object.freeze(this)}static fromBytes(E,O=m){y(E,O);let N;if(O==="der"){const{r:D,s:U}=Qt.toSig(kn(E));return new A(D,U)}O==="recovered"&&(N=E[0],O="compact",E=E.subarray(1));const b=i.BYTES,k=E.subarray(0,b),R=E.subarray(b,b*2);return new A(i.fromBytes(k),i.fromBytes(R),N)}static fromHex(E,O){return this.fromBytes(zo(E),O)}addRecoveryBit(E){return new A(this.r,this.s,E)}recoverPublicKey(E){const O=s.ORDER,{r:N,s:b,recovery:k}=this;if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");if(c*Td<O&&k>1)throw new Error("recovery id is ambiguous for h>1 curve");const D=k===2||k===3?N+c:N;if(!s.isValid(D))throw new Error("recovery id 2 or 3 invalid");const U=s.toBytes(D),W=e.fromBytes(fn(Od((k&1)===0),U)),K=i.inv(D),G=L(_e("msgHash",E)),H=i.create(-G*K),V=i.create(b*K),Y=e.BASE.multiplyUnsafe(H).add(W.multiplyUnsafe(V));if(Y.is0())throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return x(this.s)}toBytes(E=m){if(Oa(E),E==="der")return zo(Qt.hexFromSig(this));const O=i.toBytes(this.r),N=i.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return fn(Uint8Array.of(this.recovery),O,N)}return fn(O,N)}toHex(E){return tr(this.toBytes(E))}assertValidity(){}static fromCompact(E){return A.fromBytes(_e("sig",E),"compact")}static fromDER(E){return A.fromBytes(_e("sig",E),"der")}normalizeS(){return this.hasHighS()?new A(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return tr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return tr(this.toBytes("compact"))}}const B=n.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const O=ns(E),N=E.length*8-a;return N>0?O>>BigInt(N):O},L=n.bits2int_modN||function(E){return i.create(B(E))},_=lo(a);function j(S){return gy("num < 2^"+a,S,Jt,_),i.toBytes(S)}function g(S,E){return kn(S,void 0,"message"),E?kn(t(S),void 0,"prehashed message"):S}function w(S,E,O){if(["recovered","canonical"].some(H=>H in O))throw new Error("sign() legacy options not supported");const{lowS:N,prehash:b,extraEntropy:k}=Ca(O,h);S=g(S,b);const R=L(S),D=mr(i,E),U=[j(D),j(R)];if(k!=null&&k!==!1){const H=k===!0?r(d.secretKey):k;U.push(_e("extraEntropy",H))}const W=fn(...U),K=R;function G(H){const V=B(H);if(!i.isValidNot0(V))return;const Y=i.inv(V),Q=e.BASE.multiply(V).toAffine(),oe=i.create(Q.x);if(oe===Jt)return;const pe=i.create(Y*i.create(K+oe*D));if(pe===Jt)return;let Se=(Q.x===oe?0:2)|Number(Q.y&hr),he=pe;return N&&x(pe)&&(he=i.neg(pe),Se^=1),new A(oe,he,Se)}return{seed:W,k2sig:G}}function $(S,E,O={}){S=_e("message",S);const{seed:N,k2sig:b}=w(S,E,O);return by(t.outputLen,i.BYTES,o)(N,b)}function I(S){let E;const O=typeof S=="string"||Uo(S),N=!O&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!O&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(N)E=new A(S.r,S.s);else if(O){try{E=A.fromBytes(_e("sig",S),"der")}catch(b){if(!(b instanceof Qt.Err))throw b}if(!E)try{E=A.fromBytes(_e("sig",S),"compact")}catch{return!1}}return E||!1}function C(S,E,O,N={}){const{lowS:b,prehash:k,format:R}=Ca(N,h);if(O=_e("publicKey",O),E=g(_e("message",E),k),"strict"in N)throw new Error("options.strict was renamed to lowS");const D=R===void 0?I(S):A.fromBytes(_e("sig",S),R);if(D===!1)return!1;try{const U=e.fromBytes(O);if(b&&D.hasHighS())return!1;const{r:W,s:K}=D,G=L(E),H=i.inv(K),V=i.create(G*H),Y=i.create(W*H),Q=e.BASE.multiplyUnsafe(V).add(U.multiplyUnsafe(Y));return Q.is0()?!1:i.create(Q.x)===W}catch{return!1}}function P(S,E,O={}){const{prehash:N}=Ca(O,h);return E=g(E,N),A.fromBytes(S,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:$,verify:C,recoverPublicKey:P,Signature:A,hash:t})}function yv(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=go(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function wv(e){const{CURVE:t,curveOpts:n}=yv(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function vv(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,yd(n.Fn.ORDER,n.Fn.BITS))})}function xv(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=wv(e),s=mv(t,n),i=bv(s,r,o);return vv(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ev(e,t){const n=r=>xv({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Na={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Sv={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Nd=BigInt(2);function Pv(e){const t=Na.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=tt(l,n,t)*l%t,p=tt(f,n,t)*l%t,d=tt(p,Nd,t)*u%t,h=tt(d,o,t)*d%t,m=tt(h,s,t)*h%t,x=tt(m,c,t)*m%t,T=tt(x,a,t)*x%t,y=tt(T,c,t)*m%t,A=tt(y,n,t)*l%t,B=tt(A,i,t)*h%t,L=tt(B,r,t)*u%t,_=tt(L,Nd,t);if(!Ia.eql(Ia.sqr(_),e))throw new Error("Cannot find square root");return _}const Ia=go(Na.p,{sqrt:Pv}),Id=Ev({...Na,Fp:Ia,lowS:!0,endo:Sv},Wl),$v=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Id},Symbol.toStringTag,{value:"Module"}));function Av({r:e,s:t,to:n="hex",v:r,yParity:o}){const s=(()=>{if(o===0||o===1)return o;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new Id.Signature(At(e),At(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:bt(i)}async function Ma(e,t){var f,p,d;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(d=(p=(f=e.chain)==null?void 0:f.contracts)==null?void 0:p.universalSignatureVerifier)==null?void 0:d.address,...a}=t,u=mt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?Av(i):$e(i),l=await(async()=>!r&&!o||dw(u)?u:pw({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Ot({abi:Ef,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:na({abi:Ef,args:[n,s,l],bytecode:Wy}),...a},{data:m}=await ee(e,fo,"call")(h);return gg(m??"0x0")}catch(h){try{if(Jo(An(n),await Il({hash:s,signature:i})))return!0}catch{}if(h instanceof Ol)return!1;throw h}}async function Tv(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Zf(n);return Ma(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function Ov(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=rw({message:i,primaryType:c,types:a,domain:u});return Ma(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function Md(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return c?(()=>{const f=Ae(["watchBlockNumber",e.uid,t,n,i]);return mn(f,{onBlockNumber:r,onError:o},p=>po(async()=>{var d;try{const h=await ee(e,ho,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(!a||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Ae(["watchBlockNumber",e.uid,t,n]);return mn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:x}=await m.subscribe({params:["newHeads"],onData(T){var A;if(!d)return;const y=At((A=T.result)==null?void 0:A.number);p.onBlockNumber(y,a),a=y},onError(T){var y;(y=p.onError)==null||y.call(p,T)}});h=x,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Cv(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:L})=>~~(1<<L)*200,timeout:a=18e4}=t,u=Ae(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var L;return t.pollingInterval?t.pollingInterval:(L=e.chain)!=null&&L.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,x;const{promise:T,resolve:y,reject:A}=Af(),B=a?setTimeout(()=>{x(),m(),A(new $b({hash:o}))},a):void 0;return m=mn(u,{onReplaced:s,resolve:y,reject:A},async L=>{if(d=await ee(e,fs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(B),L.resolve(d),m();return}x=ee(e,Md,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(_){const j=w=>{clearTimeout(B),x(),w(),m()};let g=_;if(!h)try{if(d){if(r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>L.resolve(d));return}if(n&&!f&&(h=!0,await ia(async()=>{f=await ee(e,pa,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await ee(e,fs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>L.resolve(d))}catch(w){if(w instanceof Al||w instanceof Tl){if(!f){h=!1;return}try{p=f,h=!0;const $=await ia(()=>ee(e,Ct,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof Fl});h=!1;const I=$.transactions.find(({from:P,nonce:S})=>P===p.from&&S===p.nonce);if(!I||(d=await ee(e,fs,"getTransactionReceipt")({hash:I.hash}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r)))return;let C="replaced";I.to===p.to&&I.value===p.value&&I.input===p.input?C="repriced":I.from===I.to&&I.value===0n&&(C="cancelled"),j(()=>{var P;(P=L.onReplaced)==null||P.call(L,{reason:C,replacedTransaction:p,transaction:I,transactionReceipt:d}),L.resolve(d)})}catch($){j(()=>L.reject($))}}else j(()=>L.reject(w))}}})}),T}function Nv(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),l=i??!1;let f;return u?(()=>{const h=Ae(["watchBlocks",e.uid,t,n,r,l,a]);return mn(h,{onBlock:o,onError:s},m=>po(async()=>{var x;try{const T=await ee(e,Ct,"getBlock")({blockTag:t,includeTransactions:l});if(T.number!==null&&(f==null?void 0:f.number)!=null){if(T.number===f.number)return;if(T.number-f.number>1&&n)for(let y=(f==null?void 0:f.number)+1n;y<T.number;y++){const A=await ee(e,Ct,"getBlock")({blockNumber:y,includeTransactions:l});m.onBlock(A,f),f=A}}((f==null?void 0:f.number)==null||t==="pending"&&(T==null?void 0:T.number)==null||T.number!==null&&T.number>f.number)&&(m.onBlock(T,f),f=T)}catch(T){(x=m.onError)==null||x.call(m,T)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,x=()=>h=!1;return(async()=>{try{r&&ee(e,Ct,"getBlock")({blockTag:t,includeTransactions:l}).then(A=>{h&&m&&(o(A,void 0),m=!1)}).catch(s);const T=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:y}=await T.subscribe({params:["newHeads"],async onData(A){var L;if(!h)return;const B=await ee(e,Ct,"getBlock")({blockNumber:(L=A.result)==null?void 0:L.number,includeTransactions:l}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError(A){s==null||s(A)}});x=y,h||x()}catch(T){s==null||s(T)}})(),()=>x()})()}function Iv(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 x=Ae(["watchEvent",t,n,r,e.uid,o,l,i]);return mn(x,{onLogs:a,onError:c},T=>{let y;i!==void 0&&(y=i-1n);let A,B=!1;const L=po(async()=>{var _;if(!B){try{A=await ee(e,jf,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}B=!0;return}try{let j;if(A)j=await ee(e,rs,"getFilterChanges")({filter:A});else{const g=await ee(e,ho,"getBlockNumber")({});y&&y!==g?j=await ee(e,zi,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:y+1n,toBlock:g}):j=[],y=g}if(j.length===0)return;if(r)T.onLogs(j);else for(const g of j)T.onLogs([g])}catch(j){A&&j instanceof Nn&&(B=!1),(_=T.onError)==null||_.call(T,j)}},{emitOnBegin:!0,interval:l});return async()=>{A&&await ee(e,os,"uninstallFilter")({filter:A}),L()}})})():(()=>{let x=!0,T=()=>x=!1;return(async()=>{try{const y=(()=>{if(e.transport.type==="fallback"){const _=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return _?_.value:e.transport}return e.transport})(),A=s??(o?[o]:void 0);let B=[];A&&(B=[A.flatMap(j=>jr({abi:[j],eventName:j.name,args:n}))],o&&(B=B[0]));const{unsubscribe:L}=await y.subscribe({params:["logs",{address:t,topics:B}],onData(_){var g;if(!x)return;const j=_.result;try{const{eventName:w,args:$}=_i({abi:A??[],data:j.data,topics:j.topics,strict:d}),I=Kt(j,{args:$,eventName:w});a([I])}catch(w){let $,I;if(w instanceof Br||w instanceof jo){if(f)return;$=w.abiItem.name,I=(g=w.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const C=Kt(j,{args:I?[]:{},eventName:$});a([C])}},onError(_){c==null||c(_)}});T=L,x||T()}catch(y){c==null||c(y)}})(),()=>T()})()}function Mv(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Ae(["watchPendingTransactions",e.uid,t,s]);return mn(u,{onTransactions:r,onError:n},l=>{let f;const p=po(async()=>{var d;try{if(!f)try{f=await ee(e,_f,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await ee(e,rs,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(d=l.onError)==null||d.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await ee(e,os,"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 kv(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(Bv))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(Lv))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
77
|
-
- `).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 Bv=/^(?:(?<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)?/,Lv=/(?: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 Fv(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||!Je(r.address,{strict:!1})||t&&!Jo(r.address,t))return!1}catch{return!1}return!0}async function Rv(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=kv(o);if(!l.address||!Fv({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const p=Zf(o);return Ma(e,{address:l.address,hash:p,signature:c,...u})}function Dv(e){return{call:t=>fo(e,t),createAccessList:t=>Df(e,t),createBlockFilter:()=>D1(e),createContractEventFilter:t=>ml(e,t),createEventFilter:t=>jf(e,t),createPendingTransactionFilter:()=>_f(e),estimateContractGas:t=>dy(e,t),estimateGas:t=>ji(e,t),getBalance:t=>Ql(e,t),getBlobBaseFee:()=>j1(e),getBlock:t=>Ct(e,t),getBlockNumber:t=>ho(e,t),getBlockTransactionCount:t=>_1(e,t),getBytecode:t=>Uf(e,t),getChainId:()=>Kl(e),getCode:t=>Uf(e,t),getContractEvents:t=>ef(e,t),getEip712Domain:t=>z1(e,t),getEnsAddress:t=>E1(e,t),getEnsAvatar:t=>L1(e,t),getEnsName:t=>F1(e,t),getEnsResolver:t=>R1(e,t),getEnsText:t=>Rf(e,t),getFeeHistory:t=>V1(e,t),estimateFeesPerGas:t=>Kb(e,t),getFilterChanges:t=>rs(e,t),getFilterLogs:t=>G1(e,t),getGasPrice:()=>Fi(e),getLogs:t=>zi(e,t),getProof:t=>yw(e,t),estimateMaxPriorityFeePerGas:t=>Zb(e,t),getStorageAt:t=>ww(e,t),getTransaction:t=>pa(e,t),getTransactionConfirmations:t=>vw(e,t),getTransactionCount:t=>Ul(e,t),getTransactionReceipt:t=>fs(e,t),multicall:t=>xw(e,t),prepareTransactionRequest:t=>Xl(e,t),readContract:t=>Xt(e,t),sendRawTransaction:t=>o1(e,t),simulate:t=>ha(e,t),simulateBlocks:t=>ha(e,t),simulateCalls:t=>Yw(e,t),simulateContract:t=>Yy(e,t),verifyMessage:t=>Tv(e,t),verifySiweMessage:t=>Rv(e,t),verifyTypedData:t=>Ov(e,t),uninstallFilter:t=>os(e,t),waitForTransactionReceipt:t=>Cv(e,t),watchBlocks:t=>Nv(e,t),watchBlockNumber:t=>Md(e,t),watchContractEvent:t=>r1(e,t),watchEvent:t=>Iv(e,t),watchPendingTransactions:t=>Mv(e,t)}}function jv(e){const{key:t="public",name:n="Public Client"}=e;return a1({...e,key:t,name:n,type:"publicClient"}).extend(Dv)}const _v=J1({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 Uv({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=v.useState(null),[a,u]=v.useState(o);return v.useEffect(()=>{let l,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:ur,functionName:"balanceOf",args:[n]});c(d),u(xi(d,r))}catch{u(o)}};p();try{l=e.watchContractEvent({address:t,abi:ur,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:ur,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const zv=()=>({openDeposit:v.useCallback(t=>{},[])}),Hv=()=>({openWithdraw:v.useCallback(t=>{},[])}),Dn="MPC",ka="EVM";/**
|
|
69
|
+
`,o+=zl(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
70
|
+
`,o+=zl(r.stateDiff)),o},` State Override:
|
|
71
|
+
`).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(`
|
|
72
|
+
`)}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+=`
|
|
73
|
+
${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=Bn({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(`
|
|
74
|
+
`):`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 Ln 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: ${Ae(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=o,this.status=s,this.url=i}}class _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: ${Ae(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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: ${Ae(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(`
|
|
75
|
+
`)})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Fn extends He{constructor(t){super(t,{code:Fn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Fn,"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(`
|
|
76
|
+
`)})}}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 Dn extends He{constructor(t,{method:n}={}){super(t,{code:Dn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Dn,"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,Fn.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 Sg(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(()=>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 Sg(await Pg({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"?Te(r.bytes):r.bytes}function Kl(e){return Array.isArray(e)?Tg(e.map(t=>Kl(t))):Ag(e)}function Tg(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 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(`
|
|
77
|
+
`),{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(`
|
|
78
|
+
`),{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(`
|
|
79
|
+
`),{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=>Te(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 Tt(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,Tt,"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,Tt,"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,Tt,"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=>Te(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=>Te(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 Ai{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=Ti(this.buffer)}update(t){ir(this),t=ts(t),kn(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=Ti(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=Ti(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:Te(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=>Te(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,...S}=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(S,{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 A=await(async()=>{var j,z;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const _=await X(e,Tt,"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(A<1)throw new tf;const P=10**(((O=A.toString().split(".")[1])==null?void 0:O.length)??0),L=j=>j*BigInt(Math.ceil(A*P))/BigInt(P);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:A,...T}=D.transaction;return na.set(e.uid,!0),{...n,...g?{from:g}:{},...A?{type:A}:{},...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 T&&typeof T.nonceKey<"u"?{nonceKey:T.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 S(){return E||(E=await X(e,Tt,"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 S();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 S(),{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 S(),{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:S,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:S,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?Bn({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 Rn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Bn({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 jn(e){return vf(vo(e))}function Sf(e){return ua(e),vf(vo(Uint8Array.from(e).reverse()))}function xo(e,t){return ps(e.toString(16).padStart(t*2,"0"))}function Pf(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 Tf(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(`
|
|
80
|
+
`);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 Af(this,t)}}function Af(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Af(e.cause,t):t?null:e}function Eo(e,t){if(gr(e)>t)throw new Ty({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 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 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=Un(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=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 Sy(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Eo(r,n),r=Py(r)),hy.decode(r)}function kf(e){return Nf(e,{dir:"left"})}function Py(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 Ty=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 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 At(...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),_n(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),Un(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?_n(a,r):a}function pa(e,t={}){return Ot(Oy.encode(e),t)}function _n(e,t){return Cf(e,{dir:"left",size:t})}function Un(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 So(e,t){var I,M,y,A;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:S,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 P=(typeof s=="bigint"?Q(s):void 0)||i,L=u?Uf(u):void 0,j=Yi(F),z=(A=(y=(M=e.chain)==null?void 0:M.formatters)==null?void 0:y.transactionRequest)==null?void 0:A.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:S,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,P];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(T){const P=Hy(T),{offchainLookup:L,offchainLookupSignature:j}=await Promise.resolve().then(()=>Uw);if(e.ccipRead!==!1&&(P==null?void 0:P.slice(0,10))===j&&N)return{data:await L(e,{data:P,to:N})};throw C&&(P==null?void 0:P.slice(0,10))==="0x101bb98d"?new wg({factory:p}):Kf(T,{...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:S})=>E+(S.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"}),S=await e.request({method:"eth_call",params:[{...u===null?{data:Jf({code:ma,data:E})}:{to:u,data:E}},f]});return Rn({abi:ys,args:[$],functionName:"aggregate3",data:S||"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,So,"call")({...i,data:c,to:r});return Rn({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,So,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Rn({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 Po(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,$=Ae(["watchContractEvent",r,o,s,e.uid,i,f,w,c]);return vn($,{onLogs:u,onError:a},E=>{let S;c!==void 0&&(S=c-1n);let N,B=!1;const F=Po(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")({});S&&S<g?b=await X(e,wf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:S+1n,toBlock:g,strict:w}):b=[],S=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,$=Ae(["watchContractEvent",r,o,s,e.uid,i,f,w]);let E=!0,S=()=>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)}});S=D,E||S()}catch(B){a==null||a(B)}})(),()=>S()))})()}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 Sa=256;let xs=Sa,Es;function nd(e=11){if(!Es||xs+e>Sa*2){Es="",xs=0;for(let t=0;t<Sa;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(S){return N=>{const B=N(S);for(const D in $)delete B[D];const F={...S,...B};return Object.assign(F,{extend:E(F)})}}return Object.assign($,{extend:E($)})}function Pa(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=Bn({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 Ta="/docs/contract/encodeFunctionResult";function nw(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Bn({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Ta});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Ta});if(!o.outputs)throw new al(o.name,{docsPath:Ta});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 To="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(To)?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 Aa(e){let t=new Uint8Array(32).fill(0);if(!e)return Te(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(Mn(n[r]),"bytes");t=Me(Pt([t,s]),"bytes")}return Te(t)}function ow(e){return`[${e.slice(2)}]`}function sw(e){const t=new Uint8Array(32).fill(0);return e?sd(e)||Me(Mn(e)):Te(t)}function Oa(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Mn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Mn(o[s]);i.byteLength>255&&(i=Mn(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?[Aa(s),BigInt(o)]:[Aa(s)];try{const p=$t({abi:Vf,functionName:"addr",args:f}),d={address:u,abi:Hf,functionName:"resolveWithGateways",args:[pn(Oa(s)),p,i??[To]],blockNumber:n,blockTag:r},m=await X(e,Nt,"readContract")(d);if(m[0]==="0x")return null;const w=Rn({abi:Vf,args:f,functionName:"addr",data:m[0]});return w==="0x"||In(w)==="0x00"?null:w}catch(p){if(c)throw p;if(Pa(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 Ao 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 Ao({reason:"Only EIP-155 supported"});if(!i)throw new Ao({reason:"Chain ID not found"});if(!a)throw new Ao({reason:"Contract address not found"});if(!o)throw new Ao({reason:"Token ID not found"});if(!c)throw new Ao({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,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:[Aa(s),o]}),i??[To]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await X(e,Nt,"readContract")(f);if(d[0]==="0x")return null;const h=Rn({abi:Wf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Pa(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??[To]],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(Pa(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(S){throw Kf(S,{...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 Sw(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 $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 Tw 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: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 Tw({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 Ss=new rs(8192);function kw(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Ss.get(n))return Ss.get(n);const r=e().finally(()=>Ss.delete(n));return Ss.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 Dn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Dn(new Error("method not supported"),{method:u});const l=o?jr(`${a}.${Ae(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 Fn.code:throw new Fn(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 Dn.code:throw new Dn(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 Ln){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===Fn.code:e instanceof Ln&&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: ${Ae(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(To)?await od({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await So(e,{blockNumber:t,blockTag:n,data:Pt([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 Ln({body:a,details:f!=null&&f.error?Ae(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 Ln({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)?Ae(r.map(N=>({jsonrpc:"2.0",id:N.id??md.take(),...N}))):Ae({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 Ln({body:r,details:Ae(h.error)||d.statusText,headers:d.headers,status:d.status,url:e});return h}catch(d){throw d instanceof Ln||d instanceof ql?d:new Ln({body:r,cause:d,url:e})}}}}const Gw=`Ethereum Signed Message:
|
|
81
|
+
`;function qw(e){const t=typeof e=="string"?jr(e):typeof e.raw=="string"?e.raw:Te(e.raw),n=jr(`${Gw}${we(t)}`);return Pt([n,t])}function bd(e,t){return Me(qw(e),t)}class Zw extends V{constructor({domain:t}){super(`Invalid domain "${Ae(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(Pt(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 Ps(e,t={}){const{strict:n=!0}=t;if(!sv.test(e))throw new Sd({address:e,cause:new iv});if(n){if(e.toLowerCase()===e)return;if(Ed(e)!==e)throw new Sd({address:e,cause:new av})}}function Ed(e){if(Ma.has(e))return Ma.get(e);Ps(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 Ps(e,{strict:n}),!0}catch{return!1}}class Sd 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])?$/,Pd=/^(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 Td=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+Td;e.setPosition(u);const f=en(e.readBytes(Td)),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=Sy(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 Pv(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"]=Pd.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 Sv(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 At(...n,...r)}function yv(e,t){const{checksum:n=!1}=t;return Ps(e,{strict:n}),{dynamic:!1,encoded:_n(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?At(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:At(...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=Un(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:At(_n(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:Un(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:_n(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 Sv(e){const t=pa(e),n=Math.ceil(tt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Un(Ft(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:At(Un(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):At(...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 Av({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Ad({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 Ad({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 Tv(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 Ad 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 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=Tv(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 At(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Ps(a),_n(a.toLowerCase(),o?32:0)}if(n==="string")return pa(r);if(n==="bytes")return r;if(n==="bool")return _n(Bf(r),o?32:1);const s=n.match(Pd);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 Un(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":At(...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(`
|
|
82
|
+
`)),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 Ai{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),kn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen: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),zn=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,zn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,zn),o),c=e.mul(s,e.sub(i,e.ONE));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%zn===We;)t/=zn,n++;let r=zn;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)/zn;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)/zn,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function 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?Pf(a,s):xo(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Sf(a):jn(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?Sf(e):jn(e),c=Ve(i,t-Fe)+Fe;return n?Pf(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 jn(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||((S,N,B)=>{const F=N.toAffine();return hs(Uint8Array.from([4]),n.toBytes(F.x),n.toBytes(F.y))}),s=t.fromBytes||(S=>{const N=S.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(S){const{a:N,b:B}=t,F=n.sqr(S),D=n.mul(F,S);return n.add(n.add(D,n.mul(S,N)),B)}function c(S,N){const B=n.sqr(N),F=i(S);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(S){return fa(S,Ne,t.n)}function f(S){const{allowedPrivateKeyLengths:N,nByteLength:B,wrapPrivateKey:F,n:D}=t;if(N&&typeof S!="bigint"){if(yo(S)&&(S=vo(S)),typeof S!="string"||!N.includes(S.length))throw new Error("invalid private key");S=S.padStart(B*2,"0")}let b;try{b=typeof S=="bigint"?S:jn(ct("private key",S,B))}catch{throw new Error("invalid private key, expected hex or "+B+" bytes, got "+typeof S)}return F&&(b=Ve(b,D)),br("private key",b,Ne,D),b}function p(S){if(!(S instanceof m))throw new Error("ProjectivePoint expected")}const d=Tf((S,N)=>{const{px:B,py:F,pz:D}=S;if(n.eql(D,n.ONE))return{x:B,y:F};const b=S.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=Tf(S=>{if(S.is0()){if(t.allowInfinityPoint&&!n.is0(S.py))return;throw new Error("bad point: ZERO")}const{x:N,y:B}=S.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(!S.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),A=n.mul(D,b);return A=n.add(A,A),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(A,v),O=n.mul(F,O),y=n.mul(N,y),A=n.sub(I,y),A=n.mul(N,A),A=n.add(A,O),O=n.add(I,I),I=n.add(O,I),I=n.add(I,y),I=n.mul(I,A),C=n.add(C,I),y=n.mul(b,g),y=n.add(y,y),I=n.mul(y,A),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 A=n.mul(B,b),T=n.mul(F,g),P=n.mul(D,v),L=n.add(B,F),j=n.add(b,g);L=n.mul(L,j),j=n.add(A,T),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(A,P),j=n.sub(j,z),z=n.add(F,D),C=n.add(g,v),z=n.mul(z,C),C=n.add(T,P),z=n.sub(z,C),I=n.mul(M,j),C=n.mul(y,P),I=n.add(C,I),C=n.sub(T,I),I=n.add(T,I),O=n.mul(C,I),T=n.add(A,A),T=n.add(T,A),P=n.mul(M,P),j=n.mul(y,j),T=n.add(T,P),P=n.sub(A,P),P=n.mul(M,P),j=n.add(j,P),A=n.mul(T,j),O=n.add(O,A),A=n.mul(z,j),C=n.mul(L,C),C=n.sub(C,A),A=n.mul(L,T),I=n.mul(z,I),I=n.add(I,A),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:A}=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(A)}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,A,T){const P=A.toAffine(),L=n.toBytes(P.x),j=hs;return wo("isCompressed",T),T?j(Uint8Array.from([A.hasEvenY()?2:3]),L):j(Uint8Array.from([4]),L,n.toBytes(P.y))},fromBytes(y){const A=y.length,T=y[0],P=y.subarray(1);if(A===i&&(T===2||T===3)){const L=jn(P);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(T&1)===1!==_&&(z=n.neg(z)),{x:L,y:z}}else if(A===c&&T===4){const L=n.fromBytes(P.subarray(0,n.BYTES)),j=n.fromBytes(P.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 "+A)}}});function h(y){const A=r>>Ne;return y>A}function m(y){return h(y)?a(-y):y}const w=(y,A,T)=>jn(y.slice(A,T));class ${constructor(A,T,P){br("r",A,Ne,r),br("s",T,Ne,r),this.r=A,this.s=T,P!=null&&(this.recovery=P),Object.freeze(this)}static fromCompact(A){const T=o;return A=ct("compactSignature",A,T*2),new $(w(A,0,T),w(A,T,2*T))}static fromDER(A){const{r:T,s:P}=tn.toSig(ct("DER",A));return new $(T,P)}assertValidity(){}addRecoveryBit(A){return new $(this.r,this.s,A)}recoverPublicKey(A){const{r:T,s:P,recovery:L}=this,j=D(ct("msgHash",A));if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");const z=L===2||L===3?T+t.n:T;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(P*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 A=o;return Za(this.r,A)+Za(this.s,A)}}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,A=l.BASE){return A._setWindowSize(y),A.multiply(BigInt(3)),A}};function S(y,A=!0){return l.fromPrivateKey(y).toRawBytes(A)}function N(y){if(typeof y=="bigint")return!1;if(y instanceof l)return!0;const T=ct("key",y).length,P=n.BYTES,L=P+1,j=2*P+1;if(!(t.allowedPrivateKeyLengths||o===L))return T===L||T===j}function B(y,A,T=!0){if(N(y)===!0)throw new Error("first arg must be private key");if(N(A)===!1)throw new Error("second arg must be public key");return l.fromHex(A).multiply(f(y)).toRawBytes(T)}const F=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const A=jn(y),T=y.length*8-s;return T>0?A>>BigInt(T):A},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,A,T=C){if(["recovered","canonical"].some(oe=>oe in T))throw new Error("sign() legacy options not supported");const{hash:P,randomBytes:L}=t;let{lowS:j,prehash:z,extraEntropy:_}=T;j==null&&(j=!0),y=ct("msgHash",y),qd(T),z&&(y=ct("prehashed msgHash",P(y)));const W=D(y),K=f(A),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),Se=pe;return j&&h(pe)&&(Se=m(pe),ee^=1),new $(se,Se,ee)}return{seed:H,k2sig:J}}const C={lowS:t.lowS,prehash:!1},O={lowS:t.lowS,prehash:!1};function I(y,A,T=C){const{seed:P,k2sig:L}=v(y,A,T),j=t;return iy(j.hash.outputLen,j.nByteLength,j.hmac)(P,L)}l.BASE._setWindowSize(8);function M(y,A,T,P=O){var ee;const L=y;A=ct("msgHash",A),T=ct("publicKey",T);const{lowS:j,prehash:z,format:_}=P;if(qd(P),"strict"in P)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(Se){if(!(Se instanceof tn.Err))throw Se}!G&&_!=="der"&&(G=$.fromCompact(L))}H=l.fromHex(T)}catch{return!1}if(!G||j&&G.hasHighS())return!1;z&&(A=t.hash(A));const{r:Z,s:J}=G,oe=D(A),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:S,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,S=ut(E,n,t)*l%t,N=ut(S,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 S6(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 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 S6(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 T6(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 S=0;S<u.length;S++){const{abi:N,address:B,args:F,functionName:D}=u[S];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(S=>X(e,Nt,"readContract")({...p===null?{code:ma}:{address:p},abi:ys,account:n,args:[S],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:c,functionName:"aggregate3",stateOverride:a}))),$=[];for(let S=0;S<w.length;S++){const N=w[S];if(N.status==="rejected"){if(!o)throw N.reason;for(let F=0;F<d[S].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[S][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=Rn({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,S=$.abi?$t($):$.data,N={...$,account:E,data:$.dataSuffix?Pt([S||"0x",$.dataSuffix]):S,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:S}=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"?Rn({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:S??"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 Ts(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 As({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 As({name:t});return{...a,...o?{hash:xr(a)}:{}}}function r0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Ts(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 Ts(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 Ts(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 As 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 At(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 As({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?At(s,i):s}function Er(e,t={}){return n0(e,t)}function o0(e,t,n){const r=Ts(e,t,n);if(r.type!=="function")throw new As({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 P=>{if(!P.data&&!P.abi)return;const{accessList:L}=await ld(e,{account:u.address,...P,data:P.abi?$t(P):P.data});return L.map(({address:j,storageKeys:z})=>z.length>0?j:null)})).then(P=>P.flat().filter(Boolean)):[],p=await nc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((P,L)=>({abi:[Er("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:P,from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]}]:[],{calls:[...o,{}].map(P=>({...P,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((P,L)=>({abi:[Er("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:P,from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((P,L)=>({to:P,abi:[Er("function decimals() returns (uint256)")],functionName:"decimals",from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((P,L)=>({to:P,abi:[Er("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Dt,nonce:L})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((P,L)=>({to:P,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,S,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(P=>P.status==="success"?kt(P.data):null),C=(w==null?void 0:w.calls)??[],O=($==null?void 0:$.calls)??[],I=[...C,...O].map(P=>P.status==="success"?kt(P.data):null),M=((E==null?void 0:E.calls)??[]).map(P=>P.status==="success"?P.result:null),y=((N==null?void 0:N.calls)??[]).map(P=>P.status==="success"?P.result:null),A=((S==null?void 0:S.calls)??[]).map(P=>P.status==="success"?P.result:null),T=[];for(const[P,L]of I.entries()){const j=v[P];if(typeof L!="bigint"||typeof j!="bigint")continue;const z=M[P-1],_=y[P-1],W=A[P-1],K=P===0?{address:L6,decimals:18,symbol:"ETH"}:{address:f[P-1],decimals:W||z?Number(z??1):void 0,symbol:_??void 0};T.some(G=>G.token.address===K.address)||T.push({token:K,value:{pre:j,post:L,diff:L-j}})}return{assetChanges:T,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 At(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):Te(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 Hn)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 Hn;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 Hn}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,So,"call")(l).catch(p=>{throw p instanceof Vl?new Hn:p});if(t1(f??"0x0"))return!0;throw new Hn}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 Hn:a})).startsWith("0x1626ba7e"))return!0;throw new Hn}class Hn 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=Ae(["watchBlockNumber",e.uid,t,n,i]);return vn(f,{onBlockNumber:r,onError:o},p=>Po(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=Ae(["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 S;if(!d)return;const E=kt((S=$.result)==null?void 0:S.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=Ae(["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:S}=Xf(),N=a?setTimeout(()=>{w==null||w(),m==null||m(),S(new bg({hash:o}))},a):void 0;return m=vn(u,{onReplaced:s,resolve:E,reject:S},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,Tt,"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=Ae(["watchBlocks",e.uid,t,n,r,l,a]);return vn(h,{onBlock:o,onError:s},m=>Po(async()=>{var w;try{const $=await X(e,Tt,"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 S=await X(e,Tt,"getBlock")({blockNumber:E,includeTransactions:l});m.onBlock(S,f),f=S}}((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,Tt,"getBlock")({blockTag:t,includeTransactions:l}).then(S=>{h&&m&&(o(S,void 0),m=!1)}).catch(s);const $=(()=>{if(e.transport.type==="fallback"){const S=e.transport.transports.find(N=>N.config.type==="webSocket"||N.config.type==="ipc");return S?S.value:e.transport}return e.transport})(),{unsubscribe:E}=await $.subscribe({params:["newHeads"],async onData(S){var B;if(!h)return;const N=await X(e,Tt,"getBlock")({blockNumber:(B=S.result)==null?void 0:B.number,includeTransactions:l}).catch(()=>{});h&&(o(N,f),m=!1,f=N)},onError(S){s==null||s(S)}});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=Ae(["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 S,N=!1;const B=Po(async()=>{var F;if(!N){try{S=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(S)D=await X(e,ws,"getFilterChanges")({filter:S});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){S&&D instanceof gn&&(N=!1),(F=$.onError)==null||F.call($,D)}},{emitOnBegin:!0,interval:l});return async()=>{S&&await X(e,vs,"uninstallFilter")({filter:S}),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})(),S=s??(o?[o]:void 0);let N=[];S&&(N=[S.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:S??[],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=Ae(["watchPendingTransactions",e.uid,t,s]);return vn(u,{onTransactions:r,onError:n},l=>{let f;const p=Po(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(`
|
|
83
|
+
- `).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=>So(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=>Sw(e,t),getBlobBaseFee:()=>Pw(e),getBlock:t=>Tt(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=>Aw(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=>P6(e,t),estimateMaxPriorityFeePerGas:t=>Fg(e,t),fillTransaction:t=>mf(e,t),getStorageAt:t=>$6(e,t),getTransaction:t=>tc(e,t),getTransactionConfirmations:t=>T6(e,t),getTransactionCount:t=>af(e,t),getTransactionReceipt:t=>$s(e,t),multicall:t=>A6(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,S=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!S)throw new a5;const N=Vw(S,{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:S,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:S});return C},retryCount:$,retryDelay:l,timeout:E,type:"http"},{fetchOptions:o,url:S})}}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=>{},[])}),xn="MPC",sc="EVM",p5="spot",a0="perpetual";/**
|
|
78
84
|
* @license lucide-react v0.540.0 - ISC
|
|
79
85
|
*
|
|
80
86
|
* This source code is licensed under the ISC license.
|
|
81
87
|
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const
|
|
88
|
+
*/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};/**
|
|
83
89
|
* @license lucide-react v0.540.0 - ISC
|
|
84
90
|
*
|
|
85
91
|
* This source code is licensed under the ISC license.
|
|
86
92
|
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/var
|
|
93
|
+
*/var g5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
88
94
|
* @license lucide-react v0.540.0 - ISC
|
|
89
95
|
*
|
|
90
96
|
* This source code is licensed under the ISC license.
|
|
91
97
|
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const
|
|
98
|
+
*/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]]));/**
|
|
93
99
|
* @license lucide-react v0.540.0 - ISC
|
|
94
100
|
*
|
|
95
101
|
* This source code is licensed under the ISC license.
|
|
96
102
|
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const
|
|
103
|
+
*/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};/**
|
|
98
104
|
* @license lucide-react v0.540.0 - ISC
|
|
99
105
|
*
|
|
100
106
|
* This source code is licensed under the ISC license.
|
|
101
107
|
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const Ld=Kv("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Fd=typeof document<"u"?v.useLayoutEffect:()=>{};var Ba;const Yv=(Ba=v.useInsertionEffect)!==null&&Ba!==void 0?Ba:Fd;function Xv(e){const t=v.useRef(null);return Yv(()=>{t.current=e},[e]),v.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const gn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},jn=e=>e&&"window"in e&&e.window===e?e:gn(e).defaultView||window;function Qv(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Jv(e){return Qv(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let ex=!1;function La(){return ex}function Rd(e,t){if(!La())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:Jv(n)?n=n.host:n=n.parentNode}return!1}const Fa=(e=document)=>{var t;if(!La())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Dd(e){return La()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function ms(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Ra(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function en(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Da=en(function(){return Ra(/^Mac/i)}),tx=en(function(){return Ra(/^iPhone/i)}),nx=en(function(){return Ra(/^iPad/i)||Da()&&navigator.maxTouchPoints>1}),rx=en(function(){return tx()||nx()});en(function(){return Da()||rx()}),en(function(){return ms(/AppleWebKit/i)&&!ox()});const ox=en(function(){return ms(/Chrome/i)}),sx=en(function(){return ms(/Android/i)});en(function(){return ms(/Firefox/i)});function jd(){let e=v.useRef(new Map),t=v.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=v.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=v.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return v.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ix(e){return e.mozInputSource===0&&e.isTrusted?!0:sx()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function _d(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function ax(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Ud(e){let t=v.useRef({isFocused:!1,observer:null});Fd(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Xv(r=>{e==null||e(r)});return v.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=_d(i);n(c)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let cx=!1,bo=null,ja=new Set,yo=new Map,_n=!1,_a=!1;const ux={Tab:!0,Escape:!0};function Ua(e,t){for(let n of ja)n(e,t)}function lx(e){return!(e.metaKey||!Da()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function gs(e){_n=!0,lx(e)&&(bo="keyboard",Ua("keyboard",e))}function nt(e){bo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(_n=!0,Ua("pointer",e))}function zd(e){ix(e)&&(_n=!0,bo="virtual")}function Hd(e){e.target===window||e.target===document||cx||!e.isTrusted||(!_n&&!_a&&(bo="virtual",Ua("virtual",e)),_n=!1,_a=!1)}function Wd(){_n=!1,_a=!0}function za(e){if(typeof window>"u"||typeof document>"u"||yo.get(jn(e)))return;const t=jn(e),n=gn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){_n=!0,r.apply(this,arguments)},n.addEventListener("keydown",gs,!0),n.addEventListener("keyup",gs,!0),n.addEventListener("click",zd,!0),t.addEventListener("focus",Hd,!0),t.addEventListener("blur",Wd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",nt,!0),n.addEventListener("pointermove",nt,!0),n.addEventListener("pointerup",nt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",nt,!0),n.addEventListener("mousemove",nt,!0),n.addEventListener("mouseup",nt,!0)),t.addEventListener("beforeunload",()=>{Vd(e)},{once:!0}),yo.set(t,{focus:r})}const Vd=(e,t)=>{const n=jn(e),r=gn(e);t&&r.removeEventListener("DOMContentLoaded",t),yo.has(n)&&(n.HTMLElement.prototype.focus=yo.get(n).focus,r.removeEventListener("keydown",gs,!0),r.removeEventListener("keyup",gs,!0),r.removeEventListener("click",zd,!0),n.removeEventListener("focus",Hd,!0),n.removeEventListener("blur",Wd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",nt,!0),r.removeEventListener("pointermove",nt,!0),r.removeEventListener("pointerup",nt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",nt,!0),r.removeEventListener("mousemove",nt,!0),r.removeEventListener("mouseup",nt,!0)),yo.delete(n))};function fx(e){const t=gn(e);let n;return t.readyState!=="loading"?za(e):(n=()=>{za(e)},t.addEventListener("DOMContentLoaded",n)),()=>Vd(e,n)}typeof document<"u"&&fx();function Gd(){return bo!=="pointer"}const dx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function px(e,t,n){let r=gn(n==null?void 0:n.target);const o=typeof window<"u"?jn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?jn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?jn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?jn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!dx.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!ux[n.key])}function hx(e,t,n){za(),v.useEffect(()=>{let r=(o,s)=>{px(!!(n!=null&&n.isTextInput),o,s)&&e(Gd())};return ja.add(r),()=>{ja.delete(r)}},t)}function mx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=v.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=Ud(s),c=v.useCallback(a=>{const u=gn(a.target),l=u?Fa(u):Fa();a.target===a.currentTarget&&l===Dd(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 gx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=v.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=jd(),a=v.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),u=Ud(a),l=v.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=gn(f.target),d=Fa(p);if(!s.current.isFocusWithin&&d===Dd(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&&!Rd(h,m.target)){let x=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});ax(x,h);let T=_d(x);a(T)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let bs=!1,ys=0;function Ha(){bs=!0,setTimeout(()=>{bs=!1},50)}function qd(e){e.pointerType==="touch"&&Ha()}function bx(){if(!(typeof document>"u"))return ys===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",qd):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Ha)),ys++,()=>{ys--,!(ys>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",qd):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Ha))}}function yx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=v.useState(!1),c=v.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;v.useEffect(bx,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=jd(),{hoverProps:l,triggerHoverEnd:f}=v.useMemo(()=>{let p=(m,x)=>{if(c.pointerType=x,o||x==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let T=m.currentTarget;c.target=T,a(gn(m.target),"pointerover",y=>{c.isHovered&&c.target&&!Rd(c.target,y.target)&&d(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:T,pointerType:x}),n&&n(!0),i(!0)},d=(m,x)=>{let T=c.target;c.pointerType="",c.target=null,!(x==="touch"||!c.isHovered||!T)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:T,pointerType:x}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{bs&&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&&!bs&&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 v.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function wx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=v.useRef({isFocused:!1,isFocusVisible:t||Gd()}),[s,i]=v.useState(!1),[c,a]=v.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=v.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=v.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);hx(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=mx({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=gx({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var vx=Object.defineProperty,xx=(e,t,n)=>t in e?vx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wa=(e,t,n)=>(xx(e,typeof t!="symbol"?t+"":t,n),n);let Ex=class{constructor(){Wa(this,"current",this.detect()),Wa(this,"handoffState","pending"),Wa(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Mt=new Ex;function wo(e){var t,n;return Mt.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Zd(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Et(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Zd(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Et();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 gr(){let[e]=v.useState(Et);return v.useEffect(()=>()=>e.dispose(),[e]),e}let be=(e,t)=>{Mt.isServer?v.useEffect(e,t):v.useLayoutEffect(e,t)};function Un(e){let t=v.useRef(e);return be(()=>{t.current=e},[e]),t}let ae=function(e){let t=Un(e);return v.useCallback((...n)=>t.current(...n),[t])};function Sx(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 Px(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function $x({disabled:e=!1}={}){let t=v.useRef(null),[n,r]=v.useState(!1),o=gr(),s=ae(()=>{t.current=null,r(!1),o.dispose()}),i=ae(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=wo(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Sx(u);r(Px(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Ax=v.createContext(void 0);function Va(){return v.useContext(Ax)}function Ga(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function rt(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,rt),r}var ws=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(ws||{}),bn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(bn||{});function Ke(){let e=Ox();return v.useCallback(t=>Tx({mergeRefs:e,...t}),[e])}function Tx({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??Cx;let a=Kd(t,e);if(s)return vs(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return vs(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return rt(l?0:1,{0(){return null},1(){return vs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return vs(a,n,r,i,c)}function vs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=qa(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,x=>`-${x.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(s===v.Fragment&&(Object.keys(yn(a)).length>0||Object.keys(yn(f)).length>0))if(!v.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(yn(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(yn(a)).concat(Object.keys(yn(f))).map(p=>` - ${p}`).join(`
|
|
108
|
+
*/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 En=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:En(e).defaultView||window;function E5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function S5(e){return E5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let P5=!1;function ac(){return P5}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:S5(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)}),T5=rn(function(){return uc(/^iPad/i)||lc()&&navigator.maxTouchPoints>1}),A5=rn(function(){return $5()||T5()});rn(function(){return lc()||A5()}),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=En(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=En(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=En(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=En(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=En(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=En(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(En(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 S0(e){var t,n;return(n=(t=Bs(e))==null?void 0:t.activeElement)!=null?n:null}function q5(e){return S0(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 Sn(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($n(a)).length>0||Object.keys($n(f)).length>0))if(!x.isValidElement(l)||Array.isArray(l)&&l.length>1||nx(l)){if(Object.keys($n(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($n(a)).concat(Object.keys($n(f))).map(p=>` - ${p}`).join(`
|
|
103
109
|
`),"","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(`
|
|
104
110
|
`)].join(`
|
|
105
|
-
`))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...T)=>Ga(d(...T),a.className):Ga(d,a.className),m=h?{className:h}:{},x=Kd(l.props,yn(qa(a,["ref"])));for(let T in f)T in x&&delete f[T];return v.cloneElement(l,Object.assign({},x,f,u,{ref:o(Nx(l),u.ref)},m))}return v.createElement(s,Object.assign({},qa(a,["ref"]),s!==v.Fragment&&u,s!==v.Fragment&&f),l)}function Ox(){let e=v.useRef([]),t=v.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Cx(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function Kd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function Yd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function ze(e){var t;return Object.assign(v.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function yn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function qa(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Nx(e){return v.version.split(".")[0]>="19"?e.props.ref:e.ref}function Ix(e,t,n){let[r,o]=v.useState(n),s=e!==void 0,i=v.useRef(s),c=v.useRef(!1),a=v.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,ae(u=>(s||o(u),t==null?void 0:t(u)))]}function Mx(e){let[t]=v.useState(e);return t}function Xd(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Jd(n,Qd(t,r),o);return n}function Qd(e,t){return e?e+"["+t+"]":t}function Jd(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Jd(e,Qd(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):Xd(n,t,e)}function kx(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Bx="span";var Za=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Za||{});function Lx(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 Ke()({ourProps:s,theirProps:o,slot:{},defaultTag:Bx,name:"Hidden"})}let ep=ze(Lx),Fx=v.createContext(null);function Rx({children:e}){let t=v.useContext(Fx);if(!t)return v.createElement(v.Fragment,null,e);let{target:n}=t;return n?ke.createPortal(v.createElement(v.Fragment,null,e),n):null}function Dx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=v.useState(null),c=gr();return v.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),v.createElement(Rx,null,v.createElement(jx,{setForm:i,formId:t}),Xd(e).map(([a,u])=>v.createElement(ep,{features:Za.Hidden,...yn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function jx({setForm:e,formId:t}){return v.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:v.createElement(ep,{features:Za.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let _x=v.createContext(void 0);function tp(){return v.useContext(_x)}function Ka(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function xs(e){return Ka(e)&&"tagName"in e}function tn(e){return xs(e)&&"accessKey"in e}function br(e){return xs(e)&&"tabIndex"in e}function Ux(e){return xs(e)&&"style"in e}function zx(e){return tn(e)&&e.nodeName==="IFRAME"}function np(e){return tn(e)&&e.nodeName==="INPUT"}function rp(e){return tn(e)&&e.nodeName==="LABEL"}function Hx(e){return tn(e)&&e.nodeName==="FIELDSET"}function op(e){return tn(e)&&e.nodeName==="LEGEND"}function Wx(e){return xs(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Vx(e){let t=e.parentElement,n=null;for(;t&&!Hx(t);)op(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Gx(n)?!1:r}function Gx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(op(t))return!1;t=t.previousElementSibling}return!0}let sp=Symbol();function qx(e,t=!0){return Object.assign(e,{[sp]:t})}function ot(...e){let t=v.useRef(e);v.useEffect(()=>{t.current=e},[e]);let n=ae(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[sp]))?void 0:n}let Ya=v.createContext(null);Ya.displayName="DescriptionContext";function ip(){let e=v.useContext(Ya);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ip),t}return e}function Zx(){var e,t;return(t=(e=v.useContext(Ya))==null?void 0:e.value)!=null?t:void 0}let Kx="p";function Yx(e,t){let n=v.useId(),r=Va(),{id:o=`headlessui-description-${n}`,...s}=e,i=ip(),c=ot(t);be(()=>i.register(o),[o,i.register]);let a=r||!1,u=v.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Ke()({ourProps:l,theirProps:s,slot:u,defaultTag:Kx,name:i.name||"Description"})}let Xx=ze(Yx);Object.assign(Xx,{});var Oe=(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))(Oe||{});let Es=v.createContext(null);Es.displayName="LabelContext";function ap(){let e=v.useContext(Es);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ap),t}return e}function cp(e){var t,n,r;let o=(n=(t=v.useContext(Es))==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 Qx({inherit:e=!1}={}){let t=cp(),[n,r]=v.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,v.useMemo(()=>function(s){let i=ae(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=v.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return v.createElement(Es.Provider,{value:c},s.children)},[r])]}let Jx="label";function eE(e,t){var n;let r=v.useId(),o=ap(),s=tp(),i=Va(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=ot(t);be(()=>o.register(c),[c,o.register]);let p=ae(x=>{let T=x.currentTarget;if(!(x.target!==x.currentTarget&&Wx(x.target))&&(rp(T)&&x.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(x),rp(T))){let y=document.getElementById(T.htmlFor);if(y){let A=y.getAttribute("disabled");if(A==="true"||A==="")return;let B=y.getAttribute("aria-disabled");if(B==="true"||B==="")return;(np(y)&&(y.type==="file"||y.type==="radio"||y.type==="checkbox")||y.role==="radio"||y.role==="checkbox"||y.role==="switch")&&y.click(),y.focus({preventScroll:!0})}}}),d=i||!1,h=v.useMemo(()=>({...o.slot,disabled:d}),[o.slot,d]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Ke()({ourProps:m,theirProps:l,slot:h,defaultTag:a?Jx:"div",name:o.name||"Label"})}let tE=ze(eE),nE=Object.assign(tE,{});function rE(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 oE(e=rE){return v.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function sE(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function iE(e,t=!1){let[n,r]=v.useReducer(()=>({}),{}),o=v.useMemo(()=>sE(e),[e,n]);return be(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let up=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 aE=Object.defineProperty,cE=(e,t,n)=>t in e?aE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uE=(e,t,n)=>(cE(e,t+"",n),n),lp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},st=(e,t,n)=>(lp(e,t,"read from private field"),n?n.call(e):t.get(e)),Xa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},fp=(e,t,n,r)=>(lp(e,t,"write to private field"),t.set(e,n),n),kt,vo,xo;let dp=class{constructor(t){Xa(this,kt,{}),Xa(this,vo,new up(()=>new Set)),Xa(this,xo,new Set),uE(this,"disposables",Et()),fp(this,kt,t),Mt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return st(this,kt)}subscribe(t,n){if(Mt.isServer)return()=>{};let r={selector:t,callback:n,current:t(st(this,kt))};return st(this,xo).add(r),this.disposables.add(()=>{st(this,xo).delete(r)})}on(t,n){return Mt.isServer?()=>{}:(st(this,vo).get(t).add(n),this.disposables.add(()=>{st(this,vo).get(t).delete(n)}))}send(t){let n=this.reduce(st(this,kt),t);if(n!==st(this,kt)){fp(this,kt,n);for(let r of st(this,xo)){let o=r.selector(st(this,kt));pp(r.current,o)||(r.current=o,r.callback(o))}for(let r of st(this,vo).get(t.type))r(st(this,kt),t)}}};kt=new WeakMap,vo=new WeakMap,xo=new WeakMap;function pp(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Qa(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Qa(e.entries(),t.entries()):hp(e)&&hp(t)?Qa(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Qa(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function hp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ja(e){let[t,n]=e(),r=Et();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var lE=Object.defineProperty,fE=(e,t,n)=>t in e?lE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t,n)=>(fE(e,typeof t!="symbol"?t+"":t,n),n),gp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(gp||{});let dE={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}}},pE=class X0 extends dp{constructor(){super(...arguments),mp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),mp(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new X0({stack:[]})}reduce(t,n){return rt(n.type,dE,t,n)}};const ec=new up(()=>pE.new());var tc={exports:{}},nc={};/**
|
|
111
|
+
`))}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,$n(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 T0(...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 $n(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))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)&&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 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}),A0(e).map(([a,u])=>x.createElement(C0,{features:vc.Hidden,...$n({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 Sr(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=Sn({...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 Sx=Ge(Ex);Object.assign(Sx,{});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 Px({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 Tx(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 S=$.getAttribute("aria-disabled");if(S==="true"||S==="")return;(k0($)&&($.type==="file"||$.type==="radio"||$.type==="checkbox")||$.role==="radio"||$.role==="checkbox"||$.role==="switch")&&$.click(),$.focus({preventScroll:!0})}}}),d=Sn({...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 Ax=Ge(Tx),Ox=Object.assign(Ax,{});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:Sc(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Sc(e.entries(),t.entries()):Z0(e)&&Z0(t)?Sc(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Sc(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 Pc(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 Tc={exports:{}},Ac={};/**
|
|
106
112
|
* @license React
|
|
107
113
|
* use-sync-external-store-with-selector.production.js
|
|
108
114
|
*
|
|
@@ -110,7 +116,7 @@ ${Eb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
110
116
|
*
|
|
111
117
|
* This source code is licensed under the MIT license found in the
|
|
112
118
|
* LICENSE file in the root directory of this source tree.
|
|
113
|
-
*/var
|
|
119
|
+
*/var X0;function _x(){if(X0)return Ac;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 Ac.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 S=F}return S=B}if(F=S,n(E,B))return F;var D=f(B);return p!==void 0&&p(F,D)?(E=B,F):(E=B,S=D)}var $=!1,E,S,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},Ac}var Oc={};/**
|
|
114
120
|
* @license React
|
|
115
121
|
* use-sync-external-store-with-selector.development.js
|
|
116
122
|
*
|
|
@@ -118,49 +124,49 @@ ${Eb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
118
124
|
*
|
|
119
125
|
* This source code is licensed under the MIT license found in the
|
|
120
126
|
* LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/var yp;function mE(){return yp||(yp=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=v,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;rc.useSyncExternalStoreWithSelector=function(a,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 x(L){if(!T){if(T=!0,y=L,L=f(L),p!==void 0&&h.hasValue){var _=h.value;if(p(_,L))return A=_}return A=L}if(_=A,n(y,L))return _;var j=f(L);return p!==void 0&&p(_,j)?(y=L,_):(y=L,A=j)}var T=!1,y,A,B=l===void 0?null:l;return[function(){return x(u())},B===null?void 0:function(){return x(B())}]},[u,l,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),rc}process.env.NODE_ENV==="production"?tc.exports=hE():tc.exports=mE();var gE=tc.exports;function it(e,t,n=pp){return gE.useSyncExternalStoreWithSelector(ae(r=>e.subscribe(bE,r)),ae(()=>e.state),ae(()=>e.state),ae(t),n)}function bE(e){return e}function wp(e,t){let n=v.useId(),r=ec.get(t),[o,s]=it(r,v.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return be(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let oc=new Map,Eo=new Map;function vp(e){var t;let n=(t=Eo.get(e))!=null?t:0;return Eo.set(e,n+1),n!==0?()=>xp(e):(oc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>xp(e))}function xp(e){var t;let n=(t=Eo.get(e))!=null?t:1;if(n===1?Eo.delete(e):Eo.set(e,n-1),n!==1)return;let r=oc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,oc.delete(e))}function yE(e,{allowed:t,disallowed:n}={}){let r=wp(e,"inert-others");be(()=>{var o,s;if(!r)return;let i=Et();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(vp(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=wo(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(vp(f));l=l.parentElement}}return i.dispose},[r,t,n])}function wE(e,t,n){let r=Un(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});v.useEffect(()=>{if(!e)return;let o=t===null?null:tn(t)?t:t.current;if(!o)return;let s=Et();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let sc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),vE=["[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||{}),xE=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(xE||{}),EE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(EE||{});function Ep(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(sc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function SE(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(vE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ac=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ac||{});function Sp(e,t=0){var n;return e===((n=wo(e))==null?void 0:n.body)?!1:rt(t,{0(){return e.matches(sc)},1(){let r=e;for(;r!==null;){if(r.matches(sc))return!0;r=r.parentElement}return!1}})}var PE=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(PE||{});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 $E=["textarea","input"].join(",");function AE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,$E))!=null?n:!1}function Pp(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function TE(e,t){return OE(Ep(),t,{relativeTo:e})}function OE(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?Pp(e):e:t&64?SE(e):Ep(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??s.activeElement;let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,p;do{if(l>=f||l+f<=0)return 0;let d=a+l;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(u),l+=c}while(p!==s.activeElement);return t&6&&AE(p)&&p.select(),2}function $p(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function CE(){return/Android/gi.test(window.navigator.userAgent)}function Ap(){return $p()||CE()}function yr(e,t,n,r){let o=Un(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function NE(e,t,n,r){let o=Un(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Tp=30;function IE(e,t,n){let r=Un(n),o=v.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!Sp(u,ac.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=v.useRef(null);yr(e,"pointerdown",c=>{var a,u;Ap()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),yr(e,"pointerup",c=>{if(Ap()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=v.useRef({x:0,y:0});yr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),yr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Tp||Math.abs(a.y-i.current.y)>=Tp))return o(c,()=>br(c.target)?c.target:null)},!0),NE(e,"blur",c=>o(c,()=>zx(window.document.activeElement)?window.document.activeElement:null),!0)}function cc(...e){return v.useMemo(()=>wo(...e),[...e])}var ME=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(ME||{});const Ss={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},kE=200,Op=5;function BE(e,{trigger:t,action:n,close:r,select:o}){let s=v.useRef(null),i=v.useRef(null),c=v.useRef(null);yr(e&&t!==null,"pointerdown",a=>{Ka(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),yr(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!br(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<Op&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<Op)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>kE&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function LE(e,t){return v.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function FE(e){return v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function RE(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function DE(){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 jE(){return $p()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=Et();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(br(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);br(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(br(c.target)&&Ux(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(br(c.target)){if(np(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function _E(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function UE(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let zn=RE(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Et(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:UE(n)},o=[jE(),DE(),_E()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});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 zE(e,t,n=()=>({containers:[]})){let r=FE(zn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return be(()=>{if(!(!t||!e))return zn.dispatch("PUSH",t,n),()=>zn.dispatch("POP",t,n)},[e,t]),s}function HE(e,t,n=()=>[document.body]){let r=wp(e,"scroll-lock");zE(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Cp(e){return[e.screenX,e.screenY]}function WE(){let e=v.useRef([-1,-1]);return{wasMoved(t){let n=Cp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Cp(t)}}}function VE(e=0){let[t,n]=v.useState(e),r=v.useCallback(a=>n(a),[t]),o=v.useCallback(a=>n(u=>u|a),[t]),s=v.useCallback(a=>(t&a)===a,[t]),i=v.useCallback(a=>n(u=>u&~a),[n]),c=v.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var Np,Ip;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Np=process==null?void 0:process.env)==null?void 0:Np.NODE_ENV)==="test"&&typeof((Ip=Element==null?void 0:Element.prototype)==null?void 0:Ip.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
122
|
-
`)),[]});var
|
|
123
|
-
* tabbable 6.
|
|
127
|
+
*/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 S=F}return S=B}if(F=S,n(E,B))return F;var D=f(B);return p!==void 0&&p(F,D)?(E=B,F):(E=B,S=D)}var $=!1,E,S,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"?Tc.exports=_x():Tc.exports=Ux();var zx=Tc.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!==S0(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 Pr(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);Pr(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),Pr(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});Pr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Pr(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,()=>Sr(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);Pr(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)}),Pr(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Sr(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(Sr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Sr(l)&&!r(l)&&(i=l)}catch{}},!0),t.group(c=>{t.addEventListener(e,"touchstart",a=>{if(c.dispose(),Sr(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(Sr(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(`
|
|
128
|
+
`)),[]});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 S2=new Set(["table","td","th"]);function P2(e){return S2.has($r(e))}const $2=[":popover-open",":modal"];function Us(e){return $2.some(t=>{try{return e.matches(t)}catch{return!1}})}const T2=["transform","translate","scale","rotate","perspective"],A2=["transform","translate","scale","rotate","perspective","filter"],O2=["paint","layout","strict","content"];function Fc(e){const t=zs(),n=fe(e)?ht(e):e;return T2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||A2.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 Tn(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?Tn(c):[])}return t.concat(o,Tn(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 Tr(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=Tr(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=Tr(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}}/*!
|
|
129
|
+
* tabbable 6.3.0
|
|
124
130
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
125
|
-
*/var g2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],bc=g2.join(","),jp=typeof Element>"u",$o=jp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Is=!jp&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Ms=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&e(t.parentNode);return i},b2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},y2=function(t,n,r){if(Ms(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(bc));return n&&$o.call(t,bc)&&o.unshift(t),o=o.filter(r),o},w2=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Ms(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=$o.call(i,bc);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Ms(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},_p=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Up=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||b2(t))&&!_p(t)?0:t.tabIndex},v2=function(t,n){var r=Up(t);return r<0&&n&&!_p(t)?0:r},x2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},zp=function(t){return t.tagName==="INPUT"},E2=function(t){return zp(t)&&t.type==="hidden"},S2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},P2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},$2=function(t){if(!t.name)return!0;var n=t.form||Is(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=P2(o,t.form);return!s||s===t},A2=function(t){return zp(t)&&t.type==="radio"},T2=function(t){return A2(t)&&!$2(t)},O2=function(t){var n,r=t&&Is(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=Is(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},Hp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},C2=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=$o.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if($o.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,u=Is(t);if(a&&!a.shadowRoot&&o(a)===!0)return Hp(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(O2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Hp(t);return!1},N2=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 $o.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},I2=function(t,n){return!(n.disabled||Ms(n)||E2(n)||C2(n,t)||S2(n)||N2(n))},Wp=function(t,n){return!(T2(n)||Up(n)<0||!I2(t,n))},M2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},k2=function e(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?e(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(x2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Vp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=w2([t],n.includeContainer,{filter:Wp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:M2}):r=y2(t,n.includeContainer,Wp.bind(null,n)),k2(r)};function Gp(e,t,n){let{reference:r,floating:o}=e;const s=sn(t),i=mc(t),c=hc(i),a=vn(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(vr(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const B2=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}=Gp(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:x,fn:T}=c[m],{x:y,y:A,data:B,reset:L}=await T({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=y??l,f=A??f,d={...d,[x]:{...d[x],...B}},L&&h<=50&&(h++,typeof L=="object"&&(L.placement&&(p=L.placement),L.rects&&(u=L.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:l,y:f}=Gp(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function ks(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}=Hn(t,e),h=Dp(d),x=c[p?f==="floating"?"reference":"floating":f],T=Ns(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:l,strategy:a})),y=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Ns(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:A,strategy:a}):y);return{top:(T.top-L.top+h.top)/B.y,bottom:(L.bottom-T.bottom+h.bottom)/B.y,left:(T.left-L.left+h.left)/B.x,right:(L.right-T.right+h.right)/B.x}}const L2=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}=Hn(e,t)||{};if(u==null)return{};const f=Dp(l),p={x:n,y:r},d=mc(o),h=hc(d),m=await i.getDimensions(u),x=d==="y",T=x?"top":"left",y=x?"bottom":"right",A=x?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[d]-p[d]-s.floating[h],L=p[d]-s.reference[d],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=_?_[A]:0;(!j||!await(i.isElement==null?void 0:i.isElement(_)))&&(j=c.floating[A]||s.floating[h]);const g=B/2-L/2,w=j/2-m[h]/2-1,$=on(f[T],w),I=on(f[y],w),C=$,P=j-m[h]-I,S=j/2-m[h]/2+g,E=pc(C,S,P),O=!a.arrow&&vr(o)!=null&&S!==E&&s.reference[h]/2-(S<C?$:I)-m[h]/2<0,N=O?S<C?S-C:S-P:0;return{[d]:p[d]+N,data:{[d]:E,centerOffset:S-E-N,...O&&{alignmentOffset:N}},reset:O}}}),F2=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=Hn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const T=vn(o),y=sn(c),A=vn(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(u.floating)),L=p||(A||!m?[Cs(c)]:l2(c)),_=h!=="none";!p&&_&&L.push(...h2(c,m,h,B));const j=[c,...L],g=await ks(t,x),w=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(g[T]),f){const S=u2(o,i,B);w.push(g[S[0]],g[S[1]])}if($=[...$,{placement:o,overflows:w}],!w.every(S=>S<=0)){var I,C;const S=(((I=s.flip)==null?void 0:I.index)||0)+1,E=j[S];if(E&&(!(f==="alignment"?y!==sn(E):!1)||$.every(b=>sn(b.placement)===y?b.overflows[0]>0:!0)))return{data:{index:S,overflows:$},reset:{placement:E}};let O=(C=$.filter(N=>N.overflows[0]<=0).sort((N,b)=>N.overflows[1]-b.overflows[1])[0])==null?void 0:C.placement;if(!O)switch(d){case"bestFit":{var P;const N=(P=$.filter(b=>{if(_){const k=sn(b.placement);return k===y||k==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(k=>k>0).reduce((k,R)=>k+R,0)]).sort((b,k)=>b[1]-k[1])[0])==null?void 0:P[0];N&&(O=N);break}case"initialPlacement":O=c;break}if(o!==O)return{reset:{placement:O}}}return{}}}},R2=new Set(["left","top"]);async function D2(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=vn(n),c=vr(n),a=sn(n)==="y",u=R2.has(i)?-1:1,l=s&&a?-1:1,f=Hn(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 j2=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 D2(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}}}}},_2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:x=>{let{x:T,y}=x;return{x:T,y}}},...a}=Hn(e,t),u={x:n,y:r},l=await ks(t,a),f=sn(vn(o)),p=Lp(f);let d=u[p],h=u[f];if(s){const x=p==="y"?"top":"left",T=p==="y"?"bottom":"right",y=d+l[x],A=d-l[T];d=pc(y,d,A)}if(i){const x=f==="y"?"top":"left",T=f==="y"?"bottom":"right",y=h+l[x],A=h-l[T];h=pc(y,h,A)}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}}}}}},U2=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}=Hn(e,t),l=await ks(t,u),f=vn(o),p=vr(o),d=sn(o)==="y",{width:h,height:m}=s.floating;let x,T;f==="top"||f==="bottom"?(x=f,T=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(T=f,x=p==="end"?"top":"bottom");const y=m-l.top-l.bottom,A=h-l.left-l.right,B=on(m-l[x],y),L=on(h-l[T],A),_=!t.middlewareData.shift;let j=B,g=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=A),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=y),_&&!p){const $=Me(l.left,0),I=Me(l.right,0),C=Me(l.top,0),P=Me(l.bottom,0);d?g=h-2*($!==0||I!==0?$+I:Me(l.left,l.right)):j=m-2*(C!==0||P!==0?C+P:Me(l.top,l.bottom))}await a({...t,availableWidth:g,availableHeight:j});const w=await i.getDimensions(c.floating);return h!==w.width||m!==w.height?{reset:{rects:!0}}:{}}}};function qp(e){const t=at(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Fe(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Po(n)!==s||Po(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function yc(e){return ue(e)?e:e.contextElement}function xr(e){const t=yc(e);if(!Fe(t))return Lt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=qp(t);let i=(s?Po(n.width):n.width)/r,c=(s?Po(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const z2=Lt(0);function Zp(e){const t=He(e);return!As()||!t.visualViewport?z2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function H2(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==He(e)?!1:t}function Wn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=yc(e);let i=Lt(1);t&&(r?ue(r)&&(i=xr(r)):i=xr(e));const c=H2(s,n,r)?Zp(s):Lt(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=He(s),d=r&&ue(r)?He(r):r;let h=p,m=dc(h);for(;m&&r&&d!==h;){const x=xr(m),T=m.getBoundingClientRect(),y=at(m),A=T.left+(m.clientLeft+parseFloat(y.paddingLeft))*x.x,B=T.top+(m.clientTop+parseFloat(y.paddingTop))*x.y;a*=x.x,u*=x.y,l*=x.x,f*=x.y,a+=A,u+=B,h=He(m),m=dc(h)}}return Ns({width:l,height:f,x:a,y:u})}function Bs(e,t){const n=Ts(e).scrollLeft;return t?t.left+n:Wn(Bt(e)).left+n}function Kp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Bs(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function W2(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Bt(r),c=t?$s(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Lt(1);const l=Lt(0),f=Fe(r);if((f||!f&&!s)&&((wr(r)!=="body"||So(i))&&(a=Ts(r)),Fe(r))){const d=Wn(r);u=xr(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?Kp(i,a):Lt(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 V2(e){return Array.from(e.getClientRects())}function G2(e){const t=Bt(e),n=Ts(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Bs(e);const c=-n.scrollTop;return at(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Yp=25;function q2(e,t){const n=He(e),r=Bt(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=As();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Bs(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<=Yp&&(s-=h)}else u<=Yp&&(s+=u);return{width:s,height:i,x:c,y:a}}const Z2=new Set(["absolute","fixed"]);function K2(e,t){const n=Wn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Fe(e)?xr(e):Lt(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 Xp(e,t,n){let r;if(t==="viewport")r=q2(e,n);else if(t==="document")r=G2(Bt(e));else if(ue(t))r=K2(t,n);else{const o=Zp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ns(r)}function Qp(e,t){const n=rn(e);return n===t||!ue(n)||nn(n)?!1:at(n).position==="fixed"||Qp(n,t)}function Y2(e,t){const n=t.get(e);if(n)return n;let r=wn(e,[],!1).filter(c=>ue(c)&&wr(c)!=="body"),o=null;const s=at(e).position==="fixed";let i=s?rn(e):e;for(;ue(i)&&!nn(i);){const c=at(i),a=fc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&Z2.has(o.position)||So(i)&&!a&&Qp(e,i))?r=r.filter(l=>l!==i):o=c,i=rn(i)}return t.set(e,r),r}function X2(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?$s(t)?[]:Y2(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Xp(t,l,o);return u.top=Me(f.top,u.top),u.right=on(f.right,u.right),u.bottom=on(f.bottom,u.bottom),u.left=Me(f.left,u.left),u},Xp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Q2(e){const{width:t,height:n}=qp(e);return{width:t,height:n}}function J2(e,t,n){const r=Fe(t),o=Bt(t),s=n==="fixed",i=Wn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Lt(0);function u(){a.x=Bs(o)}if(r||!r&&!s)if((wr(t)!=="body"||So(o))&&(c=Ts(t)),r){const d=Wn(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?Kp(o,c):Lt(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 wc(e){return at(e).position==="static"}function Jp(e,t){if(!Fe(e)||at(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Bt(e)===n&&(n=n.ownerDocument.body),n}function eh(e,t){const n=He(e);if($s(e))return n;if(!Fe(e)){let o=rn(e);for(;o&&!nn(o);){if(ue(o)&&!wc(o))return o;o=rn(o)}return n}let r=Jp(e,t);for(;r&&QE(r)&&wc(r);)r=Jp(r,t);return r&&nn(r)&&wc(r)&&!fc(r)?n:r||r2(e)||n}const e6=async function(e){const t=this.getOffsetParent||eh,n=this.getDimensions,r=await n(e.floating);return{reference:J2(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function t6(e){return at(e).direction==="rtl"}const n6={convertOffsetParentRelativeRectToViewportRelativeRect:W2,getDocumentElement:Bt,getClippingRect:X2,getOffsetParent:eh,getElementRects:e6,getClientRects:V2,getDimensions:Q2,getScale:xr,isElement:ue,isRTL:t6};function th(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function r6(e,t){let n=null,r;const o=Bt(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=Os(f),m=Os(o.clientWidth-(l+p)),x=Os(o.clientHeight-(f+d)),T=Os(l),A={rootMargin:-h+"px "+-m+"px "+-x+"px "+-T+"px",threshold:Me(0,on(1,a))||1};let B=!0;function L(_){const j=_[0].intersectionRatio;if(j!==a){if(!B)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!th(u,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(L,{...A,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return i(!0),s}function nh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=yc(e),l=o||s?[...u?wn(u):[],...wn(t)]:[];l.forEach(T=>{o&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});const f=u&&c?r6(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(T=>{let[y]=T;y&&y.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var A;(A=d)==null||A.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?Wn(e):null;a&&x();function x(){const T=Wn(e);m&&!th(m,T)&&n(),m=T,h=requestAnimationFrame(x)}return n(),()=>{var T;l.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f==null||f(),(T=d)==null||T.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const vc=ks,o6=j2,s6=_2,i6=F2,a6=U2,rh=L2,c6=(e,t,n)=>{const r=new Map,o={platform:n6,...n},s={...o.platform,_c:r};return B2(e,t,{...o,platform:s})};var u6=typeof document<"u",l6=function(){},Ls=u6?v.useLayoutEffect:l6;function Fs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fs(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Fs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function oh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sh(e,t){const n=oh(e);return Math.round(t*n)/n}function xc(e){const t=z.useRef(e);return Ls(()=>{t.current=e}),t}function ih(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,f]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=z.useState(r);Fs(p,r)||d(r);const[h,m]=z.useState(null),[x,T]=z.useState(null),y=z.useCallback(b=>{b!==_.current&&(_.current=b,m(b))},[]),A=z.useCallback(b=>{b!==j.current&&(j.current=b,T(b))},[]),B=s||h,L=i||x,_=z.useRef(null),j=z.useRef(null),g=z.useRef(l),w=a!=null,$=xc(a),I=xc(o),C=xc(u),P=z.useCallback(()=>{if(!_.current||!j.current)return;const b={placement:t,strategy:n,middleware:p};I.current&&(b.platform=I.current),c6(_.current,j.current,b).then(k=>{const R={...k,isPositioned:C.current!==!1};S.current&&!Fs(g.current,R)&&(g.current=R,Or.flushSync(()=>{f(R)}))})},[p,t,n,I,C]);Ls(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(b=>({...b,isPositioned:!1})))},[u]);const S=z.useRef(!1);Ls(()=>(S.current=!0,()=>{S.current=!1}),[]),Ls(()=>{if(B&&(_.current=B),L&&(j.current=L),B&&L){if($.current)return $.current(B,L,P);P()}},[B,L,P,$,w]);const E=z.useMemo(()=>({reference:_,floating:j,setReference:y,setFloating:A}),[y,A]),O=z.useMemo(()=>({reference:B,floating:L}),[B,L]),N=z.useMemo(()=>{const b={position:n,left:0,top:0};if(!O.floating)return b;const k=sh(O.floating,l.x),R=sh(O.floating,l.y);return c?{...b,transform:"translate("+k+"px, "+R+"px)",...oh(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:R}},[n,c,O.floating,l.x,l.y]);return z.useMemo(()=>({...l,update:P,refs:E,elements:O,floatingStyles:N}),[l,P,E,O,N])}const f6=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?rh({element:r.current,padding:o}).fn(n):{}:r?rh({element:r,padding:o}).fn(n):{}}}},Ec=(e,t)=>({...o6(e),options:[e,t]}),ah=(e,t)=>({...s6(e),options:[e,t]}),ch=(e,t)=>({...i6(e),options:[e,t]}),d6=(e,t)=>({...a6(e),options:[e,t]}),p6=(e,t)=>({...f6(e),options:[e,t]}),uh={...z},h6=uh.useInsertionEffect||(e=>e());function lh(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return h6(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var Sc=typeof document<"u"?v.useLayoutEffect:v.useEffect;let fh=!1,m6=0;const dh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+m6++;function g6(){const[e,t]=z.useState(()=>fh?dh():void 0);return Sc(()=>{e==null&&t(dh())},[]),z.useEffect(()=>{fh=!0},[]),e}const b6=uh.useId||g6;let Ao;process.env.NODE_ENV!=="production"&&(Ao=new Set);function y6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.warn(o)}}function w6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.error(o)}}function v6(){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 x6=z.createContext(null),E6=z.createContext(null),S6=()=>{var e;return((e=z.useContext(x6))==null?void 0:e.id)||null},P6=()=>z.useContext(E6),$6="data-floating-ui-focusable";function A6(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=b6(),s=z.useRef({}),[i]=z.useState(()=>v6()),c=S6()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ue(d)&&w6("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]=z.useState(r.reference),l=lh((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:u}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function T6(e){e===void 0&&(e={});const{nodeId:t}=e,n=A6({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=P6();Sc(()=>{l&&(f.current=l)},[l]);const d=ih({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(A=>{const B=ue(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),contextElement:A}:A;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(A=>{(ue(A)||A===null)&&(f.current=A,i(A)),(ue(d.refs.reference.current)||d.refs.reference.current===null||A!==null&&!ue(A))&&d.refs.setReference(A)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),T=z.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),y=z.useMemo(()=>({...d,...r,refs:x,elements:T,nodeId:t}),[d,x,T,t,r]);return Sc(()=>{r.dataRef.current.floatingContext=y;const A=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);A&&(A.context=y)}),z.useMemo(()=>({...d,context:y,refs:x,elements:T}),[d,x,T,y])}const ph="active",hh="selected";function Pc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[ph]:i,[hh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[$6]:""},...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&&[ph,hh].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(x=>x(...h)).find(x=>x!==void 0)}}}else i[u]=l}),i),{})}}function O6(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Pc(c,e,"reference"),t),s=z.useCallback(c=>Pc(c,e,"floating"),n),i=z.useCallback(c=>Pc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function mh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const C6=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Hn(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,x=p.clientTop!==0,T=h.clientTop!==0,y=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||y6('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const A={...t,...await Ec(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},B=await vc(mh(A,h.scrollHeight+m+p.clientTop),l),L=await vc(A,{...l,elementContext:"reference"}),_=Me(0,B.top),j=A.y+_,$=(h.scrollHeight>h.clientHeight?I=>I:Po)(Me(0,h.scrollHeight+(x&&y||T?m*2:0)-_-Me(0,B.bottom)));if(h.style.maxHeight=$+"px",h.scrollTop=_,o){const I=h.offsetHeight<d.offsetHeight*on(c,n.current.length)-1||L.top>=-a||L.bottom>=-a;Or.flushSync(()=>o(I))}return r&&(r.current=await vc(mh({...A,y:j},h.offsetHeight+m+p.clientTop),l)),{y:j}}});function N6(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=lh(c),u=z.useRef(!1),l=z.useRef(null),f=z.useRef(null);z.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const x=m.deltaY,T=s.current.top>=-.5,y=s.current.bottom>=-.5,A=h.scrollHeight-h.clientHeight,B=x<0?-1:1,L=x<0?"max":"min";h.scrollHeight<=h.clientHeight||(!T&&x>0||!y&&x<0?(m.preventDefault(),Or.flushSync(()=>{a(_=>_+Math[L](x,A*B))})):/firefox/i.test(s2())&&(h.scrollTop+=x))}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=z.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)&&Or.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:p}:{},[o,p])}let Er=v.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Er.displayName="FloatingContext";let $c=v.createContext(null);$c.displayName="PlacementContext";function I6(e){return v.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function M6(){return v.useContext(Er).setReference}function k6(){return v.useContext(Er).getReferenceProps}function B6(){let{getFloatingProps:e,slot:t}=v.useContext(Er);return v.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function L6(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=v.useContext($c),n=v.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);be(()=>{t==null||t(n??null)},[t,n]);let r=v.useContext(Er);return v.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let gh=4;function F6({children:e,enabled:t=!0}){let[n,r]=v.useState(null),[o,s]=v.useState(0),i=v.useRef(null),[c,a]=v.useState(null);R6(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=D6(n,c),[m,x="center"]=l.split(" ");be(()=>{u&&s(0)},[u]);let{refs:T,floatingStyles:y,context:A}=T6({open:u,placement:m==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${m}`:`${m}-${x}`,strategy:"absolute",transform:!1,middleware:[Ec({mainAxis:m==="selection"?0:f,crossAxis:p}),ah({padding:d}),m!=="selection"&&ch({padding:d}),m==="selection"&&h?C6({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:gh,referenceOverflowThreshold:d,onFallbackChange(I){var C,P;if(!I)return;let S=A.elements.floating;if(!S)return;let E=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,O=Math.min(gh,S.childElementCount),N=0,b=0;for(let k of(P=(C=A.elements.floating)==null?void 0:C.childNodes)!=null?P:[])if(tn(k)){let R=k.offsetTop,D=R+k.clientHeight+E,U=S.scrollTop,W=U+S.clientHeight;if(R>=U&&D<=W)O--;else{b=Math.max(0,Math.min(D,W)-Math.max(R,U)),N=k.clientHeight;break}}O>=1&&s(k=>{let R=N*O-b+E;return k>=R?k:R})}}):null,d6({padding:d,apply({availableWidth:I,availableHeight:C,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:nh}),[B=m,L=x]=A.placement.split("-");m==="selection"&&(B="selection");let _=v.useMemo(()=>({anchor:[B,L].filter(Boolean).join(" ")}),[B,L]),j=N6(A,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:w}=O6([j]),$=ae(I=>{a(I),T.setFloating(I)});return z.createElement($c.Provider,{value:r},z.createElement(Er.Provider,{value:{setFloating:$,setReference:T.setReference,styles:y,getReferenceProps:g,getFloatingProps:w,slot:_}},e))}function R6(e){be(()=>{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 D6(e,t){var n,r,o;let s=Ac((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Ac((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Ac((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Ac(e,t,n=void 0){let r=gr(),o=ae((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=yh(a,u);return[l,f=>{let p=bh(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[T,y]of p.entries()){let A=window.getComputedStyle(u).getPropertyValue(y);if(d[T]!==A){d[T]=A,m=!0;break}}if(!m)return;let x=yh(a,u);l!==x&&(f(x),l=x)})}return r.dispose}]}return[n,null]}),s=v.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=v.useState();return be(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function bh(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...bh(o)]:[r]}return[]}function yh(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function j6(e,t){let[n,r]=v.useState(t);return!e&&n!==t&&r(t),e?n:t}let Tc=v.createContext(null);Tc.displayName="OpenClosedContext";var St=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(St||{});function Oc(){return v.useContext(Tc)}function wh({value:e,children:t}){return v.createElement(Tc.Provider,{value:e},t)}function _6(e){throw new Error("Unexpected object: "+e)}var we=(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))(we||{});function Rs(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:_6(e)}}var vh=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(vh||{});function xh(e){let t=ae(e),n=v.useRef(!1);v.useEffect(()=>(n.current=!1,()=>{n.current=!0,Zd(()=>{n.current&&t()})}),[t])}function U6(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function Cc(){let e=U6(),[t,n]=z.useState(Mt.isHandoffComplete);return t&&Mt.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>Mt.handoff(),[]),e?!1:t}let z6=v.createContext(!1);function H6(){return v.useContext(z6)}function W6(e){let t=H6(),n=v.useContext(Sh),[r,o]=v.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Mt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return v.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),v.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Eh=v.Fragment,V6=ze(function(e,t){let{ownerDocument:n=null,...r}=e,o=v.useRef(null),s=ot(qx(d=>{o.current=d}),t),i=cc(o),c=n??i,a=W6(c),[u]=v.useState(()=>{var d;return Mt.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),l=v.useContext(K6),f=Cc();be(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),be(()=>{if(u&&l)return l.register(u)},[l,u]),xh(()=>{var d;!a||!u||(Ka(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ke();return f?!a||!u?null:ke.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Eh,name:"Portal"}),u):null});function G6(e,t){let n=ot(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ke();return r?v.createElement(V6,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Eh,name:"Portal"})}let q6=v.Fragment,Sh=v.createContext(null);function Z6(e,t){let{target:n,...r}=e,o={ref:ot(t)},s=Ke();return v.createElement(Sh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:q6,name:"Popover.Group"}))}let K6=v.createContext(null),Y6=ze(G6),X6=ze(Z6),Q6=Object.assign(Y6,{Group:X6});function J6(){let e=v.useRef(!1);return be(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ph(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Ah)!==v.Fragment||v.Children.count(e.children)===1}let Ds=v.createContext(null);Ds.displayName="TransitionContext";var e5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(e5||{});function t5(){let e=v.useContext(Ds);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function n5(){let e=v.useContext(js);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let js=v.createContext(null);js.displayName="NestingContext";function _s(e){return"children"in e?_s(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function $h(e,t){let n=Un(e),r=v.useRef([]),o=J6(),s=gr(),i=ae((d,h=bn.Hidden)=>{let m=r.current.findIndex(({el:x})=>x===d);m!==-1&&(rt(h,{[bn.Unmount](){r.current.splice(m,1)},[bn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var x;!_s(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),c=ae(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,bn.Unmount)}),a=v.useRef([]),u=v.useRef(Promise.resolve()),l=v.useRef({enter:[],leave:[]}),f=ae((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([x])=>x!==d)),t==null||t.chains.current[h].push([d,new Promise(x=>{a.current.push(x)})]),t==null||t.chains.current[h].push([d,new Promise(x=>{Promise.all(l.current[h].map(([T,y])=>y)).then(()=>x())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ae((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([x,T])=>T)).then(()=>{var x;(x=a.current.shift())==null||x()}).then(()=>m(h))});return v.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let Ah=v.Fragment,Th=ws.RenderStrategy;function r5(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,...x}=e,[T,y]=v.useState(null),A=v.useRef(null),B=Ph(e),L=ot(...B?[A,t,y]:t===null?[]:[t]),_=(n=x.unmount)==null||n?bn.Unmount:bn.Hidden,{show:j,appear:g,initial:w}=t5(),[$,I]=v.useState(j?"visible":"hidden"),C=n5(),{register:P,unregister:S}=C;be(()=>P(A),[P,A]),be(()=>{if(_===bn.Hidden&&A.current){if(j&&$!=="visible"){I("visible");return}return rt($,{hidden:()=>S(A),visible:()=>P(A)})}},[$,A,P,S,j,_]);let E=Cc();be(()=>{if(B&&E&&$==="visible"&&A.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[A,$,E,B]);let O=w&&!g,N=g&&j&&w,b=v.useRef(!1),k=$h(()=>{b.current||(I("hidden"),S(A))},C),R=ae(V=>{b.current=!0;let Y=V?"enter":"leave";k.onStart(A,Y,Q=>{Q==="enter"?s==null||s():Q==="leave"&&(c==null||c())})}),D=ae(V=>{let Y=V?"enter":"leave";b.current=!1,k.onStop(A,Y,Q=>{Q==="enter"?i==null||i():Q==="leave"&&(a==null||a())}),Y==="leave"&&!_s(k)&&(I("hidden"),S(A))});v.useEffect(()=>{B&&o||(R(j),D(j))},[j,B,o]);let U=!(!o||!B||!E||O),[,W]=kp(U,T,j,{start:R,end:D}),K=yn({ref:L,className:((r=Ga(x.className,N&&u,N&&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&&j&&p))==null?void 0:r.trim())||void 0,...Mp(W)}),G=0;$==="visible"&&(G|=St.Open),$==="hidden"&&(G|=St.Closed),j&&$==="hidden"&&(G|=St.Opening),!j&&$==="visible"&&(G|=St.Closing);let H=Ke();return v.createElement(js.Provider,{value:k},v.createElement(wh,{value:G},H({ourProps:K,theirProps:x,defaultTag:Ah,features:Th,visible:$==="visible",name:"Transition.Child"})))}function o5(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=v.useRef(null),c=Ph(e),a=ot(...c?[i,t]:t===null?[]:[t]);Cc();let u=Oc();if(n===void 0&&u!==null&&(n=(u&St.Open)===St.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=v.useState(n?"visible":"hidden"),p=$h(()=>{n||f("hidden")}),[d,h]=v.useState(!0),m=v.useRef([n]);be(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let x=v.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);be(()=>{n?f("visible"):!_s(p)&&i.current!==null&&f("hidden")},[n,p]);let T={unmount:o},y=ae(()=>{var L;d&&h(!1),(L=e.beforeEnter)==null||L.call(e)}),A=ae(()=>{var L;d&&h(!1),(L=e.beforeLeave)==null||L.call(e)}),B=Ke();return v.createElement(js.Provider,{value:p},v.createElement(Ds.Provider,{value:x},B({ourProps:{...T,as:v.Fragment,children:v.createElement(Oh,{ref:a,...T,...s,beforeEnter:y,beforeLeave:A})},theirProps:{},defaultTag:v.Fragment,features:Th,visible:l==="visible",name:"Transition"})))}function s5(e,t){let n=v.useContext(Ds)!==null,r=Oc()!==null;return v.createElement(v.Fragment,null,!n&&r?v.createElement(Nc,{ref:t,...e}):v.createElement(Oh,{ref:t,...e}))}let Nc=ze(o5),Oh=ze(r5),i5=ze(s5),Ic=Object.assign(Nc,{Child:i5,Root:Nc});function a5(e,t){let n=v.useRef({left:0,top:0});if(be(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Ch=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Nh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!tn(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 Ch.test(i)&&(i=i.replace(Ch,"")),i}function c5(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():Nh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Nh(e).trim()}function u5(e){let t=v.useRef(""),n=v.useRef("");return ae(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=c5(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var l5=Object.defineProperty,f5=(e,t,n)=>t in e?l5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ih=(e,t,n)=>(f5(e,typeof t!="symbol"?t+"":t,n),n),Ce=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ce||{}),Ft=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ft||{}),Us=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Us||{}),Mh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(Mh||{});function kh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Pp(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let d5={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:we.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===we.Nothing)return{...c,activeOptionIndex:null};if(t.focus===we.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===we.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===we.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=kh(e),u=Rs(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==we.Nothing&&(r=Rs(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:we.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...kh(e),pendingShouldSort:!1}:e};class Mc extends dp{constructor(t){super(t),Ih(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return rt(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:Ja(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:Ja(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Ja(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:we.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),Ih(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=ec.get(null);this.disposables.add(r.on(gp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new Mc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:we.Nothing},__demoMode:n})}reduce(t,n){return rt(n.type,d5,t,n)}}const Bh=v.createContext(null);function kc(e){let t=v.useContext(Bh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Lh),n}return t}function Lh({id:e,__demoMode:t=!1}){let n=v.useMemo(()=>Mc.new({id:e,__demoMode:t}),[]);return xh(()=>n.dispose()),n}let zs=v.createContext(null);zs.displayName="ListboxDataContext";function To(e){let t=v.useContext(zs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,To),n}return t}let p5=v.Fragment;function h5(e,t){let n=v.useId(),r=Va(),{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 x=p?"horizontal":"vertical";let T=ot(t),y=Mx(s),[A=d?[]:void 0,B]=Ix(o,a,y),L=Lh({id:n,__demoMode:h}),_=v.useRef({static:!1,hold:!1}),j=v.useRef(new Map),g=oE(u),w=v.useCallback(U=>rt($.mode,{[Ft.Multi]:()=>A.some(W=>g(W,U)),[Ft.Single]:()=>g(A,U)}),[A]),$=v.useMemo(()=>({value:A,disabled:f,invalid:l,mode:d?Ft.Multi:Ft.Single,orientation:x,onChange:B,compare:g,isSelected:w,optionsPropsRef:_,listRef:j}),[A,f,l,d,x,B,g,w,_,j]);be(()=>{L.state.dataRef.current=$},[$]);let I=it(L,U=>U.listboxState),C=ec.get(null),P=it(C,v.useCallback(U=>C.selectors.isTop(U,n),[C,n])),[S,E]=it(L,U=>[U.buttonElement,U.optionsElement]);IE(P,[S,E],(U,W)=>{L.send({type:Mh.CloseListbox}),Sp(W,ac.Loose)||(U.preventDefault(),S==null||S.focus())});let O=v.useMemo(()=>({open:I===Ce.Open,disabled:f,invalid:l,value:A}),[I,f,l,A]),[N,b]=Qx({inherit:!0}),k={ref:T},R=v.useCallback(()=>{if(y!==void 0)return B==null?void 0:B(y)},[B,y]),D=Ke();return v.createElement(b,{value:N,props:{htmlFor:S==null?void 0:S.id},slot:{open:I===Ce.Open,disabled:f}},v.createElement(F6,null,v.createElement(Bh.Provider,{value:L},v.createElement(zs.Provider,{value:$},v.createElement(wh,{value:rt(I,{[Ce.Open]:St.Open,[Ce.Closed]:St.Closed})},c!=null&&A!=null&&v.createElement(Dx,{disabled:f,data:{[c]:A},form:i,onReset:R}),D({ourProps:k,theirProps:m,slot:O,defaultTag:p5,name:"Listbox"}))))))}let m5="button";function g5(e,t){let n=v.useId(),r=tp(),o=To("Listbox.Button"),s=kc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=ot(t,M6(),s.actions.setButtonElement),f=k6(),[p,d,h]=it(s,b=>[b.listboxState,b.buttonElement,b.optionsElement]),m=p===Ce.Open;BE(m,{trigger:d,action:v.useCallback(b=>{if(d!=null&&d.contains(b.target))return Ss.Ignore;let k=b.target.closest('[role="option"]:not([data-disabled])');return tn(k)?Ss.Select(k):h!=null&&h.contains(b.target)?Ss.Ignore:Ss.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let x=ae(b=>{switch(b.key){case Oe.Enter:kx(b.currentTarget);break;case Oe.Space:case Oe.ArrowDown:b.preventDefault(),s.actions.openListbox({focus:o.value?we.Nothing:we.First});break;case Oe.ArrowUp:b.preventDefault(),s.actions.openListbox({focus:o.value?we.Nothing:we.Last});break}}),T=ae(b=>{switch(b.key){case Oe.Space:b.preventDefault();break}}),y=ae(b=>{var k;if(b.button===vh.Left){if(Vx(b.currentTarget))return b.preventDefault();s.state.listboxState===Ce.Open?(ke.flushSync(()=>s.actions.closeListbox()),(k=s.state.buttonElement)==null||k.focus({preventScroll:!0})):(b.preventDefault(),s.actions.openListbox({focus:we.Nothing}))}}),A=v.useRef(null),B=ae(b=>{A.current=b.pointerType,b.pointerType==="mouse"&&y(b)}),L=ae(b=>{A.current!=="mouse"&&y(b)}),_=ae(b=>b.preventDefault()),j=cp([i]),g=Zx(),{isFocusVisible:w,focusProps:$}=wx({autoFocus:a}),{isHovered:I,hoverProps:C}=yx({isDisabled:c}),{pressed:P,pressProps:S}=$x({disabled:c}),E=v.useMemo(()=>({open:p===Ce.Open,active:P||p===Ce.Open,disabled:c,invalid:o.invalid,value:o.value,hover:I,focus:w,autofocus:a}),[p,o.value,c,I,w,P,o.invalid,a]),O=it(s,b=>b.listboxState===Ce.Open),N=Yd(f(),{ref:l,id:i,type:LE(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":O,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:x,onKeyUp:T,onKeyPress:_,onPointerDown:B,onClick:L},$,C,S);return Ke()({ourProps:N,theirProps:u,slot:E,defaultTag:m5,name:"Listbox.Button"})}let Fh=v.createContext(!1),b5="div",y5=ws.RenderStrategy|ws.Static;function w5(e,t){let n=v.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=I6(o),[l,f]=v.useState(null);u&&(s=!0);let p=To("Listbox.Options"),d=kc("Listbox.Options"),[h,m,x,T]=it(d,V=>[V.listboxState,V.buttonElement,V.optionsElement,V.__demoMode]),y=cc(m),A=cc(x),B=Oc(),[L,_]=kp(c,l,B!==null?(B&St.Open)===St.Open:h===Ce.Open);wE(L,m,d.actions.closeListbox);let j=T?!1:i&&h===Ce.Open;HE(j,A);let g=T?!1:i&&h===Ce.Open;yE(g,{allowed:v.useCallback(()=>[m,x],[m,x])});let w=h!==Ce.Open,$=a5(w,m)?!1:L,I=L&&h===Ce.Closed,C=j6(I,p.value),P=ae(V=>p.compare(C,V)),S=it(d,V=>{var Y;if(u==null||!((Y=u==null?void 0:u.to)!=null&&Y.includes("selection")))return null;let Q=V.options.findIndex(oe=>P(oe.dataRef.current.value));return Q===-1&&(Q=0),Q}),E=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let V=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:V},index:S}}})(),[O,N]=L6(E),b=B6(),k=ot(t,u?O:null,d.actions.setOptionsElement,f),R=gr();v.useEffect(()=>{var V;let Y=x;Y&&h===Ce.Open&&Y!==((V=wo(Y))==null?void 0:V.activeElement)&&(Y==null||Y.focus({preventScroll:!0}))},[h,x]);let D=ae(V=>{var Y,Q;switch(R.dispose(),V.key){case Oe.Space:if(d.state.searchQuery!=="")return V.preventDefault(),V.stopPropagation(),d.actions.search(V.key);case Oe.Enter:if(V.preventDefault(),V.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:oe}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(oe.current.value)}p.mode===Ft.Single&&(ke.flushSync(()=>d.actions.closeListbox()),(Y=d.state.buttonElement)==null||Y.focus({preventScroll:!0}));break;case rt(p.orientation,{vertical:Oe.ArrowDown,horizontal:Oe.ArrowRight}):return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:we.Next});case rt(p.orientation,{vertical:Oe.ArrowUp,horizontal:Oe.ArrowLeft}):return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:we.Previous});case Oe.Home:case Oe.PageUp:return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:we.First});case Oe.End:case Oe.PageDown:return V.preventDefault(),V.stopPropagation(),d.actions.goToOption({focus:we.Last});case Oe.Escape:V.preventDefault(),V.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),(Q=d.state.buttonElement)==null||Q.focus({preventScroll:!0});return;case Oe.Tab:V.preventDefault(),V.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),TE(d.state.buttonElement,V.shiftKey?ic.Previous:ic.Next);break;default:V.key.length===1&&(d.actions.search(V.key),R.setTimeout(()=>d.actions.clearSearch(),350));break}}),U=it(d,V=>{var Y;return(Y=V.buttonElement)==null?void 0:Y.id}),W=v.useMemo(()=>({open:h===Ce.Open}),[h]),K=Yd(u?b():{},{id:r,ref:k,"aria-activedescendant":it(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Ft.Multi?!0:void 0,"aria-labelledby":U,"aria-orientation":p.orientation,onKeyDown:D,role:"listbox",tabIndex:h===Ce.Open?0:void 0,style:{...a.style,...N,"--button-width":iE(m,!0).width},...Mp(_)}),G=Ke(),H=v.useMemo(()=>p.mode===Ft.Multi?p:{...p,isSelected:P},[p,P]);return v.createElement(Q6,{enabled:s?e.static||L:!1,ownerDocument:y},v.createElement(zs.Provider,{value:H},G({ourProps:K,theirProps:a,slot:W,defaultTag:b5,features:y5,visible:$,name:"Listbox.Options"})))}let v5="div";function x5(e,t){let n=v.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=v.useContext(Fh)===!0,a=To("Listbox.Option"),u=kc("Listbox.Option"),l=it(u,$=>u.selectors.isActive($,r)),f=a.isSelected(s),p=v.useRef(null),d=u5(p),h=Un({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=ot(t,p,$=>{$?a.listRef.current.set(r,$):a.listRef.current.delete(r)}),x=it(u,$=>u.selectors.shouldScrollIntoView($,r));be(()=>{if(x)return Et().requestAnimationFrame(()=>{var $,I;(I=($=p.current)==null?void 0:$.scrollIntoView)==null||I.call($,{block:"nearest"})})},[x,p]),be(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let T=ae($=>{var I;if(o)return $.preventDefault();u.actions.onChange(s),a.mode===Ft.Single&&(ke.flushSync(()=>u.actions.closeListbox()),(I=u.state.buttonElement)==null||I.focus({preventScroll:!0}))}),y=ae(()=>{if(o)return u.actions.goToOption({focus:we.Nothing});u.actions.goToOption({focus:we.Specific,id:r})}),A=WE(),B=ae($=>A.update($)),L=ae($=>{A.wasMoved($)&&(o||l&&u.state.activationTrigger===Us.Pointer||u.actions.goToOption({focus:we.Specific,id:r},Us.Pointer))}),_=ae($=>{A.wasMoved($)&&(o||l&&u.state.activationTrigger===Us.Pointer&&u.actions.goToOption({focus:we.Nothing}))}),j=v.useMemo(()=>({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),[l,f,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:T,onFocus:y,onPointerEnter:B,onMouseEnter:B,onPointerMove:L,onMouseMove:L,onPointerLeave:_,onMouseLeave:_},w=Ke();return!f&&c?null:w({ourProps:g,theirProps:i,slot:j,defaultTag:v5,name:"Listbox.Option"})}let E5=v.Fragment;function S5(e,t){let{options:n,placeholder:r,...o}=e,s={ref:ot(t)},i=To("ListboxSelectedOption"),c=v.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Ft.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ke();return v.createElement(Fh.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:v.createElement(v.Fragment,null,r&&a?r:n)},slot:c,defaultTag:E5,name:"ListboxSelectedOption"}))}let P5=ze(h5),$5=ze(g5),A5=nE,T5=ze(w5),O5=ze(x5),C5=ze(S5),ct=Object.assign(P5,{Button:$5,Label:A5,Options:T5,Option:O5,SelectedOption:C5});const N5=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_active)",children:M.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_active",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),I5=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_inactive)",children:M.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_inactive",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Oo=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return M.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>M.jsx("div",{className:"flex items-center justify-center",children:o>t-e?M.jsx(N5,{}):M.jsx(I5,{})},o))})};class Pt{}ko(Pt,"FAST",3),ko(Pt,"Medium",2),ko(Pt,"SLOW",1),ko(Pt,"NONE",0);const M5=Object.values({MAINNET:1,SEPOLIA:11155111}),an=e=>{const t=typeof e=="string"?parseInt(e,10):e;return M5.includes(t)},k5={USDT:!0},Rh=(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:!k5[t.toUpperCase()]:!0},B5=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=dt();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(ct,{value:t,onChange:n,disabled:r,children:({open:c})=>M.jsxs(M.Fragment,{children:[M.jsxs(ct.Button,{className:`
|
|
131
|
+
*/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},Sp=function(t){return t.tagName==="INPUT"},q2=function(t){return Sp(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 Sp(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))},$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)},Tp=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?Tp(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:$p.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:rE}):r=W2(t,n.includeContainer,$p.bind(null,n)),Tp(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(Tr(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:S,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=S??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,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),N=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},B=Gs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:S,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",S=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[S]:0;(!D||!await(i.isElement==null?void 0:i.isElement(F)))&&(D=c.floating[S]||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),A=!a.arrow&&Tr(o)!=null&&M!==y&&s.reference[h]/2-(M<O?v:C)-m[h]/2<0,T=A?M<O?M-O:M-I:0;return{[d]:p[d]+T,data:{[d]:y,centerOffset:M-y-T,...A&&{alignmentOffset:T}},reset:A}}}),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),S=An(c)===c,N=await(a.isRTL==null?void 0:a.isRTL(u.floating)),B=p||(S||!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(P=>un(P.placement)===E?P.overflows[0]>0:!0)))return{data:{index:M,overflows:v},reset:{placement:y}};let A=(O=v.filter(T=>T.overflows[0]<=0).sort((T,P)=>T.overflows[1]-P.overflows[1])[0])==null?void 0:O.placement;if(!A)switch(d){case"bestFit":{var I;const T=(I=v.filter(P=>{if(F){const L=un(P.placement);return L===E||L==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(L=>L>0).reduce((L,j)=>L+j,0)]).sort((P,L)=>P[1]-L[1])[0])==null?void 0:I[0];T&&(A=T);break}case"initialPlacement":A=c;break}if(o!==A)return{reset:{placement:A}}}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=Tr(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],S=d-l[$];d=Rc(E,d,S)}if(i){const w=f==="y"?"top":"left",$=f==="y"?"bottom":"right",E=h+l[w],S=h-l[$];h=Rc(E,h,S)}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=Tr(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,S=h-l.left-l.right,N=cn(m-l[w],E),B=cn(h-l[$],S),F=!t.middlewareData.shift;let D=N,b=B;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=S),(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 Ar(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=Ar(r)):i=Ar(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=Ar(m),$=m.getBoundingClientRect(),E=ht(m),S=$.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+=S,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=Ar(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)?Ar(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=Tn(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 SE(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&&P2(r)&&Vc(r);)r=Lp(r,t);return r&&sn(r)&&Vc(r)&&!Fc(r)?n:r||N2(e)||n}const PE=async function(e){const t=this.getOffsetParent||Fp,n=this.getDimensions,r=await n(e.floating);return{reference:SE(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 TE={convertOffsetParentRelativeRectToViewportRelativeRect:hE,getDocumentElement:_t,getClippingRect:xE,getOffsetParent:Fp,getElementRects:PE,getClientRects:mE,getDimensions:EE,getScale:Ar,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 AE(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),S={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,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(B,S)}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?Tn(u):[],...Tn(t)]:[];l.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),s&&$.addEventListener("resize",n)});const f=u&&c?AE(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 S;(S=d)==null||S.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:TE,...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(P=>{P!==F.current&&(F.current=P,m(P))},[]),S=U.useCallback(P=>{P!==D.current&&(D.current=P,$(P))},[]),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 P={placement:t,strategy:n,middleware:p};C.current&&(P.platform=C.current),ME(F.current,D.current,P).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(P=>({...P,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:S}),[E,S]),A=U.useMemo(()=>({reference:N,floating:B}),[N,B]),T=U.useMemo(()=>{const P={position:n,left:0,top:0};if(!A.floating)return P;const L=Up(A.floating,l.x),j=Up(A.floating,l.y);return c?{...P,transform:"translate("+L+"px, "+j+"px)",..._p(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:j}},[n,c,A.floating,l.x,l.y]);return U.useMemo(()=>({...l,update:I,refs:y,elements:A,floatingStyles:T}),[l,I,y,A,T])}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(S=>{const N=fe(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;a(N),d.refs.setReference(N)},[d.refs]),m=U.useCallback(S=>{(fe(S)||S===null)&&(f.current=S,i(S)),(fe(d.refs.reference.current)||d.refs.reference.current===null||S!==null&&!fe(S))&&d.refs.setReference(S)},[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 S=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);S&&(S.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 S={...t,...await Zc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},N=await Gc(Xp(S,h.scrollHeight+m+p.clientTop),l),B=await Gc(S,{...l,elementContext:"reference"}),F=ke(0,N.top),D=S.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({...S,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,S=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,S*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:S}=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=S.elements.floating;if(!M)return;let y=parseFloat(getComputedStyle(M).scrollPaddingBottom)||0,A=Math.min(Qp,M.childElementCount),T=0,P=0;for(let L of(I=(O=S.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)A--;else{P=Math.max(0,Math.min(z,W)-Math.max(j,_)),T=L.clientHeight;break}}A>=1&&s(L=>{let j=T*A-P+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]=S.placement.split("-");m==="selection"&&(N="selection");let F=x.useMemo(()=>({anchor:[N,B].filter(Boolean).join(" ")}),[N,B]),D=e8(S,{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 S=window.getComputedStyle(u).getPropertyValue(E);if(d[$]!==S){d[$]=S,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,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(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 S8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function ah(){let e=S8(),[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 P8(){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 T8(){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 A8(){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=P8(),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),S=x.useRef(null),N=ch(e),B=dt(...N?[S,t,E]:t===null?[]:[t]),F=(n=w.unmount)==null||n?Pn.Unmount:Pn.Hidden,{show:D,appear:b,initial:g}=T8(),[v,C]=x.useState(D?"visible":"hidden"),O=A8(),{register:I,unregister:M}=O;Ee(()=>I(S),[I,S]),Ee(()=>{if(F===Pn.Hidden&&S.current){if(D&&v!=="visible"){C("visible");return}return ft(v,{hidden:()=>M(S),visible:()=>I(S)})}},[v,S,I,M,D,F]);let y=ah();Ee(()=>{if(N&&y&&v==="visible"&&S.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[S,v,y,N]);let A=g&&!b,T=b&&D&&g,P=x.useRef(!1),L=uh(()=>{P.current||(C("hidden"),M(S))},O),j=le(Z=>{P.current=!0;let J=Z?"enter":"leave";L.onStart(S,J,oe=>{oe==="enter"?s==null||s():oe==="leave"&&(c==null||c())})}),z=le(Z=>{let J=Z?"enter":"leave";P.current=!1,L.onStop(S,J,oe=>{oe==="enter"?i==null||i():oe==="leave"&&(a==null||a())}),J==="leave"&&!ni(L)&&(C("hidden"),M(S))});x.useEffect(()=>{N&&o||(j(D),z(D))},[D,N,o]);let _=!(!o||!N||!y||A),[,W]=hp(_,$,D,{start:j,end:z}),K=$n({ref:B,className:((r=yc(w.className,T&&u,T&&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)}),S=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:S})},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||{}),On=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(On||{}),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:Pc(()=>{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:Pc(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Pc(()=>{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),[S=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,{[On.Multi]:()=>S.some(W=>b(W,_)),[On.Single]:()=>b(S,_)}),[S]),v=Sn({value:S,disabled:f,invalid:l,mode:d?On.Multi:On.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 A=Sn({open:C===Be.Open,disabled:f,invalid:l,value:S}),[T,P]=Px({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(P,{value:T,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&&S!=null&&x.createElement(fx,{disabled:f,data:{[c]:S},form:i,onReset:j}),z({ourProps:L,theirProps:m,slot:A,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 A=y.target.closest('[role="option"]:not([data-disabled])');return on(A)?js.Select(A):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 A;s.state.listboxState===Be.Open?(je.flushSync(()=>s.actions.closeListbox()),(A=s.state.buttonElement)==null||A.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}),S=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=Sn({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=T0(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:S},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),S=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,S);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,A]=s8(M),T=o8(),P=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}),_=Sn({open:h===Be.Open}),W=T0(u?T():{},{id:r,ref:P,"aria-activedescendant":qe(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===On.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,...A,"--button-width":Ix(B,m,!0).width},...pp(F)}),K=rt(),G=x.useMemo(()=>p.mode===On.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})}),S=m2(),N=le(v=>S.update(v)),B=le(v=>{S.wasMoved(v)&&(o||l&&u.state.activationTrigger===ri.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},ri.Pointer))}),F=le(v=>{S.wasMoved(v)&&(o||l&&u.state.activationTrigger===ri.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),D=Sn({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=Sn({}),a=i.value===void 0||i.value===null||i.mode===On.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:`
|
|
126
132
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
127
133
|
items-center justify-between flex px-3 rounded-lg
|
|
128
134
|
focus:outline-none
|
|
129
135
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
130
136
|
${c?"ring-1 ring-white":""}
|
|
131
|
-
`,children:[
|
|
137
|
+
`,children:[k.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),k.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?k.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):k.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:k.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),k.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),k.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${c?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[k.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:k.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),k.jsx("defs",{children:k.jsx("clipPath",{id:"clip0_12919_27745",children:k.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),k.jsx(nu,{as:x.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:k.jsx(mt.Options,{className:`
|
|
132
138
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
133
139
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
134
140
|
focus:outline-none
|
|
135
|
-
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>
|
|
141
|
+
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).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.jsx(k.Fragment,{children:k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?k.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):k.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:k.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),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:a.chain})})]}),k.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:k.jsx(Uo,{className:"w-full justify-between",selectedLevel:ln(a.chainId)?It.SLOW:It.FAST,maxLevel:3})})]})})},a.chainId))})})]})})})},s3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:c}=vt(),a=u=>u.token||u.symbol;return k.jsx("div",{className:`relative ${o}`,children:k.jsx(mt,{value:t,onChange:n,disabled:r,children:({open:u})=>k.jsxs(k.Fragment,{children:[k.jsxs(mt.Button,{className:`
|
|
136
142
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
137
143
|
items-center justify-between flex px-3 rounded-lg
|
|
138
144
|
focus:outline-none
|
|
139
145
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
140
|
-
${
|
|
141
|
-
`,children:[
|
|
146
|
+
${u?"ring-1 ring-white":""}
|
|
147
|
+
`,children:[k.jsx("span",{className:"text-sm leading-[18px] font-medium",children:c("deposit.asset")}),k.jsxs("div",{className:"flex items-center space-x-2",children:[k.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),k.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),k.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[k.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:k.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),k.jsx("defs",{children:k.jsx("clipPath",{id:"clip0_asset_selector",children:k.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),k.jsx(nu,{as:x.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:k.jsx(mt.Options,{className:`
|
|
142
148
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
143
149
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
144
150
|
focus:outline-none
|
|
145
|
-
`,children:e.map(
|
|
151
|
+
`,children:e.map(l=>k.jsx(mt.Option,{value:l,className:({active:f,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:p})=>k.jsxs("div",{className:"flex items-center space-x-3",children:[k.jsx("img",{src:l.iconUrl,alt:a(l),className:"w-5 h-5 rounded-full"}),k.jsxs("div",{className:"flex flex-col",children:[k.jsx("span",{className:`text-sm font-medium ${f||p?"text-text-primary":"text-text-tertiary"}`,children:a(l)}),s===xn&&i==="perpetual"&&l.token==="USDC"&&k.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:c("deposit.defaultSpotNotice")})]})]})},a(l)))})})]})})})},Eh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=xn,txType:i="deposit",accountType:c})=>{const a=x.useCallback(w=>i==="withdraw"?s===xn?w.allowAaWithdraw!==!1:w.allowWithdraw!==!1:s===xn?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 S of E.tokenList||[]){const N=S.symbol||S.token;!N||!(i!=="withdraw"||S.withdrawEnable===!0&&S.pullOff===!1)||w.has(N)||(w.add(N),$.push({token:N,symbol:N,iconUrl:S.iconUrl,decimals:S.decimals,tokenAddress:S.tokenAddress}))}return $},[t,a,i]),l=w=>{n(w.chainId)},f=w=>{const $=w.symbol||w.token;o($);const E=[];for(const S of t){if(!a(S))continue;(S.tokenList||[]).some(B=>(B.symbol||B.token)===$)&&E.push(S.chainId)}!E.includes(e.chainId)&&E[0]!==void 0&&n(E[0])},p=x.useMemo(()=>{var E,S;const w=r||((E=u[0])==null?void 0:E.symbol)||((S=u[0])==null?void 0:S.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,walletType:s,accountType:c}),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))}),Sh=({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:`
|
|
146
152
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
147
153
|
items-center justify-between flex px-3 rounded-lg
|
|
148
154
|
focus:outline-none
|
|
149
155
|
${n?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
150
156
|
${p?"ring-1 ring-white":""}
|
|
151
|
-
`,children:[
|
|
157
|
+
`,children:[k.jsx("span",{className:"text-sm leading-[18px] font-medium",children:o("account.title")}),k.jsxs("div",{className:"flex items-center space-x-2",children:[k.jsx("span",{className:"text-sm text-white ml-1",children:i}),k.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${p?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[k.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:k.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),k.jsx("defs",{children:k.jsx("clipPath",{id:"clip0_asset_selector",children:k.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),k.jsx(nu,{as:x.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:k.jsx(mt.Options,{className:`
|
|
152
158
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
153
159
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
154
160
|
focus:outline-none
|
|
155
|
-
`,children:
|
|
161
|
+
`,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,Ph={"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=Ph[t.format]||Ph.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 Th(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 Ah(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Th(Object(n),!0).forEach(function(r){au(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Th(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=S3();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 S3(){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,Ah(Ah({},i),{},{onClick:this.onClick}))}}]),n}(ii.default.PureComponent);si.CopyToClipboard=Nh,au(Nh,"defaultProps",{onCopy:void 0,options:void 0});var P3=si,cu=P3.CopyToClipboard;cu.CopyToClipboard=cu;var $3=cu;const T3=Lm($3);var A3=Object.defineProperty,ci=Object.getOwnPropertySymbols,Ch=Object.prototype.hasOwnProperty,Ih=Object.prototype.propertyIsEnumerable,Mh=(e,t,n)=>t in e?A3(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};/**
|
|
156
162
|
* @license QR Code generator library (TypeScript)
|
|
157
163
|
* Copyright (c) Project Nayuki.
|
|
158
164
|
* SPDX-License-Identifier: MIT
|
|
159
|
-
*/var Vn;(e=>{const t=class se{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<se.MIN_VERSION||a>se.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(l);if(this.drawCodewords(d),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const x=this.getPenaltyScore();x<h&&(f=m,h=x),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return se.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return se.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,p=-1,d=!0){if(!(se.MIN_VERSION<=l&&l<=f&&f<=se.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const A=se.getNumDataCodewords(h,u)*8,B=i.getTotalBits(a,h);if(B<=A){m=B;break}if(h>=f)throw new RangeError("Data too long")}for(const A of[se.Ecc.MEDIUM,se.Ecc.QUARTILE,se.Ecc.HIGH])d&&m<=se.getNumDataCodewords(h,A)*8&&(u=A);let x=[];for(const A of a){n(A.mode.modeBits,4,x),n(A.numChars,A.mode.numCharCountBits(h),x);for(const B of A.getData())x.push(B)}o(x.length==m);const T=se.getNumDataCodewords(h,u)*8;o(x.length<=T),n(0,Math.min(4,T-x.length),x),n(0,(8-x.length%8)%8,x),o(x.length%8==0);for(let A=236;x.length<T;A^=253)n(A,8,x);let y=[];for(;y.length*8<x.length;)y.push(0);return x.forEach((A,B)=>y[B>>>3]|=A<<7-(B&7)),new se(h,u,y,p)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let l=0;l<u;l++)for(let f=0;f<u;f++)l==0&&f==0||l==0&&f==u-1||l==u-1&&f==0||this.drawAlignmentPattern(a[l],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let p=0;p<10;p++)l=l<<1^(l>>>9)*1335;const f=(u<<10|l)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let l=0;l<12;l++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;o(u>>>18==0);for(let l=0;l<18;l++){const f=r(u,l),p=this.size-11+l%3,d=Math.floor(l/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(l)),d=a+f,h=u+l;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,u+l,Math.max(Math.abs(f),Math.abs(l))!=1)}setFunctionModule(a,u,l){this.modules[u][a]=l,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,l=this.errorCorrectionLevel;if(a.length!=se.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=se.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],p=se.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],d=Math.floor(se.getNumRawDataModules(u)/8),h=f-d%f,m=Math.floor(d/f);let x=[];const T=se.reedSolomonComputeDivisor(p);for(let A=0,B=0;A<f;A++){let L=a.slice(B,B+m-p+(A<h?0:1));B+=L.length;const _=se.reedSolomonComputeRemainder(L,T);A<h&&L.push(0),x.push(L.concat(_))}let y=[];for(let A=0;A<x[0].length;A++)x.forEach((B,L)=>{(A!=m-p||L>=h)&&y.push(B[A])});return o(y.length==d),y}drawCodewords(a){if(a.length!=Math.floor(se.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=l-p,m=(l+1&2)==0?this.size-1-f:f;!this.isFunction[m][d]&&u<a.length*8&&(this.modules[m][d]=r(a[u>>>3],7-(u&7)),u++)}}o(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let l=0;l<this.size;l++){let f;switch(a){case 0:f=(l+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=l%3==0;break;case 3:f=(l+u)%3==0;break;case 4:f=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:f=l*u%2+l*u%3==0;break;case 6:f=(l*u%2+l*u%3)%2==0;break;case 7:f=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&f&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[p][x]==d?(h++,h==5?a+=se.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*se.PENALTY_N3),d=this.modules[p][x],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*se.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][p]==d?(h++,h==5?a+=se.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*se.PENALTY_N3),d=this.modules[x][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*se.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=se.PENALTY_N2)}let u=0;for(const p of this.modules)u=p.reduce((d,h)=>d+(h?1:0),u);const l=this.size*this.size,f=Math.ceil(Math.abs(u*20-l*10)/l)-1;return o(0<=f&&f<=9),a+=f*se.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let l=[6];for(let f=this.size-7;l.length<a;f-=u)l.splice(1,0,f);return l}}static getNumRawDataModules(a){if(a<se.MIN_VERSION||a>se.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const l=Math.floor(a/7)+2;u-=(25*l-10)*l-55,a>=7&&(u-=36)}return o(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(se.getNumRawDataModules(a)/8)-se.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*se.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<a-1;f++)u.push(0);u.push(1);let l=1;for(let f=0;f<a;f++){for(let p=0;p<u.length;p++)u[p]=se.reedSolomonMultiply(u[p],l),p+1<u.length&&(u[p]^=u[p+1]);l=se.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(f=>0);for(const f of a){const p=f^l.shift();l.push(0),u.forEach((d,h)=>l[h]^=se.reedSolomonMultiply(d,p))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let f=7;f>=0;f--)l=l<<1^(l>>>7)*285,l^=(u>>>f&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class xe{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new xe(xe.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!xe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const f=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+f),10),f*3+1,u),l+=f}return new xe(xe.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!xe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let f=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new xe(xe.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:xe.isNumeric(a)?[xe.makeNumeric(a)]:xe.isAlphanumeric(a)?[xe.makeAlphanumeric(a)]:[xe.makeBytes(xe.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new xe(xe.Mode.ECI,0,u)}static isNumeric(a){return xe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return xe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const p=f.mode.numCharCountBits(u);if(f.numChars>=1<<p)return 1/0;l+=4+p+f.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(Vn||(Vn={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Vn||(Vn={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Vn||(Vn={}));var Sr=Vn;/**
|
|
165
|
+
*/var Xn;(e=>{const t=class ae{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ae.MIN_VERSION||a>ae.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(l);if(this.drawCodewords(d),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const w=this.getPenaltyScore();w<h&&(f=m,h=w),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return ae.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ae.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,p=-1,d=!0){if(!(ae.MIN_VERSION<=l&&l<=f&&f<=ae.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const S=ae.getNumDataCodewords(h,u)*8,N=i.getTotalBits(a,h);if(N<=S){m=N;break}if(h>=f)throw new RangeError("Data too long")}for(const S of[ae.Ecc.MEDIUM,ae.Ecc.QUARTILE,ae.Ecc.HIGH])d&&m<=ae.getNumDataCodewords(h,S)*8&&(u=S);let w=[];for(const S of a){n(S.mode.modeBits,4,w),n(S.numChars,S.mode.numCharCountBits(h),w);for(const N of S.getData())w.push(N)}o(w.length==m);const $=ae.getNumDataCodewords(h,u)*8;o(w.length<=$),n(0,Math.min(4,$-w.length),w),n(0,(8-w.length%8)%8,w),o(w.length%8==0);for(let S=236;w.length<$;S^=253)n(S,8,w);let E=[];for(;E.length*8<w.length;)E.push(0);return w.forEach((S,N)=>E[N>>>3]|=S<<7-(N&7)),new ae(h,u,E,p)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let l=0;l<u;l++)for(let f=0;f<u;f++)l==0&&f==0||l==0&&f==u-1||l==u-1&&f==0||this.drawAlignmentPattern(a[l],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let p=0;p<10;p++)l=l<<1^(l>>>9)*1335;const f=(u<<10|l)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let l=0;l<12;l++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;o(u>>>18==0);for(let l=0;l<18;l++){const f=r(u,l),p=this.size-11+l%3,d=Math.floor(l/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(l)),d=a+f,h=u+l;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,u+l,Math.max(Math.abs(f),Math.abs(l))!=1)}setFunctionModule(a,u,l){this.modules[u][a]=l,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,l=this.errorCorrectionLevel;if(a.length!=ae.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=ae.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],p=ae.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],d=Math.floor(ae.getNumRawDataModules(u)/8),h=f-d%f,m=Math.floor(d/f);let w=[];const $=ae.reedSolomonComputeDivisor(p);for(let S=0,N=0;S<f;S++){let B=a.slice(N,N+m-p+(S<h?0:1));N+=B.length;const F=ae.reedSolomonComputeRemainder(B,$);S<h&&B.push(0),w.push(B.concat(F))}let E=[];for(let S=0;S<w[0].length;S++)w.forEach((N,B)=>{(S!=m-p||B>=h)&&E.push(N[S])});return o(E.length==d),E}drawCodewords(a){if(a.length!=Math.floor(ae.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=l-p,m=(l+1&2)==0?this.size-1-f:f;!this.isFunction[m][d]&&u<a.length*8&&(this.modules[m][d]=r(a[u>>>3],7-(u&7)),u++)}}o(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let l=0;l<this.size;l++){let f;switch(a){case 0:f=(l+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=l%3==0;break;case 3:f=(l+u)%3==0;break;case 4:f=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:f=l*u%2+l*u%3==0;break;case 6:f=(l*u%2+l*u%3)%2==0;break;case 7:f=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&f&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[p][w]==d?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ae.PENALTY_N3),d=this.modules[p][w],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ae.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][p]==d?(h++,h==5?a+=ae.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ae.PENALTY_N3),d=this.modules[w][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ae.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=ae.PENALTY_N2)}let u=0;for(const p of this.modules)u=p.reduce((d,h)=>d+(h?1:0),u);const l=this.size*this.size,f=Math.ceil(Math.abs(u*20-l*10)/l)-1;return o(0<=f&&f<=9),a+=f*ae.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let l=[6];for(let f=this.size-7;l.length<a;f-=u)l.splice(1,0,f);return l}}static getNumRawDataModules(a){if(a<ae.MIN_VERSION||a>ae.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const l=Math.floor(a/7)+2;u-=(25*l-10)*l-55,a>=7&&(u-=36)}return o(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(ae.getNumRawDataModules(a)/8)-ae.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ae.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<a-1;f++)u.push(0);u.push(1);let l=1;for(let f=0;f<a;f++){for(let p=0;p<u.length;p++)u[p]=ae.reedSolomonMultiply(u[p],l),p+1<u.length&&(u[p]^=u[p+1]);l=ae.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(f=>0);for(const f of a){const p=f^l.shift();l.push(0),u.forEach((d,h)=>l[h]^=ae.reedSolomonMultiply(d,p))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let f=7;f>=0;f--)l=l<<1^(l>>>7)*285,l^=(u>>>f&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class xe{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new xe(xe.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!xe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const f=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+f),10),f*3+1,u),l+=f}return new xe(xe.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!xe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let f=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(xe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new xe(xe.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:xe.isNumeric(a)?[xe.makeNumeric(a)]:xe.isAlphanumeric(a)?[xe.makeAlphanumeric(a)]:[xe.makeBytes(xe.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new xe(xe.Mode.ECI,0,u)}static isNumeric(a){return xe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return xe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const p=f.mode.numCharCountBits(u);if(f.numChars>=1<<p)return 1/0;l+=4+p+f.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(Xn||(Xn={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Xn||(Xn={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Xn||(Xn={}));var Nr=Xn;/**
|
|
160
166
|
* @license qrcode.react
|
|
161
167
|
* Copyright (c) Paul O'Shannessy
|
|
162
168
|
* SPDX-License-Identifier: ISC
|
|
163
|
-
*/var oS={L:Sr.QrCode.Ecc.LOW,M:Sr.QrCode.Ecc.MEDIUM,Q:Sr.QrCode.Ecc.QUARTILE,H:Sr.QrCode.Ecc.HIGH},Kh=128,Yh="L",Xh="#FFFFFF",Qh="#000000",Jh=!1,e0=1,sS=4,iS=0,aS=.1;function t0(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function n0(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function cS(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*aS),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),x=Math.ceil(c+u-h),T=Math.ceil(a+l-m);p={x:h,y:m,w:x,h:T}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function uS(e,t){return t!=null?Math.max(Math.floor(t),0):e?sS:iS}function r0({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=v.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,x)=>(m.push(...Sr.QrSegment.makeSegments(x)),m),[]);return Sr.QrCode.encodeSegments(h,oS[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=v.useMemo(()=>{let d=a.getModules();const h=uS(r,o),m=d.length+h*2,x=cS(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:x}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:p}}var lS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),fS=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Kh,level:i=Yh,bgColor:c=Xh,fgColor:a=Qh,includeMargin:u=Jh,minVersion:l=e0,boostLevel:f,marginSize:p,imageSettings:d}=r,m=jc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,T=jc(m,["style"]),y=d==null?void 0:d.src,A=v.useRef(null),B=v.useRef(null),L=v.useCallback(S=>{A.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[_,j]=v.useState(!1),{margin:g,cells:w,numCells:$,calculatedImageSettings:I}=r0({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});v.useEffect(()=>{if(A.current!=null){const S=A.current,E=S.getContext("2d");if(!E)return;let O=w;const N=B.current,b=I!=null&&N!==null&&N.complete&&N.naturalHeight!==0&&N.naturalWidth!==0;b&&I.excavation!=null&&(O=n0(w,I.excavation));const k=window.devicePixelRatio||1;S.height=S.width=s*k;const R=s/$*k;E.scale(R,R),E.fillStyle=c,E.fillRect(0,0,$,$),E.fillStyle=a,lS?E.fill(new Path2D(t0(O,g))):w.forEach(function(D,U){D.forEach(function(W,K){W&&E.fillRect(K+g,U+g,1,1)})}),I&&(E.globalAlpha=I.opacity),b&&E.drawImage(N,I.x+g,I.y+g,I.w,I.h)}}),v.useEffect(()=>{j(!1)},[y]);const C=Dc({height:s,width:s},x);let P=null;return y!=null&&(P=v.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{j(!0)},ref:B,crossOrigin:I==null?void 0:I.crossOrigin})),v.createElement(v.Fragment,null,v.createElement("canvas",Dc({style:C,height:s,width:s,ref:L,role:"img"},T)),P)});fS.displayName="QRCodeCanvas";var o0=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Kh,level:i=Yh,bgColor:c=Xh,fgColor:a=Qh,includeMargin:u=Jh,minVersion:l=e0,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=jc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:T,numCells:y,calculatedImageSettings:A}=r0({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let B=T,L=null;h!=null&&A!=null&&(A.excavation!=null&&(B=n0(T,A.excavation)),L=v.createElement("image",{href:h.src,height:A.h,width:A.w,x:A.x+x,y:A.y+x,preserveAspectRatio:"none",opacity:A.opacity,crossOrigin:A.crossOrigin}));const _=t0(B,x);return v.createElement("svg",Dc({height:s,width:s,viewBox:`0 0 ${y} ${y}`,ref:n,role:"img"},m),!!p&&v.createElement("title",null,p),v.createElement("path",{fill:c,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),v.createElement("path",{fill:a,d:_,shapeRendering:"crispEdges"}),L)});o0.displayName="QRCodeSVG";function dS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function pS(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function s0(){return/apple/i.test(navigator.vendor)}function hS(){return dS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function mS(){return pS().includes("jsdom/")}const i0="data-floating-ui-focusable",gS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function _c(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Pr(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 $r(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Uc(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function bS(e){return e.matches("html,body")}function Rt(e){return(e==null?void 0:e.ownerDocument)||document}function a0(e){return Fe(e)&&e.matches(gS)}function yS(e){if(!e||mS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function wS(e){return e?e.hasAttribute(i0)?e:e.querySelector("["+i0+"]")||e:null}function qs(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,...qs(e,o.id,n)])}function vS(e){return"nativeEvent"in e}function Co(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var xS=typeof document<"u",ES=function(){},Dt=xS?v.useLayoutEffect:ES;const SS={...z};function Zs(e){const t=z.useRef(e);return Dt(()=>{t.current=e}),t}const PS=SS.useInsertionEffect||(e=>e());function jt(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return PS(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const c0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function u0(e,t){const n=Vp(e,c0()),r=n.length;if(r===0)return;const o=_c(Rt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function $S(e){return u0(Rt(e).body,1)||e}function AS(e){return u0(Rt(e).body,-1)||e}function zc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Pr(n,r)}function TS(e){Vp(e,c0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function l0(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const OS="data-floating-ui-focusable",f0="active",d0="selected",CS={...z};let p0=!1,NS=0;const h0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+NS++;function IS(){const[e,t]=z.useState(()=>p0?h0():void 0);return Dt(()=>{e==null&&t(h0())},[]),z.useEffect(()=>{p0=!0},[]),e}const Hc=CS.useId||IS;let Wc;process.env.NODE_ENV!=="production"&&(Wc=new Set);function MS(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Wc)!=null&&e.has(o))){var s;(s=Wc)==null||s.add(o),console.error(o)}}function kS(){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 BS=z.createContext(null),LS=z.createContext(null),Vc=()=>{var e;return((e=z.useContext(BS))==null?void 0:e.id)||null},Gc=()=>z.useContext(LS);function No(e){return"data-floating-ui-"+e}function ut(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const m0=No("safe-polygon");function qc(e,t,n){if(n&&!Co(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function Zc(e){return typeof e=="function"?e():e}function FS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:p=!0}=t,d=Gc(),h=Vc(),m=Zs(u),x=Zs(a),T=Zs(n),y=Zs(f),A=z.useRef(),B=z.useRef(-1),L=z.useRef(),_=z.useRef(-1),j=z.useRef(!0),g=z.useRef(!1),w=z.useRef(()=>{}),$=z.useRef(!1),I=jt(()=>{var N;const b=(N=o.current.openEvent)==null?void 0:N.type;return(b==null?void 0:b.includes("mouse"))&&b!=="mousedown"});z.useEffect(()=>{if(!c)return;function N(b){let{open:k}=b;k||(ut(B),ut(_),j.current=!0,$.current=!1)}return s.on("openchange",N),()=>{s.off("openchange",N)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function N(k){I()&&r(!1,k,"hover")}const b=Rt(i.floating).documentElement;return b.addEventListener("mouseleave",N),()=>{b.removeEventListener("mouseleave",N)}},[i.floating,n,r,c,m,I]);const C=z.useCallback(function(N,b,k){b===void 0&&(b=!0),k===void 0&&(k="hover");const R=qc(x.current,"close",A.current);R&&!L.current?(ut(B),B.current=window.setTimeout(()=>r(!1,N,k),R)):b&&(ut(B),r(!1,N,k))},[x,r]),P=jt(()=>{w.current(),L.current=void 0}),S=jt(()=>{if(g.current){const N=Rt(i.floating).body;N.style.pointerEvents="",N.removeAttribute(m0),g.current=!1}}),E=jt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function N(U){if(ut(B),j.current=!1,l&&!Co(A.current)||Zc(y.current)>0&&!qc(x.current,"open"))return;const W=qc(x.current,"open",A.current);W?B.current=window.setTimeout(()=>{T.current||r(!0,U,"hover")},W):n||r(!0,U,"hover")}function b(U){if(E()){S();return}w.current();const W=Rt(i.floating);if(ut(_),$.current=!1,m.current&&o.current.floatingContext){n||ut(B),L.current=m.current({...o.current.floatingContext,tree:d,x:U.clientX,y:U.clientY,onClose(){S(),P(),E()||C(U,!0,"safe-polygon")}});const G=L.current;W.addEventListener("mousemove",G),w.current=()=>{W.removeEventListener("mousemove",G)};return}(A.current==="touch"?!Pr(i.floating,U.relatedTarget):!0)&&C(U)}function k(U){E()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:U.clientX,y:U.clientY,onClose(){S(),P(),E()||C(U)}})(U))}function R(){ut(B)}function D(U){E()||C(U,!1)}if(ue(i.domReference)){const U=i.domReference,W=i.floating;return n&&U.addEventListener("mouseleave",k),p&&U.addEventListener("mousemove",N,{once:!0}),U.addEventListener("mouseenter",N),U.addEventListener("mouseleave",b),W&&(W.addEventListener("mouseleave",k),W.addEventListener("mouseenter",R),W.addEventListener("mouseleave",D)),()=>{n&&U.removeEventListener("mouseleave",k),p&&U.removeEventListener("mousemove",N),U.removeEventListener("mouseenter",N),U.removeEventListener("mouseleave",b),W&&(W.removeEventListener("mouseleave",k),W.removeEventListener("mouseenter",R),W.removeEventListener("mouseleave",D))}}},[i,c,e,l,p,C,P,S,r,n,T,d,x,m,o,E,y]),Dt(()=>{var N;if(c&&n&&(N=m.current)!=null&&(N=N.__options)!=null&&N.blockPointerEvents&&I()){g.current=!0;const k=i.floating;if(ue(i.domReference)&&k){var b;const R=Rt(i.floating).body;R.setAttribute(m0,"");const D=i.domReference,U=d==null||(b=d.nodesRef.current.find(W=>W.id===h))==null||(b=b.context)==null?void 0:b.elements.floating;return U&&(U.style.pointerEvents=""),R.style.pointerEvents="none",D.style.pointerEvents="auto",k.style.pointerEvents="auto",()=>{R.style.pointerEvents="",D.style.pointerEvents="",k.style.pointerEvents=""}}}},[c,n,h,i,d,m,I]),Dt(()=>{n||(A.current=void 0,$.current=!1,P(),S())},[n,P,S]),z.useEffect(()=>()=>{P(),ut(B),ut(_),S()},[c,i.domReference,P,S]);const O=z.useMemo(()=>{function N(b){A.current=b.pointerType}return{onPointerDown:N,onPointerEnter:N,onMouseMove(b){const{nativeEvent:k}=b;function R(){!j.current&&!T.current&&r(!0,k,"hover")}l&&!Co(A.current)||n||Zc(y.current)===0||$.current&&b.movementX**2+b.movementY**2<2||(ut(_),A.current==="touch"?R():($.current=!0,_.current=window.setTimeout(R,Zc(y.current))))}}},[l,r,n,T,y]);return z.useMemo(()=>c?{reference:O}:{},[c,O])}const g0={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},b0=z.forwardRef(function(t,n){const[r,o]=z.useState();Dt(()=>{s0()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[No("focus-guard")]:"",style:g0};return M.jsx("span",{...t,...s})}),y0=z.createContext(null),w0=No("portal");function RS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Hc(),o=jS(),[s,i]=z.useState(null),c=z.useRef(null);return Dt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Dt(()=>{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(w0,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Dt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!uc(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(w0,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function DS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=RS({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),u=z.useRef(null),l=z.useRef(null),f=z.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||p)return;function m(x){s&&zc(x)&&(x.type==="focusin"?l0:TS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),z.useEffect(()=>{s&&(d||l0(s))},[d,s]),M.jsxs(y0.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&M.jsx(b0,{"data-type":"outside",ref:a,onFocus:m=>{if(zc(m,s)){var x;(x=l.current)==null||x.focus()}else{const T=i?i.domReference:null,y=AS(T);y==null||y.focus()}}}),h&&s&&M.jsx("span",{"aria-owns":s.id,style:g0}),s&&Or.createPortal(t,s),h&&s&&M.jsx(b0,{"data-type":"outside",ref:u,onFocus:m=>{if(zc(m,s)){var x;(x=f.current)==null||x.focus()}else{const T=i?i.domReference:null,y=$S(T);y==null||y.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const jS=()=>z.useContext(y0);function v0(e){return Fe(e.target)&&e.target.tagName==="BUTTON"}function _S(e){return Fe(e.target)&&e.target.tagName==="A"}function x0(e){return a0(e)}function US(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=z.useRef(),d=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const x=p.current;m.button===0&&c!=="click"&&(Co(x,!0)&&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 x=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}Co(x,!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||v0(m))&&(m.key===" "&&!x0(s)&&(m.preventDefault(),d.current=!0),!_S(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||v0(m)||x0(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const zS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},HS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},E0=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function WS(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=Gc(),x=jt(typeof a=="function"?a:()=>!1),T=typeof a=="function"?x:a,y=z.useRef(!1),{escapeKey:A,outsidePress:B}=E0(d),{escapeKey:L,outsidePress:_}=E0(h),j=z.useRef(!1),g=jt(S=>{var E;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const O=(E=s.current.floatingContext)==null?void 0:E.nodeId,N=m?qs(m.nodesRef.current,O):[];if(!A&&(S.stopPropagation(),N.length>0)){let b=!0;if(N.forEach(k=>{var R;if((R=k.context)!=null&&R.open&&!k.context.dataRef.current.__escapeKeyBubbles){b=!1;return}}),!b)return}r(!1,vS(S)?S.nativeEvent:S,"escape-key")}),w=jt(S=>{var E;const O=()=>{var N;g(S),(N=$r(S))==null||N.removeEventListener("keydown",O)};(E=$r(S))==null||E.addEventListener("keydown",O)}),$=jt(S=>{var E;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const N=y.current;if(y.current=!1,u==="click"&&N||O||typeof T=="function"&&!T(S))return;const b=$r(S),k="["+No("inert")+"]",R=Rt(o.floating).querySelectorAll(k);let D=ue(b)?b:null;for(;D&&!nn(D);){const G=rn(D);if(nn(G)||!ue(G))break;D=G}if(R.length&&ue(b)&&!bS(b)&&!Pr(b,o.floating)&&Array.from(R).every(G=>!Pr(D,G)))return;if(Fe(b)&&P){const G=nn(b),H=at(b),V=/auto|scroll/,Y=G||V.test(H.overflowX),Q=G||V.test(H.overflowY),oe=Y&&b.clientWidth>0&&b.scrollWidth>b.clientWidth,pe=Q&&b.clientHeight>0&&b.scrollHeight>b.clientHeight,Se=H.direction==="rtl",he=pe&&(Se?S.offsetX<=b.offsetWidth-b.clientWidth:S.offsetX>b.clientWidth),me=oe&&S.offsetY>b.clientHeight;if(he||me)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,W=m&&qs(m.nodesRef.current,U).some(G=>{var H;return Uc(S,(H=G.context)==null?void 0:H.elements.floating)});if(Uc(S,o.floating)||Uc(S,o.domReference)||W)return;const K=m?qs(m.nodesRef.current,U):[];if(K.length>0){let G=!0;if(K.forEach(H=>{var V;if((V=H.context)!=null&&V.open&&!H.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}r(!1,S,"outside-press")}),I=jt(S=>{var E;const O=()=>{var N;$(S),(N=$r(S))==null||N.removeEventListener(u,O)};(E=$r(S))==null||E.addEventListener(u,O)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=A,s.current.__outsidePressBubbles=B;let S=-1;function E(R){r(!1,R,"ancestor-scroll")}function O(){window.clearTimeout(S),j.current=!0}function N(){S=window.setTimeout(()=>{j.current=!1},As()?5:0)}const b=Rt(o.floating);c&&(b.addEventListener("keydown",L?w:g,L),b.addEventListener("compositionstart",O),b.addEventListener("compositionend",N)),T&&b.addEventListener(u,_?I:$,_);let k=[];return p&&(ue(o.domReference)&&(k=wn(o.domReference)),ue(o.floating)&&(k=k.concat(wn(o.floating))),!ue(o.reference)&&o.reference&&o.reference.contextElement&&(k=k.concat(wn(o.reference.contextElement)))),k=k.filter(R=>{var D;return R!==((D=b.defaultView)==null?void 0:D.visualViewport)}),k.forEach(R=>{R.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(b.removeEventListener("keydown",L?w:g,L),b.removeEventListener("compositionstart",O),b.removeEventListener("compositionend",N)),T&&b.removeEventListener(u,_?I:$,_),k.forEach(R=>{R.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,o,c,T,u,n,r,p,i,A,B,g,L,w,$,_,I]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,T,u]);const C=z.useMemo(()=>({onKeyDown:g,...l&&{[zS[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,f]),P=z.useMemo(()=>({onKeyDown:g,onMouseDown(){y.current=!0},onMouseUp(){y.current=!0},[HS[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return z.useMemo(()=>i?{reference:C,floating:P}:{},[i,C,P])}function VS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Hc(),s=z.useRef({}),[i]=z.useState(()=>kS()),c=Vc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ue(d)&&MS("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]=z.useState(r.reference),l=jt((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:u}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function GS(e){e===void 0&&(e={});const{nodeId:t}=e,n=VS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=Gc();Dt(()=>{l&&(f.current=l)},[l]);const d=ih({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(A=>{const B=ue(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),getClientRects:()=>A.getClientRects(),contextElement:A}:A;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(A=>{(ue(A)||A===null)&&(f.current=A,i(A)),(ue(d.refs.reference.current)||d.refs.reference.current===null||A!==null&&!ue(A))&&d.refs.setReference(A)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),T=z.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),y=z.useMemo(()=>({...d,...r,refs:x,elements:T,nodeId:t}),[d,x,T,t,r]);return Dt(()=>{r.dataRef.current.floatingContext=y;const A=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);A&&(A.context=y)}),z.useMemo(()=>({...d,context:y,refs:x,elements:T}),[d,x,T,y])}function Kc(){return hS()&&s0()}function qS(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=z.useRef(!1),l=z.useRef(-1),f=z.useRef(!0);z.useEffect(()=>{if(!c)return;const d=He(i.domReference);function h(){!n&&Fe(i.domReference)&&i.domReference===_c(Rt(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function x(){f.current=!1}return d.addEventListener("blur",h),Kc()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",x,!0)),()=>{d.removeEventListener("blur",h),Kc()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",x,!0))}},[i.domReference,n,c]),z.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),z.useEffect(()=>()=>{ut(l)},[]);const p=z.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=$r(d.nativeEvent);if(a&&ue(h)){if(Kc()&&!d.relatedTarget){if(!f.current&&!a0(h))return}else if(!yS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,x=ue(h)&&h.hasAttribute(No("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var T;const y=_c(i.domReference?i.domReference.ownerDocument:document);!h&&y===i.domReference||Pr((T=s.current.floatingContext)==null?void 0:T.refs.floating.current,y)||Pr(i.domReference,y)||x||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:p}:{},[c,p])}function Yc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[f0]:i,[d0]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[OS]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[f0,d0].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(x=>x(...h)).find(x=>x!==void 0)}}}else i[u]=l}),i),{})}}function ZS(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Yc(c,e,"reference"),t),s=z.useCallback(c=>Yc(c,e,"floating"),n),i=z.useCallback(c=>Yc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const KS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function YS(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=Hc(),l=((n=s.domReference)==null?void 0:n.id)||u,f=z.useMemo(()=>{var y;return((y=wS(s.floating))==null?void 0:y.id)||i},[s.floating,i]),p=(r=KS.get(a))!=null?r:a,h=Vc()!=null,m=z.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:l},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,l,a]),x=z.useMemo(()=>{const y={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?y:{...y,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),T=z.useCallback(y=>{let{active:A,selected:B}=y;const L={role:"option",...A&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...L,"aria-selected":B}}return{}},[f,a]);return z.useMemo(()=>c?{reference:m,floating:x,item:T}:{},[c,m,x,T])}const S0=v.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return M.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});S0.displayName="TooltipArrow";const Gn=({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]=v.useState(!1),f=v.useRef(null),{refs:p,floatingStyles:d,context:h}=GS({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:nh,middleware:[Ec(o?12:8),ch({fallbackAxisSideDirection:"start",padding:8}),ah({padding:8}),...o?[p6({element:f})]:[]]}),m=FS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),x=qS(h,{enabled:a.includes("focus")}),T=US(h,{enabled:a.includes("click")}),y=WS(h),A=YS(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:L}=ZS([m,x,T,y,A]);return i?M.jsx(M.Fragment,{children:e}):M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:p.setReference,...B(),className:"cursor-help",children:e}),u&&M.jsx(DS,{children:M.jsxs("div",{ref:p.setFloating,...L(),style:{...d,zIndex:101},className:`
|
|
169
|
+
*/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,S=x.useRef(null),N=x.useRef(null),B=x.useCallback(M=>{S.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(S.current!=null){const M=S.current,y=M.getContext("2d");if(!y)return;let A=g;const T=N.current,P=C!=null&&T!==null&&T.complete&&T.naturalHeight!==0&&T.naturalWidth!==0;P&&C.excavation!=null&&(A=_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(A,b))):g.forEach(function(z,_){z.forEach(function(W,K){W&&y.fillRect(K+b,_+b,1,1)})}),C&&(y.globalAlpha=C.opacity),P&&y.drawImage(T,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:S}=Uh({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let N=$,B=null;h!=null&&S!=null&&(S.excavation!=null&&(N=_h($,S.excavation)),B=x.createElement("image",{href:h.src,height:S.h,width:S.w,x:S.x+w,y:S.y+w,preserveAspectRatio:"none",opacity:S.opacity,crossOrigin:S.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=Ap(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){Ap(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),S=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 T;const P=(T=o.current.openEvent)==null?void 0:T.type;return(P==null?void 0:P.includes("mouse"))&&P!=="mousedown"});U.useEffect(()=>{if(!c)return;function T(P){let{open:L}=P;L||(bt(N),bt(F),D.current=!0,v.current=!1)}return s.on("openchange",T),()=>{s.off("openchange",T)}},[c,s]),U.useEffect(()=>{if(!c||!m.current||!n)return;function T(L){C()&&r(!1,L,"hover")}const P=zt(i.floating).documentElement;return P.addEventListener("mouseleave",T),()=>{P.removeEventListener("mouseleave",T)}},[i.floating,n,r,c,m,C]);const O=U.useCallback(function(T,P,L){P===void 0&&(P=!0),L===void 0&&(L="hover");const j=yu(w.current,"close",S.current);j&&!B.current?(bt(N),N.current=window.setTimeout(()=>r(!1,T,L),j)):P&&(bt(N),r(!1,T,L))},[w,r]),I=Wt(()=>{g.current(),B.current=void 0}),M=Wt(()=>{if(b.current){const T=zt(i.floating).body;T.style.pointerEvents="",T.removeAttribute(Jh),b.current=!1}}),y=Wt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function T(_){if(bt(N),D.current=!1,l&&!zo(S.current)||wu(E.current)>0&&!yu(w.current,"open"))return;const W=yu(w.current,"open",S.current);W?N.current=window.setTimeout(()=>{$.current||r(!0,_,"hover")},W):n||r(!0,_,"hover")}function P(_){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}(S.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",T,{once:!0}),_.addEventListener("mouseenter",T),_.addEventListener("mouseleave",P),W&&(W.addEventListener("mouseleave",L),W.addEventListener("mouseenter",j),W.addEventListener("mouseleave",z)),()=>{n&&_.removeEventListener("mouseleave",L),p&&_.removeEventListener("mousemove",T),_.removeEventListener("mouseenter",T),_.removeEventListener("mouseleave",P),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 T;if(c&&n&&(T=m.current)!=null&&(T=T.__options)!=null&&T.blockPointerEvents&&C()){b.current=!0;const L=i.floating;if(fe(i.domReference)&&L){var P;const j=zt(i.floating).body;j.setAttribute(Jh,"");const z=i.domReference,_=d==null||(P=d.nodesRef.current.find(W=>W.id===h))==null||(P=P.context)==null?void 0:P.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||(S.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 A=U.useMemo(()=>{function T(P){S.current=P.pointerType}return{onPointerDown:T,onPointerEnter:T,onMouseMove(P){const{nativeEvent:L}=P;function j(){!D.current&&!$.current&&r(!0,L,"hover")}l&&!zo(S.current)||n||wu(E.current)===0||v.current&&P.movementX**2+P.movementY**2<2||(bt(F),S.current==="touch"?j():(v.current=!0,F.current=window.setTimeout(j,wu(E.current))))}}},[l,r,n,$,E]);return U.useMemo(()=>c?{reference:A}:{},[c,A])}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:S,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 A=(y=s.current.floatingContext)==null?void 0:y.nodeId,T=m?ui(m.nodesRef.current,A):[];if(!S&&(M.stopPropagation(),T.length>0)){let P=!0;if(T.forEach(L=>{var j;if((j=L.context)!=null&&j.open&&!L.context.dataRef.current.__escapeKeyBubbles){P=!1;return}}),!P)return}r(!1,W3(M)?M.nativeEvent:M,"escape-key")}),g=Wt(M=>{var y;const A=()=>{var T;b(M),(T=Ir(M))==null||T.removeEventListener("keydown",A)};(y=Ir(M))==null||y.addEventListener("keydown",A)}),v=Wt(M=>{var y;const A=s.current.insideReactTree;s.current.insideReactTree=!1;const T=E.current;if(E.current=!1,u==="click"&&T||A||typeof $=="function"&&!$(M))return;const P=Ir(M),L="["+Ho("inert")+"]",j=zt(o.floating).querySelectorAll(L);let z=fe(P)?P:null;for(;z&&!sn(z);){const G=an(z);if(sn(G)||!fe(G))break;z=G}if(j.length&&fe(P)&&!U3(P)&&!Cr(P,o.floating)&&Array.from(j).every(G=>!Cr(z,G)))return;if(De(P)&&I){const G=sn(P),H=ht(P),Z=/auto|scroll/,J=G||Z.test(H.overflowX),oe=G||Z.test(H.overflowY),me=J&&P.clientWidth>0&&P.scrollWidth>P.clientWidth,ge=oe&&P.clientHeight>0&&P.scrollHeight>P.clientHeight,de=H.direction==="rtl",se=ge&&(de?M.offsetX<=P.offsetWidth-P.clientWidth:M.offsetX>P.clientWidth),pe=me&&M.offsetY>P.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 A=()=>{var T;v(M),(T=Ir(M))==null||T.removeEventListener(u,A)};(y=Ir(M))==null||y.addEventListener(u,A)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=S,s.current.__outsidePressBubbles=N;let M=-1;function y(j){r(!1,j,"ancestor-scroll")}function A(){window.clearTimeout(M),D.current=!0}function T(){M=window.setTimeout(()=>{D.current=!1},zs()?5:0)}const P=zt(o.floating);c&&(P.addEventListener("keydown",B?g:b,B),P.addEventListener("compositionstart",A),P.addEventListener("compositionend",T)),$&&P.addEventListener(u,F?C:v,F);let L=[];return p&&(fe(o.domReference)&&(L=Tn(o.domReference)),fe(o.floating)&&(L=L.concat(Tn(o.floating))),!fe(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat(Tn(o.reference.contextElement)))),L=L.filter(j=>{var z;return j!==((z=P.defaultView)==null?void 0:z.visualViewport)}),L.forEach(j=>{j.addEventListener("scroll",y,{passive:!0})}),()=>{c&&(P.removeEventListener("keydown",B?g:b,B),P.removeEventListener("compositionstart",A),P.removeEventListener("compositionend",T)),$&&P.removeEventListener(u,F?C:v,F),L.forEach(j=>{j.removeEventListener("scroll",y)}),window.clearTimeout(M)}},[s,o,c,$,u,n,r,p,i,S,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(S=>{const N=fe(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;a(N),d.refs.setReference(N)},[d.refs]),m=U.useCallback(S=>{(fe(S)||S===null)&&(f.current=S,i(S)),(fe(d.refs.reference.current)||d.refs.reference.current===null||S!==null&&!fe(S))&&d.refs.setReference(S)},[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 S=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);S&&(S.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:S,selected:N}=E;const B={role:"option",...S&&{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),S=v4(h,{role:"tooltip"}),{getReferenceProps:N,getFloatingProps:B}=y4([m,w,$,E,S]);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:`
|
|
164
170
|
z-[101] px-3 py-2 cursor-help
|
|
165
171
|
bg-fill-page-secondary
|
|
166
172
|
text-text-primary text-sm font-medium
|
|
@@ -168,5 +174,6 @@ ${Eb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
168
174
|
relative
|
|
169
175
|
${c}
|
|
170
176
|
${s}
|
|
171
|
-
`,children:[t,o&&M.jsx(S0,{ref:f,placement:h.placement||n})]})})]})},Io="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=",XS=(e,t)=>Number(e)>Number(t),$t=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},Xc=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return Xc(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:$t(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Ks={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},QS=[Ks.ETHEREUM,Ks.SEPOLIA,Ks.ARBITRUM,Ks.ARBITRUM_SEPOLIA],JS=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!QS.includes(t)}return!0},eP=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=dt(),c=v.useMemo(()=>JS(e||{}),[e]);return M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&M.jsx("div",{className:"bg-white rounded-lg",children:M.jsx(o0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&M.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[M.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),M.jsx(nS,{onCopy:()=>{o&&o(n)},text:n,children:M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[M.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),M.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),M.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[M.jsxs("div",{className:"flex items-start",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1",children:M.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),M.jsxs("div",{className:"text-sm",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[M.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),M.jsx(Gn,{content:M.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[M.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),M.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:M.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[M.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[M.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),M.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{r&&r({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),s()},children:i("deposit.title")})]})},Mo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return M.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},tP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=$t(Math.max(0,s).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[$t(e),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${$t(e)} ${n}`},nP=(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)},rP=(e,t,n)=>{if(!Rh(e,n))return!1;try{const r=new Ne(t||"0"),o=new Ne("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},oP=(e,t,n)=>{let r=t||"0";if(Rh(e,n))try{const o=new Ne(r),s=new Ne("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}try{const o=new Ne(r||"0");return console.log("bn:",o),o.isNaN()?r:o.decimalPlaces(6,Ne.ROUND_DOWN).toString()}catch{return r}},P0={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let We=null;const $0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(P0),a=v.useCallback(h=>{c(h),r(!0)},[]),u=v.useCallback(h=>{c(m=>({...m,...h}))},[]),l=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),v.useEffect(()=>(We={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{We=null}),[a,l,u,f,p,d]),n?M.jsx(I0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});$0.displayName="DepositManager";const A0=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.openDeposit(e||P0)},T0=()=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.closeDeposit()},O0=e=>{We&&We.updateDepositOptions(e)},Ys=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.setDepositLoading(e)},sP=()=>We?We.isOpen():!1,C0=()=>We?We.isLoading():!1,iP=()=>({openDeposit:A0,closeDeposit:T0,updateDepositOptions:O0,setDepositLoading:Ys,isOpen:sP,isLoading:C0}),aP=e=>{const{t}=dt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),f=(i||"").toUpperCase()==="ETH"?.001:a,p=nP(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<f?{text:t("deposit.minDepositParsed",{amount:f,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!p,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function cP(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(),x=a(),T=i({address:l,abi:ur,functionName:"allowance",args:[An(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&l&&p)}}),y=T!=null&&T.isSuccess?T.data:void 0,A=v.useMemo(()=>{if(d)return!0;if(!T.isSuccess||y===void 0||y===0n)return!1;try{const L=mw(String(Number(s||"0")||0),Number(f));return y>=L}catch{return!1}},[d,T.isSuccess,y,s,f]),B=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!x||!l||!p)return;const _=An(l),j=An(p);if((y||0n)>0n){const $=await m({abi:ur,address:_,functionName:"approve",args:[j,0n]});await x.waitForTransactionReceipt({hash:$})}const w=await m({abi:ur,address:_,functionName:"approve",args:[j,Ll]});await x.waitForTransactionReceipt({hash:w}),T!=null&&T.refetch&&await T.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,l,p,y,T,m,x,h]);return{approve:A,onApprove:B}}const uP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o(An(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},lP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var y;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=v.useMemo(()=>{const A="0x0000000000000000000000000000000000000000",B="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(L=>{const _=L.tokenAddress;if(!_)return!1;const j=_.toLowerCase();return!(_===A||j===B)})},[r]),[c,a]=v.useState({}),u=v.useCallback((A,B)=>{a(L=>({...L,[A]:B}))},[]),l=(y=o==null?void 0:o.useBalance)==null?void 0:y.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=v.useState(0),d=v.useMemo(()=>i.map(A=>v.createElement(uP,{key:`${A.tokenAddress}-${f}`,token:A,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:u})),[i,e,s,n,o,u,f]),h=v.useMemo(()=>{const A=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"},B=i.map(_=>{const j=c[An(_.tokenAddress)],g=j==null?void 0:j.balance,w=g==null?void 0:g.data;return{address:An(_.tokenAddress),value:(w==null?void 0:w.value)||BigInt(0),formatted:(w==null?void 0:w.formatted)||"0",decimals:(w==null?void 0:w.decimals)||_.decimals}}).filter(_=>_.address),L=B.reduce((_,j)=>({..._,[j.address]:{balance:j}}),{});return{balanceList:B,baseTokenBalance:A,combinedData:L}},[l,c,i]),m=v.useCallback(async()=>h,[h]),x=v.useMemo(()=>{const A=(l==null?void 0:l.isLoading)||!1,B=Object.values(c).some(L=>{var _;return(_=L.balance)==null?void 0:_.isLoading});return A||B},[l==null?void 0:l.isLoading,c]),T=v.useCallback(()=>p(A=>A+1),[]);return{multicallRun:m,multicallRefresh:T,multicallResult:h,validErcTokens:i,isLoading:x,queryComponents:d}},fP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:u}=dt(),l=i.useAccount(),f=t.tokenList.find(D=>D.token===n||D.symbol===n),p=t.chainId,[d,h]=v.useState("");v.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:x}=lP({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),T=v.useMemo(()=>{var U;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const D=m.combinedData[f.tokenAddress];return((U=D==null?void 0:D.balance)==null?void 0:U.formatted)||"0"},[f,m]),y="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",A="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",B=v.useMemo(()=>{var D,U;return jv({chain:_v,transport:g1(t.rpcUrl||((D=window==null?void 0:window.ENV)==null?void 0:D.CHAIN_RPC_URL_42161)||((U=window==null?void 0:window.ENV)==null?void 0:U.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),L="1000000000000",{formatted:_}=Uv({client:B,tokenAddress:y,holder:A,decimals:6,fallbackFormatted:L,pollingInterval:12e3}),[j,g]=v.useState(!1),{approve:w,onApprove:$}=cP({account:e,accountChainId:l.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),I=v.useCallback(async()=>{if(!j)try{g(!0),await $()}catch(D){console.error("Approve failed:",D)}finally{g(!1)}},[j,$]),C=v.useMemo(()=>+l.chainId!=+t.chainId,[l.chainId,t.chainId]),P=v.useCallback(async()=>{c&&c(p)},[c,p]);v.useEffect(()=>{C&&P()},[C,P]);const{showLayerZeroTip:S,layerZeroTipKey:E}=v.useMemo(()=>{const D=+t.chainId==42161||+t.chainId==421614,U=(n==null?void 0:n.toUpperCase())==="USDT",W=new Ne(d||"0"),K=new Ne("200000");let G=!1,H;if(D&&U&&d)if(W.gte(K))G=!0,H="deposit.layerZeroDepositTipGte200k";else{const V=_;if(typeof V=="string"&&V.length>0){const Q=new Ne(V);!Q.isNaN()&&W.gte(Q)&&(G=!0,H="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:G,layerZeroTipKey:H}},[t.chainId,n,d,_]),O=v.useCallback(()=>oP(+t.chainId,T||"0",n),[T,t==null?void 0:t.chainId,n]),N=v.useMemo(()=>rP(+t.chainId,d,n),[t==null?void 0:t.chainId,d,n]),b=aP({isNetworkMismatch:C,depositAmount:d,approved:w,currentTokenBalance:T,selectedToken:n,showLayerZeroTip:S,minDeposit:10}),k=D=>{const U=D.target.value,W=O(),K=Xc(U,W);if(K.isValid)h(K.formattedValue),K.errorType;else return K.errorType==="exceed_balance",void 0},R=v.useCallback(async()=>{Ys(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(D){console.error("Deposit error:",D),Ys(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return M.jsxs(M.Fragment,{children:[x,M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:u("deposit.amount"),value:d,onChange:k,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:()=>{const D=O();h(D)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:u("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(Gn,{content:u("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:u("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:tP(T||"0",d,n)})]})]}),!w&&XS(d||"0",0)&&M.jsxs("div",{className:"flex justify-center flex-col items-center",children:[M.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:u("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),M.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})}),M.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:I,disabled:j,children:j?M.jsx(Mo,{size:"xs",inline:!0}):u("deposit.enableWithToken",{token:n})})]}),S&&M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(E||"deposit.layerZeroDepositTip")})]}),M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),N&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u("deposit.depositTipFor25w")})]}),N&&M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:!(N||S)&&M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u("deposit.noPrivateKeyWalletWarning")})]}),M.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[M.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.arrivalTime")}),M.jsx(Gn,{content:M.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[M.jsx("p",{children:u("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),M.jsx("p",{children:u("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:M.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:u("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[M.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.equity")}),M.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?M.jsxs("span",{className:"flex items-center gap-1",children:[$t(o),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),$t((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${$t(o)} ${n}`})]})]}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${b.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:R,disabled:b.disabled||s,children:[(s||C)&&M.jsx(Mo,{size:"xs"}),b.text]})]})},N0=e=>e.toLocaleUpperCase()===Dn?Dn:ka,Qc=e=>N0(e.wallet)===Dn,dP=e=>N0(e.wallet)===ka,I0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultAccountType:c="perpetual",balances:a,wagmiHooks:u,onDeposit:l,onCopy:f,onChainChange:p,onTokenChange:d})=>{const{t:h}=dt(),[m,x]=v.useState(c),T=v.useCallback(C=>C==="spot"&&s&&s.length>0?s:o,[o,s]),y=T(c),[A,B]=v.useState(()=>{var C;return!y||y.length===0?1:i||((C=y[0])==null?void 0:C.chainId)||1}),L=v.useMemo(()=>T(m),[m,T]),_=L.find(C=>C.chainId===A)||L[0],[j,g]=v.useState(()=>{var O,N;if(!y||y.length===0)return"";const C=i||((O=y[0])==null?void 0:O.chainId),P=y.find(b=>b.chainId===C)||y[0],S=((P==null?void 0:P.tokenList)||[]).length>0?P:y.find(b=>(b.tokenList||[]).length>0),E=(N=S==null?void 0:S.tokenList)==null?void 0:N[0];return(E==null?void 0:E.token)||(E==null?void 0:E.symbol)||""}),w=v.useCallback(C=>{B(C),p==null||p(C)},[p]),$=v.useCallback(C=>{g(C),d==null||d(C)},[d]),I=v.useMemo(()=>{const C=(j||"").toLowerCase();if(console.log("key:",C),!C)return"0";const P=m==="spot"?a==null?void 0:a.spot:a==null?void 0:a.perpetual,S=P==null?void 0:P[C];return typeof S=="string"&&S.length>0?S:"0"},[a,m,j]);return e?ke.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:M.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)"},onClick:()=>{n()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:C=>{C.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:h("deposit.title")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(Ld,{className:"h-4 w-4"})})]}),M.jsx(jh,{selectedAccount:m,onAccountChange:C=>{var D,U;const P=C||"perpetual";x(P);const S=T(P);if(!S||S.length===0)return;const E=S.find(W=>W.chainId===A),O=E?E.chainId:S[0].chainId;B(O),p==null||p(O);const N=S.find(W=>W.chainId===O),b=(N==null?void 0:N.tokenList)||[],R=b.some(W=>(W.symbol||W.token)===j)?j:((D=b[0])==null?void 0:D.symbol)||((U=b[0])==null?void 0:U.token)||"";R&&(g(R),d==null||d(R))},className:"w-full"}),M.jsx(Dh,{currentActiveChain:_,chainList:L,onChainChange:w,curSelectToken:j,onTokenChange:$,walletType:Qc(r)?Dn:ka}),Qc(r)&&M.jsx(eP,{address:r.smartWalletAddress,currentActiveChain:_,selectedToken:j,onDeposit:l,onCopy:f,onClose:n}),dP(r)&&M.jsx(fP,{address:r.ethAddress,currentActiveChain:_,selectedToken:j,accountType:m,platformBalance:I,isLoading:t,wagmiHooks:u,onChainChange:w,onDeposit:l,onClose:n})]})})}),document.body):null},pP=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},hP=({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}=dt(),h=v.useMemo(()=>{const B=pP(n==null?void 0:n.showStepSize);if(a==="spot"||!an(r==null?void 0:r.chainId)){const L=new Ne(e||"0").minus(s||"0").decimalPlaces(B,Ne.ROUND_DOWN);return L.isNegative()?"0.00":L.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=v.useMemo(()=>o||"0",[o]),x=v.useMemo(()=>{const B=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ne(B||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]),T=B=>{const L=B.target.value,j=Xc(L,m||"0");if(j.isValid)u(j.formattedValue),j.errorType;else return j.errorType==="exceed_balance",void 0;f==null||f(j.formattedValue)},y=()=>{u(m),f==null||f(m)},A=()=>{const B=parseFloat(o||"0"),L=parseFloat(e||"0");if(L>0){const _=B-L,j=$t(Math.max(0,_).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[$t(o||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),j," ",t]})}return`${$t(o||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:T,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:y,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(Gn,{content:d("withdraw.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:A()})]})]}),i==="mpc"&&(a==="spot"||!an(r==null?void 0:r.chainId))?M.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:M.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:B=>l==null?void 0:l(B.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,M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:an(r==null?void 0:r.chainId)?M.jsxs(M.Fragment,{children:[M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),M.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:d("withdraw.commonWithdraw")})]}):M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:Io,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),M.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[M.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[M.jsx(Gn,{content:M.jsxs("div",{children:[M.jsx("div",{children:d("withdraw.speedNote")}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Oo,{selectedLevel:Pt.FAST,maxLevel:3}),M.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Oo,{selectedLevel:Pt.Medium,maxLevel:3}),M.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Oo,{selectedLevel:Pt.SLOW,maxLevel:3}),M.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:M.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),M.jsx("div",{className:"flex items-center",children:M.jsx(Oo,{selectedLevel:an(r==null?void 0:r.chainId)?Pt.SLOW:Pt.FAST,maxLevel:3})})]}),(a==="spot"||!an(r==null?void 0:r.chainId))&&M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx(Gn,{content:d("withdraw.feeCalculationTip"),children:M.jsxs("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:[d("withdraw.fee"),"/",d("withdraw.feeRate")]})}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t," / ",x,"%"]})]}),M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(an(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[$t(h)," ",t]})]})]})]})},mP=[];let Ve=null;const M0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=v.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=v.useCallback(h=>{c(m=>({...m,...h}))},[]),l=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),v.useEffect(()=>(Ve={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,l,u,f,p,d]),n?M.jsx(R0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||mP,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});M0.displayName="WithdrawManager";const k0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},B0=()=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.closeWithdraw()},L0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.updateWithdrawOptions(e)},Xs=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.setWithdrawLoading(e)},gP=()=>Ve?Ve.isOpen():!1,F0=()=>Ve?Ve.isLoading():!1,bP=()=>({openWithdraw:k0,closeWithdraw:B0,updateWithdrawOptions:L0,setWithdrawLoading:Xs,isOpen:gP,isLoading:F0}),yP=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultTokenAddress: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:x})=>{var G;const{t:T}=dt(),[y,A]=v.useState(i),B=v.useCallback(H=>H==="spot"&&n&&n.length>0?n:t,[t,n]),L=v.useMemo(()=>B(y),[y,B]),_=v.useMemo(()=>{var pe,Se;const H="USDC";if(!L||L.length===0)return{chainId:1,tokenSymbol:""};const V=he=>Array.isArray(he.tokenList)&&he.tokenList.some(me=>(me.token||me.symbol||"").toUpperCase()===H),Y=L.find(V)||L[0];if(!Y||!Array.isArray(Y.tokenList)||Y.tokenList.length===0)return{chainId:(Y==null?void 0:Y.chainId)||1,tokenSymbol:""};const Q=Y.tokenList.find(he=>(he.token||he.symbol||"").toUpperCase()===H),oe=(Q==null?void 0:Q.token)||(Q==null?void 0:Q.symbol)||((pe=Y.tokenList[0])==null?void 0:pe.token)||((Se=Y.tokenList[0])==null?void 0:Se.symbol)||"";return{chainId:Y.chainId,tokenSymbol:oe}},[L]),[j,g]=v.useState(()=>_.chainId),[w,$]=v.useState(()=>_.tokenSymbol),[I,C]=v.useState(s),[P,S]=v.useState(""),E=v.useCallback(H=>{g(H),h==null||h(H)},[h]),O=v.useCallback(H=>{$(H),m==null||m(H)},[m]),N=v.useRef(!0),b=v.useRef(w),k=v.useRef(j);v.useEffect(()=>{if(N.current){N.current=!1,b.current=w,k.current=j;return}(b.current!==w||k.current!==j)&&(C(""),b.current=w,k.current=j)},[w,j]);const R=L&&L.length>0?L.find(H=>H.chainId===j)||L[0]:null,D=(G=R==null?void 0:R.tokenList)==null?void 0:G.find(H=>H.token===w),U=v.useMemo(()=>{const H=new Ne(I||"0"),V=new Ne(l||"0"),Y=an(j);return!I||H.isZero()||!Y&&H.isLessThan(V)?{text:T("withdraw.confirmWithdraw"),disabled:!0}:D!=null&&D.minWithdrawSize&&H.lt(D.minWithdrawSize)?{text:T("withdraw.minWithdrawParsed",{amount:D.minWithdrawSize,token:D.symbol||D.token}),disabled:!0}:e==="mpc"&&(!Y||y==="spot")&&!P.trim()?{text:T("withdraw.invalidReceiverAddress"),disabled:!0}:{text:T("withdraw.confirmWithdraw"),disabled:!1}},[T,j,I,e,P,l,y,D]),W=v.useMemo(()=>{const H=(w||"").toLowerCase();if(!H)return a||"0";const V=y==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,Y=V==null?void 0:V[H];return typeof Y=="string"&&Y.length>0?Y:a||"0"},[u,y,w,a]),K=v.useCallback(async()=>{Xs(!0);try{if(p){const H=new Ne(I||"0");console.log("selectedToken:",D);const V={amount:H.toString(),chainId:j,tokenAddress:(D==null?void 0:D.tokenAddress)||"",coinId:(D==null?void 0:D.coinId)||"",tokenSymbol:w,accountType:y,selectedToken:D};e==="mpc"&&(!an(j)||y==="spot")&&(V.receiverAddress=P),p(V)}}catch{Xs(!1)}},[p,y,D,I,j,w,e,P]);return!L||L.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):R?M.jsxs(M.Fragment,{children:[M.jsx(jh,{selectedAccount:y,onAccountChange:H=>{var le,xn;const V=H||"perpetual";A(V);const Y=B(V);if(!Y||Y.length===0)return;const Q=Y.find(cn=>cn.chainId===j),oe=Q?Q.chainId:Y[0].chainId;g(oe),h==null||h(oe);const pe=Y.find(cn=>cn.chainId===oe),Se=(pe==null?void 0:pe.tokenList)||[],me=Se.some(cn=>(cn.symbol||cn.token)===w)?w:((le=Se[0])==null?void 0:le.symbol)||((xn=Se[0])==null?void 0:xn.token)||"";me&&($(me),m==null||m(me))},className:"w-full"}),M.jsx(Dh,{currentActiveChain:R,chainList:L,onChainChange:E,curSelectToken:w,onTokenChange:O,walletType:"EVM",txType:"withdraw"}),M.jsx(hP,{withdrawAmount:I,curSelectToken:w,tokenInfo:D,curSelectTokenData:{balance:D==null?void 0:D.balance,allowance:D==null?void 0:D.allowance},currentActiveChain:R,currentEquity:c||0,decimals:(D==null?void 0:D.decimals)||6,platformBalance:W,fee:l,walletType:e,accountType:y,receiverAddress:P,onWithdrawAmountChange:C,onReceiverAddressChange:S,onAmountChanged:x}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${U.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:K,disabled:U.disabled||f,children:[f&&M.jsx(Mo,{size:"xs"}),U.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},R0=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultTokenAddress:u,defaultAmount:l="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:x,onChainChange:T,onTokenChange:y,onAmountChanged:A})=>{const{t:B}=dt();return e?ke.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:M.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)"},onClick:()=>{r()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:L=>{L.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:B("withdraw.withdraw")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:M.jsx(Ld,{className:"h-4 w-4"})})]}),M.jsx(yP,{chains:i,spotChains:c,walletType:Qc(s)?"mpc":"evm",defaultChainId:a,defaultTokenAddress:u,defaultAmount:l,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:x,onClose:r,onChainChange:T,onTokenChange:y,onAmountChanged:A})]})})}),document.body):null};re.ChromeLoader=Mo,re.ComponentProvider=um,re.DEFAULT_LOCALE=Bo,re.Deposit=I0,re.DepositManager=$0,re.LOCALE_NAMES=im,re.LoadingSpinner=Mo,re.SUPPORTED_LOCALES=ei,re.Tooltip=Gn,re.Withdraw=R0,re.WithdrawManager=M0,re.closeDeposit=T0,re.closeWithdraw=B0,re.formatThousands=fm,re.isDepositLoading=C0,re.isWithdrawLoading=F0,re.openDeposit=A0,re.openWithdraw=k0,re.setDepositLoading=Ys,re.setWithdrawLoading=Xs,re.updateDepositOptions=O0,re.updateWithdrawOptions=L0,re.useComponentConfig=fu,re.useDeposit=zv,re.useDepositManager=iP,re.useTranslation=dt,re.useWithdraw=Hv,re.useWithdrawManager=bP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|
|
177
|
+
`,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=r===p5,u=x.useMemo(()=>{if(!e)return!1;const h=Number(e.chainId);return!Number.isNaN(h)&&(h===42161||h===421614)},[e]),l=a,f=x.useMemo(()=>{var h;return(h=e==null?void 0:e.tokenList)==null?void 0:h.find(m=>m.token===t||m.symbol===t)},[e,t]),p=x.useMemo(()=>{const h=(t||"").toUpperCase();if(!l&&h==="USDC")return c("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const $=c(l?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return l&&(!u||h==="USDC")?String($).split(`
|
|
178
|
+
`)[0]:$},[c,t,e==null?void 0:e.chain,l,u]),d=(f==null?void 0:f.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(T3,{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:p})})]}),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:[(a||t.toUpperCase()!=="USDC")&&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] ${a||t.toUpperCase()!=="USDC"?"mt-1":"mt-4"}`,children:[k.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),k.jsxs("span",{className:"text-text-primary font-medium text-right",children:[d," ",t]})]}),r===a0&&t.toUpperCase()!=="USDC"&&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}},S4=(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}`},P4=(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}},T4=(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)},A4=()=>Ye?Ye.isOpen():!1,pm=()=>Ye?Ye.isLoading():!1,O4=()=>({openDeposit:lm,closeDeposit:fm,updateDepositOptions:dm,setDepositLoading:di,isOpen:A4,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=P4(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,S=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:S,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 S="0x0000000000000000000000000000000000000000",N="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(B=>{const F=B.tokenAddress;if(!F)return!1;const D=F.toLowerCase();return!(F===S||D===N)})},[r]),[c,a]=x.useState({}),u=x.useCallback((S,N)=>{a(B=>({...B,[S]: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(S=>x.createElement(I4,{key:`${S.tokenAddress}-${f}`,token:S,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:u})),[i,e,s,n,o,u,f]),h=x.useMemo(()=>{const S=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:S,combinedData:B}},[l,c,i]),m=x.useCallback(async()=>h,[h]),w=x.useMemo(()=>{const S=(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 S||N},[l==null?void 0:l.isLoading,c]),$=x.useCallback(()=>p(S=>S+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",S="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:S,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]),A=x.useCallback(()=>T4(+t.chainId,$||"0",n,r),[$,t==null?void 0:t.chainId,n,r]),T=x.useMemo(()=>r!=="spot"&&$4(+t.chainId,d,n),[r,t==null?void 0:t.chainId,d,n]),P=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=A(),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 _=A();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:S4($||"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"})]}),T&&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(P)})]}),T&&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:!(T||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 whitespace-pre-line",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()===xn?xn:sc,Eu=e=>hm(e.wallet)===xn,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(T=>T==="spot"&&s&&s.length>0?s:o,[o,s]),S=E(a),[N,B]=x.useState(()=>{var T;return!S||S.length===0?1:i||((T=S[0])==null?void 0:T.chainId)||1}),F=x.useMemo(()=>E(w),[w,E]),D=F.find(T=>T.chainId===N)||F[0],[b,g]=x.useState(()=>{var _;if(!S||S.length===0)return"";const T=i||((_=S[0])==null?void 0:_.chainId),P=S.find(W=>W.chainId===T)||S[0],L=((P==null?void 0:P.tokenList)||[]).length>0?P:S.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(T=>{B(T),d==null||d(T)},[d]),C=x.useCallback(T=>{g(T),h==null||h(T)},[h]),O=x.useMemo(()=>{const T=(b||"").toLowerCase();if(!T)return"0";const P=w==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,L=P==null?void 0:P[T];return typeof L=="string"&&L.length>0?L:"0"},[u,w,b]),[I,M]=x.useState(!1),y=T=>{T.target===T.currentTarget?M(!0):M(!1)},A=T=>{I&&T.target===T.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:A,"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:T=>{T.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(Sh,{selectedAccount:w,onAccountChange:T=>{var H,Z;const P=T||"perpetual";$(P);const L=E(P);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)?xn: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]),S=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:S,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(),[S,N]=x.useState(i),B=x.useCallback(Z=>Z==="spot"&&n&&n.length>0?n:t,[t,n]),F=x.useMemo(()=>B(S),[S,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(),Nn=se.find(gt=>(gt.token||gt.symbol||"").toUpperCase()===ee)||se[0];return Nn.token||Nn.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(Se=>(Se.token||Se.symbol||"").toUpperCase()===de)),ee){const Se=ee.token||ee.symbol||o||"";return{chainId:se.chainId,tokenSymbol:Se}}}}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(""),A=x.useCallback(Z=>{g(Z),h==null||h(Z)},[h]),T=x.useCallback(Z=>{C(Z),m==null||m(Z)},[m]),P=x.useRef(!0),L=x.useRef(v),j=x.useRef(b);x.useEffect(()=>{if(P.current){P.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||S==="spot")&&!M.trim()?{text:E("withdraw.invalidReceiverAddress"),disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,b,O,e,M,l,S,_]),K=x.useMemo(()=>{const Z=(v||"").toLowerCase();if(!Z)return a||"0";const J=S==="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,S,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:S,selectedToken:_};e==="mpc"&&(!ln(b)||S==="spot")&&(J.receiverAddress=M),p(J)}}catch{pi(!1)}},[p,S,_,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(Sh,{selectedAccount:S,onAccountChange:Z=>{var Se,Nn;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:((Se=se[0])==null?void 0:Se.symbol)||((Nn=se[0])==null?void 0:Nn.token)||"";ee&&(C(ee),m==null||m(ee))},className:"w-full"}),k.jsx(Eh,{currentActiveChain:z,chainList:F,onChainChange:A,curSelectToken:v,onTokenChange:T,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:S,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:S,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:S,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"})});
|
|
172
179
|
//# sourceMappingURL=index.umd.js.map
|