@edgex-web/components 0.1.0-beta.3 → 0.1.0-beta.31
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-DOFg6QiX.mjs +150 -0
- package/dist/ccip-DOFg6QiX.mjs.map +1 -0
- package/dist/components/Deposit/index.d.ts +4 -6
- package/dist/components/Deposit/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/DepositManager.d.ts +2 -0
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
- package/dist/components/Deposit/src/{EVMWalletView.d.ts → evm/WalletView.d.ts} +7 -7
- package/dist/components/Deposit/src/evm/WalletView.d.ts.map +1 -0
- package/dist/components/Deposit/src/evm/index.d.ts +33 -0
- package/dist/components/Deposit/src/evm/index.d.ts.map +1 -0
- package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts +69 -0
- package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts.map +1 -0
- package/dist/components/Deposit/src/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/{MPCWalletView.d.ts → mpc/WalletView.d.ts} +3 -4
- package/dist/components/Deposit/src/mpc/WalletView.d.ts.map +1 -0
- package/dist/components/Deposit/src/mpc/index.d.ts +23 -0
- package/dist/components/Deposit/src/mpc/index.d.ts.map +1 -0
- package/dist/components/Deposit/src/selector/Asset.d.ts +19 -0
- package/dist/components/Deposit/src/selector/Asset.d.ts.map +1 -0
- package/dist/components/Deposit/src/selector/Chain.d.ts +16 -0
- package/dist/components/Deposit/src/selector/Chain.d.ts.map +1 -0
- package/dist/components/Deposit/src/selector/index.d.ts +14 -0
- package/dist/components/Deposit/src/selector/index.d.ts.map +1 -0
- package/dist/components/Deposit/src/utils.d.ts +62 -1
- package/dist/components/Deposit/src/utils.d.ts.map +1 -1
- package/dist/components/Deposit/src/walletAdapters.d.ts.map +1 -1
- package/dist/components/Deposit/test-arbitrum-token-limits.d.ts +5 -0
- package/dist/components/Deposit/test-arbitrum-token-limits.d.ts.map +1 -0
- package/dist/components/Deposit/test-arbitrum-unlimited.d.ts +5 -0
- package/dist/components/Deposit/test-arbitrum-unlimited.d.ts.map +1 -0
- package/dist/components/Deposit/types/index.d.ts +63 -49
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/components/Deposit/utils/migrateDepositData.d.ts +42 -0
- package/dist/components/Deposit/utils/migrateDepositData.d.ts.map +1 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +19 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts.map +1 -0
- package/dist/components/LoadingSpinner/index.d.ts +4 -0
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -0
- package/dist/components/Provider/index.d.ts +6 -1
- package/dist/components/Provider/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/Tooltip/src/Tooltip.d.ts +5 -0
- package/dist/components/Tooltip/src/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/src/TooltipArrow.d.ts +5 -0
- package/dist/components/Tooltip/src/TooltipArrow.d.ts.map +1 -0
- package/dist/components/Tooltip/src/index.d.ts +3 -0
- package/dist/components/Tooltip/src/index.d.ts.map +1 -0
- package/dist/components/Tooltip/types/index.d.ts +52 -0
- package/dist/components/Tooltip/types/index.d.ts.map +1 -0
- package/dist/components/Withdraw/constants/index.d.ts +7 -0
- package/dist/components/Withdraw/constants/index.d.ts.map +1 -0
- package/dist/components/Withdraw/index.d.ts +6 -10
- package/dist/components/Withdraw/index.d.ts.map +1 -1
- package/dist/components/Withdraw/src/Speed.d.ts +10 -0
- package/dist/components/Withdraw/src/Speed.d.ts.map +1 -0
- package/dist/components/Withdraw/src/WithdrawManager.d.ts +12 -0
- package/dist/components/Withdraw/src/WithdrawManager.d.ts.map +1 -0
- package/dist/components/Withdraw/src/constants.d.ts +24 -0
- package/dist/components/Withdraw/src/constants.d.ts.map +1 -0
- package/dist/components/Withdraw/src/evm/WalletView.d.ts +22 -0
- package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -0
- package/dist/components/Withdraw/src/evm/index.d.ts +34 -0
- package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -0
- package/dist/components/Withdraw/src/index.d.ts +5 -0
- package/dist/components/Withdraw/src/index.d.ts.map +1 -0
- package/dist/components/Withdraw/types/index.d.ts +83 -0
- package/dist/components/Withdraw/types/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useTranslation.d.ts +135 -0
- package/dist/hooks/useTranslation.d.ts.map +1 -0
- package/dist/index-B_-QpzAE.mjs +20192 -0
- package/dist/index-B_-QpzAE.mjs.map +1 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +30 -7269
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +99 -60
- package/dist/index.umd.js.map +1 -1
- package/dist/locales/en-US.d.ts +50 -0
- package/dist/locales/en-US.d.ts.map +1 -0
- package/dist/locales/index.d.ts +16 -0
- package/dist/locales/index.d.ts.map +1 -0
- package/dist/locales/ja-JP.d.ts +50 -0
- package/dist/locales/ja-JP.d.ts.map +1 -0
- package/dist/locales/ru-RU.d.ts +50 -0
- package/dist/locales/ru-RU.d.ts.map +1 -0
- package/dist/locales/zh-CN.d.ts +51 -0
- package/dist/locales/zh-CN.d.ts.map +1 -0
- package/dist/locales/zh-TW.d.ts +50 -0
- package/dist/locales/zh-TW.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +22 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +12 -5
- package/dist/components/Deposit/src/ChainSelector.d.ts +0 -35
- package/dist/components/Deposit/src/ChainSelector.d.ts.map +0 -1
- package/dist/components/Deposit/src/ChainTokenSelector.d.ts +0 -25
- package/dist/components/Deposit/src/ChainTokenSelector.d.ts.map +0 -1
- package/dist/components/Deposit/src/Deposit.d.ts +0 -17
- package/dist/components/Deposit/src/Deposit.d.ts.map +0 -1
- package/dist/components/Deposit/src/EVMWalletView.d.ts.map +0 -1
- package/dist/components/Deposit/src/MPCWalletView.d.ts.map +0 -1
- package/dist/components/Deposit/src/components.d.ts +0 -89
- package/dist/components/Deposit/src/components.d.ts.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(re,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],S):(re=typeof globalThis<"u"?globalThis:re||self,S(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,S,Be){"use strict";var DP=Object.defineProperty;var jP=(re,S,Be)=>S in re?DP(re,S,{enumerable:!0,configurable:!0,writable:!0,value:Be}):re[S]=Be;var Xe=(re,S,Be)=>jP(re,typeof S!="symbol"?S+"":S,Be);function su(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 _=su(S),Ar=su(Be);function X0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qs={exports:{}},Tr={};/**
|
|
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 Q0(){if(iu)return Tr;iu=1;var e=S,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 Tr.Fragment=n,Tr.jsx=i,Tr.jsxs=i,Tr}var Cr={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,56 +14,53 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var au;function J0(){return au||(au=1,process.env.NODE_ENV!=="production"&&function(){var e=S,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 v(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[m];return typeof q=="function"?q:null}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(R){{for(var q=arguments.length,Y=new Array(q>1?q-1:0),te=1;te<q;te++)Y[te-1]=arguments[te];$("error",R,Y)}}function $(R,q,Y){{var te=C.ReactDebugCurrentFrame,he=te.getStackAddendum();he!==""&&(q+="%s",Y=Y.concat([he]));var me=Y.map(function(le){return String(le)});me.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,me)}}var B=!1,k=!1,D=!1,j=!1,g=!1,w;w=Symbol.for("react.module.reference");function A(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||g||R===o||R===u||R===l||j||R===d||B||k||D||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===w||R.getModuleId!==void 0))}function I(R,q,Y){var te=R.displayName;if(te)return te;var he=q.displayName||q.name||"";return he!==""?Y+"("+he+")":Y}function N(R){return R.displayName||"Context"}function P(R){if(R==null)return null;if(typeof R.tag=="number"&&b("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 N(q)+".Consumer";case i:var Y=R;return N(Y._context)+".Provider";case a:return I(R,R.render,"ForwardRef");case f:var te=R.displayName||null;return te!==null?te:P(R.type)||"Memo";case p:{var he=R,me=he._payload,le=he._init;try{return P(le(me))}catch{return null}}}return null}var E=Object.assign,x=0,T,O,y,L,F,U,z;function V(){}V.__reactDisabledLog=!0;function Z(){{if(x===0){T=console.log,O=console.info,y=console.warn,L=console.error,F=console.group,U=console.groupCollapsed,z=console.groupEnd;var R={configurable:!0,enumerable:!0,value:V,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}x++}}function W(){{if(x--,x===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:E({},R,{value:T}),info:E({},R,{value:O}),warn:E({},R,{value:y}),error:E({},R,{value:L}),group:E({},R,{value:F}),groupCollapsed:E({},R,{value:U}),groupEnd:E({},R,{value:z})})}x<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=C.ReactCurrentDispatcher,G;function X(R,q,Y){{if(G===void 0)try{throw Error()}catch(he){var te=he.stack.trim().match(/\n( *(at )?)/);G=te&&te[1]||""}return`
|
|
18
|
+
`+G+R}}var ee=!1,fe;{var xe=typeof WeakMap=="function"?WeakMap:Map;fe=new xe}function oe(R,q){if(!R||ee)return"";{var Y=fe.get(R);if(Y!==void 0)return Y}var te;ee=!0;var he=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var me;me=K.current,K.current=null,Z();try{if(q){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(qe){te=qe}Reflect.construct(R,[],le)}else{try{le.call()}catch(qe){te=qe}R.call(le.prototype)}}else{try{throw Error()}catch(qe){te=qe}R()}}catch(qe){if(qe&&te&&typeof qe.stack=="string"){for(var ae=qe.stack.split(`
|
|
19
|
+
`),De=te.stack.split(`
|
|
20
|
+
`),Se=ae.length-1,Pe=De.length-1;Se>=1&&Pe>=0&&ae[Se]!==De[Pe];)Pe--;for(;Se>=1&&Pe>=0;Se--,Pe--)if(ae[Se]!==De[Pe]){if(Se!==1||Pe!==1)do if(Se--,Pe--,Pe<0||ae[Se]!==De[Pe]){var ft=`
|
|
21
|
+
`+ae[Se].replace(" at new "," at ");return R.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",R.displayName)),typeof R=="function"&&fe.set(R,ft),ft}while(Se>=1&&Pe>=0);break}}}finally{ee=!1,K.current=me,W(),Error.prepareStackTrace=he}var $r=R?R.displayName||R.name:"",Hn=$r?X($r):"";return typeof R=="function"&&fe.set(R,Hn),Hn}function ue(R,q,Y){return oe(R,!1)}function pe(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function se(R,q,Y){if(R==null)return"";if(typeof R=="function")return oe(R,pe(R));if(typeof R=="string")return X(R);switch(R){case u:return X("Suspense");case l:return X("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return ue(R.render);case f:return se(R.type,q,Y);case p:{var te=R,he=te._payload,me=te._init;try{return se(me(he),q,Y)}catch{}}}return""}var Le=Object.prototype.hasOwnProperty,Er={},Sr=C.ReactDebugCurrentFrame;function No(R){if(R){var q=R._owner,Y=se(R.type,R._source,q?q.type:null);Sr.setExtraStackFrame(Y)}else Sr.setExtraStackFrame(null)}function Xs(R,q,Y,te,he){{var me=Function.call.bind(Le);for(var le in R)if(me(R,le)){var ae=void 0;try{if(typeof R[le]!="function"){var De=Error((te||"React class")+": "+Y+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw De.name="Invariant Violation",De}ae=R[le](q,le,te,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ae=Se}ae&&!(ae instanceof Error)&&(No(he),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",te||"React class",Y,le,typeof ae),No(null)),ae instanceof Error&&!(ae.message in Er)&&(Er[ae.message]=!0,No(he),b("Failed %s type: %s",Y,ae.message),No(null))}}}var bP=Array.isArray;function Qc(R){return bP(R)}function yP(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,Y=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function vP(R){try{return D0(R),!1}catch{return!0}}function D0(R){return""+R}function j0(R){if(vP(R))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",yP(R)),D0(R)}var _0=C.ReactCurrentOwner,wP={key:!0,ref:!0,__self:!0,__source:!0},U0,z0;function xP(R){if(Le.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function EP(R){if(Le.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function SP(R,q){typeof R.ref=="string"&&_0.current}function PP(R,q){{var Y=function(){U0||(U0=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function $P(R,q){{var Y=function(){z0||(z0=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var AP=function(R,q,Y,te,he,me,le){var ae={$$typeof:t,type:R,key:q,ref:Y,props:le,_owner:me};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:he}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function TP(R,q,Y,te,he){{var me,le={},ae=null,De=null;Y!==void 0&&(j0(Y),ae=""+Y),EP(q)&&(j0(q.key),ae=""+q.key),xP(q)&&(De=q.ref,SP(q,he));for(me in q)Le.call(q,me)&&!wP.hasOwnProperty(me)&&(le[me]=q[me]);if(R&&R.defaultProps){var Se=R.defaultProps;for(me in Se)le[me]===void 0&&(le[me]=Se[me])}if(ae||De){var Pe=typeof R=="function"?R.displayName||R.name||"Unknown":R;ae&&PP(le,Pe),De&&$P(le,Pe)}return AP(R,ae,De,he,te,_0.current,le)}}var Jc=C.ReactCurrentOwner,W0=C.ReactDebugCurrentFrame;function Pr(R){if(R){var q=R._owner,Y=se(R.type,R._source,q?q.type:null);W0.setExtraStackFrame(Y)}else W0.setExtraStackFrame(null)}var eu;eu=!1;function tu(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function H0(){{if(Jc.current){var R=P(Jc.current.type);if(R)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+R+"`."}return""}}function CP(R){return""}var V0={};function OP(R){{var q=H0();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 G0(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=OP(q);if(V0[Y])return;V0[Y]=!0;var te="";R&&R._owner&&R._owner!==Jc.current&&(te=" It was passed a child from "+P(R._owner.type)+"."),Pr(R),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,te),Pr(null)}}function q0(R,q){{if(typeof R!="object")return;if(Qc(R))for(var Y=0;Y<R.length;Y++){var te=R[Y];tu(te)&&G0(te,q)}else if(tu(R))R._store&&(R._store.validated=!0);else if(R){var he=v(R);if(typeof he=="function"&&he!==R.entries)for(var me=he.call(R),le;!(le=me.next()).done;)tu(le.value)&&G0(le.value,q)}}}function NP(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=P(q);Xs(Y,R.props,"prop",te,R)}else if(q.PropTypes!==void 0&&!eu){eu=!0;var he=P(q);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",he||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function IP(R){{for(var q=Object.keys(R.props),Y=0;Y<q.length;Y++){var te=q[Y];if(te!=="children"&&te!=="key"){Pr(R),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),Pr(null);break}}R.ref!==null&&(Pr(R),b("Invalid attribute `ref` supplied to `React.Fragment`."),Pr(null))}}var Z0={};function K0(R,q,Y,te,he,me){{var le=A(R);if(!le){var ae="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var De=CP();De?ae+=De:ae+=H0();var Se;R===null?Se="null":Qc(R)?Se="array":R!==void 0&&R.$$typeof===t?(Se="<"+(P(R.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):Se=typeof R,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Se,ae)}var Pe=TP(R,q,Y,he,me);if(Pe==null)return Pe;if(le){var ft=q.children;if(ft!==void 0)if(te)if(Qc(ft)){for(var $r=0;$r<ft.length;$r++)q0(ft[$r],R);Object.freeze&&Object.freeze(ft)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else q0(ft,R)}if(Le.call(q,"key")){var Hn=P(R),qe=Object.keys(q).filter(function(FP){return FP!=="key"}),nu=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!Z0[Hn+nu]){var RP=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
30
|
+
<%s key={someKey} {...props} />`,nu,Hn,RP,Hn),Z0[Hn+nu]=!0}}return R===r?IP(Pe):NP(Pe),Pe}}function MP(R,q,Y){return K0(R,q,Y,!0)}function LP(R,q,Y){return K0(R,q,Y,!1)}var BP=LP,kP=MP;Cr.Fragment=r,Cr.jsx=BP,Cr.jsxs=kP}()),Cr}process.env.NODE_ENV==="production"?Qs.exports=Q0():Qs.exports=J0();var M=Qs.exports;const em={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
|
|
31
|
+
充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"您可以在约 {{v}} 分钟 (达到 {{v1}} 个区块确认后) 提走已到账的资金",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以提取的最大金额。当 available 为0或负数时,不允许提现。",noPrivateKeyWalletWarning:"暂不支持无私钥钱包充值。若您是无私钥钱包,请勿进行充值。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法"}},tm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
32
|
+
If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"You can withdraw the arrived funds in approximately {{v}} minutes (after reaching {{v1}} block confirmations)",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"Max. amount you can withdraw. When the available amount shown is 0 or negative, you are not allowed to make withdrawals.",noPrivateKeyWalletWarning:"Deposits from wallets without private keys are not supported at the moment. If you are using such a wallet, please do not make a deposit.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address"}},nm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
|
|
33
|
+
入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"{{v1}} ブロック確認後、おおよそ {{v}} 分以内に引き出し可能となります",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"出金可能な最大金額です。 available が0またはマイナスの場合、出金は行えません。",noPrivateKeyWalletWarning:"現在、秘密鍵のないウォレットからの入金はサポートされていません。該当ウォレットをご利用の場合は、入金しないでください。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス"}},rm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
|
|
34
|
+
Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Вы сможете вывести поступившие средства примерно через {{v}} минут (после {{v1}} подтверждений в блокчейне)",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма для вывода. Если доступная сумма равна 0 или меньше, вывод невозможен.",noPrivateKeyWalletWarning:"В настоящее время пополнение кошельков без приватных ключей не поддерживается. Если у вас такой кошелёк, пожалуйста, не выполняйте пополнение.",layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя"}},om={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
35
|
+
充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"您可以在約 {{v}} 分鐘 (達到 {{v1}} 個區塊確認後) 提走已到帳的資金",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以提取的最大金額。當 available 爲0或負數時,不允許提現。",noPrivateKeyWalletWarning:"暫不支援無私鑰錢包充值。若您使用的是無私鑰錢包,請勿進行充值。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法"}},Js=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],cu={"en-US":tm,"ja-JP":nm,"ru-RU":rm,"zh-CN":em,"zh-TW":om},Io="en-US",sm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},im=e=>Js.includes(e)?cu[e]:cu[Io],am=e=>Js.includes(e),uu=S.createContext(null),cm=({config:e,children:t})=>{const n=S.useMemo(()=>{const r=e.locale||Io,o=am(r)?r:Io,s=im(o);return{...e,currentLocale:o,translations:s}},[e]);return M.jsx(uu.Provider,{value:n,children:t})},lu=()=>{const e=S.useContext(uu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var um=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ei=Math.ceil,Qe=Math.floor,je="[BigNumber Error] ",fu=je+"Number primitive has more than 15 significant digits: ",dt=1e14,ne=14,ti=9007199254740991,ni=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],un=1e7,Te=1e9;function du(e){var t,n,r,o=b.prototype={constructor:b,toString:null,valueOf:null},s=new b(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},v="0123456789abcdefghijklmnopqrstuvwxyz",C=!0;function b(g,w){var A,I,N,P,E,x,T,O,y=this;if(!(y instanceof b))return new b(g,w);if(w==null){if(g&&g._isBigNumber===!0){y.s=g.s,!g.c||g.e>f?y.c=y.e=null:g.e<l?y.c=[y.e=0]:(y.e=g.e,y.c=g.c.slice());return}if((x=typeof g=="number")&&g*0==0){if(y.s=1/g<0?(g=-g,-1):1,g===~~g){for(P=0,E=g;E>=10;E/=10,P++);P>f?y.c=y.e=null:(y.e=P,y.c=[g]);return}O=String(g)}else{if(!um.test(O=String(g)))return r(y,O,x);y.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(P=O.indexOf("."))>-1&&(O=O.replace(".","")),(E=O.search(/e/i))>0?(P<0&&(P=E),P+=+O.slice(E+1),O=O.substring(0,E)):P<0&&(P=O.length)}else{if(ye(w,2,v.length,"Base"),w==10&&C)return y=new b(g),D(y,i+y.e+1,c);if(O=String(g),x=typeof g=="number"){if(g*0!=0)return r(y,O,x,w);if(y.s=1/g<0?(O=O.slice(1),-1):1,b.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(fu+g)}else y.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(A=v.slice(0,w),P=E=0,T=O.length;E<T;E++)if(A.indexOf(I=O.charAt(E))<0){if(I=="."){if(E>P){P=T;continue}}else if(!N&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){N=!0,E=-1,P=0;continue}return r(y,String(g),x,w)}x=!1,O=n(O,w,10,y.s),(P=O.indexOf("."))>-1?O=O.replace(".",""):P=O.length}for(E=0;O.charCodeAt(E)===48;E++);for(T=O.length;O.charCodeAt(--T)===48;);if(O=O.slice(E,++T)){if(T-=E,x&&b.DEBUG&&T>15&&(g>ti||g!==Qe(g)))throw Error(fu+y.s*g);if((P=P-E-1)>f)y.c=y.e=null;else if(P<l)y.c=[y.e=0];else{if(y.e=P,y.c=[],E=(P+1)%ne,P<0&&(E+=ne),E<T){for(E&&y.c.push(+O.slice(0,E)),T-=ne;E<T;)y.c.push(+O.slice(E,E+=ne));E=ne-(O=O.slice(E)).length}else E-=T;for(;E--;O+="0");y.c.push(+O)}}else y.c=[y.e=0]}b.clone=du,b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.EUCLID=9,b.config=b.set=function(g){var w,A;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(w="DECIMAL_PLACES")&&(A=g[w],ye(A,0,Te,w),i=A),g.hasOwnProperty(w="ROUNDING_MODE")&&(A=g[w],ye(A,0,8,w),c=A),g.hasOwnProperty(w="EXPONENTIAL_AT")&&(A=g[w],A&&A.pop?(ye(A[0],-Te,0,w),ye(A[1],0,Te,w),a=A[0],u=A[1]):(ye(A,-Te,Te,w),a=-(u=A<0?-A:A))),g.hasOwnProperty(w="RANGE"))if(A=g[w],A&&A.pop)ye(A[0],-Te,-1,w),ye(A[1],1,Te,w),l=A[0],f=A[1];else if(ye(A,-Te,Te,w),A)l=-(f=A<0?-A:A);else throw Error(je+w+" cannot be zero: "+A);if(g.hasOwnProperty(w="CRYPTO"))if(A=g[w],A===!!A)if(A)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=A;else throw p=!A,Error(je+"crypto unavailable");else p=A;else throw Error(je+w+" not true or false: "+A);if(g.hasOwnProperty(w="MODULO_MODE")&&(A=g[w],ye(A,0,9,w),d=A),g.hasOwnProperty(w="POW_PRECISION")&&(A=g[w],ye(A,0,Te,w),h=A),g.hasOwnProperty(w="FORMAT"))if(A=g[w],typeof A=="object")m=A;else throw Error(je+w+" not an object: "+A);if(g.hasOwnProperty(w="ALPHABET"))if(A=g[w],typeof A=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(A))C=A.slice(0,10)=="0123456789",v=A;else throw Error(je+w+" invalid: "+A)}else throw Error(je+"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:v}},b.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!b.DEBUG)return!0;var w,A,I=g.c,N=g.e,P=g.s;e:if({}.toString.call(I)=="[object Array]"){if((P===1||P===-1)&&N>=-Te&&N<=Te&&N===Qe(N)){if(I[0]===0){if(N===0&&I.length===1)return!0;break e}if(w=(N+1)%ne,w<1&&(w+=ne),String(I[0]).length==w){for(w=0;w<I.length;w++)if(A=I[w],A<0||A>=dt||A!==Qe(A))break e;if(A!==0)return!0}}}else if(I===null&&N===null&&(P===null||P===1||P===-1))return!0;throw Error(je+"Invalid BigNumber: "+g)},b.maximum=b.max=function(){return B(arguments,-1)},b.minimum=b.min=function(){return B(arguments,1)},b.random=function(){var g=9007199254740992,w=Math.random()*g&2097151?function(){return Qe(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var I,N,P,E,x,T=0,O=[],y=new b(s);if(A==null?A=i:ye(A,0,Te),E=ei(A/ne),p)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(E*=2));T<E;)x=I[T]*131072+(I[T+1]>>>11),x>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),I[T]=N[0],I[T+1]=N[1]):(O.push(x%1e14),T+=2);T=E/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(E*=7);T<E;)x=(I[T]&31)*281474976710656+I[T+1]*1099511627776+I[T+2]*4294967296+I[T+3]*16777216+(I[T+4]<<16)+(I[T+5]<<8)+I[T+6],x>=9e15?crypto.randomBytes(7).copy(I,T):(O.push(x%1e14),T+=7);T=E/7}else throw p=!1,Error(je+"crypto unavailable");if(!p)for(;T<E;)x=w(),x<9e15&&(O[T++]=x%1e14);for(E=O[--T],A%=ne,E&&A&&(x=ni[ne-A],O[T]=Qe(E/x)*x);O[T]===0;O.pop(),T--);if(T<0)O=[P=0];else{for(P=-1;O[0]===0;O.splice(0,1),P-=ne);for(T=1,x=O[0];x>=10;x/=10,T++);T<ne&&(P-=ne-T)}return y.e=P,y.c=O,y}}(),b.sum=function(){for(var g=1,w=arguments,A=new b(w[0]);g<w.length;)A=A.plus(w[g++]);return A},n=function(){var g="0123456789";function w(A,I,N,P){for(var E,x=[0],T,O=0,y=A.length;O<y;){for(T=x.length;T--;x[T]*=I);for(x[0]+=P.indexOf(A.charAt(O++)),E=0;E<x.length;E++)x[E]>N-1&&(x[E+1]==null&&(x[E+1]=0),x[E+1]+=x[E]/N|0,x[E]%=N)}return x.reverse()}return function(A,I,N,P,E){var x,T,O,y,L,F,U,z,V=A.indexOf("."),Z=i,W=c;for(V>=0&&(y=h,h=0,A=A.replace(".",""),z=new b(I),F=z.pow(A.length-V),h=y,z.c=w(_t(et(F.c),F.e,"0"),10,N,g),z.e=z.c.length),U=w(A,I,N,E?(x=v,g):(x=g,v)),O=y=U.length;U[--y]==0;U.pop());if(!U[0])return x.charAt(0);if(V<0?--O:(F.c=U,F.e=O,F.s=P,F=t(F,z,Z,W,N),U=F.c,L=F.r,O=F.e),T=O+Z+1,V=U[T],y=N/2,L=L||T<0||U[T+1]!=null,L=W<4?(V!=null||L)&&(W==0||W==(F.s<0?3:2)):V>y||V==y&&(W==4||L||W==6&&U[T-1]&1||W==(F.s<0?8:7)),T<1||!U[0])A=L?_t(x.charAt(1),-Z,x.charAt(0)):x.charAt(0);else{if(U.length=T,L)for(--N;++U[--T]>N;)U[T]=0,T||(++O,U=[1].concat(U));for(y=U.length;!U[--y];);for(V=0,A="";V<=y;A+=x.charAt(U[V++]));A=_t(A,O,x.charAt(0))}return A}}(),t=function(){function g(I,N,P){var E,x,T,O,y=0,L=I.length,F=N%un,U=N/un|0;for(I=I.slice();L--;)T=I[L]%un,O=I[L]/un|0,E=U*T+O*F,x=F*T+E%un*un+y,y=(x/P|0)+(E/un|0)+U*O,I[L]=x%P;return y&&(I=[y].concat(I)),I}function w(I,N,P,E){var x,T;if(P!=E)T=P>E?1:-1;else for(x=T=0;x<P;x++)if(I[x]!=N[x]){T=I[x]>N[x]?1:-1;break}return T}function A(I,N,P,E){for(var x=0;P--;)I[P]-=x,x=I[P]<N[P]?1:0,I[P]=x*E+I[P]-N[P];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,N,P,E,x){var T,O,y,L,F,U,z,V,Z,W,K,G,X,ee,fe,xe,oe,ue=I.s==N.s?1:-1,pe=I.c,se=N.c;if(!pe||!pe[0]||!se||!se[0])return new b(!I.s||!N.s||(pe?se&&pe[0]==se[0]:!se)?NaN:pe&&pe[0]==0||!se?ue*0:ue/0);for(V=new b(ue),Z=V.c=[],O=I.e-N.e,ue=P+O+1,x||(x=dt,O=Je(I.e/ne)-Je(N.e/ne),ue=ue/ne|0),y=0;se[y]==(pe[y]||0);y++);if(se[y]>(pe[y]||0)&&O--,ue<0)Z.push(1),L=!0;else{for(ee=pe.length,xe=se.length,y=0,ue+=2,F=Qe(x/(se[0]+1)),F>1&&(se=g(se,F,x),pe=g(pe,F,x),xe=se.length,ee=pe.length),X=xe,W=pe.slice(0,xe),K=W.length;K<xe;W[K++]=0);oe=se.slice(),oe=[0].concat(oe),fe=se[0],se[1]>=x/2&&fe++;do{if(F=0,T=w(se,W,xe,K),T<0){if(G=W[0],xe!=K&&(G=G*x+(W[1]||0)),F=Qe(G/fe),F>1)for(F>=x&&(F=x-1),U=g(se,F,x),z=U.length,K=W.length;w(U,W,z,K)==1;)F--,A(U,xe<z?oe:se,z,x),z=U.length,T=1;else F==0&&(T=F=1),U=se.slice(),z=U.length;if(z<K&&(U=[0].concat(U)),A(W,U,K,x),K=W.length,T==-1)for(;w(se,W,xe,K)<1;)F++,A(W,xe<K?oe:se,K,x),K=W.length}else T===0&&(F++,W=[0]);Z[y++]=F,W[0]?W[K++]=pe[X]||0:(W=[pe[X]],K=1)}while((X++<ee||W[0]!=null)&&ue--);L=W[0]!=null,Z[0]||Z.splice(0,1)}if(x==dt){for(y=1,ue=Z[0];ue>=10;ue/=10,y++);D(V,P+(V.e=y+O*ne-1)+1,E,L)}else V.e=O,V.r=+L;return V}}();function $(g,w,A,I){var N,P,E,x,T;if(A==null?A=c:ye(A,0,8),!g.c)return g.toString();if(N=g.c[0],E=g.e,w==null)T=et(g.c),T=I==1||I==2&&(E<=a||E>=u)?Lo(T,E):_t(T,E,"0");else if(g=D(new b(g),w,A),P=g.e,T=et(g.c),x=T.length,I==1||I==2&&(w<=P||P<=a)){for(;x<w;T+="0",x++);T=Lo(T,P)}else if(w-=E+(I===2&&P>E),T=_t(T,P,"0"),P+1>x){if(--w>0)for(T+=".";w--;T+="0");}else if(w+=P-x,w>0)for(P+1==x&&(T+=".");w--;T+="0");return g.s<0&&N?"-"+T:T}function B(g,w){for(var A,I,N=1,P=new b(g[0]);N<g.length;N++)I=new b(g[N]),(!I.s||(A=En(P,I))===w||A===0&&P.s===w)&&(P=I);return P}function k(g,w,A){for(var I=1,N=w.length;!w[--N];w.pop());for(N=w[0];N>=10;N/=10,I++);return(A=I+A*ne-1)>f?g.c=g.e=null:A<l?g.c=[g.e=0]:(g.e=A,g.c=w),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,A=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,E,x,T){var O,y=x?E:E.replace(N,"");if(I.test(y))P.s=isNaN(y)?null:y<0?-1:1;else{if(!x&&(y=y.replace(g,function(L,F,U){return O=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!T||T==O?F:L}),T&&(O=T,y=y.replace(w,"$1").replace(A,"0.$1")),E!=y))return new b(y,O);if(b.DEBUG)throw Error(je+"Not a"+(T?" base "+T:"")+" number: "+E);P.s=null}P.c=P.e=null}}();function D(g,w,A,I){var N,P,E,x,T,O,y,L=g.c,F=ni;if(L){e:{for(N=1,x=L[0];x>=10;x/=10,N++);if(P=w-N,P<0)P+=ne,E=w,T=L[O=0],y=Qe(T/F[N-E-1]%10);else if(O=ei((P+1)/ne),O>=L.length)if(I){for(;L.length<=O;L.push(0));T=y=0,N=1,P%=ne,E=P-ne+1}else break e;else{for(T=x=L[O],N=1;x>=10;x/=10,N++);P%=ne,E=P-ne+N,y=E<0?0:Qe(T/F[N-E-1]%10)}if(I=I||w<0||L[O+1]!=null||(E<0?T:T%F[N-E-1]),I=A<4?(y||I)&&(A==0||A==(g.s<0?3:2)):y>5||y==5&&(A==4||I||A==6&&(P>0?E>0?T/F[N-E]:0:L[O-1])%10&1||A==(g.s<0?8:7)),w<1||!L[0])return L.length=0,I?(w-=g.e+1,L[0]=F[(ne-w%ne)%ne],g.e=-w||0):L[0]=g.e=0,g;if(P==0?(L.length=O,x=1,O--):(L.length=O+1,x=F[ne-P],L[O]=E>0?Qe(T/F[N-E]%F[E])*x:0),I)for(;;)if(O==0){for(P=1,E=L[0];E>=10;E/=10,P++);for(E=L[0]+=x,x=1;E>=10;E/=10,x++);P!=x&&(g.e++,L[0]==dt&&(L[0]=1));break}else{if(L[O]+=x,L[O]!=dt)break;L[O--]=0,x=1}for(P=L.length;L[--P]===0;L.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var w,A=g.e;return A===null?g.toString():(w=et(g.c),w=A<=a||A>=u?Lo(w,A):_t(w,A,"0"),g.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var g=new b(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,w){return En(this,new b(g,w))},o.decimalPlaces=o.dp=function(g,w){var A,I,N,P=this;if(g!=null)return ye(g,0,Te),w==null?w=c:ye(w,0,8),D(new b(P),g+P.e+1,w);if(!(A=P.c))return null;if(I=((N=A.length-1)-Je(this.e/ne))*ne,N=A[N])for(;N%10==0;N/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(g,w){return t(this,new b(g,w),i,c)},o.dividedToIntegerBy=o.idiv=function(g,w){return t(this,new b(g,w),0,1)},o.exponentiatedBy=o.pow=function(g,w){var A,I,N,P,E,x,T,O,y,L=this;if(g=new b(g),g.c&&!g.isInteger())throw Error(je+"Exponent not an integer: "+j(g));if(w!=null&&(w=new b(w)),x=g.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!g.c||!g.c[0])return y=new b(Math.pow(+j(L),x?g.s*(2-Mo(g)):+j(g))),w?y.mod(w):y;if(T=g.s<0,w){if(w.c?!w.c[0]:!w.s)return new b(NaN);I=!T&&L.isInteger()&&w.isInteger(),I&&(L=L.mod(w))}else{if(g.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||x&&L.c[1]>=24e7:L.c[0]<8e13||x&&L.c[0]<=9999975e7)))return P=L.s<0&&Mo(g)?-0:0,L.e>-1&&(P=1/P),new b(T?1/P:P);h&&(P=ei(h/ne+2))}for(x?(A=new b(.5),T&&(g.s=1),O=Mo(g)):(N=Math.abs(+j(g)),O=N%2),y=new b(s);;){if(O){if(y=y.times(L),!y.c)break;P?y.c.length>P&&(y.c.length=P):I&&(y=y.mod(w))}if(N){if(N=Qe(N/2),N===0)break;O=N%2}else if(g=g.times(A),D(g,g.e+1,1),g.e>14)O=Mo(g);else{if(N=+j(g),N===0)break;O=N%2}L=L.times(L),P?L.c&&L.c.length>P&&(L.c.length=P):I&&(L=L.mod(w))}return I?y:(T&&(y=s.div(y)),w?y.mod(w):P?D(y,h,c,E):y)},o.integerValue=function(g){var w=new b(this);return g==null?g=c:ye(g,0,8),D(w,w.e+1,g)},o.isEqualTo=o.eq=function(g,w){return En(this,new b(g,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,w){return En(this,new b(g,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,w){return(w=En(this,new b(g,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Je(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,w){return En(this,new b(g,w))<0},o.isLessThanOrEqualTo=o.lte=function(g,w){return(w=En(this,new b(g,w)))===-1||w===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(g,w){var A,I,N,P,E=this,x=E.s;if(g=new b(g,w),w=g.s,!x||!w)return new b(NaN);if(x!=w)return g.s=-w,E.plus(g);var T=E.e/ne,O=g.e/ne,y=E.c,L=g.c;if(!T||!O){if(!y||!L)return y?(g.s=-w,g):new b(L?E:NaN);if(!y[0]||!L[0])return L[0]?(g.s=-w,g):new b(y[0]?E:c==3?-0:0)}if(T=Je(T),O=Je(O),y=y.slice(),x=T-O){for((P=x<0)?(x=-x,N=y):(O=T,N=L),N.reverse(),w=x;w--;N.push(0));N.reverse()}else for(I=(P=(x=y.length)<(w=L.length))?x:w,x=w=0;w<I;w++)if(y[w]!=L[w]){P=y[w]<L[w];break}if(P&&(N=y,y=L,L=N,g.s=-g.s),w=(I=L.length)-(A=y.length),w>0)for(;w--;y[A++]=0);for(w=dt-1;I>x;){if(y[--I]<L[I]){for(A=I;A&&!y[--A];y[A]=w);--y[A],y[I]+=dt}y[I]-=L[I]}for(;y[0]==0;y.splice(0,1),--O);return y[0]?k(g,y,O):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,w){var A,I,N=this;return g=new b(g,w),!N.c||!g.s||g.c&&!g.c[0]?new b(NaN):!g.c||N.c&&!N.c[0]?new b(N):(d==9?(I=g.s,g.s=1,A=t(N,g,0,3),g.s=I,A.s*=I):A=t(N,g,0,d),g=N.minus(A.times(g)),!g.c[0]&&d==1&&(g.s=N.s),g)},o.multipliedBy=o.times=function(g,w){var A,I,N,P,E,x,T,O,y,L,F,U,z,V,Z,W=this,K=W.c,G=(g=new b(g,w)).c;if(!K||!G||!K[0]||!G[0])return!W.s||!g.s||K&&!K[0]&&!G||G&&!G[0]&&!K?g.c=g.e=g.s=null:(g.s*=W.s,!K||!G?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(I=Je(W.e/ne)+Je(g.e/ne),g.s*=W.s,T=K.length,L=G.length,T<L&&(z=K,K=G,G=z,N=T,T=L,L=N),N=T+L,z=[];N--;z.push(0));for(V=dt,Z=un,N=L;--N>=0;){for(A=0,F=G[N]%Z,U=G[N]/Z|0,E=T,P=N+E;P>N;)O=K[--E]%Z,y=K[E]/Z|0,x=U*O+y*F,O=F*O+x%Z*Z+z[P]+A,A=(O/V|0)+(x/Z|0)+U*y,z[P--]=O%V;z[P]=A}return A?++I:z.splice(0,1),k(g,z,I)},o.negated=function(){var g=new b(this);return g.s=-g.s||null,g},o.plus=function(g,w){var A,I=this,N=I.s;if(g=new b(g,w),w=g.s,!N||!w)return new b(NaN);if(N!=w)return g.s=-w,I.minus(g);var P=I.e/ne,E=g.e/ne,x=I.c,T=g.c;if(!P||!E){if(!x||!T)return new b(N/0);if(!x[0]||!T[0])return T[0]?g:new b(x[0]?I:N*0)}if(P=Je(P),E=Je(E),x=x.slice(),N=P-E){for(N>0?(E=P,A=T):(N=-N,A=x),A.reverse();N--;A.push(0));A.reverse()}for(N=x.length,w=T.length,N-w<0&&(A=T,T=x,x=A,w=N),N=0;w;)N=(x[--w]=x[w]+T[w]+N)/dt|0,x[w]=dt===x[w]?0:x[w]%dt;return N&&(x=[N].concat(x),++E),k(g,x,E)},o.precision=o.sd=function(g,w){var A,I,N,P=this;if(g!=null&&g!==!!g)return ye(g,1,Te),w==null?w=c:ye(w,0,8),D(new b(P),g,w);if(!(A=P.c))return null;if(N=A.length-1,I=N*ne+1,N=A[N]){for(;N%10==0;N/=10,I--);for(N=A[0];N>=10;N/=10,I++);}return g&&P.e+1>I&&(I=P.e+1),I},o.shiftedBy=function(g){return ye(g,-ti,ti),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,w,A,I,N,P=this,E=P.c,x=P.s,T=P.e,O=i+4,y=new b("0.5");if(x!==1||!E||!E[0])return new b(!x||x<0&&(!E||E[0])?NaN:E?P:1/0);if(x=Math.sqrt(+j(P)),x==0||x==1/0?(w=et(E),(w.length+T)%2==0&&(w+="0"),x=Math.sqrt(+w),T=Je((T+1)/2)-(T<0||T%2),x==1/0?w="5e"+T:(w=x.toExponential(),w=w.slice(0,w.indexOf("e")+1)+T),A=new b(w)):A=new b(x+""),A.c[0]){for(T=A.e,x=T+O,x<3&&(x=0);;)if(N=A,A=y.times(N.plus(t(P,N,O,1))),et(N.c).slice(0,x)===(w=et(A.c)).slice(0,x))if(A.e<T&&--x,w=w.slice(x-3,x+1),w=="9999"||!I&&w=="4999"){if(!I&&(D(N,N.e+i+2,0),N.times(N).eq(P))){A=N;break}O+=4,x+=4,I=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(D(A,A.e+i+2,1),g=!A.times(A).eq(P));break}}return D(A,A.e+i+1,c,g)},o.toExponential=function(g,w){return g!=null&&(ye(g,0,Te),g++),$(this,g,w,1)},o.toFixed=function(g,w){return g!=null&&(ye(g,0,Te),g=g+this.e+1),$(this,g,w)},o.toFormat=function(g,w,A){var I,N=this;if(A==null)g!=null&&w&&typeof w=="object"?(A=w,w=null):g&&typeof g=="object"?(A=g,g=w=null):A=m;else if(typeof A!="object")throw Error(je+"Argument not an object: "+A);if(I=N.toFixed(g,w),N.c){var P,E=I.split("."),x=+A.groupSize,T=+A.secondaryGroupSize,O=A.groupSeparator||"",y=E[0],L=E[1],F=N.s<0,U=F?y.slice(1):y,z=U.length;if(T&&(P=x,x=T,T=P,z-=P),x>0&&z>0){for(P=z%x||x,y=U.substr(0,P);P<z;P+=x)y+=O+U.substr(P,x);T>0&&(y+=O+U.slice(P)),F&&(y="-"+y)}I=L?y+(A.decimalSeparator||"")+((T=+A.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):L):y}return(A.prefix||"")+I+(A.suffix||"")},o.toFraction=function(g){var w,A,I,N,P,E,x,T,O,y,L,F,U=this,z=U.c;if(g!=null&&(x=new b(g),!x.isInteger()&&(x.c||x.s!==1)||x.lt(s)))throw Error(je+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+j(x));if(!z)return new b(U);for(w=new b(s),O=A=new b(s),I=T=new b(s),F=et(z),P=w.e=F.length-U.e-1,w.c[0]=ni[(E=P%ne)<0?ne+E:E],g=!g||x.comparedTo(w)>0?P>0?w:O:x,E=f,f=1/0,x=new b(F),T.c[0]=0;y=t(x,w,0,1),N=A.plus(y.times(I)),N.comparedTo(g)!=1;)A=I,I=N,O=T.plus(y.times(N=O)),T=N,w=x.minus(y.times(N=w)),x=N;return N=t(g.minus(A),I,0,1),T=T.plus(N.times(O)),A=A.plus(N.times(I)),T.s=O.s=U.s,P=P*2,L=t(O,I,P,c).minus(U).abs().comparedTo(t(T,A,P,c).minus(U).abs())<1?[O,I]:[T,A],f=E,L},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,w){return g!=null&&ye(g,1,Te),$(this,g,w,2)},o.toString=function(g){var w,A=this,I=A.s,N=A.e;return N===null?I?(w="Infinity",I<0&&(w="-"+w)):w="NaN":(g==null?w=N<=a||N>=u?Lo(et(A.c),N):_t(et(A.c),N,"0"):g===10&&C?(A=D(new b(A),i+N+1,c),w=_t(et(A.c),A.e,"0")):(ye(g,2,v.length,"Base"),w=n(_t(et(A.c),N,"0"),10,g,I,!0)),I<0&&A.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return j(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&b.set(e),b}function Je(e){var t=e|0;return e>0||e===t?t:t-1}function et(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function 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!==Qe(e))throw Error(je+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Mo(e){var t=e.c.length-1;return Je(e.e/ne)==t&&e.c[t]%2!=0}function Lo(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 Ie=du();const lm=(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"}},pt=()=>{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}}}},fm=()=>({openDeposit:S.useCallback(t=>{},[])}),dm=()=>({openWithdraw:S.useCallback(t=>{},[])});/**
|
|
31
36
|
* @license lucide-react v0.540.0 - ISC
|
|
32
37
|
*
|
|
33
38
|
* This source code is licensed under the ISC license.
|
|
34
39
|
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/const
|
|
40
|
+
*/const pm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),pu=e=>{const t=hm(e);return t.charAt(0).toUpperCase()+t.slice(1)},hu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),mm=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
36
41
|
* @license lucide-react v0.540.0 - ISC
|
|
37
42
|
*
|
|
38
43
|
* This source code is licensed under the ISC license.
|
|
39
44
|
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var
|
|
45
|
+
*/var gm={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
41
46
|
* @license lucide-react v0.540.0 - ISC
|
|
42
47
|
*
|
|
43
48
|
* This source code is licensed under the ISC license.
|
|
44
49
|
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const
|
|
50
|
+
*/const bm=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>S.createElement("svg",{ref:a,...gm,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:hu("lucide",o),...!s&&!mm(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>S.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
|
|
46
51
|
* @license lucide-react v0.540.0 - ISC
|
|
47
52
|
*
|
|
48
53
|
* This source code is licensed under the ISC license.
|
|
49
54
|
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/const
|
|
55
|
+
*/const ym=(e,t)=>{const n=S.forwardRef(({className:r,...o},s)=>S.createElement(bm,{ref:s,iconNode:t,className:hu(`lucide-${pm(pu(e))}`,`lucide-${e}`,r),...o}));return n.displayName=pu(e),n};/**
|
|
51
56
|
* @license lucide-react v0.540.0 - ISC
|
|
52
57
|
*
|
|
53
58
|
* This source code is licensed under the ISC license.
|
|
54
59
|
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const Is=Ns("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Mr{constructor(){Ye(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class js extends Mr{constructor(n,r){super();Ye(this,"smartWallet");Ye(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{console.log("Connecting MPC wallet..."),this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){console.log("Disconnecting MPC wallet...")}async switchChain(n){console.log(`MPC wallet switching to chain ${n}`)}async getBalance(n){return console.log(`Getting MPC wallet balance for token ${n}`),"0"}async approve(n,r){return console.log(`MPC wallet approve not needed for ${n}`),""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{console.log(`MPC deposit ${n} of ${r} to ${this.getDisplayAddress()}`);const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return console.log(`MPC signing message: ${n}`),`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class ks extends Mr{constructor(n,r,o,s="0",c="0"){super();Ye(this,"currentActiveAccount");Ye(this,"approved");Ye(this,"chainId");Ye(this,"balance");Ye(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=c}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{console.log("Connecting EVM wallet..."),this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){console.log("Disconnecting EVM wallet...")}async switchChain(n){this.setState({isLoading:!0,error:null});try{console.log(`Switching EVM wallet to chain ${n}`),this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return console.log(`Getting EVM wallet balance for token ${n}`),this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{console.log(`Approving ${r} of ${n}`);const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");console.log(`EVM deposit ${n} of ${r}`);const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return console.log(`EVM signing message: ${n}`),`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function Rs(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new js(t,e);default:return new ks(e,n||!1,r||1,o,s)}}var Ws=Object.defineProperty,It=Object.getOwnPropertySymbols,Ar=Object.prototype.hasOwnProperty,Dr=Object.prototype.propertyIsEnumerable,_r=(e,t,n)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hn=(e,t)=>{for(var n in t||(t={}))Ar.call(t,n)&&_r(e,n,t[n]);if(It)for(var n of It(t))Dr.call(t,n)&&_r(e,n,t[n]);return e},gn=(e,t)=>{var n={};for(var r in e)Ar.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&It)for(var r of It(e))t.indexOf(r)<0&&Dr.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
56
|
-
|
|
57
|
-
* Copyright (c) Project Nayuki.
|
|
58
|
-
* SPDX-License-Identifier: MIT
|
|
59
|
-
*/var Ze;(e=>{const t=class ee{constructor(i,l,a,d){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<ee.MIN_VERSION||i>ee.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let m=[];for(let h=0;h<this.size;h++)m.push(!1);for(let h=0;h<this.size;h++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(a);if(this.drawCodewords(f),d==-1){let h=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const b=this.getPenaltyScore();b<h&&(d=v,h=b),this.applyMask(v)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(i,l){const a=e.QrSegment.makeSegments(i);return ee.encodeSegments(a,l)}static encodeBinary(i,l){const a=e.QrSegment.makeBytes(i);return ee.encodeSegments([a],l)}static encodeSegments(i,l,a=1,d=40,m=-1,f=!0){if(!(ee.MIN_VERSION<=a&&a<=d&&d<=ee.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,v;for(h=a;;h++){const y=ee.getNumDataCodewords(h,l)*8,O=c.getTotalBits(i,h);if(O<=y){v=O;break}if(h>=d)throw new RangeError("Data too long")}for(const y of[ee.Ecc.MEDIUM,ee.Ecc.QUARTILE,ee.Ecc.HIGH])f&&v<=ee.getNumDataCodewords(h,y)*8&&(l=y);let b=[];for(const y of i){n(y.mode.modeBits,4,b),n(y.numChars,y.mode.numCharCountBits(h),b);for(const O of y.getData())b.push(O)}o(b.length==v);const C=ee.getNumDataCodewords(h,l)*8;o(b.length<=C),n(0,Math.min(4,C-b.length),b),n(0,(8-b.length%8)%8,b),o(b.length%8==0);for(let y=236;b.length<C;y^=253)n(y,8,b);let E=[];for(;E.length*8<b.length;)E.push(0);return b.forEach((y,O)=>E[O>>>3]|=y<<7-(O&7)),new ee(h,l,E,m)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let a=0;a<l;a++)for(let d=0;d<l;d++)a==0&&d==0||a==0&&d==l-1||a==l-1&&d==0||this.drawAlignmentPattern(i[a],i[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let a=l;for(let m=0;m<10;m++)a=a<<1^(a>>>9)*1335;const d=(l<<10|a)^21522;o(d>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(d,m));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(d,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(d,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(d,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let a=0;a<12;a++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let a=0;a<18;a++){const d=r(l,a),m=this.size-11+a%3,f=Math.floor(a/3);this.setFunctionModule(m,f,d),this.setFunctionModule(f,m,d)}}drawFinderPattern(i,l){for(let a=-4;a<=4;a++)for(let d=-4;d<=4;d++){const m=Math.max(Math.abs(d),Math.abs(a)),f=i+d,h=l+a;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,m!=2&&m!=4)}}drawAlignmentPattern(i,l){for(let a=-2;a<=2;a++)for(let d=-2;d<=2;d++)this.setFunctionModule(i+d,l+a,Math.max(Math.abs(d),Math.abs(a))!=1)}setFunctionModule(i,l,a){this.modules[l][i]=a,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,a=this.errorCorrectionLevel;if(i.length!=ee.getNumDataCodewords(l,a))throw new RangeError("Invalid argument");const d=ee.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][l],m=ee.ECC_CODEWORDS_PER_BLOCK[a.ordinal][l],f=Math.floor(ee.getNumRawDataModules(l)/8),h=d-f%d,v=Math.floor(f/d);let b=[];const C=ee.reedSolomonComputeDivisor(m);for(let y=0,O=0;y<d;y++){let w=i.slice(O,O+v-m+(y<h?0:1));O+=w.length;const F=ee.reedSolomonComputeRemainder(w,C);y<h&&w.push(0),b.push(w.concat(F))}let E=[];for(let y=0;y<b[0].length;y++)b.forEach((O,w)=>{(y!=v-m||w>=h)&&E.push(O[y])});return o(E.length==f),E}drawCodewords(i){if(i.length!=Math.floor(ee.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let d=0;d<this.size;d++)for(let m=0;m<2;m++){const f=a-m,v=(a+1&2)==0?this.size-1-d:d;!this.isFunction[v][f]&&l<i.length*8&&(this.modules[v][f]=r(i[l>>>3],7-(l&7)),l++)}}o(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let a=0;a<this.size;a++){let d;switch(i){case 0:d=(a+l)%2==0;break;case 1:d=l%2==0;break;case 2:d=a%3==0;break;case 3:d=(a+l)%3==0;break;case 4:d=(Math.floor(a/3)+Math.floor(l/2))%2==0;break;case 5:d=a*l%2+a*l%3==0;break;case 6:d=(a*l%2+a*l%3)%2==0;break;case 7:d=((a+l)%2+a*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][a]&&d&&(this.modules[l][a]=!this.modules[l][a])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[m][b]==f?(h++,h==5?i+=ee.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,v),f||(i+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[m][b],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,v)*ee.PENALTY_N3}for(let m=0;m<this.size;m++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[b][m]==f?(h++,h==5?i+=ee.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,v),f||(i+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[b][m],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,v)*ee.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let f=0;f<this.size-1;f++){const h=this.modules[m][f];h==this.modules[m][f+1]&&h==this.modules[m+1][f]&&h==this.modules[m+1][f+1]&&(i+=ee.PENALTY_N2)}let l=0;for(const m of this.modules)l=m.reduce((f,h)=>f+(h?1:0),l);const a=this.size*this.size,d=Math.ceil(Math.abs(l*20-a*10)/a)-1;return o(0<=d&&d<=9),i+=d*ee.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let a=[6];for(let d=this.size-7;a.length<i;d-=l)a.splice(1,0,d);return a}}static getNumRawDataModules(i){if(i<ee.MIN_VERSION||i>ee.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const a=Math.floor(i/7)+2;l-=(25*a-10)*a-55,i>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(ee.getNumRawDataModules(i)/8)-ee.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*ee.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let l=[];for(let d=0;d<i-1;d++)l.push(0);l.push(1);let a=1;for(let d=0;d<i;d++){for(let m=0;m<l.length;m++)l[m]=ee.reedSolomonMultiply(l[m],a),m+1<l.length&&(l[m]^=l[m+1]);a=ee.reedSolomonMultiply(a,2)}return l}static reedSolomonComputeRemainder(i,l){let a=l.map(d=>0);for(const d of i){const m=d^a.shift();a.push(0),l.forEach((f,h)=>a[h]^=ee.reedSolomonMultiply(f,m))}return a}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let a=0;for(let d=7;d>=0;d--)a=a<<1^(a>>>7)*285,a^=(l>>>d&1)*i;return o(a>>>8==0),a}finderPenaltyCountPatterns(i){const l=i[1];o(l<=this.size*3);const a=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(a&&i[0]>=l*4&&i[6]>=l?1:0)+(a&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,a){return i&&(this.finderPenaltyAddHistory(l,a),l=0),l+=this.size,this.finderPenaltyAddHistory(l,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.unshift(i)}};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(u,i,l){if(i<0||i>31||u>>>i)throw new RangeError("Value out of range");for(let a=i-1;a>=0;a--)l.push(u>>>a&1)}function r(u,i){return(u>>>i&1)!=0}function o(u){if(!u)throw new Error("Assertion error")}const s=class de{constructor(i,l,a){if(this.mode=i,this.numChars=l,this.bitData=a,l<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}static makeBytes(i){let l=[];for(const a of i)n(a,8,l);return new de(de.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!de.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let a=0;a<i.length;){const d=Math.min(i.length-a,3);n(parseInt(i.substring(a,a+d),10),d*3+1,l),a+=d}return new de(de.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!de.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],a;for(a=0;a+2<=i.length;a+=2){let d=de.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a))*45;d+=de.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a+1)),n(d,11,l)}return a<i.length&&n(de.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a)),6,l),new de(de.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:de.isNumeric(i)?[de.makeNumeric(i)]:de.isAlphanumeric(i)?[de.makeAlphanumeric(i)]:[de.makeBytes(de.toUtf8ByteArray(i))]}static makeEci(i){let l=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)n(i,8,l);else if(i<16384)n(2,2,l),n(i,14,l);else if(i<1e6)n(6,3,l),n(i,21,l);else throw new RangeError("ECI assignment value out of range");return new de(de.Mode.ECI,0,l)}static isNumeric(i){return de.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return de.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let a=0;for(const d of i){const m=d.mode.numCharCountBits(l);if(d.numChars>=1<<m)return 1/0;a+=4+m+d.bitData.length}return a}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let a=0;a<i.length;a++)i.charAt(a)!="%"?l.push(i.charCodeAt(a)):(l.push(parseInt(i.substring(a+1,a+3),16)),a+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let c=s;e.QrSegment=s})(Ze||(Ze={})),(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={}))})(Ze||(Ze={})),(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={}))})(Ze||(Ze={}));var at=Ze;/**
|
|
60
|
-
* @license qrcode.react
|
|
61
|
-
* Copyright (c) Paul O'Shannessy
|
|
62
|
-
* SPDX-License-Identifier: ISC
|
|
63
|
-
*/var Bs={L:at.QrCode.Ecc.LOW,M:at.QrCode.Ecc.MEDIUM,Q:at.QrCode.Ecc.QUARTILE,H:at.QrCode.Ecc.HIGH},Fr=128,Lr="L",Nr="#FFFFFF",Ir="#000000",jr=!1,kr=1,Hs=4,Us=0,Vs=.1;function Rr(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(c,u){if(!c&&s!==null){n.push(`M${s+t} ${o+t}h${u-s}v1H${s+t}z`),s=null;return}if(u===r.length-1){if(!c)return;s===null?n.push(`M${u+t},${o+t} h1v1H${u+t}z`):n.push(`M${s+t},${o+t} h${u+1-s}v1H${s+t}z`);return}c&&s===null&&(s=u)})}),n.join("")}function Wr(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 zs(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Vs),c=o/t,u=(r.width||s)*c,i=(r.height||s)*c,l=r.x==null?e.length/2-u/2:r.x*c,a=r.y==null?e.length/2-i/2:r.y*c,d=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let h=Math.floor(l),v=Math.floor(a),b=Math.ceil(u+l-h),C=Math.ceil(i+a-v);m={x:h,y:v,w:b,h:C}}const f=r.crossOrigin;return{x:l,y:a,h:i,w:u,excavation:m,opacity:d,crossOrigin:f}}function Ys(e,t){return t!=null?Math.max(Math.floor(t),0):e?Hs:Us}function Br({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:c,boostLevel:u}){let i=p.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((v,b)=>(v.push(...at.QrSegment.makeSegments(b)),v),[]);return at.QrCode.encodeSegments(h,Bs[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:a,numCells:d,calculatedImageSettings:m}=p.useMemo(()=>{let f=i.getModules();const h=Ys(r,o),v=f.length+h*2,b=zs(f,c,h,s);return{cells:f,margin:h,numCells:v,calculatedImageSettings:b}},[i,c,s,r,o]);return{qrcode:i,margin:a,cells:l,numCells:d,calculatedImageSettings:m}}var Gs=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),qs=p.forwardRef(function(t,n){const r=t,{value:o,size:s=Fr,level:c=Lr,bgColor:u=Nr,fgColor:i=Ir,includeMargin:l=jr,minVersion:a=kr,boostLevel:d,marginSize:m,imageSettings:f}=r,v=gn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=v,C=gn(v,["style"]),E=f==null?void 0:f.src,y=p.useRef(null),O=p.useRef(null),w=p.useCallback(R=>{y.current=R,typeof n=="function"?n(R):n&&(n.current=R)},[n]),[F,_]=p.useState(!1),{margin:B,cells:K,numCells:A,calculatedImageSettings:j}=Br({value:o,level:c,minVersion:a,boostLevel:d,includeMargin:l,marginSize:m,imageSettings:f,size:s});p.useEffect(()=>{if(y.current!=null){const R=y.current,X=R.getContext("2d");if(!X)return;let G=K;const Q=O.current,T=j!=null&&Q!==null&&Q.complete&&Q.naturalHeight!==0&&Q.naturalWidth!==0;T&&j.excavation!=null&&(G=Wr(K,j.excavation));const H=window.devicePixelRatio||1;R.height=R.width=s*H;const S=s/A*H;X.scale(S,S),X.fillStyle=u,X.fillRect(0,0,A,A),X.fillStyle=i,Gs?X.fill(new Path2D(Rr(G,B))):K.forEach(function(M,k){M.forEach(function(I,V){I&&X.fillRect(V+B,k+B,1,1)})}),j&&(X.globalAlpha=j.opacity),T&&X.drawImage(Q,j.x+B,j.y+B,j.w,j.h)}}),p.useEffect(()=>{_(!1)},[E]);const re=hn({height:s,width:s},b);let U=null;return E!=null&&(U=p.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{_(!0)},ref:O,crossOrigin:j==null?void 0:j.crossOrigin})),p.createElement(p.Fragment,null,p.createElement("canvas",hn({style:re,height:s,width:s,ref:w,role:"img"},C)),U)});qs.displayName="QRCodeCanvas";var Hr=p.forwardRef(function(t,n){const r=t,{value:o,size:s=Fr,level:c=Lr,bgColor:u=Nr,fgColor:i=Ir,includeMargin:l=jr,minVersion:a=kr,boostLevel:d,title:m,marginSize:f,imageSettings:h}=r,v=gn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:C,numCells:E,calculatedImageSettings:y}=Br({value:o,level:c,minVersion:a,boostLevel:d,includeMargin:l,marginSize:f,imageSettings:h,size:s});let O=C,w=null;h!=null&&y!=null&&(y.excavation!=null&&(O=Wr(C,y.excavation)),w=p.createElement("image",{href:h.src,height:y.h,width:y.w,x:y.x+b,y:y.y+b,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const F=Rr(O,b);return p.createElement("svg",hn({height:s,width:s,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},v),!!m&&p.createElement("title",null,m),p.createElement("path",{fill:u,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),p.createElement("path",{fill:i,d:F,shapeRendering:"crispEdges"}),w)});Hr.displayName="QRCodeSVG";const Ks=({value:e,size:t,level:n,bgColor:r,fgColor:o,includeMargin:s=!0})=>x.jsx(Hr,{value:e,size:t,level:n,bgColor:r,fgColor:o,marginSize:s?4:0}),Xs=({text:e,onCopy:t,children:n})=>x.jsx("div",{onClick:()=>{navigator.clipboard.writeText(e).then(t)},style:{cursor:"pointer"},children:n}),Qs=(...e)=>e.filter(Boolean).join(" "),Ur=typeof document<"u"?p.useLayoutEffect:()=>{};var vn;const Js=(vn=p.useInsertionEffect)!==null&&vn!==void 0?vn:Ur;function Zs(e){const t=p.useRef(null);return Js(()=>{t.current=e},[e]),p.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Ge=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},et=e=>e&&"window"in e&&e.window===e?e:Ge(e).defaultView||window;function el(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function tl(e){return el(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let nl=!1;function bn(){return nl}function Vr(e,t){if(!bn())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:tl(n)?n=n.host:n=n.parentNode}return!1}const yn=(e=document)=>{var t;if(!bn())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 zr(e){return bn()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function jt(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 wn(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 Ue(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const En=Ue(function(){return wn(/^Mac/i)}),rl=Ue(function(){return wn(/^iPhone/i)}),ol=Ue(function(){return wn(/^iPad/i)||En()&&navigator.maxTouchPoints>1}),il=Ue(function(){return rl()||ol()});Ue(function(){return En()||il()}),Ue(function(){return jt(/AppleWebKit/i)&&!sl()});const sl=Ue(function(){return jt(/Chrome/i)}),ll=Ue(function(){return jt(/Android/i)});Ue(function(){return jt(/Firefox/i)});function Yr(){let e=p.useRef(new Map),t=p.useCallback((o,s,c,u)=>{let i=u!=null&&u.once?(...l)=>{e.current.delete(c),c(...l)}:c;e.current.set(c,{type:s,eventTarget:o,fn:i,options:u}),o.addEventListener(s,i,u)},[]),n=p.useCallback((o,s,c,u)=>{var i;let l=((i=e.current.get(c))===null||i===void 0?void 0:i.fn)||c;o.removeEventListener(s,l,u),e.current.delete(c)},[]),r=p.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return p.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function al(e){return e.mozInputSource===0&&e.isTrusted?!0:ll()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Gr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function ul(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function qr(e){let t=p.useRef({isFocused:!1,observer:null});Ur(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Zs(r=>{e==null||e(r)});return p.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=c=>{if(t.current.isFocused=!1,o.disabled){let u=Gr(c);n(u)}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 c;(c=t.current.observer)===null||c===void 0||c.disconnect();let u=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:u})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:u}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let cl=!1,xt=null,xn=new Set,Ct=new Map,tt=!1,Cn=!1;const fl={Tab:!0,Escape:!0};function Sn(e,t){for(let n of xn)n(e,t)}function dl(e){return!(e.metaKey||!En()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function kt(e){tt=!0,dl(e)&&(xt="keyboard",Sn("keyboard",e))}function Te(e){xt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(tt=!0,Sn("pointer",e))}function Kr(e){al(e)&&(tt=!0,xt="virtual")}function Xr(e){e.target===window||e.target===document||cl||!e.isTrusted||(!tt&&!Cn&&(xt="virtual",Sn("virtual",e)),tt=!1,Cn=!1)}function Qr(){tt=!1,Cn=!0}function On(e){if(typeof window>"u"||typeof document>"u"||Ct.get(et(e)))return;const t=et(e),n=Ge(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){tt=!0,r.apply(this,arguments)},n.addEventListener("keydown",kt,!0),n.addEventListener("keyup",kt,!0),n.addEventListener("click",Kr,!0),t.addEventListener("focus",Xr,!0),t.addEventListener("blur",Qr,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Te,!0),n.addEventListener("pointermove",Te,!0),n.addEventListener("pointerup",Te,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Te,!0),n.addEventListener("mousemove",Te,!0),n.addEventListener("mouseup",Te,!0)),t.addEventListener("beforeunload",()=>{Jr(e)},{once:!0}),Ct.set(t,{focus:r})}const Jr=(e,t)=>{const n=et(e),r=Ge(e);t&&r.removeEventListener("DOMContentLoaded",t),Ct.has(n)&&(n.HTMLElement.prototype.focus=Ct.get(n).focus,r.removeEventListener("keydown",kt,!0),r.removeEventListener("keyup",kt,!0),r.removeEventListener("click",Kr,!0),n.removeEventListener("focus",Xr,!0),n.removeEventListener("blur",Qr,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Te,!0),r.removeEventListener("pointermove",Te,!0),r.removeEventListener("pointerup",Te,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Te,!0),r.removeEventListener("mousemove",Te,!0),r.removeEventListener("mouseup",Te,!0)),Ct.delete(n))};function pl(e){const t=Ge(e);let n;return t.readyState!=="loading"?On(e):(n=()=>{On(e)},t.addEventListener("DOMContentLoaded",n)),()=>Jr(e,n)}typeof document<"u"&&pl();function Zr(){return xt!=="pointer"}const ml=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function hl(e,t,n){let r=Ge(n==null?void 0:n.target);const o=typeof window<"u"?et(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?et(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?et(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?et(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!ml.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof c&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!fl[n.key])}function gl(e,t,n){On(),p.useEffect(()=>{let r=(o,s)=>{hl(!!(n!=null&&n.isTextInput),o,s)&&e(Zr())};return xn.add(r),()=>{xn.delete(r)}},t)}function vl(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=p.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),c=qr(s),u=p.useCallback(i=>{const l=Ge(i.target),a=l?yn(l):yn();i.target===i.currentTarget&&a===zr(i.nativeEvent)&&(n&&n(i),o&&o(!0),c(i))},[o,n,c]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?s:void 0}}}function bl(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=p.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:u}=Yr(),i=p.useCallback(d=>{d.currentTarget.contains(d.target)&&s.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(s.current.isFocusWithin=!1,u(),n&&n(d),o&&o(!1))},[n,o,s,u]),l=qr(i),a=p.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const m=Ge(d.target),f=yn(m);if(!s.current.isFocusWithin&&f===zr(d.nativeEvent)){r&&r(d),o&&o(!0),s.current.isFocusWithin=!0,l(d);let h=d.currentTarget;c(m,"focus",v=>{if(s.current.isFocusWithin&&!Vr(h,v.target)){let b=new m.defaultView.FocusEvent("blur",{relatedTarget:v.target});ul(b,h);let C=Gr(b);i(C)}},{capture:!0})}},[r,o,l,c,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:a,onBlur:i}}}let Rt=!1,Wt=0;function Tn(){Rt=!0,setTimeout(()=>{Rt=!1},50)}function eo(e){e.pointerType==="touch"&&Tn()}function yl(){if(!(typeof document>"u"))return Wt===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",eo):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Tn)),Wt++,()=>{Wt--,!(Wt>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",eo):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Tn))}}function wl(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,c]=p.useState(!1),u=p.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;p.useEffect(yl,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Yr(),{hoverProps:a,triggerHoverEnd:d}=p.useMemo(()=>{let m=(v,b)=>{if(u.pointerType=b,o||b==="touch"||u.isHovered||!v.currentTarget.contains(v.target))return;u.isHovered=!0;let C=v.currentTarget;u.target=C,i(Ge(v.target),"pointerover",E=>{u.isHovered&&u.target&&!Vr(u.target,E.target)&&f(E,E.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:C,pointerType:b}),n&&n(!0),c(!0)},f=(v,b)=>{let C=u.target;u.pointerType="",u.target=null,!(b==="touch"||!u.isHovered||!C)&&(u.isHovered=!1,l(),r&&r({type:"hoverend",target:C,pointerType:b}),n&&n(!1),c(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=v=>{Rt&&v.pointerType==="mouse"||m(v,v.pointerType)},h.onPointerLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,v.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=v=>{!u.ignoreEmulatedMouseEvents&&!Rt&&m(v,"mouse"),u.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,"mouse")}),{hoverProps:h,triggerHoverEnd:f}},[t,n,r,o,u,i,l]);return p.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:a,isHovered:s}}function El(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=p.useRef({isFocused:!1,isFocusVisible:t||Zr()}),[s,c]=p.useState(!1),[u,i]=p.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=p.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),a=p.useCallback(f=>{o.current.isFocused=f,c(f),l()},[l]);gl(f=>{o.current.isFocusVisible=f,l()},[],{isTextInput:n});let{focusProps:d}=vl({isDisabled:r,onFocusChange:a}),{focusWithinProps:m}=bl({isDisabled:!r,onFocusWithinChange:a});return{isFocused:s,isFocusVisible:u,focusProps:r?m:d}}var xl=Object.defineProperty,Cl=(e,t,n)=>t in e?xl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$n=(e,t,n)=>(Cl(e,typeof t!="symbol"?t+"":t,n),n);let Sl=class{constructor(){$n(this,"current",this.detect()),$n(this,"handoffState","pending"),$n(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"}},Ie=new Sl;function St(e){var t,n;return Ie.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 to(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Fe(){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 to(()=>{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=Fe();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 ut(){let[e]=p.useState(Fe);return p.useEffect(()=>()=>e.dispose(),[e]),e}let ue=(e,t)=>{Ie.isServer?p.useEffect(e,t):p.useLayoutEffect(e,t)};function nt(e){let t=p.useRef(e);return ue(()=>{t.current=e},[e]),t}let ne=function(e){let t=nt(e);return p.useCallback((...n)=>t.current(...n),[t])};function Ol(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 Tl(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function $l({disabled:e=!1}={}){let t=p.useRef(null),[n,r]=p.useState(!1),o=ut(),s=ne(()=>{t.current=null,r(!1),o.dispose()}),c=ne(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let i=St(u.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let a=Ol(l);r(Tl(a,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:c,onPointerUp:s,onClick:s}}}let Pl=p.createContext(void 0);function Pn(){return p.useContext(Pl)}function Mn(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function $e(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,$e),r}var Bt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Bt||{}),qe=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(qe||{});function Se(){let e=Al();return p.useCallback(t=>Ml({mergeRefs:e,...t}),[e])}function Ml({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:c,mergeRefs:u}){u=u??Dl;let i=no(t,e);if(s)return Ht(i,n,r,c,u);let l=o??0;if(l&2){let{static:a=!1,...d}=i;if(a)return Ht(d,n,r,c,u)}if(l&1){let{unmount:a=!0,...d}=i;return $e(a?0:1,{0(){return null},1(){return Ht({...d,hidden:!0,style:{display:"none"}},n,r,c,u)}})}return Ht(i,n,r,c,u)}function Ht(e,t={},n,r,o){let{as:s=n,children:c,refName:u="ref",...i}=An(e,["unmount","static"]),l=e.ref!==void 0?{[u]:e.ref}:{},a=typeof c=="function"?c(t):c;"className"in i&&i.className&&typeof i.className=="function"&&(i.className=i.className(t)),i["aria-labelledby"]&&i["aria-labelledby"]===i.id&&(i["aria-labelledby"]=void 0);let d={};if(t){let m=!1,f=[];for(let[h,v]of Object.entries(t))typeof v=="boolean"&&(m=!0),v===!0&&f.push(h.replace(/([A-Z])/g,b=>`-${b.toLowerCase()}`));if(m){d["data-headlessui-state"]=f.join(" ");for(let h of f)d[`data-${h}`]=""}}if(s===p.Fragment&&(Object.keys(Ke(i)).length>0||Object.keys(Ke(d)).length>0))if(!p.isValidElement(a)||Array.isArray(a)&&a.length>1){if(Object.keys(Ke(i)).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(Ke(i)).concat(Object.keys(Ke(d))).map(m=>` - ${m}`).join(`
|
|
64
|
-
`),"","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(m=>` - ${m}`).join(`
|
|
60
|
+
*/const mu=ym("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class gu{constructor(){Xe(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class vm extends gu{constructor(n,r){super();Xe(this,"smartWallet");Xe(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n;return((n=this.smartWallet)==null?void 0:n.address)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class wm extends gu{constructor(n,r,o,s="0",i="0"){super();Xe(this,"currentActiveAccount");Xe(this,"approved");Xe(this,"chainId");Xe(this,"balance");Xe(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=i}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function bu(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new vm(t,e);default:return new wm(e,!1,r||1,o,s)}}const yu=typeof document<"u"?S.useLayoutEffect:()=>{};var ri;const xm=(ri=S.useInsertionEffect)!==null&&ri!==void 0?ri:yu;function Em(e){const t=S.useRef(null);return xm(()=>{t.current=e},[e]),S.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const ln=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Sn=e=>e&&"window"in e&&e.window===e?e:ln(e).defaultView||window;function Sm(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Pm(e){return Sm(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let $m=!1;function oi(){return $m}function vu(e,t){if(!oi())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:Pm(n)?n=n.host:n=n.parentNode}return!1}const si=(e=document)=>{var t;if(!oi())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function wu(e){return oi()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Bo(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function ii(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Ut(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ai=Ut(function(){return ii(/^Mac/i)}),Am=Ut(function(){return ii(/^iPhone/i)}),Tm=Ut(function(){return ii(/^iPad/i)||ai()&&navigator.maxTouchPoints>1}),Cm=Ut(function(){return Am()||Tm()});Ut(function(){return ai()||Cm()}),Ut(function(){return Bo(/AppleWebKit/i)&&!Om()});const Om=Ut(function(){return Bo(/Chrome/i)}),Nm=Ut(function(){return Bo(/Android/i)});Ut(function(){return Bo(/Firefox/i)});function xu(){let e=S.useRef(new Map),t=S.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=S.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=S.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return S.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Im(e){return e.mozInputSource===0&&e.isTrusted?!0:Nm()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Eu(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Mm(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Su(e){let t=S.useRef({isFocused:!1,observer:null});yu(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Em(r=>{e==null||e(r)});return S.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=Eu(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 Lm=!1,Or=null,ci=new Set,Nr=new Map,Pn=!1,ui=!1;const Bm={Tab:!0,Escape:!0};function li(e,t){for(let n of ci)n(e,t)}function km(e){return!(e.metaKey||!ai()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ko(e){Pn=!0,km(e)&&(Or="keyboard",li("keyboard",e))}function tt(e){Or="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Pn=!0,li("pointer",e))}function Pu(e){Im(e)&&(Pn=!0,Or="virtual")}function $u(e){e.target===window||e.target===document||Lm||!e.isTrusted||(!Pn&&!ui&&(Or="virtual",li("virtual",e)),Pn=!1,ui=!1)}function Au(){Pn=!1,ui=!0}function fi(e){if(typeof window>"u"||typeof document>"u"||Nr.get(Sn(e)))return;const t=Sn(e),n=ln(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Pn=!0,r.apply(this,arguments)},n.addEventListener("keydown",ko,!0),n.addEventListener("keyup",ko,!0),n.addEventListener("click",Pu,!0),t.addEventListener("focus",$u,!0),t.addEventListener("blur",Au,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",tt,!0),n.addEventListener("pointermove",tt,!0),n.addEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",tt,!0),n.addEventListener("mousemove",tt,!0),n.addEventListener("mouseup",tt,!0)),t.addEventListener("beforeunload",()=>{Tu(e)},{once:!0}),Nr.set(t,{focus:r})}const Tu=(e,t)=>{const n=Sn(e),r=ln(e);t&&r.removeEventListener("DOMContentLoaded",t),Nr.has(n)&&(n.HTMLElement.prototype.focus=Nr.get(n).focus,r.removeEventListener("keydown",ko,!0),r.removeEventListener("keyup",ko,!0),r.removeEventListener("click",Pu,!0),n.removeEventListener("focus",$u,!0),n.removeEventListener("blur",Au,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",tt,!0),r.removeEventListener("pointermove",tt,!0),r.removeEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",tt,!0),r.removeEventListener("mousemove",tt,!0),r.removeEventListener("mouseup",tt,!0)),Nr.delete(n))};function Rm(e){const t=ln(e);let n;return t.readyState!=="loading"?fi(e):(n=()=>{fi(e)},t.addEventListener("DOMContentLoaded",n)),()=>Tu(e,n)}typeof document<"u"&&Rm();function Cu(){return Or!=="pointer"}const Fm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Dm(e,t,n){let r=ln(n==null?void 0:n.target);const o=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?Sn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Fm.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!Bm[n.key])}function jm(e,t,n){fi(),S.useEffect(()=>{let r=(o,s)=>{Dm(!!(n!=null&&n.isTextInput),o,s)&&e(Cu())};return ci.add(r),()=>{ci.delete(r)}},t)}function _m(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=S.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=Su(s),c=S.useCallback(a=>{const u=ln(a.target),l=u?si(u):si();a.target===a.currentTarget&&l===wu(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Um(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=S.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=xu(),a=S.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=Su(a),l=S.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=ln(f.target),d=si(p);if(!s.current.isFocusWithin&&d===wu(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&&!vu(h,m.target)){let v=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});Mm(v,h);let C=Eu(v);a(C)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let Ro=!1,Fo=0;function di(){Ro=!0,setTimeout(()=>{Ro=!1},50)}function Ou(e){e.pointerType==="touch"&&di()}function zm(){if(!(typeof document>"u"))return Fo===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Ou):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",di)),Fo++,()=>{Fo--,!(Fo>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Ou):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",di))}}function Wm(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=S.useState(!1),c=S.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;S.useEffect(zm,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=xu(),{hoverProps:l,triggerHoverEnd:f}=S.useMemo(()=>{let p=(m,v)=>{if(c.pointerType=v,o||v==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let C=m.currentTarget;c.target=C,a(ln(m.target),"pointerover",b=>{c.isHovered&&c.target&&!vu(c.target,b.target)&&d(b,b.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:C,pointerType:v}),n&&n(!0),i(!0)},d=(m,v)=>{let C=c.target;c.pointerType="",c.target=null,!(v==="touch"||!c.isHovered||!C)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:C,pointerType:v}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Ro&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!Ro&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,u]);return S.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Hm(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=S.useRef({isFocused:!1,isFocusVisible:t||Cu()}),[s,i]=S.useState(!1),[c,a]=S.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=S.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=S.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);jm(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=_m({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=Um({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var Vm=Object.defineProperty,Gm=(e,t,n)=>t in e?Vm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t,n)=>(Gm(e,typeof t!="symbol"?t+"":t,n),n);let qm=class{constructor(){pi(this,"current",this.detect()),pi(this,"handoffState","pending"),pi(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},At=new qm;function Ir(e){var t,n;return At.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Nu(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ht(){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 Nu(()=>{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=ht();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 Vn(){let[e]=S.useState(ht);return S.useEffect(()=>()=>e.dispose(),[e]),e}let ge=(e,t)=>{At.isServer?S.useEffect(e,t):S.useLayoutEffect(e,t)};function $n(e){let t=S.useRef(e);return ge(()=>{t.current=e},[e]),t}let ce=function(e){let t=$n(e);return S.useCallback((...n)=>t.current(...n),[t])};function Zm(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Km(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ym({disabled:e=!1}={}){let t=S.useRef(null),[n,r]=S.useState(!1),o=Vn(),s=ce(()=>{t.current=null,r(!1),o.dispose()}),i=ce(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=Ir(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Zm(u);r(Km(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Xm=S.createContext(void 0);function hi(){return S.useContext(Xm)}function mi(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function nt(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,nt),r}var Do=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Do||{}),fn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(fn||{});function Ze(){let e=Jm();return S.useCallback(t=>Qm({mergeRefs:e,...t}),[e])}function Qm({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??eg;let a=Iu(t,e);if(s)return jo(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return jo(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return nt(l?0:1,{0(){return null},1(){return jo({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return jo(a,n,r,i,c)}function jo(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=gi(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(s===S.Fragment&&(Object.keys(dn(a)).length>0||Object.keys(dn(f)).length>0))if(!S.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(dn(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(dn(a)).concat(Object.keys(dn(f))).map(p=>` - ${p}`).join(`
|
|
61
|
+
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
|
|
65
62
|
`)].join(`
|
|
66
|
-
`))}else{let m=a.props,f=m==null?void 0:m.className,h=typeof f=="function"?(...C)=>Mn(f(...C),i.className):Mn(f,i.className),v=h?{className:h}:{},b=no(a.props,Ke(An(i,["ref"])));for(let C in d)C in b&&delete d[C];return p.cloneElement(a,Object.assign({},b,d,l,{ref:o(_l(a),l.ref)},v))}return p.createElement(s,Object.assign({},An(i,["ref"]),s!==p.Fragment&&l,s!==p.Fragment&&d),a)}function Al(){let e=p.useRef([]),t=p.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 Dl(...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 no(...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 c=n[r];for(let u of c){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...s)}}});return t}function ro(...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 c of s)c==null||c(...o)}});return t}function xe(e){var t;return Object.assign(p.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ke(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function An(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function _l(e){return p.version.split(".")[0]>="19"?e.props.ref:e.ref}function Fl(e,t,n){let[r,o]=p.useState(n),s=e!==void 0,c=p.useRef(s),u=p.useRef(!1),i=p.useRef(!1);return s&&!c.current&&!u.current?(u.current=!0,c.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&&c.current&&!i.current&&(i.current=!0,c.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,ne(l=>(s||o(l),t==null?void 0:t(l)))]}function Ll(e){let[t]=p.useState(e);return t}function oo(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))so(n,io(t,r),o);return n}function io(e,t){return e?e+"["+t+"]":t}function so(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())so(e,io(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,""]):oo(n,t,e)}function Nl(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 Il="span";var Dn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Dn||{});function jl(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 Se()({ourProps:s,theirProps:o,slot:{},defaultTag:Il,name:"Hidden"})}let lo=xe(jl),kl=p.createContext(null);function Rl({children:e}){let t=p.useContext(kl);if(!t)return p.createElement(p.Fragment,null,e);let{target:n}=t;return n?Ee.createPortal(p.createElement(p.Fragment,null,e),n):null}function Wl({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,c]=p.useState(null),u=ut();return p.useEffect(()=>{if(r&&s)return u.addEventListener(s,"reset",r)},[s,t,r]),p.createElement(Rl,null,p.createElement(Bl,{setForm:c,formId:t}),oo(e).map(([i,l])=>p.createElement(lo,{features:Dn.Hidden,...Ke({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function Bl({setForm:e,formId:t}){return p.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:p.createElement(lo,{features:Dn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Hl=p.createContext(void 0);function ao(){return p.useContext(Hl)}function _n(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ut(e){return _n(e)&&"tagName"in e}function Ve(e){return Ut(e)&&"accessKey"in e}function ct(e){return Ut(e)&&"tabIndex"in e}function Ul(e){return Ut(e)&&"style"in e}function Vl(e){return Ve(e)&&e.nodeName==="IFRAME"}function uo(e){return Ve(e)&&e.nodeName==="INPUT"}function co(e){return Ve(e)&&e.nodeName==="LABEL"}function zl(e){return Ve(e)&&e.nodeName==="FIELDSET"}function fo(e){return Ve(e)&&e.nodeName==="LEGEND"}function Yl(e){return Ut(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Gl(e){let t=e.parentElement,n=null;for(;t&&!zl(t);)fo(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&ql(n)?!1:r}function ql(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(fo(t))return!1;t=t.previousElementSibling}return!0}let po=Symbol();function Kl(e,t=!0){return Object.assign(e,{[po]:t})}function Pe(...e){let t=p.useRef(e);p.useEffect(()=>{t.current=e},[e]);let n=ne(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[po]))?void 0:n}let Fn=p.createContext(null);Fn.displayName="DescriptionContext";function mo(){let e=p.useContext(Fn);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,mo),t}return e}function Xl(){var e,t;return(t=(e=p.useContext(Fn))==null?void 0:e.value)!=null?t:void 0}let Ql="p";function Jl(e,t){let n=p.useId(),r=Pn(),{id:o=`headlessui-description-${n}`,...s}=e,c=mo(),u=Pe(t);ue(()=>c.register(o),[o,c.register]);let i=r||!1,l=p.useMemo(()=>({...c.slot,disabled:i}),[c.slot,i]),a={ref:u,...c.props,id:o};return Se()({ourProps:a,theirProps:s,slot:l,defaultTag:Ql,name:c.name||"Description"})}let Zl=xe(Jl);Object.assign(Zl,{});var he=(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))(he||{});let Vt=p.createContext(null);Vt.displayName="LabelContext";function ho(){let e=p.useContext(Vt);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,ho),t}return e}function go(e){var t,n,r;let o=(n=(t=p.useContext(Vt))==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 ea({inherit:e=!1}={}){let t=go(),[n,r]=p.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,p.useMemo(()=>function(s){let c=ne(i=>(r(l=>[...l,i]),()=>r(l=>{let a=l.slice(),d=a.indexOf(i);return d!==-1&&a.splice(d,1),a}))),u=p.useMemo(()=>({register:c,slot:s.slot,name:s.name,props:s.props,value:s.value}),[c,s.slot,s.name,s.props,s.value]);return p.createElement(Vt.Provider,{value:u},s.children)},[r])]}let ta="label";function na(e,t){var n;let r=p.useId(),o=ho(),s=ao(),c=Pn(),{id:u=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...a}=e,d=Pe(t);ue(()=>o.register(u),[u,o.register]);let m=ne(b=>{let C=b.currentTarget;if(!(b.target!==b.currentTarget&&Yl(b.target))&&(co(C)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),co(C))){let E=document.getElementById(C.htmlFor);if(E){let y=E.getAttribute("disabled");if(y==="true"||y==="")return;let O=E.getAttribute("aria-disabled");if(O==="true"||O==="")return;(uo(E)&&(E.type==="file"||E.type==="radio"||E.type==="checkbox")||E.role==="radio"||E.role==="checkbox"||E.role==="switch")&&E.click(),E.focus({preventScroll:!0})}}}),f=c||!1,h=p.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),v={ref:d,...o.props,id:u,htmlFor:i,onClick:m};return l&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in a&&delete a.onClick),Se()({ourProps:v,theirProps:a,slot:h,defaultTag:i?ta:"div",name:o.name||"Label"})}let ra=xe(na),oa=Object.assign(ra,{});function ia(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 sa(e=ia){return p.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 la(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function aa(e,t=!1){let[n,r]=p.useReducer(()=>({}),{}),o=p.useMemo(()=>la(e),[e,n]);return ue(()=>{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 vo=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 ua=Object.defineProperty,ca=(e,t,n)=>t in e?ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fa=(e,t,n)=>(ca(e,t+"",n),n),bo=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Me=(e,t,n)=>(bo(e,t,"read from private field"),n?n.call(e):t.get(e)),Ln=(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)},yo=(e,t,n,r)=>(bo(e,t,"write to private field"),t.set(e,n),n),je,Ot,Tt;let wo=class{constructor(t){Ln(this,je,{}),Ln(this,Ot,new vo(()=>new Set)),Ln(this,Tt,new Set),fa(this,"disposables",Fe()),yo(this,je,t),Ie.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Me(this,je)}subscribe(t,n){if(Ie.isServer)return()=>{};let r={selector:t,callback:n,current:t(Me(this,je))};return Me(this,Tt).add(r),this.disposables.add(()=>{Me(this,Tt).delete(r)})}on(t,n){return Ie.isServer?()=>{}:(Me(this,Ot).get(t).add(n),this.disposables.add(()=>{Me(this,Ot).get(t).delete(n)}))}send(t){let n=this.reduce(Me(this,je),t);if(n!==Me(this,je)){yo(this,je,n);for(let r of Me(this,Tt)){let o=r.selector(Me(this,je));Eo(r.current,o)||(r.current=o,r.callback(o))}for(let r of Me(this,Ot).get(t.type))r(Me(this,je),t)}}};je=new WeakMap,Ot=new WeakMap,Tt=new WeakMap;function Eo(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:Nn(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Nn(e.entries(),t.entries()):xo(e)&&xo(t)?Nn(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Nn(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 xo(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function In(e){let[t,n]=e(),r=Fe();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var da=Object.defineProperty,pa=(e,t,n)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Co=(e,t,n)=>(pa(e,typeof t!="symbol"?t+"":t,n),n),So=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(So||{});let ma={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}}},ha=class xs extends wo{constructor(){super(...arguments),Co(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Co(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new xs({stack:[]})}reduce(t,n){return $e(n.type,ma,t,n)}};const jn=new vo(()=>ha.new());var kn={exports:{}},Rn={};/**
|
|
63
|
+
`))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...C)=>mi(d(...C),a.className):mi(d,a.className),m=h?{className:h}:{},v=Iu(l.props,dn(gi(a,["ref"])));for(let C in f)C in v&&delete f[C];return S.cloneElement(l,Object.assign({},v,f,u,{ref:o(tg(l),u.ref)},m))}return S.createElement(s,Object.assign({},gi(a,["ref"]),s!==S.Fragment&&u,s!==S.Fragment&&f),l)}function Jm(){let e=S.useRef([]),t=S.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function eg(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function Iu(...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 Mu(...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 _e(e){var t;return Object.assign(S.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function dn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function gi(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function tg(e){return S.version.split(".")[0]>="19"?e.props.ref:e.ref}function ng(e,t,n){let[r,o]=S.useState(n),s=e!==void 0,i=S.useRef(s),c=S.useRef(!1),a=S.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,ce(u=>(s||o(u),t==null?void 0:t(u)))]}function rg(e){let[t]=S.useState(e);return t}function Lu(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ku(n,Bu(t,r),o);return n}function Bu(e,t){return e?e+"["+t+"]":t}function ku(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ku(e,Bu(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,""]):Lu(n,t,e)}function og(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let sg="span";var bi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(bi||{});function ig(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Ze()({ourProps:s,theirProps:o,slot:{},defaultTag:sg,name:"Hidden"})}let Ru=_e(ig),ag=S.createContext(null);function cg({children:e}){let t=S.useContext(ag);if(!t)return S.createElement(S.Fragment,null,e);let{target:n}=t;return n?Be.createPortal(S.createElement(S.Fragment,null,e),n):null}function ug({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=S.useState(null),c=Vn();return S.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),S.createElement(cg,null,S.createElement(lg,{setForm:i,formId:t}),Lu(e).map(([a,u])=>S.createElement(Ru,{features:bi.Hidden,...dn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function lg({setForm:e,formId:t}){return S.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:S.createElement(Ru,{features:bi.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let fg=S.createContext(void 0);function Fu(){return S.useContext(fg)}function yi(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function _o(e){return yi(e)&&"tagName"in e}function zt(e){return _o(e)&&"accessKey"in e}function Gn(e){return _o(e)&&"tabIndex"in e}function dg(e){return _o(e)&&"style"in e}function pg(e){return zt(e)&&e.nodeName==="IFRAME"}function Du(e){return zt(e)&&e.nodeName==="INPUT"}function ju(e){return zt(e)&&e.nodeName==="LABEL"}function hg(e){return zt(e)&&e.nodeName==="FIELDSET"}function _u(e){return zt(e)&&e.nodeName==="LEGEND"}function mg(e){return _o(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function gg(e){let t=e.parentElement,n=null;for(;t&&!hg(t);)_u(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&bg(n)?!1:r}function bg(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(_u(t))return!1;t=t.previousElementSibling}return!0}let Uu=Symbol();function yg(e,t=!0){return Object.assign(e,{[Uu]:t})}function rt(...e){let t=S.useRef(e);S.useEffect(()=>{t.current=e},[e]);let n=ce(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[Uu]))?void 0:n}let vi=S.createContext(null);vi.displayName="DescriptionContext";function zu(){let e=S.useContext(vi);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,zu),t}return e}function vg(){var e,t;return(t=(e=S.useContext(vi))==null?void 0:e.value)!=null?t:void 0}let wg="p";function xg(e,t){let n=S.useId(),r=hi(),{id:o=`headlessui-description-${n}`,...s}=e,i=zu(),c=rt(t);ge(()=>i.register(o),[o,i.register]);let a=r||!1,u=S.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Ze()({ourProps:l,theirProps:s,slot:u,defaultTag:wg,name:i.name||"Description"})}let Eg=_e(xg);Object.assign(Eg,{});var Ce=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ce||{});let Uo=S.createContext(null);Uo.displayName="LabelContext";function Wu(){let e=S.useContext(Uo);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Wu),t}return e}function Hu(e){var t,n,r;let o=(n=(t=S.useContext(Uo))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function Sg({inherit:e=!1}={}){let t=Hu(),[n,r]=S.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,S.useMemo(()=>function(s){let i=ce(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=S.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 S.createElement(Uo.Provider,{value:c},s.children)},[r])]}let Pg="label";function $g(e,t){var n;let r=S.useId(),o=Wu(),s=Fu(),i=hi(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=rt(t);ge(()=>o.register(c),[c,o.register]);let p=ce(v=>{let C=v.currentTarget;if(!(v.target!==v.currentTarget&&mg(v.target))&&(ju(C)&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),ju(C))){let b=document.getElementById(C.htmlFor);if(b){let $=b.getAttribute("disabled");if($==="true"||$==="")return;let B=b.getAttribute("aria-disabled");if(B==="true"||B==="")return;(Du(b)&&(b.type==="file"||b.type==="radio"||b.type==="checkbox")||b.role==="radio"||b.role==="checkbox"||b.role==="switch")&&b.click(),b.focus({preventScroll:!0})}}}),d=i||!1,h=S.useMemo(()=>({...o.slot,disabled:d}),[o.slot,d]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Ze()({ourProps:m,theirProps:l,slot:h,defaultTag:a?Pg:"div",name:o.name||"Label"})}let Ag=_e($g),Tg=Object.assign(Ag,{});function Cg(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function Og(e=Cg){return S.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 Ng(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ig(e,t=!1){let[n,r]=S.useReducer(()=>({}),{}),o=S.useMemo(()=>Ng(e),[e,n]);return ge(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let Vu=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var Mg=Object.defineProperty,Lg=(e,t,n)=>t in e?Mg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bg=(e,t,n)=>(Lg(e,t+"",n),n),Gu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ot=(e,t,n)=>(Gu(e,t,"read from private field"),n?n.call(e):t.get(e)),wi=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},qu=(e,t,n,r)=>(Gu(e,t,"write to private field"),t.set(e,n),n),Tt,Mr,Lr;let Zu=class{constructor(t){wi(this,Tt,{}),wi(this,Mr,new Vu(()=>new Set)),wi(this,Lr,new Set),Bg(this,"disposables",ht()),qu(this,Tt,t),At.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ot(this,Tt)}subscribe(t,n){if(At.isServer)return()=>{};let r={selector:t,callback:n,current:t(ot(this,Tt))};return ot(this,Lr).add(r),this.disposables.add(()=>{ot(this,Lr).delete(r)})}on(t,n){return At.isServer?()=>{}:(ot(this,Mr).get(t).add(n),this.disposables.add(()=>{ot(this,Mr).get(t).delete(n)}))}send(t){let n=this.reduce(ot(this,Tt),t);if(n!==ot(this,Tt)){qu(this,Tt,n);for(let r of ot(this,Lr)){let o=r.selector(ot(this,Tt));Ku(r.current,o)||(r.current=o,r.callback(o))}for(let r of ot(this,Mr).get(t.type))r(ot(this,Tt),t)}}};Tt=new WeakMap,Mr=new WeakMap,Lr=new WeakMap;function Ku(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:xi(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:xi(e.entries(),t.entries()):Yu(e)&&Yu(t)?xi(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function xi(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function Yu(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ei(e){let[t,n]=e(),r=ht();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var kg=Object.defineProperty,Rg=(e,t,n)=>t in e?kg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xu=(e,t,n)=>(Rg(e,typeof t!="symbol"?t+"":t,n),n),Qu=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Qu||{});let Fg={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}}},Dg=class Y0 extends Zu{constructor(){super(...arguments),Xu(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Xu(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Y0({stack:[]})}reduce(t,n){return nt(n.type,Fg,t,n)}};const Si=new Vu(()=>Dg.new());var Pi={exports:{}},$i={};/**
|
|
67
64
|
* @license React
|
|
68
65
|
* use-sync-external-store-with-selector.production.js
|
|
69
66
|
*
|
|
@@ -71,7 +68,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
71
68
|
*
|
|
72
69
|
* This source code is licensed under the MIT license found in the
|
|
73
70
|
* LICENSE file in the root directory of this source tree.
|
|
74
|
-
*/var
|
|
71
|
+
*/var Ju;function jg(){if(Ju)return $i;Ju=1;var e=S;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return $i.useSyncExternalStoreWithSelector=function(a,u,l,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function v(k){if(!C){if(C=!0,b=k,k=f(k),p!==void 0&&h.hasValue){var D=h.value;if(p(D,k))return $=D}return $=k}if(D=$,n(b,k))return D;var j=f(k);return p!==void 0&&p(D,j)?(b=k,D):(b=k,$=j)}var C=!1,b,$,B=l===void 0?null:l;return[function(){return v(u())},B===null?void 0:function(){return v(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},$i}var Ai={};/**
|
|
75
72
|
* @license React
|
|
76
73
|
* use-sync-external-store-with-selector.development.js
|
|
77
74
|
*
|
|
@@ -79,45 +76,87 @@ React keys must be passed directly to JSX without using spread:
|
|
|
79
76
|
*
|
|
80
77
|
* This source code is licensed under the MIT license found in the
|
|
81
78
|
* LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/var To;function va(){return To||(To=1,process.env.NODE_ENV!=="production"&&function(){function e(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,u=t.useDebugValue;Wn.useSyncExternalStoreWithSelector=function(i,l,a,d,m){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=c(function(){function b(w){if(!C){if(C=!0,E=w,w=d(w),m!==void 0&&h.hasValue){var F=h.value;if(m(F,w))return y=F}return y=w}if(F=y,n(E,w))return F;var _=d(w);return m!==void 0&&m(F,_)?(E=w,F):(E=w,y=_)}var C=!1,E,y,O=a===void 0?null:a;return[function(){return b(l())},O===null?void 0:function(){return b(O())}]},[l,a,d,m]);var v=r(i,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=v},[v]),u(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Wn}process.env.NODE_ENV==="production"?kn.exports=ga():kn.exports=va();var ba=kn.exports;function Ae(e,t,n=Eo){return ba.useSyncExternalStoreWithSelector(ne(r=>e.subscribe(ya,r)),ne(()=>e.state),ne(()=>e.state),ne(t),n)}function ya(e){return e}function $o(e,t){let n=p.useId(),r=jn.get(t),[o,s]=Ae(r,p.useCallback(c=>[r.selectors.isTop(c,n),r.selectors.inStack(c,n)],[r,n]));return ue(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Bn=new Map,$t=new Map;function Po(e){var t;let n=(t=$t.get(e))!=null?t:0;return $t.set(e,n+1),n!==0?()=>Mo(e):(Bn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Mo(e))}function Mo(e){var t;let n=(t=$t.get(e))!=null?t:1;if(n===1?$t.delete(e):$t.set(e,n-1),n!==1)return;let r=Bn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Bn.delete(e))}function wa(e,{allowed:t,disallowed:n}={}){let r=$o(e,"inert-others");ue(()=>{var o,s;if(!r)return;let c=Fe();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&c.add(Po(i));let u=(s=t==null?void 0:t())!=null?s:[];for(let i of u){if(!i)continue;let l=St(i);if(!l)continue;let a=i.parentElement;for(;a&&a!==l.body;){for(let d of a.children)u.some(m=>d.contains(m))||c.add(Po(d));a=a.parentElement}}return c.dispose},[r,t,n])}function Ea(e,t,n){let r=nt(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});p.useEffect(()=>{if(!e)return;let o=t===null?null:Ve(t)?t:t.current;if(!o)return;let s=Fe();if(typeof ResizeObserver<"u"){let c=new ResizeObserver(()=>r.current(o));c.observe(o),s.add(()=>c.disconnect())}if(typeof IntersectionObserver<"u"){let c=new IntersectionObserver(()=>r.current(o));c.observe(o),s.add(()=>c.disconnect())}return()=>s.dispose()},[t,r,e])}let Hn=["[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(","),xa=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Un=(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))(Un||{}),Ca=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Ca||{}),Sa=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Sa||{});function Ao(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Hn)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Oa(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(xa)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Vn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Vn||{});function Do(e,t=0){var n;return e===((n=St(e))==null?void 0:n.body)?!1:$e(t,{0(){return e.matches(Hn)},1(){let r=e;for(;r!==null;){if(r.matches(Hn))return!0;r=r.parentElement}return!1}})}var Ta=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Ta||{});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 $a=["textarea","input"].join(",");function Pa(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,$a))!=null?n:!1}function _o(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 c=o.compareDocumentPosition(s);return c&Node.DOCUMENT_POSITION_FOLLOWING?-1:c&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ma(e,t){return Aa(Ao(),t,{relativeTo:e})}function Aa(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,c=Array.isArray(e)?n?_o(e):e:t&64?Oa(e):Ao(e);o.length>0&&c.length>1&&(c=c.filter(f=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===f:h===f))),r=r??s.activeElement;let u=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,c.indexOf(r))-1;if(t&4)return Math.max(0,c.indexOf(r))+1;if(t&8)return c.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},a=0,d=c.length,m;do{if(a>=d||a+d<=0)return 0;let f=i+a;if(t&16)f=(f+d)%d;else{if(f<0)return 3;if(f>=d)return 1}m=c[f],m==null||m.focus(l),a+=u}while(m!==s.activeElement);return t&6&&Pa(m)&&m.select(),2}function Fo(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Da(){return/Android/gi.test(window.navigator.userAgent)}function Lo(){return Fo()||Da()}function ft(e,t,n,r){let o=nt(n);p.useEffect(()=>{if(!e)return;function s(c){o.current(c)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function _a(e,t,n,r){let o=nt(n);p.useEffect(()=>{if(!e)return;function s(c){o.current(c)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const No=30;function Fa(e,t,n){let r=nt(n),o=p.useCallback(function(u,i){if(u.defaultPrevented)return;let l=i(u);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let a=function d(m){return typeof m=="function"?d(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let d of a)if(d!==null&&(d.contains(l)||u.composed&&u.composedPath().includes(d)))return;return!Do(l,Vn.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),s=p.useRef(null);ft(e,"pointerdown",u=>{var i,l;Lo()||(s.current=((l=(i=u.composedPath)==null?void 0:i.call(u))==null?void 0:l[0])||u.target)},!0),ft(e,"pointerup",u=>{if(Lo()||!s.current)return;let i=s.current;return s.current=null,o(u,()=>i)},!0);let c=p.useRef({x:0,y:0});ft(e,"touchstart",u=>{c.current.x=u.touches[0].clientX,c.current.y=u.touches[0].clientY},!0),ft(e,"touchend",u=>{let i={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(i.x-c.current.x)>=No||Math.abs(i.y-c.current.y)>=No))return o(u,()=>ct(u.target)?u.target:null)},!0),_a(e,"blur",u=>o(u,()=>Vl(window.document.activeElement)?window.document.activeElement:null),!0)}function zn(...e){return p.useMemo(()=>St(...e),[...e])}var La=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(La||{});const zt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},Na=200,Io=5;function Ia(e,{trigger:t,action:n,close:r,select:o}){let s=p.useRef(null),c=p.useRef(null),u=p.useRef(null);ft(e&&t!==null,"pointerdown",i=>{_n(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(c.current=i.x,u.current=i.y,s.current=i.timeStamp)}),ft(e&&t!==null,"pointerup",i=>{var l,a;let d=s.current;if(d===null||(s.current=null,!ct(i.target))||Math.abs(i.x-((l=c.current)!=null?l:i.x))<Io&&Math.abs(i.y-((a=u.current)!=null?a:i.y))<Io)return;let m=n(i);switch(m.kind){case 0:return;case 1:{i.timeStamp-d>Na&&(o(m.target),r());break}case 2:{r();break}}},{capture:!0})}function ja(e,t){return p.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 ka(e){return p.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Ra(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 c=t[o].call(n,...s);c&&(n=c,r.forEach(u=>u()))}}}function Wa(){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 Ba(){return Fo()?{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 u=Fe();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,c=null;t.addEventListener(e,"click",u=>{if(ct(u.target))try{let i=u.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),a=e.querySelector(l);ct(a)&&!r(a)&&(c=a)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(ct(u.target)&&Ul(u.target))if(r(u.target)){let i=u.target;for(;i.parentElement&&r(i.parentElement);)i=i.parentElement;t.style(i,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(ct(u.target)){if(uo(u.target))return;if(r(u.target)){let i=u.target;for(;i.parentElement&&i.dataset.headlessuiPortal!==""&&!(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);)i=i.parentElement;i.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let i=(u=window.scrollY)!=null?u:window.pageYOffset;s!==i&&window.scrollTo(0,s),c&&c.isConnected&&(c.scrollIntoView({block:"nearest"}),c=null)})})}}:{}}function Ha(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Ua(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let rt=Ra(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Fe(),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:Ua(n)},o=[Ba(),Wa(),Ha()];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)}});rt.subscribe(()=>{let e=rt.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)&&rt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&rt.dispatch("TEARDOWN",n)}});function Va(e,t,n=()=>({containers:[]})){let r=ka(rt),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ue(()=>{if(!(!t||!e))return rt.dispatch("PUSH",t,n),()=>rt.dispatch("POP",t,n)},[e,t]),s}function za(e,t,n=()=>[document.body]){let r=$o(e,"scroll-lock");Va(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function jo(e){return[e.screenX,e.screenY]}function Ya(){let e=p.useRef([-1,-1]);return{wasMoved(t){let n=jo(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=jo(t)}}}function Ga(e=0){let[t,n]=p.useState(e),r=p.useCallback(i=>n(i),[t]),o=p.useCallback(i=>n(l=>l|i),[t]),s=p.useCallback(i=>(t&i)===i,[t]),c=p.useCallback(i=>n(l=>l&~i),[n]),u=p.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:c,toggleFlag:u}}var ko,Ro;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ko=process==null?void 0:process.env)==null?void 0:ko.NODE_ENV)==="test"&&typeof((Ro=Element==null?void 0:Element.prototype)==null?void 0:Ro.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(`
|
|
83
|
-
`)),[]});var qa=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(qa||{});function Wo(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Bo(e,t,n,r){let[o,s]=p.useState(n),{hasFlag:c,addFlag:u,removeFlag:i}=Ga(e&&o?3:0),l=p.useRef(!1),a=p.useRef(!1),d=ut();return ue(()=>{var m;if(e){if(n&&s(!0),!t){n&&u(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),Ka(t,{inFlight:l,prepare(){a.current?a.current=!1:a.current=l.current,l.current=!0,!a.current&&(n?(u(3),i(4)):(u(4),i(2)))},run(){a.current?n?(i(3),u(4)):(i(4),u(3)):n?i(1):u(1)},done(){var f;a.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:c(1),enter:c(2),leave:c(4),transition:c(2)||c(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Ka(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Fe();return Qa(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(Xa(e,r))})}),s.dispose}function Xa(e,t){var n,r;let o=Fe();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let c=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return c.length===0?(t(),o.dispose):(Promise.allSettled(c.map(u=>u.finished)).then(()=>{s||t()}),o.dispose)}function Qa(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 Yt(){return typeof window<"u"}function dt(e){return Ho(e)?(e.nodeName||"").toLowerCase():"#document"}function Oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ke(e){var t;return(t=(Ho(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ho(e){return Yt()?e instanceof Node||e instanceof Oe(e).Node:!1}function ve(e){return Yt()?e instanceof Element||e instanceof Oe(e).Element:!1}function Re(e){return Yt()?e instanceof HTMLElement||e instanceof Oe(e).HTMLElement:!1}function Uo(e){return!Yt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oe(e).ShadowRoot}const Ja=new Set(["inline","contents"]);function Pt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Le(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ja.has(o)}const Za=new Set(["table","td","th"]);function eu(e){return Za.has(dt(e))}const tu=[":popover-open",":modal"];function Gt(e){return tu.some(t=>{try{return e.matches(t)}catch{return!1}})}const nu=["transform","translate","scale","rotate","perspective"],ru=["transform","translate","scale","rotate","perspective","filter"],ou=["paint","layout","strict","content"];function Yn(e){const t=Gn(),n=ve(e)?Le(e):e;return nu.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)||ru.some(r=>(n.willChange||"").includes(r))||ou.some(r=>(n.contain||"").includes(r))}function iu(e){let t=Xe(e);for(;Re(t)&&!pt(t);){if(Yn(t))return t;if(Gt(t))return null;t=Xe(t)}return null}function Gn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const su=new Set(["html","body","#document"]);function pt(e){return su.has(dt(e))}function Le(e){return Oe(e).getComputedStyle(e)}function qt(e){return ve(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xe(e){if(dt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Uo(e)&&e.host||ke(e);return Uo(t)?t.host:t}function Vo(e){const t=Xe(e);return pt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Re(t)&&Pt(t)?t:Vo(t)}function Mt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Vo(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=Oe(o);if(s){const u=qn(c);return t.concat(c,c.visualViewport||[],Pt(o)?o:[],u&&n?Mt(u):[])}return t.concat(o,Mt(o,[],n))}function qn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lu(){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 ot=Math.min,be=Math.max,At=Math.round,Kt=Math.floor,We=e=>({x:e,y:e}),au={left:"right",right:"left",bottom:"top",top:"bottom"},uu={start:"end",end:"start"};function zo(e,t,n){return be(e,ot(t,n))}function mt(e,t){return typeof e=="function"?e(t):e}function Qe(e){return e.split("-")[0]}function Dt(e){return e.split("-")[1]}function Yo(e){return e==="x"?"y":"x"}function Go(e){return e==="y"?"height":"width"}const cu=new Set(["top","bottom"]);function ze(e){return cu.has(Qe(e))?"y":"x"}function qo(e){return Yo(ze(e))}function fu(e,t,n){n===void 0&&(n=!1);const r=Dt(e),o=qo(e),s=Go(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=Xt(c)),[c,Xt(c)]}function du(e){const t=Xt(e);return[Kn(e),t,Kn(t)]}function Kn(e){return e.replace(/start|end/g,t=>uu[t])}const Ko=["left","right"],Xo=["right","left"],pu=["top","bottom"],mu=["bottom","top"];function hu(e,t,n){switch(e){case"top":case"bottom":return n?t?Xo:Ko:t?Ko:Xo;case"left":case"right":return t?pu:mu;default:return[]}}function gu(e,t,n,r){const o=Dt(e);let s=hu(Qe(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(Kn)))),s}function Xt(e){return e.replace(/left|right|bottom|top/g,t=>au[t])}function vu(e){return{top:0,right:0,bottom:0,left:0,...e}}function bu(e){return typeof e!="number"?vu(e):{top:e,right:e,bottom:e,left:e}}function Qt(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}}function Qo(e,t,n){let{reference:r,floating:o}=e;const s=ze(t),c=qo(t),u=Go(c),i=Qe(t),l=s==="y",a=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,m=r[u]/2-o[u]/2;let f;switch(i){case"top":f={x:a,y:r.y-o.height};break;case"bottom":f={x:a,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Dt(t)){case"start":f[c]-=m*(n&&l?-1:1);break;case"end":f[c]+=m*(n&&l?-1:1);break}return f}const yu=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:c}=n,u=s.filter(Boolean),i=await(c.isRTL==null?void 0:c.isRTL(t));let l=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:d}=Qo(l,r,i),m=r,f={},h=0;for(let v=0;v<u.length;v++){const{name:b,fn:C}=u[v],{x:E,y,data:O,reset:w}=await C({x:a,y:d,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:l,platform:c,elements:{reference:e,floating:t}});a=E??a,d=y??d,f={...f,[b]:{...f[b],...O}},w&&h<=50&&(h++,typeof w=="object"&&(w.placement&&(m=w.placement),w.rects&&(l=w.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:a,y:d}=Qo(l,m,i)),v=-1)}return{x:a,y:d,placement:m,strategy:o,middlewareData:f}};async function Jt(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:c,elements:u,strategy:i}=e,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=mt(t,e),h=bu(f),b=u[m?d==="floating"?"reference":"floating":d],C=Qt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:l,rootBoundary:a,strategy:i})),E=d==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),O=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},w=Qt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:y,strategy:i}):E);return{top:(C.top-w.top+h.top)/O.y,bottom:(w.bottom-C.bottom+h.bottom)/O.y,left:(C.left-w.left+h.left)/O.x,right:(w.right-C.right+h.right)/O.x}}const wu=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:c,initialPlacement:u,platform:i,elements:l}=t,{mainAxis:a=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...b}=mt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Qe(o),E=ze(u),y=Qe(u)===u,O=await(i.isRTL==null?void 0:i.isRTL(l.floating)),w=m||(y||!v?[Xt(u)]:du(u)),F=h!=="none";!m&&F&&w.push(...gu(u,v,h,O));const _=[u,...w],B=await Jt(t,b),K=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&K.push(B[C]),d){const R=fu(o,c,O);K.push(B[R[0]],B[R[1]])}if(A=[...A,{placement:o,overflows:K}],!K.every(R=>R<=0)){var j,re;const R=(((j=s.flip)==null?void 0:j.index)||0)+1,X=_[R];if(X&&(!(d==="alignment"?E!==ze(X):!1)||A.every(T=>ze(T.placement)===E?T.overflows[0]>0:!0)))return{data:{index:R,overflows:A},reset:{placement:X}};let G=(re=A.filter(Q=>Q.overflows[0]<=0).sort((Q,T)=>Q.overflows[1]-T.overflows[1])[0])==null?void 0:re.placement;if(!G)switch(f){case"bestFit":{var U;const Q=(U=A.filter(T=>{if(F){const H=ze(T.placement);return H===E||H==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(H=>H>0).reduce((H,S)=>H+S,0)]).sort((T,H)=>T[1]-H[1])[0])==null?void 0:U[0];Q&&(G=Q);break}case"initialPlacement":G=u;break}if(o!==G)return{reset:{placement:G}}}return{}}}},Eu=new Set(["left","top"]);async function xu(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Qe(n),u=Dt(n),i=ze(n)==="y",l=Eu.has(c)?-1:1,a=s&&i?-1:1,d=mt(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return u&&typeof h=="number"&&(f=u==="end"?h*-1:h),i?{x:f*a,y:m*l}:{x:m*l,y:f*a}}const Cu=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:c,middlewareData:u}=t,i=await xu(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+i.x,y:s+i.y,data:{...i,placement:c}}}}},Su=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:c=!1,limiter:u={fn:b=>{let{x:C,y:E}=b;return{x:C,y:E}}},...i}=mt(e,t),l={x:n,y:r},a=await Jt(t,i),d=ze(Qe(o)),m=Yo(d);let f=l[m],h=l[d];if(s){const b=m==="y"?"top":"left",C=m==="y"?"bottom":"right",E=f+a[b],y=f-a[C];f=zo(E,f,y)}if(c){const b=d==="y"?"top":"left",C=d==="y"?"bottom":"right",E=h+a[b],y=h-a[C];h=zo(E,h,y)}const v=u.fn({...t,[m]:f,[d]:h});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:s,[d]:c}}}}}},Ou=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:c,elements:u}=t,{apply:i=()=>{},...l}=mt(e,t),a=await Jt(t,l),d=Qe(o),m=Dt(o),f=ze(o)==="y",{width:h,height:v}=s.floating;let b,C;d==="top"||d==="bottom"?(b=d,C=m===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(C=d,b=m==="end"?"top":"bottom");const E=v-a.top-a.bottom,y=h-a.left-a.right,O=ot(v-a[b],E),w=ot(h-a[C],y),F=!t.middlewareData.shift;let _=O,B=w;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(B=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=E),F&&!m){const A=be(a.left,0),j=be(a.right,0),re=be(a.top,0),U=be(a.bottom,0);f?B=h-2*(A!==0||j!==0?A+j:be(a.left,a.right)):_=v-2*(re!==0||U!==0?re+U:be(a.top,a.bottom))}await i({...t,availableWidth:B,availableHeight:_});const K=await c.getDimensions(u.floating);return h!==K.width||v!==K.height?{reset:{rects:!0}}:{}}}};function Jo(e){const t=Le(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Re(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,u=At(n)!==s||At(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}function Xn(e){return ve(e)?e:e.contextElement}function ht(e){const t=Xn(e);if(!Re(t))return We(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Jo(t);let c=(s?At(n.width):n.width)/r,u=(s?At(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const Tu=We(0);function Zo(e){const t=Oe(e);return!Gn()||!t.visualViewport?Tu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $u(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Oe(e)?!1:t}function it(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Xn(e);let c=We(1);t&&(r?ve(r)&&(c=ht(r)):c=ht(e));const u=$u(s,n,r)?Zo(s):We(0);let i=(o.left+u.x)/c.x,l=(o.top+u.y)/c.y,a=o.width/c.x,d=o.height/c.y;if(s){const m=Oe(s),f=r&&ve(r)?Oe(r):r;let h=m,v=qn(h);for(;v&&r&&f!==h;){const b=ht(v),C=v.getBoundingClientRect(),E=Le(v),y=C.left+(v.clientLeft+parseFloat(E.paddingLeft))*b.x,O=C.top+(v.clientTop+parseFloat(E.paddingTop))*b.y;i*=b.x,l*=b.y,a*=b.x,d*=b.y,i+=y,l+=O,h=Oe(v),v=qn(h)}}return Qt({width:a,height:d,x:i,y:l})}function Zt(e,t){const n=qt(e).scrollLeft;return t?t.left+n:it(ke(e)).left+n}function ei(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Pu(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=ke(r),u=t?Gt(t.floating):!1;if(r===c||u&&s)return n;let i={scrollLeft:0,scrollTop:0},l=We(1);const a=We(0),d=Re(r);if((d||!d&&!s)&&((dt(r)!=="body"||Pt(c))&&(i=qt(r)),Re(r))){const f=it(r);l=ht(r),a.x=f.x+r.clientLeft,a.y=f.y+r.clientTop}const m=c&&!d&&!s?ei(c,i):We(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+a.x+m.x,y:n.y*l.y-i.scrollTop*l.y+a.y+m.y}}function Mu(e){return Array.from(e.getClientRects())}function Au(e){const t=ke(e),n=qt(e),r=e.ownerDocument.body,o=be(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=be(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Zt(e);const u=-n.scrollTop;return Le(r).direction==="rtl"&&(c+=be(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:u}}const ti=25;function Du(e,t){const n=Oe(e),r=ke(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,u=0,i=0;if(o){s=o.width,c=o.height;const a=Gn();(!a||a&&t==="fixed")&&(u=o.offsetLeft,i=o.offsetTop)}const l=Zt(r);if(l<=0){const a=r.ownerDocument,d=a.body,m=getComputedStyle(d),f=a.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(r.clientWidth-d.clientWidth-f);h<=ti&&(s-=h)}else l<=ti&&(s+=l);return{width:s,height:c,x:u,y:i}}const _u=new Set(["absolute","fixed"]);function Fu(e,t){const n=it(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Re(e)?ht(e):We(1),c=e.clientWidth*s.x,u=e.clientHeight*s.y,i=o*s.x,l=r*s.y;return{width:c,height:u,x:i,y:l}}function ni(e,t,n){let r;if(t==="viewport")r=Du(e,n);else if(t==="document")r=Au(ke(e));else if(ve(t))r=Fu(t,n);else{const o=Zo(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Qt(r)}function ri(e,t){const n=Xe(e);return n===t||!ve(n)||pt(n)?!1:Le(n).position==="fixed"||ri(n,t)}function Lu(e,t){const n=t.get(e);if(n)return n;let r=Mt(e,[],!1).filter(u=>ve(u)&&dt(u)!=="body"),o=null;const s=Le(e).position==="fixed";let c=s?Xe(e):e;for(;ve(c)&&!pt(c);){const u=Le(c),i=Yn(c);!i&&u.position==="fixed"&&(o=null),(s?!i&&!o:!i&&u.position==="static"&&!!o&&_u.has(o.position)||Pt(c)&&!i&&ri(e,c))?r=r.filter(a=>a!==c):o=u,c=Xe(c)}return t.set(e,r),r}function Nu(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Gt(t)?[]:Lu(t,this._c):[].concat(n),r],u=c[0],i=c.reduce((l,a)=>{const d=ni(t,a,o);return l.top=be(d.top,l.top),l.right=ot(d.right,l.right),l.bottom=ot(d.bottom,l.bottom),l.left=be(d.left,l.left),l},ni(t,u,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function Iu(e){const{width:t,height:n}=Jo(e);return{width:t,height:n}}function ju(e,t,n){const r=Re(t),o=ke(t),s=n==="fixed",c=it(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const i=We(0);function l(){i.x=Zt(o)}if(r||!r&&!s)if((dt(t)!=="body"||Pt(o))&&(u=qt(t)),r){const f=it(t,!0,s,t);i.x=f.x+t.clientLeft,i.y=f.y+t.clientTop}else o&&l();s&&!r&&o&&l();const a=o&&!r&&!s?ei(o,u):We(0),d=c.left+u.scrollLeft-i.x-a.x,m=c.top+u.scrollTop-i.y-a.y;return{x:d,y:m,width:c.width,height:c.height}}function Qn(e){return Le(e).position==="static"}function oi(e,t){if(!Re(e)||Le(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ke(e)===n&&(n=n.ownerDocument.body),n}function ii(e,t){const n=Oe(e);if(Gt(e))return n;if(!Re(e)){let o=Xe(e);for(;o&&!pt(o);){if(ve(o)&&!Qn(o))return o;o=Xe(o)}return n}let r=oi(e,t);for(;r&&eu(r)&&Qn(r);)r=oi(r,t);return r&&pt(r)&&Qn(r)&&!Yn(r)?n:r||iu(e)||n}const ku=async function(e){const t=this.getOffsetParent||ii,n=this.getDimensions,r=await n(e.floating);return{reference:ju(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ru(e){return Le(e).direction==="rtl"}const Wu={convertOffsetParentRelativeRectToViewportRelativeRect:Pu,getDocumentElement:ke,getClippingRect:Nu,getOffsetParent:ii,getElementRects:ku,getClientRects:Mu,getDimensions:Iu,getScale:ht,isElement:ve,isRTL:Ru};function si(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bu(e,t){let n=null,r;const o=ke(e);function s(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function c(u,i){u===void 0&&(u=!1),i===void 0&&(i=1),s();const l=e.getBoundingClientRect(),{left:a,top:d,width:m,height:f}=l;if(u||t(),!m||!f)return;const h=Kt(d),v=Kt(o.clientWidth-(a+m)),b=Kt(o.clientHeight-(d+f)),C=Kt(a),y={rootMargin:-h+"px "+-v+"px "+-b+"px "+-C+"px",threshold:be(0,ot(1,i))||1};let O=!0;function w(F){const _=F[0].intersectionRatio;if(_!==i){if(!O)return c();_?c(!1,_):r=setTimeout(()=>{c(!1,1e-7)},1e3)}_===1&&!si(l,e.getBoundingClientRect())&&c(),O=!1}try{n=new IntersectionObserver(w,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(w,y)}n.observe(e)}return c(!0),s}function Hu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,l=Xn(e),a=o||s?[...l?Mt(l):[],...Mt(t)]:[];a.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const d=l&&u?Bu(l,n):null;let m=-1,f=null;c&&(f=new ResizeObserver(C=>{let[E]=C;E&&E.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(t)})),n()}),l&&!i&&f.observe(l),f.observe(t));let h,v=i?it(e):null;i&&b();function b(){const C=it(e);v&&!si(v,C)&&n(),v=C,h=requestAnimationFrame(b)}return n(),()=>{var C;a.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),d==null||d(),(C=f)==null||C.disconnect(),f=null,i&&cancelAnimationFrame(h)}}const Jn=Jt,Uu=Cu,Vu=Su,zu=wu,Yu=Ou,Gu=(e,t,n)=>{const r=new Map,o={platform:Wu,...n},s={...o.platform,_c:r};return yu(e,t,{...o,platform:s})};var qu=typeof document<"u",Ku=function(){},en=qu?p.useLayoutEffect:Ku;function tn(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(!tn(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)&&!tn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function li(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ai(e,t){const n=li(e);return Math.round(t*n)/n}function Zn(e){const t=N.useRef(e);return en(()=>{t.current=e}),t}function Xu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:c}={},transform:u=!0,whileElementsMounted:i,open:l}=e,[a,d]=N.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=N.useState(r);tn(m,r)||f(r);const[h,v]=N.useState(null),[b,C]=N.useState(null),E=N.useCallback(T=>{T!==F.current&&(F.current=T,v(T))},[]),y=N.useCallback(T=>{T!==_.current&&(_.current=T,C(T))},[]),O=s||h,w=c||b,F=N.useRef(null),_=N.useRef(null),B=N.useRef(a),K=i!=null,A=Zn(i),j=Zn(o),re=Zn(l),U=N.useCallback(()=>{if(!F.current||!_.current)return;const T={placement:t,strategy:n,middleware:m};j.current&&(T.platform=j.current),Gu(F.current,_.current,T).then(H=>{const S={...H,isPositioned:re.current!==!1};R.current&&!tn(B.current,S)&&(B.current=S,Nt.flushSync(()=>{d(S)}))})},[m,t,n,j,re]);en(()=>{l===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,d(T=>({...T,isPositioned:!1})))},[l]);const R=N.useRef(!1);en(()=>(R.current=!0,()=>{R.current=!1}),[]),en(()=>{if(O&&(F.current=O),w&&(_.current=w),O&&w){if(A.current)return A.current(O,w,U);U()}},[O,w,U,A,K]);const X=N.useMemo(()=>({reference:F,floating:_,setReference:E,setFloating:y}),[E,y]),G=N.useMemo(()=>({reference:O,floating:w}),[O,w]),Q=N.useMemo(()=>{const T={position:n,left:0,top:0};if(!G.floating)return T;const H=ai(G.floating,a.x),S=ai(G.floating,a.y);return u?{...T,transform:"translate("+H+"px, "+S+"px)",...li(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:S}},[n,u,G.floating,a.x,a.y]);return N.useMemo(()=>({...a,update:U,refs:X,elements:G,floatingStyles:Q}),[a,U,X,G,Q])}const ui=(e,t)=>({...Uu(e),options:[e,t]}),Qu=(e,t)=>({...Vu(e),options:[e,t]}),Ju=(e,t)=>({...zu(e),options:[e,t]}),Zu=(e,t)=>({...Yu(e),options:[e,t]}),ci={...N},ec=ci.useInsertionEffect||(e=>e());function fi(e){const t=N.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return ec(()=>{t.current=e}),N.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 er=typeof document<"u"?p.useLayoutEffect:p.useEffect;let di=!1,tc=0;const pi=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+tc++;function nc(){const[e,t]=N.useState(()=>di?pi():void 0);return er(()=>{e==null&&t(pi())},[]),N.useEffect(()=>{di=!0},[]),e}const rc=ci.useId||nc;let _t;process.env.NODE_ENV!=="production"&&(_t=new Set);function oc(){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=_t)!=null&&e.has(o))){var s;(s=_t)==null||s.add(o),console.warn(o)}}function ic(){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=_t)!=null&&e.has(o))){var s;(s=_t)==null||s.add(o),console.error(o)}}function sc(){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 lc=N.createContext(null),ac=N.createContext(null),uc=()=>{var e;return((e=N.useContext(lc))==null?void 0:e.id)||null},cc=()=>N.useContext(ac),fc="data-floating-ui-focusable";function dc(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=rc(),s=N.useRef({}),[c]=N.useState(()=>sc()),u=uc()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!ve(f)&&ic("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[i,l]=N.useState(r.reference),a=fi((f,h,v)=>{s.current.openEvent=f?h:void 0,c.emit("openchange",{open:f,event:h,reason:v,nested:u}),n==null||n(f,h,v)}),d=N.useMemo(()=>({setPositionReference:l}),[]),m=N.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return N.useMemo(()=>({dataRef:s,open:t,onOpenChange:a,elements:m,events:c,floatingId:o,refs:d}),[t,a,m,c,o,d])}function pc(e){e===void 0&&(e={});const{nodeId:t}=e,n=dc({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=N.useState(null),[u,i]=N.useState(null),a=(o==null?void 0:o.domReference)||s,d=N.useRef(null),m=cc();er(()=>{a&&(d.current=a)},[a]);const f=Xu({...e,elements:{...o,...u&&{reference:u}}}),h=N.useCallback(y=>{const O=ve(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;i(O),f.refs.setReference(O)},[f.refs]),v=N.useCallback(y=>{(ve(y)||y===null)&&(d.current=y,c(y)),(ve(f.refs.reference.current)||f.refs.reference.current===null||y!==null&&!ve(y))&&f.refs.setReference(y)},[f.refs]),b=N.useMemo(()=>({...f.refs,setReference:v,setPositionReference:h,domReference:d}),[f.refs,v,h]),C=N.useMemo(()=>({...f.elements,domReference:a}),[f.elements,a]),E=N.useMemo(()=>({...f,...r,refs:b,elements:C,nodeId:t}),[f,b,C,t,r]);return er(()=>{r.dataRef.current.floatingContext=E;const y=m==null?void 0:m.nodesRef.current.find(O=>O.id===t);y&&(y.context=E)}),N.useMemo(()=>({...f,context:E,refs:b,elements:C}),[f,b,C,E])}const mi="active",hi="selected";function tr(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[mi]:c,[hi]:u,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[fc]:""},...s,...t.map(c=>{const u=c?c[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((c,u)=>(u&&Object.entries(u).forEach(i=>{let[l,a]=i;if(!(o&&[mi,hi].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof a=="function"){var d;(d=r.get(l))==null||d.push(a),c[l]=function(){for(var m,f=arguments.length,h=new Array(f),v=0;v<f;v++)h[v]=arguments[v];return(m=r.get(l))==null?void 0:m.map(b=>b(...h)).find(b=>b!==void 0)}}}else c[l]=a}),c),{})}}function mc(e){e===void 0&&(e=[]);const t=e.map(u=>u==null?void 0:u.reference),n=e.map(u=>u==null?void 0:u.floating),r=e.map(u=>u==null?void 0:u.item),o=N.useCallback(u=>tr(u,e,"reference"),t),s=N.useCallback(u=>tr(u,e,"floating"),n),c=N.useCallback(u=>tr(u,e,"item"),r);return N.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}function gi(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const hc=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:c=0,minItemsVisible:u=4,referenceOverflowThreshold:i=0,scrollRef:l,...a}=mt(e,t),{rects:d,elements:{floating:m}}=t,f=n.current[c],h=(l==null?void 0:l.current)||m,v=m.clientTop||h.clientTop,b=m.clientTop!==0,C=h.clientTop!==0,E=m===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||oc('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const y={...t,...await ui(-f.offsetTop-m.clientTop-d.reference.height/2-f.offsetHeight/2-s).fn(t)},O=await Jn(gi(y,h.scrollHeight+v+m.clientTop),a),w=await Jn(y,{...a,elementContext:"reference"}),F=be(0,O.top),_=y.y+F,A=(h.scrollHeight>h.clientHeight?j=>j:At)(be(0,h.scrollHeight+(b&&E||C?v*2:0)-F-be(0,O.bottom)));if(h.style.maxHeight=A+"px",h.scrollTop=F,o){const j=h.offsetHeight<f.offsetHeight*ot(u,n.current.length)-1||w.top>=-i||w.bottom>=-i;Nt.flushSync(()=>o(j))}return r&&(r.current=await Jn(gi({...y,y:_},h.offsetHeight+v+m.clientTop),a)),{y:_}}});function gc(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:c,onChange:u}=t,i=fi(u),l=N.useRef(!1),a=N.useRef(null),d=N.useRef(null);N.useEffect(()=>{if(!o)return;function f(v){if(v.ctrlKey||!h||s.current==null)return;const b=v.deltaY,C=s.current.top>=-.5,E=s.current.bottom>=-.5,y=h.scrollHeight-h.clientHeight,O=b<0?-1:1,w=b<0?"max":"min";h.scrollHeight<=h.clientHeight||(!C&&b>0||!E&&b<0?(v.preventDefault(),Nt.flushSync(()=>{i(F=>F+Math[w](b,y*O))})):/firefox/i.test(lu())&&(h.scrollTop+=b))}const h=(c==null?void 0:c.current)||r.floating;if(n&&h)return h.addEventListener("wheel",f),requestAnimationFrame(()=>{a.current=h.scrollTop,s.current!=null&&(d.current={...s.current})}),()=>{a.current=null,d.current=null,h.removeEventListener("wheel",f)}},[o,n,r.floating,s,c,i]);const m=N.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const f=(c==null?void 0:c.current)||r.floating;if(!(!s.current||!f||!l.current)){if(a.current!==null){const h=f.scrollTop-a.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Nt.flushSync(()=>i(v=>v+h))}requestAnimationFrame(()=>{a.current=f.scrollTop})}}}),[r.floating,i,s,c]);return N.useMemo(()=>o?{floating:m}:{},[o,m])}let gt=p.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});gt.displayName="FloatingContext";let nr=p.createContext(null);nr.displayName="PlacementContext";function vc(e){return p.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function bc(){return p.useContext(gt).setReference}function yc(){return p.useContext(gt).getReferenceProps}function wc(){let{getFloatingProps:e,slot:t}=p.useContext(gt);return p.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Ec(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=p.useContext(nr),n=p.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var c;return(c=s==null?void 0:s.outerHTML)!=null?c:s})]);ue(()=>{t==null||t(n??null)},[t,n]);let r=p.useContext(gt);return p.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let vi=4;function xc({children:e,enabled:t=!0}){let[n,r]=p.useState(null),[o,s]=p.useState(0),c=p.useRef(null),[u,i]=p.useState(null);Cc(u);let l=t&&n!==null&&u!==null,{to:a="bottom",gap:d=0,offset:m=0,padding:f=0,inner:h}=Sc(n,u),[v,b="center"]=a.split(" ");ue(()=>{l&&s(0)},[l]);let{refs:C,floatingStyles:E,context:y}=pc({open:l,placement:v==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${v}`:`${v}-${b}`,strategy:"absolute",transform:!1,middleware:[ui({mainAxis:v==="selection"?0:d,crossAxis:m}),Qu({padding:f}),v!=="selection"&&Ju({padding:f}),v==="selection"&&h?hc({...h,padding:f,overflowRef:c,offset:o,minItemsVisible:vi,referenceOverflowThreshold:f,onFallbackChange(j){var re,U;if(!j)return;let R=y.elements.floating;if(!R)return;let X=parseFloat(getComputedStyle(R).scrollPaddingBottom)||0,G=Math.min(vi,R.childElementCount),Q=0,T=0;for(let H of(U=(re=y.elements.floating)==null?void 0:re.childNodes)!=null?U:[])if(Ve(H)){let S=H.offsetTop,M=S+H.clientHeight+X,k=R.scrollTop,I=k+R.clientHeight;if(S>=k&&M<=I)G--;else{T=Math.max(0,Math.min(M,I)-Math.max(S,k)),Q=H.clientHeight;break}}G>=1&&s(H=>{let S=Q*G-T+X;return H>=S?H:S})}}):null,Zu({padding:f,apply({availableWidth:j,availableHeight:re,elements:U}){Object.assign(U.floating.style,{overflow:"auto",maxWidth:`${j}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${re}px)`})}})].filter(Boolean),whileElementsMounted:Hu}),[O=v,w=b]=y.placement.split("-");v==="selection"&&(O="selection");let F=p.useMemo(()=>({anchor:[O,w].filter(Boolean).join(" ")}),[O,w]),_=gc(y,{overflowRef:c,onChange:s}),{getReferenceProps:B,getFloatingProps:K}=mc([_]),A=ne(j=>{i(j),C.setFloating(j)});return N.createElement(nr.Provider,{value:r},N.createElement(gt.Provider,{value:{setFloating:A,setReference:C.setReference,styles:E,getReferenceProps:B,getFloatingProps:K,slot:F}},e))}function Cc(e){ue(()=>{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 Sc(e,t){var n,r,o;let s=rr((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),c=rr((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=rr((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:c,padding:u}}function rr(e,t,n=void 0){let r=ut(),o=ne((i,l)=>{if(i==null)return[n,null];if(typeof i=="number")return[i,null];if(typeof i=="string"){if(!l)return[n,null];let a=yi(i,l);return[a,d=>{let m=bi(i);{let f=m.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let v=!1;for(let[C,E]of m.entries()){let y=window.getComputedStyle(l).getPropertyValue(E);if(f[C]!==y){f[C]=y,v=!0;break}}if(!v)return;let b=yi(i,l);a!==b&&(d(b),a=b)})}return r.dispose}]}return[n,null]}),s=p.useMemo(()=>o(e,t)[0],[e,t]),[c=s,u]=p.useState();return ue(()=>{let[i,l]=o(e,t);if(u(i),!!l)return l(u)},[e,t]),c}function bi(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,...bi(o)]:[r]}return[]}function yi(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 Oc(e,t){let[n,r]=p.useState(t);return!e&&n!==t&&r(t),e?n:t}let or=p.createContext(null);or.displayName="OpenClosedContext";var Ne=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ne||{});function ir(){return p.useContext(or)}function wi({value:e,children:t}){return p.createElement(or.Provider,{value:e},t)}function Tc(e){throw new Error("Unexpected object: "+e)}var fe=(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))(fe||{});function nn(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:Tc(e)}}var Ei=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Ei||{});function xi(e){let t=ne(e),n=p.useRef(!1);p.useEffect(()=>(n.current=!1,()=>{n.current=!0,to(()=>{n.current&&t()})}),[t])}function $c(){let e=typeof document>"u";return"useSyncExternalStore"in N?(t=>t.useSyncExternalStore)(N)(()=>()=>{},()=>!1,()=>!e):!1}function sr(){let e=$c(),[t,n]=N.useState(Ie.isHandoffComplete);return t&&Ie.isHandoffComplete===!1&&n(!1),N.useEffect(()=>{t!==!0&&n(!0)},[t]),N.useEffect(()=>Ie.handoff(),[]),e?!1:t}let Pc=p.createContext(!1);function Mc(){return p.useContext(Pc)}function Ac(e){let t=Mc(),n=p.useContext(Si),[r,o]=p.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Ie.isServer)return null;let c=e==null?void 0:e.getElementById("headlessui-portal-root");if(c)return c;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return p.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),p.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Ci=p.Fragment,Dc=xe(function(e,t){let{ownerDocument:n=null,...r}=e,o=p.useRef(null),s=Pe(Kl(f=>{o.current=f}),t),c=zn(o),u=n??c,i=Ac(u),[l]=p.useState(()=>{var f;return Ie.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),a=p.useContext(Nc),d=sr();ue(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),ue(()=>{if(l&&a)return a.register(l)},[a,l]),xi(()=>{var f;!i||!l||(_n(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let m=Se();return d?!i||!l?null:Ee.createPortal(m({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Ci,name:"Portal"}),l):null});function _c(e,t){let n=Pe(t),{enabled:r=!0,ownerDocument:o,...s}=e,c=Se();return r?p.createElement(Dc,{...s,ownerDocument:o,ref:n}):c({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Ci,name:"Portal"})}let Fc=p.Fragment,Si=p.createContext(null);function Lc(e,t){let{target:n,...r}=e,o={ref:Pe(t)},s=Se();return p.createElement(Si.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:Fc,name:"Popover.Group"}))}let Nc=p.createContext(null),Ic=xe(_c),jc=xe(Lc),kc=Object.assign(Ic,{Group:jc});function Rc(){let e=p.useRef(!1);return ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Oi(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:$i)!==p.Fragment||p.Children.count(e.children)===1}let rn=p.createContext(null);rn.displayName="TransitionContext";var Wc=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Wc||{});function Bc(){let e=p.useContext(rn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Hc(){let e=p.useContext(on);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let on=p.createContext(null);on.displayName="NestingContext";function sn(e){return"children"in e?sn(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Ti(e,t){let n=nt(e),r=p.useRef([]),o=Rc(),s=ut(),c=ne((f,h=qe.Hidden)=>{let v=r.current.findIndex(({el:b})=>b===f);v!==-1&&($e(h,{[qe.Unmount](){r.current.splice(v,1)},[qe.Hidden](){r.current[v].state="hidden"}}),s.microTask(()=>{var b;!sn(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),u=ne(f=>{let h=r.current.find(({el:v})=>v===f);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:f,state:"visible"}),()=>c(f,qe.Unmount)}),i=p.useRef([]),l=p.useRef(Promise.resolve()),a=p.useRef({enter:[],leave:[]}),d=ne((f,h,v)=>{i.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([b])=>b!==f)),t==null||t.chains.current[h].push([f,new Promise(b=>{i.current.push(b)})]),t==null||t.chains.current[h].push([f,new Promise(b=>{Promise.all(a.current[h].map(([C,E])=>E)).then(()=>b())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(h)):v(h)}),m=ne((f,h,v)=>{Promise.all(a.current[h].splice(0).map(([b,C])=>C)).then(()=>{var b;(b=i.current.shift())==null||b()}).then(()=>v(h))});return p.useMemo(()=>({children:r,register:u,unregister:c,onStart:d,onStop:m,wait:l,chains:a}),[u,c,r,d,m,a,l])}let $i=p.Fragment,Pi=Bt.RenderStrategy;function Uc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:u,afterLeave:i,enter:l,enterFrom:a,enterTo:d,entered:m,leave:f,leaveFrom:h,leaveTo:v,...b}=e,[C,E]=p.useState(null),y=p.useRef(null),O=Oi(e),w=Pe(...O?[y,t,E]:t===null?[]:[t]),F=(n=b.unmount)==null||n?qe.Unmount:qe.Hidden,{show:_,appear:B,initial:K}=Bc(),[A,j]=p.useState(_?"visible":"hidden"),re=Hc(),{register:U,unregister:R}=re;ue(()=>U(y),[U,y]),ue(()=>{if(F===qe.Hidden&&y.current){if(_&&A!=="visible"){j("visible");return}return $e(A,{hidden:()=>R(y),visible:()=>U(y)})}},[A,y,U,R,_,F]);let X=sr();ue(()=>{if(O&&X&&A==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,A,X,O]);let G=K&&!B,Q=B&&_&&K,T=p.useRef(!1),H=Ti(()=>{T.current||(j("hidden"),R(y))},re),S=ne(P=>{T.current=!0;let W=P?"enter":"leave";H.onStart(y,W,z=>{z==="enter"?s==null||s():z==="leave"&&(u==null||u())})}),M=ne(P=>{let W=P?"enter":"leave";T.current=!1,H.onStop(y,W,z=>{z==="enter"?c==null||c():z==="leave"&&(i==null||i())}),W==="leave"&&!sn(H)&&(j("hidden"),R(y))});p.useEffect(()=>{O&&o||(S(_),M(_))},[_,O,o]);let k=!(!o||!O||!X||G),[,I]=Bo(k,C,_,{start:S,end:M}),V=Ke({ref:w,className:((r=Mn(b.className,Q&&l,Q&&a,I.enter&&l,I.enter&&I.closed&&a,I.enter&&!I.closed&&d,I.leave&&f,I.leave&&!I.closed&&h,I.leave&&I.closed&&v,!I.transition&&_&&m))==null?void 0:r.trim())||void 0,...Wo(I)}),J=0;A==="visible"&&(J|=Ne.Open),A==="hidden"&&(J|=Ne.Closed),_&&A==="hidden"&&(J|=Ne.Opening),!_&&A==="visible"&&(J|=Ne.Closing);let q=Se();return p.createElement(on.Provider,{value:H},p.createElement(wi,{value:J},q({ourProps:V,theirProps:b,defaultTag:$i,features:Pi,visible:A==="visible",name:"Transition.Child"})))}function Vc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,c=p.useRef(null),u=Oi(e),i=Pe(...u?[c,t]:t===null?[]:[t]);sr();let l=ir();if(n===void 0&&l!==null&&(n=(l&Ne.Open)===Ne.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,d]=p.useState(n?"visible":"hidden"),m=Ti(()=>{n||d("hidden")}),[f,h]=p.useState(!0),v=p.useRef([n]);ue(()=>{f!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),h(!1))},[v,n]);let b=p.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);ue(()=>{n?d("visible"):!sn(m)&&c.current!==null&&d("hidden")},[n,m]);let C={unmount:o},E=ne(()=>{var w;f&&h(!1),(w=e.beforeEnter)==null||w.call(e)}),y=ne(()=>{var w;f&&h(!1),(w=e.beforeLeave)==null||w.call(e)}),O=Se();return p.createElement(on.Provider,{value:m},p.createElement(rn.Provider,{value:b},O({ourProps:{...C,as:p.Fragment,children:p.createElement(Mi,{ref:i,...C,...s,beforeEnter:E,beforeLeave:y})},theirProps:{},defaultTag:p.Fragment,features:Pi,visible:a==="visible",name:"Transition"})))}function zc(e,t){let n=p.useContext(rn)!==null,r=ir()!==null;return p.createElement(p.Fragment,null,!n&&r?p.createElement(lr,{ref:t,...e}):p.createElement(Mi,{ref:t,...e}))}let lr=xe(Vc),Mi=xe(Uc),Yc=xe(zc),Ai=Object.assign(lr,{Child:Yc,Root:lr});function Gc(e,t){let n=p.useRef({left:0,top:0});if(ue(()=>{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 Di=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function _i(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Ve(o))return r;let s=!1;for(let u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),s=!0;let c=s?(n=o.innerText)!=null?n:"":r;return Di.test(c)&&(c=c.replace(Di,"")),c}function qc(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 c=s.getAttribute("aria-label");return typeof c=="string"?c.trim():_i(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return _i(e).trim()}function Kc(e){let t=p.useRef(""),n=p.useRef("");return ne(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=qc(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Xc=Object.defineProperty,Qc=(e,t,n)=>t in e?Xc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fi=(e,t,n)=>(Qc(e,typeof t!="symbol"?t+"":t,n),n),ge=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ge||{}),Be=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Be||{}),ln=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(ln||{}),Li=(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))(Li||{});function Ni(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=_o(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 Jc={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:fe.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,c;if(e.dataRef.current.disabled||e.listboxState===1)return e;let u={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===fe.Nothing)return{...u,activeOptionIndex:null};if(t.focus===fe.Specific)return{...u,activeOptionIndex:e.options.findIndex(a=>a.id===t.id)};if(t.focus===fe.Previous){let a=e.activeOptionIndex;if(a!==null){let d=e.options[a].dataRef.current.domRef,m=nn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...u,activeOptionIndex:m}}}}else if(t.focus===fe.Next){let a=e.activeOptionIndex;if(a!==null){let d=e.options[a].dataRef.current.domRef,m=nn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((s=d.current)==null?void 0:s.nextElementSibling)===f.current||((c=f.current)==null?void 0:c.nextElementSibling)===null)return{...u,activeOptionIndex:m}}}}let i=Ni(e),l=nn(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:a=>a.id,resolveDisabled:a=>a.dataRef.current.disabled});return{...u,...i,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(c=>{var u;return!c.dataRef.current.disabled&&((u=c.dataRef.current.textValue)==null?void 0:u.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!==fe.Nothing&&(r=nn(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(c=>o==null?void 0:o(c.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:fe.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,c]of n.entries())if(o.has(c.id)&&(r.push(s),o.delete(c.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,...Ni(e),pendingShouldSort:!1}:e};class ar extends wo{constructor(t){super(t),Fi(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:c}=this.state.dataRef.current;return $e(s,{0:()=>r==null?void 0:r(n),1:()=>{let u=c.slice(),i=u.findIndex(l=>o(l,n));return i===-1?u.push(n):u.splice(i,1),r==null?void 0:r(u)}})},registerOption:In(()=>{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:In(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:In(()=>{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:fe.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})}}),Fi(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,c=n.options;return s!==null?((o=c[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=jn.get(null);this.disposables.add(r.on(So.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 ar({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:fe.Nothing},__demoMode:n})}reduce(t,n){return $e(n.type,Jc,t,n)}}const Ii=p.createContext(null);function ur(e){let t=p.useContext(Ii);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ji),n}return t}function ji({id:e,__demoMode:t=!1}){let n=p.useMemo(()=>ar.new({id:e,__demoMode:t}),[]);return xi(()=>n.dispose()),n}let an=p.createContext(null);an.displayName="ListboxDataContext";function Ft(e){let t=p.useContext(an);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ft),n}return t}let Zc=p.Fragment;function ef(e,t){let n=p.useId(),r=Pn(),{value:o,defaultValue:s,form:c,name:u,onChange:i,by:l,invalid:a=!1,disabled:d=r||!1,horizontal:m=!1,multiple:f=!1,__demoMode:h=!1,...v}=e;const b=m?"horizontal":"vertical";let C=Pe(t),E=Ll(s),[y=f?[]:void 0,O]=Fl(o,i,E),w=ji({id:n,__demoMode:h}),F=p.useRef({static:!1,hold:!1}),_=p.useRef(new Map),B=sa(l),K=p.useCallback(k=>$e(A.mode,{[Be.Multi]:()=>y.some(I=>B(I,k)),[Be.Single]:()=>B(y,k)}),[y]),A=p.useMemo(()=>({value:y,disabled:d,invalid:a,mode:f?Be.Multi:Be.Single,orientation:b,onChange:O,compare:B,isSelected:K,optionsPropsRef:F,listRef:_}),[y,d,a,f,b,O,B,K,F,_]);ue(()=>{w.state.dataRef.current=A},[A]);let j=Ae(w,k=>k.listboxState),re=jn.get(null),U=Ae(re,p.useCallback(k=>re.selectors.isTop(k,n),[re,n])),[R,X]=Ae(w,k=>[k.buttonElement,k.optionsElement]);Fa(U,[R,X],(k,I)=>{w.send({type:Li.CloseListbox}),Do(I,Vn.Loose)||(k.preventDefault(),R==null||R.focus())});let G=p.useMemo(()=>({open:j===ge.Open,disabled:d,invalid:a,value:y}),[j,d,a,y]),[Q,T]=ea({inherit:!0}),H={ref:C},S=p.useCallback(()=>{if(E!==void 0)return O==null?void 0:O(E)},[O,E]),M=Se();return p.createElement(T,{value:Q,props:{htmlFor:R==null?void 0:R.id},slot:{open:j===ge.Open,disabled:d}},p.createElement(xc,null,p.createElement(Ii.Provider,{value:w},p.createElement(an.Provider,{value:A},p.createElement(wi,{value:$e(j,{[ge.Open]:Ne.Open,[ge.Closed]:Ne.Closed})},u!=null&&y!=null&&p.createElement(Wl,{disabled:d,data:{[u]:y},form:c,onReset:S}),M({ourProps:H,theirProps:v,slot:G,defaultTag:Zc,name:"Listbox"}))))))}let tf="button";function nf(e,t){let n=p.useId(),r=ao(),o=Ft("Listbox.Button"),s=ur("Listbox.Button"),{id:c=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:i=!1,...l}=e,a=Pe(t,bc(),s.actions.setButtonElement),d=yc(),[m,f,h]=Ae(s,T=>[T.listboxState,T.buttonElement,T.optionsElement]),v=m===ge.Open;Ia(v,{trigger:f,action:p.useCallback(T=>{if(f!=null&&f.contains(T.target))return zt.Ignore;let H=T.target.closest('[role="option"]:not([data-disabled])');return Ve(H)?zt.Select(H):h!=null&&h.contains(T.target)?zt.Ignore:zt.Close},[f,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let b=ne(T=>{switch(T.key){case he.Enter:Nl(T.currentTarget);break;case he.Space:case he.ArrowDown:T.preventDefault(),s.actions.openListbox({focus:o.value?fe.Nothing:fe.First});break;case he.ArrowUp:T.preventDefault(),s.actions.openListbox({focus:o.value?fe.Nothing:fe.Last});break}}),C=ne(T=>{switch(T.key){case he.Space:T.preventDefault();break}}),E=ne(T=>{var H;if(T.button===Ei.Left){if(Gl(T.currentTarget))return T.preventDefault();s.state.listboxState===ge.Open?(Ee.flushSync(()=>s.actions.closeListbox()),(H=s.state.buttonElement)==null||H.focus({preventScroll:!0})):(T.preventDefault(),s.actions.openListbox({focus:fe.Nothing}))}}),y=p.useRef(null),O=ne(T=>{y.current=T.pointerType,T.pointerType==="mouse"&&E(T)}),w=ne(T=>{y.current!=="mouse"&&E(T)}),F=ne(T=>T.preventDefault()),_=go([c]),B=Xl(),{isFocusVisible:K,focusProps:A}=El({autoFocus:i}),{isHovered:j,hoverProps:re}=wl({isDisabled:u}),{pressed:U,pressProps:R}=$l({disabled:u}),X=p.useMemo(()=>({open:m===ge.Open,active:U||m===ge.Open,disabled:u,invalid:o.invalid,value:o.value,hover:j,focus:K,autofocus:i}),[m,o.value,u,j,K,U,o.invalid,i]),G=Ae(s,T=>T.listboxState===ge.Open),Q=ro(d(),{ref:a,id:c,type:ja(e,f),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":G,"aria-labelledby":_,"aria-describedby":B,disabled:u||void 0,autoFocus:i,onKeyDown:b,onKeyUp:C,onKeyPress:F,onPointerDown:O,onClick:w},A,re,R);return Se()({ourProps:Q,theirProps:l,slot:X,defaultTag:tf,name:"Listbox.Button"})}let ki=p.createContext(!1),rf="div",of=Bt.RenderStrategy|Bt.Static;function sf(e,t){let n=p.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:c=!0,transition:u=!1,...i}=e,l=vc(o),[a,d]=p.useState(null);l&&(s=!0);let m=Ft("Listbox.Options"),f=ur("Listbox.Options"),[h,v,b,C]=Ae(f,P=>[P.listboxState,P.buttonElement,P.optionsElement,P.__demoMode]),E=zn(v),y=zn(b),O=ir(),[w,F]=Bo(u,a,O!==null?(O&Ne.Open)===Ne.Open:h===ge.Open);Ea(w,v,f.actions.closeListbox);let _=C?!1:c&&h===ge.Open;za(_,y);let B=C?!1:c&&h===ge.Open;wa(B,{allowed:p.useCallback(()=>[v,b],[v,b])});let K=h!==ge.Open,A=Gc(K,v)?!1:w,j=w&&h===ge.Closed,re=Oc(j,m.value),U=ne(P=>m.compare(re,P)),R=Ae(f,P=>{var W;if(l==null||!((W=l==null?void 0:l.to)!=null&&W.includes("selection")))return null;let z=P.options.findIndex(Z=>U(Z.dataRef.current.value));return z===-1&&(z=0),z}),X=(()=>{if(l==null)return;if(R===null)return{...l,inner:void 0};let P=Array.from(m.listRef.current.values());return{...l,inner:{listRef:{current:P},index:R}}})(),[G,Q]=Ec(X),T=wc(),H=Pe(t,l?G:null,f.actions.setOptionsElement,d),S=ut();p.useEffect(()=>{var P;let W=b;W&&h===ge.Open&&W!==((P=St(W))==null?void 0:P.activeElement)&&(W==null||W.focus({preventScroll:!0}))},[h,b]);let M=ne(P=>{var W,z;switch(S.dispose(),P.key){case he.Space:if(f.state.searchQuery!=="")return P.preventDefault(),P.stopPropagation(),f.actions.search(P.key);case he.Enter:if(P.preventDefault(),P.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:Z}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(Z.current.value)}m.mode===Be.Single&&(Ee.flushSync(()=>f.actions.closeListbox()),(W=f.state.buttonElement)==null||W.focus({preventScroll:!0}));break;case $e(m.orientation,{vertical:he.ArrowDown,horizontal:he.ArrowRight}):return P.preventDefault(),P.stopPropagation(),f.actions.goToOption({focus:fe.Next});case $e(m.orientation,{vertical:he.ArrowUp,horizontal:he.ArrowLeft}):return P.preventDefault(),P.stopPropagation(),f.actions.goToOption({focus:fe.Previous});case he.Home:case he.PageUp:return P.preventDefault(),P.stopPropagation(),f.actions.goToOption({focus:fe.First});case he.End:case he.PageDown:return P.preventDefault(),P.stopPropagation(),f.actions.goToOption({focus:fe.Last});case he.Escape:P.preventDefault(),P.stopPropagation(),Ee.flushSync(()=>f.actions.closeListbox()),(z=f.state.buttonElement)==null||z.focus({preventScroll:!0});return;case he.Tab:P.preventDefault(),P.stopPropagation(),Ee.flushSync(()=>f.actions.closeListbox()),Ma(f.state.buttonElement,P.shiftKey?Un.Previous:Un.Next);break;default:P.key.length===1&&(f.actions.search(P.key),S.setTimeout(()=>f.actions.clearSearch(),350));break}}),k=Ae(f,P=>{var W;return(W=P.buttonElement)==null?void 0:W.id}),I=p.useMemo(()=>({open:h===ge.Open}),[h]),V=ro(l?T():{},{id:r,ref:H,"aria-activedescendant":Ae(f,f.selectors.activeDescendantId),"aria-multiselectable":m.mode===Be.Multi?!0:void 0,"aria-labelledby":k,"aria-orientation":m.orientation,onKeyDown:M,role:"listbox",tabIndex:h===ge.Open?0:void 0,style:{...i.style,...Q,"--button-width":aa(v,!0).width},...Wo(F)}),J=Se(),q=p.useMemo(()=>m.mode===Be.Multi?m:{...m,isSelected:U},[m,U]);return p.createElement(kc,{enabled:s?e.static||w:!1,ownerDocument:E},p.createElement(an.Provider,{value:q},J({ourProps:V,theirProps:i,slot:I,defaultTag:rf,features:of,visible:A,name:"Listbox.Options"})))}let lf="div";function af(e,t){let n=p.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...c}=e,u=p.useContext(ki)===!0,i=Ft("Listbox.Option"),l=ur("Listbox.Option"),a=Ae(l,A=>l.selectors.isActive(A,r)),d=i.isSelected(s),m=p.useRef(null),f=Kc(m),h=nt({disabled:o,value:s,domRef:m,get textValue(){return f()}}),v=Pe(t,m,A=>{A?i.listRef.current.set(r,A):i.listRef.current.delete(r)}),b=Ae(l,A=>l.selectors.shouldScrollIntoView(A,r));ue(()=>{if(b)return Fe().requestAnimationFrame(()=>{var A,j;(j=(A=m.current)==null?void 0:A.scrollIntoView)==null||j.call(A,{block:"nearest"})})},[b,m]),ue(()=>{if(!u)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,u]);let C=ne(A=>{var j;if(o)return A.preventDefault();l.actions.onChange(s),i.mode===Be.Single&&(Ee.flushSync(()=>l.actions.closeListbox()),(j=l.state.buttonElement)==null||j.focus({preventScroll:!0}))}),E=ne(()=>{if(o)return l.actions.goToOption({focus:fe.Nothing});l.actions.goToOption({focus:fe.Specific,id:r})}),y=Ya(),O=ne(A=>y.update(A)),w=ne(A=>{y.wasMoved(A)&&(o||a&&l.state.activationTrigger===ln.Pointer||l.actions.goToOption({focus:fe.Specific,id:r},ln.Pointer))}),F=ne(A=>{y.wasMoved(A)&&(o||a&&l.state.activationTrigger===ln.Pointer&&l.actions.goToOption({focus:fe.Nothing}))}),_=p.useMemo(()=>({active:a,focus:a,selected:d,disabled:o,selectedOption:d&&u}),[a,d,o,u]),B=u?{}:{id:r,ref:v,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:C,onFocus:E,onPointerEnter:O,onMouseEnter:O,onPointerMove:w,onMouseMove:w,onPointerLeave:F,onMouseLeave:F},K=Se();return!d&&u?null:K({ourProps:B,theirProps:c,slot:_,defaultTag:lf,name:"Listbox.Option"})}let uf=p.Fragment;function cf(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pe(t)},c=Ft("ListboxSelectedOption"),u=p.useMemo(()=>({}),[]),i=c.value===void 0||c.value===null||c.mode===Be.Multi&&Array.isArray(c.value)&&c.value.length===0,l=Se();return p.createElement(ki.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:p.createElement(p.Fragment,null,r&&i?r:n)},slot:u,defaultTag:uf,name:"ListboxSelectedOption"}))}let ff=xe(ef),df=xe(nf),pf=oa,mf=xe(sf),hf=xe(af),gf=xe(cf),Je=Object.assign(ff,{Button:df,Label:pf,Options:mf,Option:hf,SelectedOption:gf});function vf({title:e,titleId:t,...n},r){return N.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?N.createElement("title",{id:t},e):null,N.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const Ri=N.forwardRef(vf);function bf({title:e,titleId:t,...n},r){return N.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?N.createElement("title",{id:t},e):null,N.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Wi=N.forwardRef(bf),Bi=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o=""})=>(p.useEffect(()=>{console.log("🔗 ChainSelector: selectedChain updated",t)},[t]),x.jsx("div",{className:`relative ${o}`,children:x.jsx(Je,{value:t,onChange:n,disabled:r,children:({open:s})=>x.jsxs(x.Fragment,{children:[x.jsxs(Je.Button,{className:`
|
|
79
|
+
*/var el;function _g(){return el||(el=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=S,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Ai.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 v(k){if(!C){if(C=!0,b=k,k=f(k),p!==void 0&&h.hasValue){var D=h.value;if(p(D,k))return $=D}return $=k}if(D=$,n(b,k))return D;var j=f(k);return p!==void 0&&p(D,j)?(b=k,D):(b=k,$=j)}var C=!1,b,$,B=l===void 0?null:l;return[function(){return v(u())},B===null?void 0:function(){return v(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())}()),Ai}process.env.NODE_ENV==="production"?Pi.exports=jg():Pi.exports=_g();var Ug=Pi.exports;function st(e,t,n=Ku){return Ug.useSyncExternalStoreWithSelector(ce(r=>e.subscribe(zg,r)),ce(()=>e.state),ce(()=>e.state),ce(t),n)}function zg(e){return e}function tl(e,t){let n=S.useId(),r=Si.get(t),[o,s]=st(r,S.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ge(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Ti=new Map,Br=new Map;function nl(e){var t;let n=(t=Br.get(e))!=null?t:0;return Br.set(e,n+1),n!==0?()=>rl(e):(Ti.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>rl(e))}function rl(e){var t;let n=(t=Br.get(e))!=null?t:1;if(n===1?Br.delete(e):Br.set(e,n-1),n!==1)return;let r=Ti.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Ti.delete(e))}function Wg(e,{allowed:t,disallowed:n}={}){let r=tl(e,"inert-others");ge(()=>{var o,s;if(!r)return;let i=ht();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(nl(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=Ir(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let f of l.children)c.some(p=>f.contains(p))||i.add(nl(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Hg(e,t,n){let r=$n(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});S.useEffect(()=>{if(!e)return;let o=t===null?null:zt(t)?t:t.current;if(!o)return;let s=ht();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let Ci=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),Vg=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Oi=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Oi||{}),Gg=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Gg||{}),qg=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(qg||{});function ol(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ci)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Zg(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Vg)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ni=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ni||{});function sl(e,t=0){var n;return e===((n=Ir(e))==null?void 0:n.body)?!1:nt(t,{0(){return e.matches(Ci)},1(){let r=e;for(;r!==null;){if(r.matches(Ci))return!0;r=r.parentElement}return!1}})}var Kg=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Kg||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let Yg=["textarea","input"].join(",");function Xg(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Yg))!=null?n:!1}function il(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Qg(e,t){return Jg(ol(),t,{relativeTo:e})}function Jg(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?il(e):e:t&64?Zg(e):ol(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??s.activeElement;let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,p;do{if(l>=f||l+f<=0)return 0;let d=a+l;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(u),l+=c}while(p!==s.activeElement);return t&6&&Xg(p)&&p.select(),2}function al(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function eb(){return/Android/gi.test(window.navigator.userAgent)}function cl(){return al()||eb()}function qn(e,t,n,r){let o=$n(n);S.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function tb(e,t,n,r){let o=$n(n);S.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 ul=30;function nb(e,t,n){let r=$n(n),o=S.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!sl(u,Ni.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=S.useRef(null);qn(e,"pointerdown",c=>{var a,u;cl()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),qn(e,"pointerup",c=>{if(cl()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=S.useRef({x:0,y:0});qn(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),qn(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=ul||Math.abs(a.y-i.current.y)>=ul))return o(c,()=>Gn(c.target)?c.target:null)},!0),tb(e,"blur",c=>o(c,()=>pg(window.document.activeElement)?window.document.activeElement:null),!0)}function Ii(...e){return S.useMemo(()=>Ir(...e),[...e])}var rb=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(rb||{});const zo={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},ob=200,ll=5;function sb(e,{trigger:t,action:n,close:r,select:o}){let s=S.useRef(null),i=S.useRef(null),c=S.useRef(null);qn(e&&t!==null,"pointerdown",a=>{yi(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),qn(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Gn(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<ll&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<ll)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>ob&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function ib(e,t){return S.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function ab(e){return S.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function cb(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function ub(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function lb(){return al()?{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=ht();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(Gn(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Gn(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(Gn(c.target)&&dg(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(Gn(c.target)){if(Du(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function fb(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function db(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let An=cb(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ht(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:db(n)},o=[lb(),ub(),fb()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});An.subscribe(()=>{let e=An.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)&&An.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&An.dispatch("TEARDOWN",n)}});function pb(e,t,n=()=>({containers:[]})){let r=ab(An),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ge(()=>{if(!(!t||!e))return An.dispatch("PUSH",t,n),()=>An.dispatch("POP",t,n)},[e,t]),s}function hb(e,t,n=()=>[document.body]){let r=tl(e,"scroll-lock");pb(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function fl(e){return[e.screenX,e.screenY]}function mb(){let e=S.useRef([-1,-1]);return{wasMoved(t){let n=fl(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=fl(t)}}}function gb(e=0){let[t,n]=S.useState(e),r=S.useCallback(a=>n(a),[t]),o=S.useCallback(a=>n(u=>u|a),[t]),s=S.useCallback(a=>(t&a)===a,[t]),i=S.useCallback(a=>n(u=>u&~a),[n]),c=S.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var dl,pl;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((dl=process==null?void 0:process.env)==null?void 0:dl.NODE_ENV)==="test"&&typeof((pl=Element==null?void 0:Element.prototype)==null?void 0:pl.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
80
|
+
`)),[]});var bb=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(bb||{});function hl(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function ml(e,t,n,r){let[o,s]=S.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=gb(e&&o?3:0),u=S.useRef(!1),l=S.useRef(!1),f=Vn();return ge(()=>{var p;if(e){if(n&&s(!0),!t){n&&c(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),yb(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.current=!1,a(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function yb(e,{prepare:t,run:n,done:r,inFlight:o}){let s=ht();return wb(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(vb(e,r))})}),s.dispose}function vb(e,t){var n,r;let o=ht();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(c=>c instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(c=>c.finished)).then(()=>{s||t()}),o.dispose)}function wb(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function Wo(){return typeof window<"u"}function Zn(e){return Mi(e)?(e.nodeName||"").toLowerCase():"#document"}function Ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ct(e){var t;return(t=(Mi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mi(e){return Wo()?e instanceof Node||e instanceof Ue(e).Node:!1}function de(e){return Wo()?e instanceof Element||e instanceof Ue(e).Element:!1}function ke(e){return Wo()?e instanceof HTMLElement||e instanceof Ue(e).HTMLElement:!1}function Li(e){return!Wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ue(e).ShadowRoot}const xb=new Set(["inline","contents"]);function kr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=it(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!xb.has(o)}const Eb=new Set(["table","td","th"]);function Sb(e){return Eb.has(Zn(e))}const Pb=[":popover-open",":modal"];function Ho(e){return Pb.some(t=>{try{return e.matches(t)}catch{return!1}})}const $b=["transform","translate","scale","rotate","perspective"],Ab=["transform","translate","scale","rotate","perspective","filter"],Tb=["paint","layout","strict","content"];function Bi(e){const t=Vo(),n=de(e)?it(e):e;return $b.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Ab.some(r=>(n.willChange||"").includes(r))||Tb.some(r=>(n.contain||"").includes(r))}function Cb(e){let t=Ht(e);for(;ke(t)&&!Wt(t);){if(Bi(t))return t;if(Ho(t))return null;t=Ht(t)}return null}function Vo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ob=new Set(["html","body","#document"]);function Wt(e){return Ob.has(Zn(e))}function it(e){return Ue(e).getComputedStyle(e)}function Go(e){return de(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ht(e){if(Zn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Li(e)&&e.host||Ct(e);return Li(t)?t.host:t}function gl(e){const t=Ht(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:ke(t)&&kr(t)?t:gl(t)}function pn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=gl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ue(o);if(s){const c=ki(i);return t.concat(i,i.visualViewport||[],kr(o)?o:[],c&&n?pn(c):[])}return t.concat(o,pn(o,[],n))}function ki(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Nb(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const Vt=Math.min,Me=Math.max,Rr=Math.round,qo=Math.floor,Ot=e=>({x:e,y:e}),Ib={left:"right",right:"left",bottom:"top",top:"bottom"},Mb={start:"end",end:"start"};function Ri(e,t,n){return Me(e,Vt(t,n))}function Tn(e,t){return typeof e=="function"?e(t):e}function hn(e){return e.split("-")[0]}function Kn(e){return e.split("-")[1]}function bl(e){return e==="x"?"y":"x"}function Fi(e){return e==="y"?"height":"width"}const Lb=new Set(["top","bottom"]);function Gt(e){return Lb.has(hn(e))?"y":"x"}function Di(e){return bl(Gt(e))}function Bb(e,t,n){n===void 0&&(n=!1);const r=Kn(e),o=Di(e),s=Fi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Zo(i)),[i,Zo(i)]}function kb(e){const t=Zo(e);return[ji(e),t,ji(t)]}function ji(e){return e.replace(/start|end/g,t=>Mb[t])}const yl=["left","right"],vl=["right","left"],Rb=["top","bottom"],Fb=["bottom","top"];function Db(e,t,n){switch(e){case"top":case"bottom":return n?t?vl:yl:t?yl:vl;case"left":case"right":return t?Rb:Fb;default:return[]}}function jb(e,t,n,r){const o=Kn(e);let s=Db(hn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ji)))),s}function Zo(e){return e.replace(/left|right|bottom|top/g,t=>Ib[t])}function _b(e){return{top:0,right:0,bottom:0,left:0,...e}}function wl(e){return typeof e!="number"?_b(e):{top:e,right:e,bottom:e,left:e}}function Ko(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
|
|
81
|
+
* tabbable 6.2.0
|
|
82
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
83
|
+
*/var Ub=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],_i=Ub.join(","),xl=typeof Element>"u",Fr=xl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Yo=!xl&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Xo=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&e(t.parentNode);return i},zb=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Wb=function(t,n,r){if(Xo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(_i));return n&&Fr.call(t,_i)&&o.unshift(t),o=o.filter(r),o},Hb=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Xo(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=Fr.call(i,_i);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Xo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},El=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Sl=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||zb(t))&&!El(t)?0:t.tabIndex},Vb=function(t,n){var r=Sl(t);return r<0&&n&&!El(t)?0:r},Gb=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Pl=function(t){return t.tagName==="INPUT"},qb=function(t){return Pl(t)&&t.type==="hidden"},Zb=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Kb=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Yb=function(t){if(!t.name)return!0;var n=t.form||Yo(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Kb(o,t.form);return!s||s===t},Xb=function(t){return Pl(t)&&t.type==="radio"},Qb=function(t){return Xb(t)&&!Yb(t)},Jb=function(t){var n,r=t&&Yo(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,f;r=Yo(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},$l=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},ey=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Fr.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(Fr.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,u=Yo(t);if(a&&!a.shadowRoot&&o(a)===!0)return $l(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(Jb(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return $l(t);return!1},ty=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Fr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},ny=function(t,n){return!(n.disabled||Xo(n)||qb(n)||ey(n,t)||Zb(n)||ty(n))},Al=function(t,n){return!(Qb(n)||Sl(n)<0||!ny(t,n))},ry=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},oy=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=Vb(c,i),u=i?e(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(Gb).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Tl=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hb([t],n.includeContainer,{filter:Al.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ry}):r=Wb(t,n.includeContainer,Al.bind(null,n)),oy(r)};function Cl(e,t,n){let{reference:r,floating:o}=e;const s=Gt(t),i=Di(t),c=Fi(i),a=hn(t),u=s==="y",l=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:l,y:r.y-o.height};break;case"bottom":d={x:l,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Kn(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const sy=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:f}=Cl(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:v,fn:C}=c[m],{x:b,y:$,data:B,reset:k}=await C({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=b??l,f=$??f,d={...d,[v]:{...d[v],...B}},k&&h<=50&&(h++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(u=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:l,y:f}=Cl(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function Qo(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Tn(t,e),h=wl(d),v=c[p?f==="floating"?"reference":"floating":f],C=Ko(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:l,strategy:a})),b=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,$=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement($))?await(s.getScale==null?void 0:s.getScale($))||{x:1,y:1}:{x:1,y:1},k=Ko(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:$,strategy:a}):b);return{top:(C.top-k.top+h.top)/B.y,bottom:(k.bottom-C.bottom+h.bottom)/B.y,left:(C.left-k.left+h.left)/B.x,right:(k.right-C.right+h.right)/B.x}}const iy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=Tn(e,t)||{};if(u==null)return{};const f=wl(l),p={x:n,y:r},d=Di(o),h=Fi(d),m=await i.getDimensions(u),v=d==="y",C=v?"top":"left",b=v?"bottom":"right",$=v?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[d]-p[d]-s.floating[h],k=p[d]-s.reference[d],D=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=D?D[$]:0;(!j||!await(i.isElement==null?void 0:i.isElement(D)))&&(j=c.floating[$]||s.floating[h]);const g=B/2-k/2,w=j/2-m[h]/2-1,A=Vt(f[C],w),I=Vt(f[b],w),N=A,P=j-m[h]-I,E=j/2-m[h]/2+g,x=Ri(N,E,P),T=!a.arrow&&Kn(o)!=null&&E!==x&&s.reference[h]/2-(E<N?A:I)-m[h]/2<0,O=T?E<N?E-N:E-P:0;return{[d]:p[d]+O,data:{[d]:x,centerOffset:E-x-O,...T&&{alignmentOffset:O}},reset:T}}}),ay=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...v}=Tn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=hn(o),b=Gt(c),$=hn(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(u.floating)),k=p||($||!m?[Zo(c)]:kb(c)),D=h!=="none";!p&&D&&k.push(...jb(c,m,h,B));const j=[c,...k],g=await Qo(t,v),w=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(g[C]),f){const E=Bb(o,i,B);w.push(g[E[0]],g[E[1]])}if(A=[...A,{placement:o,overflows:w}],!w.every(E=>E<=0)){var I,N;const E=(((I=s.flip)==null?void 0:I.index)||0)+1,x=j[E];if(x&&(!(f==="alignment"?b!==Gt(x):!1)||A.every(y=>Gt(y.placement)===b?y.overflows[0]>0:!0)))return{data:{index:E,overflows:A},reset:{placement:x}};let T=(N=A.filter(O=>O.overflows[0]<=0).sort((O,y)=>O.overflows[1]-y.overflows[1])[0])==null?void 0:N.placement;if(!T)switch(d){case"bestFit":{var P;const O=(P=A.filter(y=>{if(D){const L=Gt(y.placement);return L===b||L==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(L=>L>0).reduce((L,F)=>L+F,0)]).sort((y,L)=>y[1]-L[1])[0])==null?void 0:P[0];O&&(T=O);break}case"initialPlacement":T=c;break}if(o!==T)return{reset:{placement:T}}}return{}}}},cy=new Set(["left","top"]);async function uy(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=hn(n),c=Kn(n),a=Gt(n)==="y",u=cy.has(i)?-1:1,l=s&&a?-1:1,f=Tn(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*l,y:p*u}:{x:p*u,y:d*l}}const ly=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await uy(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},fy=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:v=>{let{x:C,y:b}=v;return{x:C,y:b}}},...a}=Tn(e,t),u={x:n,y:r},l=await Qo(t,a),f=Gt(hn(o)),p=bl(f);let d=u[p],h=u[f];if(s){const v=p==="y"?"top":"left",C=p==="y"?"bottom":"right",b=d+l[v],$=d-l[C];d=Ri(b,d,$)}if(i){const v=f==="y"?"top":"left",C=f==="y"?"bottom":"right",b=h+l[v],$=h-l[C];h=Ri(b,h,$)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},dy=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...u}=Tn(e,t),l=await Qo(t,u),f=hn(o),p=Kn(o),d=Gt(o)==="y",{width:h,height:m}=s.floating;let v,C;f==="top"||f==="bottom"?(v=f,C=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(C=f,v=p==="end"?"top":"bottom");const b=m-l.top-l.bottom,$=h-l.left-l.right,B=Vt(m-l[v],b),k=Vt(h-l[C],$),D=!t.middlewareData.shift;let j=B,g=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=$),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=b),D&&!p){const A=Me(l.left,0),I=Me(l.right,0),N=Me(l.top,0),P=Me(l.bottom,0);d?g=h-2*(A!==0||I!==0?A+I:Me(l.left,l.right)):j=m-2*(N!==0||P!==0?N+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 Ol(e){const t=it(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ke(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Rr(n)!==s||Rr(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Ui(e){return de(e)?e:e.contextElement}function Yn(e){const t=Ui(e);if(!ke(t))return Ot(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Ol(t);let i=(s?Rr(n.width):n.width)/r,c=(s?Rr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const py=Ot(0);function Nl(e){const t=Ue(e);return!Vo()||!t.visualViewport?py:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ue(e)?!1:t}function Cn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ui(e);let i=Ot(1);t&&(r?de(r)&&(i=Yn(r)):i=Yn(e));const c=hy(s,n,r)?Nl(s):Ot(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=Ue(s),d=r&&de(r)?Ue(r):r;let h=p,m=ki(h);for(;m&&r&&d!==h;){const v=Yn(m),C=m.getBoundingClientRect(),b=it(m),$=C.left+(m.clientLeft+parseFloat(b.paddingLeft))*v.x,B=C.top+(m.clientTop+parseFloat(b.paddingTop))*v.y;a*=v.x,u*=v.y,l*=v.x,f*=v.y,a+=$,u+=B,h=Ue(m),m=ki(h)}}return Ko({width:l,height:f,x:a,y:u})}function Jo(e,t){const n=Go(e).scrollLeft;return t?t.left+n:Cn(Ct(e)).left+n}function Il(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function my(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ct(r),c=t?Ho(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Ot(1);const l=Ot(0),f=ke(r);if((f||!f&&!s)&&((Zn(r)!=="body"||kr(i))&&(a=Go(r)),ke(r))){const d=Cn(r);u=Yn(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?Il(i,a):Ot(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-a.scrollTop*u.y+l.y+p.y}}function gy(e){return Array.from(e.getClientRects())}function by(e){const t=Ct(e),n=Go(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+Jo(e);const c=-n.scrollTop;return it(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Ml=25;function yy(e,t){const n=Ue(e),r=Ct(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=Vo();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Jo(r);if(u<=0){const l=r.ownerDocument,f=l.body,p=getComputedStyle(f),d=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Ml&&(s-=h)}else u<=Ml&&(s+=u);return{width:s,height:i,x:c,y:a}}const vy=new Set(["absolute","fixed"]);function wy(e,t){const n=Cn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=ke(e)?Yn(e):Ot(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 Ll(e,t,n){let r;if(t==="viewport")r=yy(e,n);else if(t==="document")r=by(Ct(e));else if(de(t))r=wy(t,n);else{const o=Nl(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ko(r)}function Bl(e,t){const n=Ht(e);return n===t||!de(n)||Wt(n)?!1:it(n).position==="fixed"||Bl(n,t)}function xy(e,t){const n=t.get(e);if(n)return n;let r=pn(e,[],!1).filter(c=>de(c)&&Zn(c)!=="body"),o=null;const s=it(e).position==="fixed";let i=s?Ht(e):e;for(;de(i)&&!Wt(i);){const c=it(i),a=Bi(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&vy.has(o.position)||kr(i)&&!a&&Bl(e,i))?r=r.filter(l=>l!==i):o=c,i=Ht(i)}return t.set(e,r),r}function Ey(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ho(t)?[]:xy(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Ll(t,l,o);return u.top=Me(f.top,u.top),u.right=Vt(f.right,u.right),u.bottom=Vt(f.bottom,u.bottom),u.left=Me(f.left,u.left),u},Ll(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Sy(e){const{width:t,height:n}=Ol(e);return{width:t,height:n}}function Py(e,t,n){const r=ke(t),o=Ct(t),s=n==="fixed",i=Cn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ot(0);function u(){a.x=Jo(o)}if(r||!r&&!s)if((Zn(t)!=="body"||kr(o))&&(c=Go(t)),r){const d=Cn(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?Il(o,c):Ot(0),f=i.left+c.scrollLeft-a.x-l.x,p=i.top+c.scrollTop-a.y-l.y;return{x:f,y:p,width:i.width,height:i.height}}function zi(e){return it(e).position==="static"}function kl(e,t){if(!ke(e)||it(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ct(e)===n&&(n=n.ownerDocument.body),n}function Rl(e,t){const n=Ue(e);if(Ho(e))return n;if(!ke(e)){let o=Ht(e);for(;o&&!Wt(o);){if(de(o)&&!zi(o))return o;o=Ht(o)}return n}let r=kl(e,t);for(;r&&Sb(r)&&zi(r);)r=kl(r,t);return r&&Wt(r)&&zi(r)&&!Bi(r)?n:r||Cb(e)||n}const $y=async function(e){const t=this.getOffsetParent||Rl,n=this.getDimensions,r=await n(e.floating);return{reference:Py(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ay(e){return it(e).direction==="rtl"}const Ty={convertOffsetParentRelativeRectToViewportRelativeRect:my,getDocumentElement:Ct,getClippingRect:Ey,getOffsetParent:Rl,getElementRects:$y,getClientRects:gy,getDimensions:Sy,getScale:Yn,isElement:de,isRTL:Ay};function Fl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Cy(e,t){let n=null,r;const o=Ct(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:f,width:p,height:d}=u;if(c||t(),!p||!d)return;const h=qo(f),m=qo(o.clientWidth-(l+p)),v=qo(o.clientHeight-(f+d)),C=qo(l),$={rootMargin:-h+"px "+-m+"px "+-v+"px "+-C+"px",threshold:Me(0,Vt(1,a))||1};let B=!0;function k(D){const j=D[0].intersectionRatio;if(j!==a){if(!B)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!Fl(u,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(k,{...$,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,$)}n.observe(e)}return i(!0),s}function Dl(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Ui(e),l=o||s?[...u?pn(u):[],...pn(t)]:[];l.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const f=u&&c?Cy(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(C=>{let[b]=C;b&&b.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var $;($=d)==null||$.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?Cn(e):null;a&&v();function v(){const C=Cn(e);m&&!Fl(m,C)&&n(),m=C,h=requestAnimationFrame(v)}return n(),()=>{var C;l.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),f==null||f(),(C=d)==null||C.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const Wi=Qo,Oy=ly,Ny=fy,Iy=ay,My=dy,jl=iy,Ly=(e,t,n)=>{const r=new Map,o={platform:Ty,...n},s={...o.platform,_c:r};return sy(e,t,{...o,platform:s})};var By=typeof document<"u",ky=function(){},es=By?S.useLayoutEffect:ky;function ts(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ts(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!ts(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function _l(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ul(e,t){const n=_l(e);return Math.round(t*n)/n}function Hi(e){const t=_.useRef(e);return es(()=>{t.current=e}),t}function zl(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]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=_.useState(r);ts(p,r)||d(r);const[h,m]=_.useState(null),[v,C]=_.useState(null),b=_.useCallback(y=>{y!==D.current&&(D.current=y,m(y))},[]),$=_.useCallback(y=>{y!==j.current&&(j.current=y,C(y))},[]),B=s||h,k=i||v,D=_.useRef(null),j=_.useRef(null),g=_.useRef(l),w=a!=null,A=Hi(a),I=Hi(o),N=Hi(u),P=_.useCallback(()=>{if(!D.current||!j.current)return;const y={placement:t,strategy:n,middleware:p};I.current&&(y.platform=I.current),Ly(D.current,j.current,y).then(L=>{const F={...L,isPositioned:N.current!==!1};E.current&&!ts(g.current,F)&&(g.current=F,Ar.flushSync(()=>{f(F)}))})},[p,t,n,I,N]);es(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(y=>({...y,isPositioned:!1})))},[u]);const E=_.useRef(!1);es(()=>(E.current=!0,()=>{E.current=!1}),[]),es(()=>{if(B&&(D.current=B),k&&(j.current=k),B&&k){if(A.current)return A.current(B,k,P);P()}},[B,k,P,A,w]);const x=_.useMemo(()=>({reference:D,floating:j,setReference:b,setFloating:$}),[b,$]),T=_.useMemo(()=>({reference:B,floating:k}),[B,k]),O=_.useMemo(()=>{const y={position:n,left:0,top:0};if(!T.floating)return y;const L=Ul(T.floating,l.x),F=Ul(T.floating,l.y);return c?{...y,transform:"translate("+L+"px, "+F+"px)",..._l(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:F}},[n,c,T.floating,l.x,l.y]);return _.useMemo(()=>({...l,update:P,refs:x,elements:T,floatingStyles:O}),[l,P,x,T,O])}const Ry=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?jl({element:r.current,padding:o}).fn(n):{}:r?jl({element:r,padding:o}).fn(n):{}}}},Vi=(e,t)=>({...Oy(e),options:[e,t]}),Wl=(e,t)=>({...Ny(e),options:[e,t]}),Hl=(e,t)=>({...Iy(e),options:[e,t]}),Fy=(e,t)=>({...My(e),options:[e,t]}),Dy=(e,t)=>({...Ry(e),options:[e,t]}),Vl={..._},jy=Vl.useInsertionEffect||(e=>e());function Gl(e){const t=_.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return jy(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var Gi=typeof document<"u"?S.useLayoutEffect:S.useEffect;let ql=!1,_y=0;const Zl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_y++;function Uy(){const[e,t]=_.useState(()=>ql?Zl():void 0);return Gi(()=>{e==null&&t(Zl())},[]),_.useEffect(()=>{ql=!0},[]),e}const zy=Vl.useId||Uy;let Dr;process.env.NODE_ENV!=="production"&&(Dr=new Set);function Wy(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Dr)!=null&&e.has(o))){var s;(s=Dr)==null||s.add(o),console.warn(o)}}function Hy(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Dr)!=null&&e.has(o))){var s;(s=Dr)==null||s.add(o),console.error(o)}}function Vy(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const Gy=_.createContext(null),qy=_.createContext(null),Zy=()=>{var e;return((e=_.useContext(Gy))==null?void 0:e.id)||null},Ky=()=>_.useContext(qy),Yy="data-floating-ui-focusable";function Xy(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=zy(),s=_.useRef({}),[i]=_.useState(()=>Vy()),c=Zy()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&Hy("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=_.useState(r.reference),l=Gl((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=_.useMemo(()=>({setPositionReference:u}),[]),p=_.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return _.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function Qy(e){e===void 0&&(e={});const{nodeId:t}=e,n=Xy({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=_.useState(null),[c,a]=_.useState(null),l=(o==null?void 0:o.domReference)||s,f=_.useRef(null),p=Ky();Gi(()=>{l&&(f.current=l)},[l]);const d=zl({...e,elements:{...o,...c&&{reference:c}}}),h=_.useCallback($=>{const B=de($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),contextElement:$}:$;a(B),d.refs.setReference(B)},[d.refs]),m=_.useCallback($=>{(de($)||$===null)&&(f.current=$,i($)),(de(d.refs.reference.current)||d.refs.reference.current===null||$!==null&&!de($))&&d.refs.setReference($)},[d.refs]),v=_.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),C=_.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),b=_.useMemo(()=>({...d,...r,refs:v,elements:C,nodeId:t}),[d,v,C,t,r]);return Gi(()=>{r.dataRef.current.floatingContext=b;const $=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);$&&($.context=b)}),_.useMemo(()=>({...d,context:b,refs:v,elements:C}),[d,v,C,b])}const Kl="active",Yl="selected";function qi(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Kl]:i,[Yl]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Yy]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[Kl,Yl].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(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function Jy(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=_.useCallback(c=>qi(c,e,"reference"),t),s=_.useCallback(c=>qi(c,e,"floating"),n),i=_.useCallback(c=>qi(c,e,"item"),r);return _.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Xl(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const ev=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Tn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(u==null?void 0:u.current)||p,m=p.clientTop||h.clientTop,v=p.clientTop!==0,C=h.clientTop!==0,b=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Wy('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const $={...t,...await Vi(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},B=await Wi(Xl($,h.scrollHeight+m+p.clientTop),l),k=await Wi($,{...l,elementContext:"reference"}),D=Me(0,B.top),j=$.y+D,A=(h.scrollHeight>h.clientHeight?I=>I:Rr)(Me(0,h.scrollHeight+(v&&b||C?m*2:0)-D-Me(0,B.bottom)));if(h.style.maxHeight=A+"px",h.scrollTop=D,o){const I=h.offsetHeight<d.offsetHeight*Vt(c,n.current.length)-1||k.top>=-a||k.bottom>=-a;Ar.flushSync(()=>o(I))}return r&&(r.current=await Wi(Xl({...$,y:j},h.offsetHeight+m+p.clientTop),l)),{y:j}}});function tv(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Gl(c),u=_.useRef(!1),l=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const v=m.deltaY,C=s.current.top>=-.5,b=s.current.bottom>=-.5,$=h.scrollHeight-h.clientHeight,B=v<0?-1:1,k=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!C&&v>0||!b&&v<0?(m.preventDefault(),Ar.flushSync(()=>{a(D=>D+Math[k](v,$*B))})):/firefox/i.test(Nb())&&(h.scrollTop+=v))}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=_.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)&&Ar.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return _.useMemo(()=>o?{floating:p}:{},[o,p])}let Xn=S.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Xn.displayName="FloatingContext";let Zi=S.createContext(null);Zi.displayName="PlacementContext";function nv(e){return S.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function rv(){return S.useContext(Xn).setReference}function ov(){return S.useContext(Xn).getReferenceProps}function sv(){let{getFloatingProps:e,slot:t}=S.useContext(Xn);return S.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function iv(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=S.useContext(Zi),n=S.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ge(()=>{t==null||t(n??null)},[t,n]);let r=S.useContext(Xn);return S.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Ql=4;function av({children:e,enabled:t=!0}){let[n,r]=S.useState(null),[o,s]=S.useState(0),i=S.useRef(null),[c,a]=S.useState(null);cv(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=uv(n,c),[m,v="center"]=l.split(" ");ge(()=>{u&&s(0)},[u]);let{refs:C,floatingStyles:b,context:$}=Qy({open:u,placement:m==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${m}`:`${m}-${v}`,strategy:"absolute",transform:!1,middleware:[Vi({mainAxis:m==="selection"?0:f,crossAxis:p}),Wl({padding:d}),m!=="selection"&&Hl({padding:d}),m==="selection"&&h?ev({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:Ql,referenceOverflowThreshold:d,onFallbackChange(I){var N,P;if(!I)return;let E=$.elements.floating;if(!E)return;let x=parseFloat(getComputedStyle(E).scrollPaddingBottom)||0,T=Math.min(Ql,E.childElementCount),O=0,y=0;for(let L of(P=(N=$.elements.floating)==null?void 0:N.childNodes)!=null?P:[])if(zt(L)){let F=L.offsetTop,U=F+L.clientHeight+x,z=E.scrollTop,V=z+E.clientHeight;if(F>=z&&U<=V)T--;else{y=Math.max(0,Math.min(U,V)-Math.max(F,z)),O=L.clientHeight;break}}T>=1&&s(L=>{let F=O*T-y+x;return L>=F?L:F})}}):null,Fy({padding:d,apply({availableWidth:I,availableHeight:N,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:Dl}),[B=m,k=v]=$.placement.split("-");m==="selection"&&(B="selection");let D=S.useMemo(()=>({anchor:[B,k].filter(Boolean).join(" ")}),[B,k]),j=tv($,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:w}=Jy([j]),A=ce(I=>{a(I),C.setFloating(I)});return _.createElement(Zi.Provider,{value:r},_.createElement(Xn.Provider,{value:{setFloating:A,setReference:C.setReference,styles:b,getReferenceProps:g,getFloatingProps:w,slot:D}},e))}function cv(e){ge(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function uv(e,t){var n,r,o;let s=Ki((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Ki((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Ki((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Ki(e,t,n=void 0){let r=Vn(),o=ce((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=ef(a,u);return[l,f=>{let p=Jl(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[C,b]of p.entries()){let $=window.getComputedStyle(u).getPropertyValue(b);if(d[C]!==$){d[C]=$,m=!0;break}}if(!m)return;let v=ef(a,u);l!==v&&(f(v),l=v)})}return r.dispose}]}return[n,null]}),s=S.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=S.useState();return ge(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Jl(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,...Jl(o)]:[r]}return[]}function ef(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function lv(e,t){let[n,r]=S.useState(t);return!e&&n!==t&&r(t),e?n:t}let Yi=S.createContext(null);Yi.displayName="OpenClosedContext";var mt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(mt||{});function Xi(){return S.useContext(Yi)}function tf({value:e,children:t}){return S.createElement(Yi.Provider,{value:e},t)}function fv(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function ns(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:fv(e)}}var nf=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(nf||{});function rf(e){let t=ce(e),n=S.useRef(!1);S.useEffect(()=>(n.current=!1,()=>{n.current=!0,Nu(()=>{n.current&&t()})}),[t])}function dv(){let e=typeof document>"u";return"useSyncExternalStore"in _?(t=>t.useSyncExternalStore)(_)(()=>()=>{},()=>!1,()=>!e):!1}function Qi(){let e=dv(),[t,n]=_.useState(At.isHandoffComplete);return t&&At.isHandoffComplete===!1&&n(!1),_.useEffect(()=>{t!==!0&&n(!0)},[t]),_.useEffect(()=>At.handoff(),[]),e?!1:t}let pv=S.createContext(!1);function hv(){return S.useContext(pv)}function mv(e){let t=hv(),n=S.useContext(sf),[r,o]=S.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(At.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return S.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),S.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let of=S.Fragment,gv=_e(function(e,t){let{ownerDocument:n=null,...r}=e,o=S.useRef(null),s=rt(yg(d=>{o.current=d}),t),i=Ii(o),c=n??i,a=mv(c),[u]=S.useState(()=>{var d;return At.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),l=S.useContext(wv),f=Qi();ge(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),ge(()=>{if(u&&l)return l.register(u)},[l,u]),rf(()=>{var d;!a||!u||(yi(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ze();return f?!a||!u?null:Be.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:of,name:"Portal"}),u):null});function bv(e,t){let n=rt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ze();return r?S.createElement(gv,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:of,name:"Portal"})}let yv=S.Fragment,sf=S.createContext(null);function vv(e,t){let{target:n,...r}=e,o={ref:rt(t)},s=Ze();return S.createElement(sf.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:yv,name:"Popover.Group"}))}let wv=S.createContext(null),xv=_e(bv),Ev=_e(vv),Sv=Object.assign(xv,{Group:Ev});function Pv(){let e=S.useRef(!1);return ge(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function af(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:uf)!==S.Fragment||S.Children.count(e.children)===1}let rs=S.createContext(null);rs.displayName="TransitionContext";var $v=(e=>(e.Visible="visible",e.Hidden="hidden",e))($v||{});function Av(){let e=S.useContext(rs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Tv(){let e=S.useContext(os);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let os=S.createContext(null);os.displayName="NestingContext";function ss(e){return"children"in e?ss(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function cf(e,t){let n=$n(e),r=S.useRef([]),o=Pv(),s=Vn(),i=ce((d,h=fn.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===d);m!==-1&&(nt(h,{[fn.Unmount](){r.current.splice(m,1)},[fn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var v;!ss(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),c=ce(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,fn.Unmount)}),a=S.useRef([]),u=S.useRef(Promise.resolve()),l=S.useRef({enter:[],leave:[]}),f=ce((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([v])=>v!==d)),t==null||t.chains.current[h].push([d,new Promise(v=>{a.current.push(v)})]),t==null||t.chains.current[h].push([d,new Promise(v=>{Promise.all(l.current[h].map(([C,b])=>b)).then(()=>v())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ce((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([v,C])=>C)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>m(h))});return S.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let uf=S.Fragment,lf=Do.RenderStrategy;function Cv(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...v}=e,[C,b]=S.useState(null),$=S.useRef(null),B=af(e),k=rt(...B?[$,t,b]:t===null?[]:[t]),D=(n=v.unmount)==null||n?fn.Unmount:fn.Hidden,{show:j,appear:g,initial:w}=Av(),[A,I]=S.useState(j?"visible":"hidden"),N=Tv(),{register:P,unregister:E}=N;ge(()=>P($),[P,$]),ge(()=>{if(D===fn.Hidden&&$.current){if(j&&A!=="visible"){I("visible");return}return nt(A,{hidden:()=>E($),visible:()=>P($)})}},[A,$,P,E,j,D]);let x=Qi();ge(()=>{if(B&&x&&A==="visible"&&$.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[$,A,x,B]);let T=w&&!g,O=g&&j&&w,y=S.useRef(!1),L=cf(()=>{y.current||(I("hidden"),E($))},N),F=ce(G=>{y.current=!0;let X=G?"enter":"leave";L.onStart($,X,ee=>{ee==="enter"?s==null||s():ee==="leave"&&(c==null||c())})}),U=ce(G=>{let X=G?"enter":"leave";y.current=!1,L.onStop($,X,ee=>{ee==="enter"?i==null||i():ee==="leave"&&(a==null||a())}),X==="leave"&&!ss(L)&&(I("hidden"),E($))});S.useEffect(()=>{B&&o||(F(j),U(j))},[j,B,o]);let z=!(!o||!B||!x||T),[,V]=ml(z,C,j,{start:F,end:U}),Z=dn({ref:k,className:((r=mi(v.className,O&&u,O&&l,V.enter&&u,V.enter&&V.closed&&l,V.enter&&!V.closed&&f,V.leave&&d,V.leave&&!V.closed&&h,V.leave&&V.closed&&m,!V.transition&&j&&p))==null?void 0:r.trim())||void 0,...hl(V)}),W=0;A==="visible"&&(W|=mt.Open),A==="hidden"&&(W|=mt.Closed),j&&A==="hidden"&&(W|=mt.Opening),!j&&A==="visible"&&(W|=mt.Closing);let K=Ze();return S.createElement(os.Provider,{value:L},S.createElement(tf,{value:W},K({ourProps:Z,theirProps:v,defaultTag:uf,features:lf,visible:A==="visible",name:"Transition.Child"})))}function Ov(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=S.useRef(null),c=af(e),a=rt(...c?[i,t]:t===null?[]:[t]);Qi();let u=Xi();if(n===void 0&&u!==null&&(n=(u&mt.Open)===mt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=S.useState(n?"visible":"hidden"),p=cf(()=>{n||f("hidden")}),[d,h]=S.useState(!0),m=S.useRef([n]);ge(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let v=S.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);ge(()=>{n?f("visible"):!ss(p)&&i.current!==null&&f("hidden")},[n,p]);let C={unmount:o},b=ce(()=>{var k;d&&h(!1),(k=e.beforeEnter)==null||k.call(e)}),$=ce(()=>{var k;d&&h(!1),(k=e.beforeLeave)==null||k.call(e)}),B=Ze();return S.createElement(os.Provider,{value:p},S.createElement(rs.Provider,{value:v},B({ourProps:{...C,as:S.Fragment,children:S.createElement(ff,{ref:a,...C,...s,beforeEnter:b,beforeLeave:$})},theirProps:{},defaultTag:S.Fragment,features:lf,visible:l==="visible",name:"Transition"})))}function Nv(e,t){let n=S.useContext(rs)!==null,r=Xi()!==null;return S.createElement(S.Fragment,null,!n&&r?S.createElement(Ji,{ref:t,...e}):S.createElement(ff,{ref:t,...e}))}let Ji=_e(Ov),ff=_e(Cv),Iv=_e(Nv),df=Object.assign(Ji,{Child:Iv,Root:Ji});function Mv(e,t){let n=S.useRef({left:0,top:0});if(ge(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let pf=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function hf(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!zt(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return pf.test(i)&&(i=i.replace(pf,"")),i}function Lv(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():hf(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return hf(e).trim()}function Bv(e){let t=S.useRef(""),n=S.useRef("");return ce(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Lv(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var kv=Object.defineProperty,Rv=(e,t,n)=>t in e?kv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mf=(e,t,n)=>(Rv(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Nt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Nt||{}),is=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(is||{}),gf=(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))(gf||{});function bf(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=il(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let Fv={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ve.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ve.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=ns(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===ve.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=ns(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=bf(e),u=ns(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ve.Nothing&&(r=ns(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...bf(e),pendingShouldSort:!1}:e};class ea extends Zu{constructor(t){super(t),mf(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return nt(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:Ei(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:Ei(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Ei(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ve.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),mf(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=Si.get(null);this.disposables.add(r.on(Qu.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new ea({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},__demoMode:n})}reduce(t,n){return nt(n.type,Fv,t,n)}}const yf=S.createContext(null);function ta(e){let t=S.useContext(yf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,vf),n}return t}function vf({id:e,__demoMode:t=!1}){let n=S.useMemo(()=>ea.new({id:e,__demoMode:t}),[]);return rf(()=>n.dispose()),n}let as=S.createContext(null);as.displayName="ListboxDataContext";function jr(e){let t=S.useContext(as);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,jr),n}return t}let Dv=S.Fragment;function jv(e,t){let n=S.useId(),r=hi(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const v=p?"horizontal":"vertical";let C=rt(t),b=rg(s),[$=d?[]:void 0,B]=ng(o,a,b),k=vf({id:n,__demoMode:h}),D=S.useRef({static:!1,hold:!1}),j=S.useRef(new Map),g=Og(u),w=S.useCallback(z=>nt(A.mode,{[Nt.Multi]:()=>$.some(V=>g(V,z)),[Nt.Single]:()=>g($,z)}),[$]),A=S.useMemo(()=>({value:$,disabled:f,invalid:l,mode:d?Nt.Multi:Nt.Single,orientation:v,onChange:B,compare:g,isSelected:w,optionsPropsRef:D,listRef:j}),[$,f,l,d,v,B,g,w,D,j]);ge(()=>{k.state.dataRef.current=A},[A]);let I=st(k,z=>z.listboxState),N=Si.get(null),P=st(N,S.useCallback(z=>N.selectors.isTop(z,n),[N,n])),[E,x]=st(k,z=>[z.buttonElement,z.optionsElement]);nb(P,[E,x],(z,V)=>{k.send({type:gf.CloseListbox}),sl(V,Ni.Loose)||(z.preventDefault(),E==null||E.focus())});let T=S.useMemo(()=>({open:I===Oe.Open,disabled:f,invalid:l,value:$}),[I,f,l,$]),[O,y]=Sg({inherit:!0}),L={ref:C},F=S.useCallback(()=>{if(b!==void 0)return B==null?void 0:B(b)},[B,b]),U=Ze();return S.createElement(y,{value:O,props:{htmlFor:E==null?void 0:E.id},slot:{open:I===Oe.Open,disabled:f}},S.createElement(av,null,S.createElement(yf.Provider,{value:k},S.createElement(as.Provider,{value:A},S.createElement(tf,{value:nt(I,{[Oe.Open]:mt.Open,[Oe.Closed]:mt.Closed})},c!=null&&$!=null&&S.createElement(ug,{disabled:f,data:{[c]:$},form:i,onReset:F}),U({ourProps:L,theirProps:m,slot:T,defaultTag:Dv,name:"Listbox"}))))))}let _v="button";function Uv(e,t){let n=S.useId(),r=Fu(),o=jr("Listbox.Button"),s=ta("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=rt(t,rv(),s.actions.setButtonElement),f=ov(),[p,d,h]=st(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=p===Oe.Open;sb(m,{trigger:d,action:S.useCallback(y=>{if(d!=null&&d.contains(y.target))return zo.Ignore;let L=y.target.closest('[role="option"]:not([data-disabled])');return zt(L)?zo.Select(L):h!=null&&h.contains(y.target)?zo.Ignore:zo.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=ce(y=>{switch(y.key){case Ce.Enter:og(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}}),C=ce(y=>{switch(y.key){case Ce.Space:y.preventDefault();break}}),b=ce(y=>{var L;if(y.button===nf.Left){if(gg(y.currentTarget))return y.preventDefault();s.state.listboxState===Oe.Open?(Be.flushSync(()=>s.actions.closeListbox()),(L=s.state.buttonElement)==null||L.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),$=S.useRef(null),B=ce(y=>{$.current=y.pointerType,y.pointerType==="mouse"&&b(y)}),k=ce(y=>{$.current!=="mouse"&&b(y)}),D=ce(y=>y.preventDefault()),j=Hu([i]),g=vg(),{isFocusVisible:w,focusProps:A}=Hm({autoFocus:a}),{isHovered:I,hoverProps:N}=Wm({isDisabled:c}),{pressed:P,pressProps:E}=Ym({disabled:c}),x=S.useMemo(()=>({open:p===Oe.Open,active:P||p===Oe.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]),T=st(s,y=>y.listboxState===Oe.Open),O=Mu(f(),{ref:l,id:i,type:ib(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":T,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:v,onKeyUp:C,onKeyPress:D,onPointerDown:B,onClick:k},A,N,E);return Ze()({ourProps:O,theirProps:u,slot:x,defaultTag:_v,name:"Listbox.Button"})}let wf=S.createContext(!1),zv="div",Wv=Do.RenderStrategy|Do.Static;function Hv(e,t){let n=S.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=nv(o),[l,f]=S.useState(null);u&&(s=!0);let p=jr("Listbox.Options"),d=ta("Listbox.Options"),[h,m,v,C]=st(d,G=>[G.listboxState,G.buttonElement,G.optionsElement,G.__demoMode]),b=Ii(m),$=Ii(v),B=Xi(),[k,D]=ml(c,l,B!==null?(B&mt.Open)===mt.Open:h===Oe.Open);Hg(k,m,d.actions.closeListbox);let j=C?!1:i&&h===Oe.Open;hb(j,$);let g=C?!1:i&&h===Oe.Open;Wg(g,{allowed:S.useCallback(()=>[m,v],[m,v])});let w=h!==Oe.Open,A=Mv(w,m)?!1:k,I=k&&h===Oe.Closed,N=lv(I,p.value),P=ce(G=>p.compare(N,G)),E=st(d,G=>{var X;if(u==null||!((X=u==null?void 0:u.to)!=null&&X.includes("selection")))return null;let ee=G.options.findIndex(fe=>P(fe.dataRef.current.value));return ee===-1&&(ee=0),ee}),x=(()=>{if(u==null)return;if(E===null)return{...u,inner:void 0};let G=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:G},index:E}}})(),[T,O]=iv(x),y=sv(),L=rt(t,u?T:null,d.actions.setOptionsElement,f),F=Vn();S.useEffect(()=>{var G;let X=v;X&&h===Oe.Open&&X!==((G=Ir(X))==null?void 0:G.activeElement)&&(X==null||X.focus({preventScroll:!0}))},[h,v]);let U=ce(G=>{var X,ee;switch(F.dispose(),G.key){case Ce.Space:if(d.state.searchQuery!=="")return G.preventDefault(),G.stopPropagation(),d.actions.search(G.key);case Ce.Enter:if(G.preventDefault(),G.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:fe}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(fe.current.value)}p.mode===Nt.Single&&(Be.flushSync(()=>d.actions.closeListbox()),(X=d.state.buttonElement)==null||X.focus({preventScroll:!0}));break;case nt(p.orientation,{vertical:Ce.ArrowDown,horizontal:Ce.ArrowRight}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Next});case nt(p.orientation,{vertical:Ce.ArrowUp,horizontal:Ce.ArrowLeft}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ce.Home:case Ce.PageUp:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ce.End:case Ce.PageDown:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ce.Escape:G.preventDefault(),G.stopPropagation(),Be.flushSync(()=>d.actions.closeListbox()),(ee=d.state.buttonElement)==null||ee.focus({preventScroll:!0});return;case Ce.Tab:G.preventDefault(),G.stopPropagation(),Be.flushSync(()=>d.actions.closeListbox()),Qg(d.state.buttonElement,G.shiftKey?Oi.Previous:Oi.Next);break;default:G.key.length===1&&(d.actions.search(G.key),F.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=st(d,G=>{var X;return(X=G.buttonElement)==null?void 0:X.id}),V=S.useMemo(()=>({open:h===Oe.Open}),[h]),Z=Mu(u?y():{},{id:r,ref:L,"aria-activedescendant":st(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Nt.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:U,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...O,"--button-width":Ig(m,!0).width},...hl(D)}),W=Ze(),K=S.useMemo(()=>p.mode===Nt.Multi?p:{...p,isSelected:P},[p,P]);return S.createElement(Sv,{enabled:s?e.static||k:!1,ownerDocument:b},S.createElement(as.Provider,{value:K},W({ourProps:Z,theirProps:a,slot:V,defaultTag:zv,features:Wv,visible:A,name:"Listbox.Options"})))}let Vv="div";function Gv(e,t){let n=S.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=S.useContext(wf)===!0,a=jr("Listbox.Option"),u=ta("Listbox.Option"),l=st(u,A=>u.selectors.isActive(A,r)),f=a.isSelected(s),p=S.useRef(null),d=Bv(p),h=$n({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=rt(t,p,A=>{A?a.listRef.current.set(r,A):a.listRef.current.delete(r)}),v=st(u,A=>u.selectors.shouldScrollIntoView(A,r));ge(()=>{if(v)return ht().requestAnimationFrame(()=>{var A,I;(I=(A=p.current)==null?void 0:A.scrollIntoView)==null||I.call(A,{block:"nearest"})})},[v,p]),ge(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let C=ce(A=>{var I;if(o)return A.preventDefault();u.actions.onChange(s),a.mode===Nt.Single&&(Be.flushSync(()=>u.actions.closeListbox()),(I=u.state.buttonElement)==null||I.focus({preventScroll:!0}))}),b=ce(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),$=mb(),B=ce(A=>$.update(A)),k=ce(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===is.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},is.Pointer))}),D=ce(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===is.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),j=S.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:C,onFocus:b,onPointerEnter:B,onMouseEnter:B,onPointerMove:k,onMouseMove:k,onPointerLeave:D,onMouseLeave:D},w=Ze();return!f&&c?null:w({ourProps:g,theirProps:i,slot:j,defaultTag:Vv,name:"Listbox.Option"})}let qv=S.Fragment;function Zv(e,t){let{options:n,placeholder:r,...o}=e,s={ref:rt(t)},i=jr("ListboxSelectedOption"),c=S.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Nt.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ze();return S.createElement(wf.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:S.createElement(S.Fragment,null,r&&a?r:n)},slot:c,defaultTag:qv,name:"ListboxSelectedOption"}))}let Kv=_e(jv),Yv=_e(Uv),Xv=Tg,Qv=_e(Hv),Jv=_e(Gv),e1=_e(Zv),mn=Object.assign(Kv,{Button:Yv,Label:Xv,Options:Qv,Option:Jv,SelectedOption:e1});function t1({title:e,titleId:t,...n},r){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?_.createElement("title",{id:t},e):null,_.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const xf=_.forwardRef(t1),n1=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>{const{t:s}=pt();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(mn,{value:t,onChange:n,disabled:r,children:({open:i})=>M.jsxs(M.Fragment,{children:[M.jsxs(mn.Button,{className:`
|
|
84
84
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
85
85
|
items-center justify-between flex px-3 rounded-lg
|
|
86
|
-
focus:outline-none
|
|
87
|
-
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-
|
|
88
|
-
${
|
|
89
|
-
`,children:[
|
|
86
|
+
focus:outline-none
|
|
87
|
+
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
88
|
+
${i?"ring-1 ring-white":""}
|
|
89
|
+
`,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("deposit.asset")}),M.jsxs("div",{className:"flex items-center",children:[t.iconUrl?M.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${i?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(df,{as:S.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:M.jsx(mn.Options,{className:`
|
|
90
90
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
91
|
-
bg-
|
|
91
|
+
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
92
92
|
focus:outline-none
|
|
93
|
-
`,children:e.map(c=>
|
|
94
|
-
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
93
|
+
`,children:e.map(c=>M.jsx(mn.Option,{value:c,className:({active:a,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,active:u})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[c.iconUrl?M.jsx("img",{src:c.iconUrl,alt:c.token,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:c.token.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${a||u?"text-text-primary":"text-text-tertiary"}`,children:c.symbol||c.token})})]}),a&&M.jsx(xf,{className:"w-4 h-4 text-blue-400"})]})},c.tokenAddress))})})]})})})},r1=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=pt();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(mn,{value:t,onChange:n,disabled:r,children:({open:c})=>M.jsxs(M.Fragment,{children:[M.jsxs(mn.Button,{className:`
|
|
94
|
+
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
95
95
|
items-center justify-between flex px-3 rounded-lg
|
|
96
|
-
focus:outline-none
|
|
97
|
-
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-
|
|
98
|
-
${
|
|
99
|
-
`,children:[
|
|
96
|
+
focus:outline-none
|
|
97
|
+
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
98
|
+
${c?"ring-1 ring-white":""}
|
|
99
|
+
`,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),M.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?M.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),M.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:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(df,{as:S.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:M.jsx(mn.Options,{className:`
|
|
100
100
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
101
|
-
bg-
|
|
101
|
+
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
102
102
|
focus:outline-none
|
|
103
|
-
`,children:e.map(c=>x.jsx(Je.Option,{value:c,className:({active:u,selected:i})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-gray-700":""} ${i?"bg-gray-700":""}`,children:({selected:u})=>x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsxs("div",{className:"flex items-center space-x-3",children:[c.iconUrl?x.jsx("img",{src:c.iconUrl,alt:c.token,className:"w-5 h-5 rounded-full"}):x.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:x.jsx("span",{className:"text-xs text-white font-bold",children:c.token.charAt(0)})}),x.jsxs("div",{className:"flex flex-col",children:[x.jsx("span",{className:`text-sm font-medium ${u?"text-white":"text-gray-200"}`,children:c.symbol||c.token}),x.jsxs("span",{className:"text-xs text-gray-400",children:[c.decimals," decimals"]})]})]}),u&&x.jsx(Ri,{className:"w-4 h-4 text-blue-400"})]})},c.tokenAddress))})})]})})}),yf=({currentActiveChain:e,chains:t,onChainChange:n,curSelectToken:r,tokens:o,onTokenChange:s,t:c})=>{p.useEffect(()=>{console.log("🔍 ChainTokenSelector: Props updated",{curSelectToken:r,currentActiveChain:e==null?void 0:e.chain})},[r,e]);const u=o.find(a=>a.token===r||a.symbol===r)||o[0],i=a=>{console.log("🔗 ChainTokenSelector: Chain change triggered",a),n(a.chainId)},l=a=>{s(a.symbol||a.token)};return x.jsxs("div",{className:"space-y-4",children:[x.jsx(Bi,{chains:t,selectedChain:e,onChainChange:i,className:"w-full"}),x.jsx(Hi,{tokens:o,selectedToken:u,onTokenChange:l,className:"w-full"})]})},wf=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,t:s})=>{p.useEffect(()=>{var f;console.log("🔍 MPCChainTokenSelector: Props updated",{curSelectToken:r,currentActiveChain:e==null?void 0:e.chain,availableTokens:((f=e==null?void 0:e.tokenList)==null?void 0:f.length)||0})},[r,e]);const c=p.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),u=p.useMemo(()=>c.find(h=>h.token===r||h.symbol===r)||c[0],[c,r]),i=f=>{var h;if(console.log("🔗 MPCChainTokenSelector: Chain change triggered",{chain:f.chain,availableTokens:((h=f.tokenList)==null?void 0:h.length)||0}),n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(b=>b.token===r||b.symbol===r)){const b=f.tokenList[0];console.log("🔄 MPCChainTokenSelector: Auto-selecting first token",b.token),o(b.symbol||b.token)}},l=f=>{console.log("🔄 MPCChainTokenSelector: Token change triggered",f.token),o(f.symbol||f.token)},a=p.useMemo(()=>t.map(f=>({chainId:f.chainId,chain:f.chain,chainIconUrl:f.chainIconUrl,allowDeposit:f.allowDeposit,blockTime:f.blockTime,txConfirm:f.txConfirm})),[t]),d=p.useMemo(()=>({chainId:e.chainId,chain:e.chain,chainIconUrl:e.chainIconUrl,allowDeposit:e.allowDeposit,blockTime:e.blockTime,txConfirm:e.txConfirm}),[e]),m=p.useMemo(()=>c.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[c]);return x.jsxs("div",{className:"space-y-4",children:[x.jsx(Bi,{chains:a,selectedChain:d,onChainChange:f=>{const h=t.find(v=>v.chainId===f.chainId);h&&i(h)},className:"w-full"}),x.jsx(Hi,{tokens:m,selectedToken:u?{token:u.token,symbol:u.symbol,iconUrl:u.iconUrl,decimals:u.decimals,tokenAddress:u.tokenAddress}:m[0],onTokenChange:l,className:"w-full"}),typeof window<"u"&&window.location.hostname==="localhost"&&x.jsxs("div",{className:"text-xs text-gray-500 p-2 bg-gray-800 rounded",children:[x.jsxs("div",{children:["Chain: ",e.chain]}),x.jsxs("div",{children:["Available tokens: ",c.length]}),x.jsxs("div",{children:["Selected token: ",(u==null?void 0:u.token)||"None"]})]})]})},Ef=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,t:o,showToast:s})=>{var c;return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex justify-center mt-4 mb-3",children:x.jsx("div",{className:"bg-white rounded-lg",children:x.jsx(Ks,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",includeMargin:!1})})}),x.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[x.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),x.jsx(Xs,{text:(e==null?void 0:e.getDisplayAddress())||"",onCopy:()=>s("Copied!"),children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[x.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),x.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),x.jsxs("div",{className:"flex items-start",children:[x.jsx("div",{className:"w-5",children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:x.jsx("path",{d:"M8.00016 14.6667C11.6821 14.6667 14.6668 11.6819 14.6668 8C14.6668 4.31809 11.6821 1.33333 8.00016 1.33333C4.31826 1.33333 1.3335 4.31809 1.3335 8C1.3335 11.6819 4.31826 14.6667 8.00016 14.6667Z",fill:"#FF8F34",stroke:"#FF8F34",strokeWidth:"1.33333",strokeLinejoin:"round"})})}),x.jsxs("div",{className:"flex-1",children:[x.jsxs("p",{className:"text-xs text-functional-orange-1",children:["Only ",t," (",n==null?void 0:n.chain,") is supported for deposits to this address."]}),x.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),x.jsx("div",{className:"flex items-start pl-5 pt-2 text-[#FF8E34] text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."}),x.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"}),x.jsxs("div",{className:"text-sm",children:[x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[x.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),x.jsxs("span",{className:"text-text-primary font-medium text-right underline decoration-dotted underline-offset-1",children:["≈"," ",Math.ceil(((n==null?void 0:n.blockTime)||12)*((n==null?void 0:n.txConfirm)||12)/60)," ","minutes"]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),x.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((c=r==null?void 0:r.multiChain)==null?void 0:c.minDeposit)||10," ",t]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),x.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},un=(e,t)=>Number(e)>Number(t),xf=(e,t)=>Number(e)<Number(t),Cf=()=>(e,t)=>{let r={Deposit:"Deposit",From:"From",Asset:"Asset",Amount:"Amount",Available:"Available",MAX:"MAX","Deposit.details":"Deposit Details","Deposit.address":"Deposit Address",copySuccess:"Copied successfully",important:"Important",depositAllTip:"Please ensure you are depositing {coin} on {v} network","Deposit.Arrivaltime":"Arrival Time","Deposit.minDeposit":"Min Deposit","Deposit.block.txConfirm":"Block Confirmations","Deposit.Arrival.Estimated":"~{v} minutes",enableSystemProWithToken:"Enable {token} for {network}",enableTokenDesc:"You need to enable {token} to deposit on {network}",enableWithToken:"Enable {token}",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",minDeposit:"Min deposit: {amount} {token}",Equity:"Equity",availableDesc:"Available balance for trading"}[e]||e;return t&&Object.keys(t).forEach(o=>{r=r.replace(new RegExp(`{${o}}`,"g"),t[o])}),r},Sf=()=>({show:(e,t)=>{console.log("Toast:",e,t)}}),cn=[{token:"USDT",iconUrl:"/icons/usdt.svg",decimals:6,tokenAddress:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},{token:"USDC",iconUrl:"/icons/usdc.svg",decimals:6,tokenAddress:"0xA0b86a33E6441b8435b662f0E2d0B8A0E6E6E6E6"}],fn=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],Ui={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Vi={address:"0x1234567890123456789012345678901234567890"},zi={balance:{formatted:"1000.0"},allowance:{formatted:"0"}},Yi={multiChain:{minDeposit:10}},Of=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:c,decimals:u,t:i,onDepositAmountChange:l,onApprove:a})=>{var d;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{className:"text-sm font-medium text-gray-300",children:"Amount"}),x.jsxs("div",{className:"relative",children:[x.jsx("input",{type:"number",placeholder:"0",value:e,onChange:m=>l(m.target.value),className:"w-full bg-gray-800 border border-gray-600 rounded-lg px-4 py-3 text-white text-right pr-16 focus:outline-none focus:border-blue-500"}),x.jsx("button",{onClick:()=>{var f;const m=((f=n==null?void 0:n.balance)==null?void 0:f.formatted)||"0";l(m)},className:"absolute right-4 top-1/2 transform -translate-y-1/2 text-green-400 text-sm font-medium hover:text-green-300",children:"MAX"})]}),x.jsxs("div",{className:"flex justify-between items-center text-sm",children:[x.jsx("span",{className:"text-gray-400",children:"Available"}),x.jsxs("span",{className:"text-white",children:[((d=n==null?void 0:n.balance)==null?void 0:d.formatted)||"278.37"," ",t]})]})]}),!r&&un(e||"0",0)&&x.jsxs("div",{className:"bg-gray-800 border border-gray-600 rounded-lg p-4 space-y-3",children:[x.jsxs("h3",{className:"text-sm font-medium text-white",children:["Enable ",t," on ",o==null?void 0:o.chain]}),x.jsxs("p",{className:"text-xs text-gray-400",children:["You must enable ",t," first before you can deposit on"," ",o==null?void 0:o.chain,"."]}),x.jsxs("button",{className:"w-full bg-white hover:bg-gray-100 text-gray-900 px-4 py-2 rounded-lg text-sm font-medium transition-colors",onClick:a,children:["Enable ",t]})]}),x.jsx("div",{className:"space-y-3 text-sm",children:x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-gray-400",children:"总资产"}),x.jsx("span",{className:"text-white font-medium",children:e?`0.00 → ${(parseFloat(e)||0).toFixed(2)} ${t}`:`0.00 ${t}`})]})})]})},Gi=({isOpen:e,onClose:t,config:n,isWalletConnected:r=!0,currentActiveAccount:o=Ui,smartWallet:s=Vi,tokens:c=cn,chains:u=fn,currentActiveChain:i=fn[0],approved:l=!1,depositAmount:a="",curSelectToken:d=(w=>(w=cn[0])==null?void 0:w.token)()||"",curSelectTokenData:m=zi,metadata:f=Yi,currentEquity:h=5e3,amount:v="1",onDepositAmountChange:b=()=>{},onTokenChange:C=()=>{},onChainChange:E=()=>{},onApprove:y=async()=>{},onDeposit:O=async()=>{}})=>{var R,X,G,Q;p.useEffect(()=>{console.log("🔍 Deposit: Props updated",{curSelectToken:d,currentActiveChain:i==null?void 0:i.chain,depositAmount:a})},[d,i,a]);const F=Cf(),{show:_}=Sf(),B=p.useMemo(()=>{var T,H;return o?Rs(o,s,l,i==null?void 0:i.chainId,(T=m==null?void 0:m.balance)==null?void 0:T.formatted,(H=m==null?void 0:m.allowance)==null?void 0:H.formatted):null},[o,s,l,i==null?void 0:i.chainId,m]),K=(B==null?void 0:B.getWalletType())==="evm",A=(B==null?void 0:B.getWalletType())==="mpc",j=Math.min(6,parseInt(((X=(R=c.find(T=>T.token===d))==null?void 0:R.decimals)==null?void 0:X.toString())||"6",10)),re=p.useCallback(async()=>{if(!B){console.error("Wallet adapter not available"),_("Wallet not connected");return}if(!r||!(o!=null&&o.ethAddress)){console.error("Wallet not connected"),_("Please connect your wallet first");return}try{A||await O(),t()}catch(T){console.error("Deposit error:",T),T instanceof Error&&(T.message.includes("ConnectorNotConnectedError")||T.message.includes("Connector not connected")?_("Wallet connection lost. Please reconnect your wallet."):_(`Deposit failed: ${T.message}`))}},[B,A,O,t,o,_,r]),U=p.useCallback(async()=>{if(!(!B||!K)){if(!r||!(o!=null&&o.ethAddress)){console.error("Wallet not connected"),_("Please connect your wallet first");return}try{await y()}catch(T){console.error("Approval error:",T),T instanceof Error&&(T.message.includes("ConnectorNotConnectedError")||T.message.includes("Connector not connected")?_("Wallet connection lost. Please reconnect your wallet."):_(`Approval failed: ${T.message}`))}}},[B,K,y,o,_,r]);return e?Ee.createPortal(x.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:[x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0",style:{backgroundColor:"#000",opacity:.6},onClick:t,"aria-hidden":"true"}),x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center",children:x.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",children:[x.jsxs("div",{className:"flex items-center justify-between mb-4",children:[x.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit [DEV MODE]"}),x.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:x.jsx(Is,{className:"h-4 w-4"})})]}),x.jsxs("div",{className:"",children:[x.jsx(yf,{currentActiveChain:i,chains:u,onChainChange:E,curSelectToken:d,tokens:c,onTokenChange:C,t:F}),A&&x.jsx(Ef,{walletAdapter:B,curSelectToken:d,currentActiveChain:i,metadata:f,t:F,showToast:_}),K&&x.jsx(Of,{depositAmount:a,curSelectToken:d,curSelectTokenData:m,approved:l,currentActiveChain:i,currentEquity:h,amount:v,decimals:j,t:F,onDepositAmountChange:b,onApprove:U})]}),x.jsx("div",{className:"mt-4",children:x.jsx("button",{className:Qs("w-full bg-white hover:bg-gray-100 text-gray-900 py-3 px-4 rounded-xl font-medium transition-colors",!l&&K&&un(a||"0",0)?"opacity-50 cursor-not-allowed":""),onClick:re,disabled:!l&&K&&un(a||"0",0),children:A?"Deposit":!l&&un(a||"0",0)?`Enable ${d}`:xf(a||"0",((G=f==null?void 0:f.multiChain)==null?void 0:G.minDeposit)||0)?`Min ${(Q=f==null?void 0:f.multiChain)==null?void 0:Q.minDeposit} ${d}`:"Confirm Deposit"})})]})})]}),document.body):null};var cr={exports:{}},dn={exports:{}},ie={};/** @license React v16.13.1
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
* react-is.development.js
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
(c)
|
|
120
|
-
@license MIT
|
|
121
|
-
|
|
122
|
-
|
|
103
|
+
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>M.jsx(mn.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})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?M.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),u&&M.jsx(xf,{className:"w-4 h-4 text-blue-400"})]})},a.chainId))})})]})})})},na=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const i=S.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),c=d=>{if(n(d.chainId),d.tokenList&&d.tokenList.length>0&&!d.tokenList.some(m=>m.token===r||m.symbol===r)){const m=d.tokenList[0];o(m.symbol||m.token)}},a=d=>{o(d.symbol||d.token)},u=S.useMemo(()=>t.map(d=>d),[t]),l=S.useMemo(()=>u.find(d=>d.chainId===e.chainId)||u[0],[u,e.chainId]),f=S.useMemo(()=>i.map(d=>({token:d.token,symbol:d.symbol,iconUrl:d.iconUrl,decimals:d.decimals,tokenAddress:d.tokenAddress})),[i]),p=S.useMemo(()=>{if(f.length!==0)return f.find(d=>d.token===r||d.symbol===r)||f[0]},[f,r]);return M.jsxs("div",{className:"space-y-4",children:[M.jsx(r1,{chains:u,selectedChain:l,onChainChange:d=>{const h=t.find(m=>m.chainId===d.chainId);h&&c(h)},walletType:s,className:"w-full"}),f.length>0?p&&M.jsx(n1,{tokens:f,selectedToken:p,onTokenChange:a,className:"w-full"}):M.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:M.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},o1=(e,t)=>Number(e)>Number(t),gt=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},ra=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return ra(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:gt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},s1=(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)},cs={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},i1=[cs.ETHEREUM,cs.SEPOLIA,cs.ARBITRUM,cs.ARBITRUM_SEPOLIA],a1=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!i1.includes(t)}return!0},c1=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],oa={wallet:"mpc",ethAddress:"",accountId:"",l2Key:""},sa={address:""},ia={multiChain:{minDeposit:10}};var us={},u1=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()}},l1=u1,Ef={"text/plain":"Text","text/html":"Url",default:"Text"},f1="Copy to clipboard: #{key}, Enter";function d1(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function p1(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=l1(),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=Ef[t.format]||Ef.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=d1("message"in t?t.message:f1),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var h1=p1;function aa(e){"@babel/helpers - typeof";return aa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},aa(e)}Object.defineProperty(us,"__esModule",{value:!0}),us.CopyToClipboard=void 0;var ls=Sf(S),m1=Sf(h1),g1=["text","onCopy","options","children"];function Sf(e){return e&&e.__esModule?e:{default:e}}function Pf(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 $f(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pf(Object(n),!0).forEach(function(r){ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pf(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function b1(e,t){if(e==null)return{};var n=y1(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 y1(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 v1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w1(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 x1(e,t,n){return t&&w1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function E1(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ca(e,t)}function ca(e,t){return ca=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},ca(e,t)}function S1(e){var t=$1();return function(){var r=fs(e),o;if(t){var s=fs(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return P1(this,o)}}function P1(e,t){if(t&&(aa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Af(e)}function Af(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $1(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},fs(e)}function ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Tf=function(e){E1(n,e);var t=S1(n);function n(){var r;v1(this,n);for(var o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),ua(Af(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,p=a.options,d=ls.default.Children.only(f),h=(0,m1.default)(u,p);l&&l(u,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return x1(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=b1(o,g1),c=ls.default.Children.only(s);return ls.default.cloneElement(c,$f($f({},i),{},{onClick:this.onClick}))}}]),n}(ls.default.PureComponent);us.CopyToClipboard=Tf,ua(Tf,"defaultProps",{onCopy:void 0,options:void 0});var A1=us,la=A1.CopyToClipboard;la.CopyToClipboard=la;var T1=la;const C1=X0(T1);var O1=Object.defineProperty,ds=Object.getOwnPropertySymbols,Cf=Object.prototype.hasOwnProperty,Of=Object.prototype.propertyIsEnumerable,Nf=(e,t,n)=>t in e?O1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fa=(e,t)=>{for(var n in t||(t={}))Cf.call(t,n)&&Nf(e,n,t[n]);if(ds)for(var n of ds(t))Of.call(t,n)&&Nf(e,n,t[n]);return e},da=(e,t)=>{var n={};for(var r in e)Cf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ds)for(var r of ds(e))t.indexOf(r)<0&&Of.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
104
|
+
* @license QR Code generator library (TypeScript)
|
|
105
|
+
* Copyright (c) Project Nayuki.
|
|
106
|
+
* SPDX-License-Identifier: MIT
|
|
107
|
+
*/var On;(e=>{const t=class ie{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ie.MIN_VERSION||a>ie.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 v=this.getPenaltyScore();v<h&&(f=m,h=v),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return ie.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ie.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,p=-1,d=!0){if(!(ie.MIN_VERSION<=l&&l<=f&&f<=ie.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const $=ie.getNumDataCodewords(h,u)*8,B=i.getTotalBits(a,h);if(B<=$){m=B;break}if(h>=f)throw new RangeError("Data too long")}for(const $ of[ie.Ecc.MEDIUM,ie.Ecc.QUARTILE,ie.Ecc.HIGH])d&&m<=ie.getNumDataCodewords(h,$)*8&&(u=$);let v=[];for(const $ of a){n($.mode.modeBits,4,v),n($.numChars,$.mode.numCharCountBits(h),v);for(const B of $.getData())v.push(B)}o(v.length==m);const C=ie.getNumDataCodewords(h,u)*8;o(v.length<=C),n(0,Math.min(4,C-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let $=236;v.length<C;$^=253)n($,8,v);let b=[];for(;b.length*8<v.length;)b.push(0);return v.forEach(($,B)=>b[B>>>3]|=$<<7-(B&7)),new ie(h,u,b,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!=ie.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=ie.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],p=ie.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],d=Math.floor(ie.getNumRawDataModules(u)/8),h=f-d%f,m=Math.floor(d/f);let v=[];const C=ie.reedSolomonComputeDivisor(p);for(let $=0,B=0;$<f;$++){let k=a.slice(B,B+m-p+($<h?0:1));B+=k.length;const D=ie.reedSolomonComputeRemainder(k,C);$<h&&k.push(0),v.push(k.concat(D))}let b=[];for(let $=0;$<v[0].length;$++)v.forEach((B,k)=>{($!=m-p||k>=h)&&b.push(B[$])});return o(b.length==d),b}drawCodewords(a){if(a.length!=Math.floor(ie.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 v=0;v<this.size;v++)this.modules[p][v]==d?(h++,h==5?a+=ie.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),d=this.modules[p][v],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ie.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 v=0;v<this.size;v++)this.modules[v][p]==d?(h++,h==5?a+=ie.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),d=this.modules[v][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ie.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+=ie.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*ie.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<ie.MIN_VERSION||a>ie.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(ie.getNumRawDataModules(a)/8)-ie.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ie.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]=ie.reedSolomonMultiply(u[p],l),p+1<u.length&&(u[p]^=u[p+1]);l=ie.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]^=ie.reedSolomonMultiply(d,p))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let f=7;f>=0;f--)l=l<<1^(l>>>7)*285,l^=(u>>>f&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class Ee{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new Ee(Ee.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!Ee.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const f=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+f),10),f*3+1,u),l+=f}return new Ee(Ee.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!Ee.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let f=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new Ee(Ee.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:Ee.isNumeric(a)?[Ee.makeNumeric(a)]:Ee.isAlphanumeric(a)?[Ee.makeAlphanumeric(a)]:[Ee.makeBytes(Ee.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new Ee(Ee.Mode.ECI,0,u)}static isNumeric(a){return Ee.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ee.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const p=f.mode.numCharCountBits(u);if(f.numChars>=1<<p)return 1/0;l+=4+p+f.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(On||(On={})),(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={}))})(On||(On={})),(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={}))})(On||(On={}));var Qn=On;/**
|
|
108
|
+
* @license qrcode.react
|
|
109
|
+
* Copyright (c) Paul O'Shannessy
|
|
110
|
+
* SPDX-License-Identifier: ISC
|
|
111
|
+
*/var N1={L:Qn.QrCode.Ecc.LOW,M:Qn.QrCode.Ecc.MEDIUM,Q:Qn.QrCode.Ecc.QUARTILE,H:Qn.QrCode.Ecc.HIGH},If=128,Mf="L",Lf="#FFFFFF",Bf="#000000",kf=!1,Rf=1,I1=4,M1=0,L1=.1;function Ff(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function Df(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 B1(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*L1),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),v=Math.ceil(c+u-h),C=Math.ceil(a+l-m);p={x:h,y:m,w:v,h:C}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function k1(e,t){return t!=null?Math.max(Math.floor(t),0):e?I1:M1}function jf({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=S.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,v)=>(m.push(...Qn.QrSegment.makeSegments(v)),m),[]);return Qn.QrCode.encodeSegments(h,N1[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=S.useMemo(()=>{let d=a.getModules();const h=k1(r,o),m=d.length+h*2,v=B1(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:v}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:p}}var R1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),F1=S.forwardRef(function(t,n){const r=t,{value:o,size:s=If,level:i=Mf,bgColor:c=Lf,fgColor:a=Bf,includeMargin:u=kf,minVersion:l=Rf,boostLevel:f,marginSize:p,imageSettings:d}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=m,C=da(m,["style"]),b=d==null?void 0:d.src,$=S.useRef(null),B=S.useRef(null),k=S.useCallback(E=>{$.current=E,typeof n=="function"?n(E):n&&(n.current=E)},[n]),[D,j]=S.useState(!1),{margin:g,cells:w,numCells:A,calculatedImageSettings:I}=jf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});S.useEffect(()=>{if($.current!=null){const E=$.current,x=E.getContext("2d");if(!x)return;let T=w;const O=B.current,y=I!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;y&&I.excavation!=null&&(T=Df(w,I.excavation));const L=window.devicePixelRatio||1;E.height=E.width=s*L;const F=s/A*L;x.scale(F,F),x.fillStyle=c,x.fillRect(0,0,A,A),x.fillStyle=a,R1?x.fill(new Path2D(Ff(T,g))):w.forEach(function(U,z){U.forEach(function(V,Z){V&&x.fillRect(Z+g,z+g,1,1)})}),I&&(x.globalAlpha=I.opacity),y&&x.drawImage(O,I.x+g,I.y+g,I.w,I.h)}}),S.useEffect(()=>{j(!1)},[b]);const N=fa({height:s,width:s},v);let P=null;return b!=null&&(P=S.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{j(!0)},ref:B,crossOrigin:I==null?void 0:I.crossOrigin})),S.createElement(S.Fragment,null,S.createElement("canvas",fa({style:N,height:s,width:s,ref:k,role:"img"},C)),P)});F1.displayName="QRCodeCanvas";var _f=S.forwardRef(function(t,n){const r=t,{value:o,size:s=If,level:i=Mf,bgColor:c=Lf,fgColor:a=Bf,includeMargin:u=kf,minVersion:l=Rf,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:C,numCells:b,calculatedImageSettings:$}=jf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let B=C,k=null;h!=null&&$!=null&&($.excavation!=null&&(B=Df(C,$.excavation)),k=S.createElement("image",{href:h.src,height:$.h,width:$.w,x:$.x+v,y:$.y+v,preserveAspectRatio:"none",opacity:$.opacity,crossOrigin:$.crossOrigin}));const D=Ff(B,v);return S.createElement("svg",fa({height:s,width:s,viewBox:`0 0 ${b} ${b}`,ref:n,role:"img"},m),!!p&&S.createElement("title",null,p),S.createElement("path",{fill:c,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),S.createElement("path",{fill:a,d:D,shapeRendering:"crispEdges"}),k)});_f.displayName="QRCodeSVG";function D1(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function j1(){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 Uf(){return/apple/i.test(navigator.vendor)}function _1(){return D1().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function U1(){return j1().includes("jsdom/")}const zf="data-floating-ui-focusable",z1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function pa(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Jn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Li(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function er(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ha(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function W1(e){return e.matches("html,body")}function It(e){return(e==null?void 0:e.ownerDocument)||document}function Wf(e){return ke(e)&&e.matches(z1)}function H1(e){if(!e||U1())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function V1(e){return e?e.hasAttribute(zf)?e:e.querySelector("["+zf+"]")||e:null}function ps(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...ps(e,o.id,n)])}function G1(e){return"nativeEvent"in e}function _r(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var q1=typeof document<"u",Z1=function(){},Mt=q1?S.useLayoutEffect:Z1;const K1={..._};function hs(e){const t=_.useRef(e);return Mt(()=>{t.current=e}),t}const Y1=K1.useInsertionEffect||(e=>e());function Lt(e){const t=_.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Y1(()=>{t.current=e}),_.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 Hf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Vf(e,t){const n=Tl(e,Hf()),r=n.length;if(r===0)return;const o=pa(It(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function X1(e){return Vf(It(e).body,1)||e}function Q1(e){return Vf(It(e).body,-1)||e}function ma(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Jn(n,r)}function J1(e){Tl(e,Hf()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Gf(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 ew="data-floating-ui-focusable",qf="active",Zf="selected",tw={..._};let Kf=!1,nw=0;const Yf=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+nw++;function rw(){const[e,t]=_.useState(()=>Kf?Yf():void 0);return Mt(()=>{e==null&&t(Yf())},[]),_.useEffect(()=>{Kf=!0},[]),e}const ga=tw.useId||rw;let ba;process.env.NODE_ENV!=="production"&&(ba=new Set);function ow(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=ba)!=null&&e.has(o))){var s;(s=ba)==null||s.add(o),console.error(o)}}function sw(){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 iw=_.createContext(null),aw=_.createContext(null),ya=()=>{var e;return((e=_.useContext(iw))==null?void 0:e.id)||null},va=()=>_.useContext(aw);function Ur(e){return"data-floating-ui-"+e}function at(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Xf=Ur("safe-polygon");function wa(e,t,n){if(n&&!_r(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function xa(e){return typeof e=="function"?e():e}function cw(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:p=!0}=t,d=va(),h=ya(),m=hs(u),v=hs(a),C=hs(n),b=hs(f),$=_.useRef(),B=_.useRef(-1),k=_.useRef(),D=_.useRef(-1),j=_.useRef(!0),g=_.useRef(!1),w=_.useRef(()=>{}),A=_.useRef(!1),I=Lt(()=>{var O;const y=(O=o.current.openEvent)==null?void 0:O.type;return(y==null?void 0:y.includes("mouse"))&&y!=="mousedown"});_.useEffect(()=>{if(!c)return;function O(y){let{open:L}=y;L||(at(B),at(D),j.current=!0,A.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),_.useEffect(()=>{if(!c||!m.current||!n)return;function O(L){I()&&r(!1,L,"hover")}const y=It(i.floating).documentElement;return y.addEventListener("mouseleave",O),()=>{y.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,I]);const N=_.useCallback(function(O,y,L){y===void 0&&(y=!0),L===void 0&&(L="hover");const F=wa(v.current,"close",$.current);F&&!k.current?(at(B),B.current=window.setTimeout(()=>r(!1,O,L),F)):y&&(at(B),r(!1,O,L))},[v,r]),P=Lt(()=>{w.current(),k.current=void 0}),E=Lt(()=>{if(g.current){const O=It(i.floating).body;O.style.pointerEvents="",O.removeAttribute(Xf),g.current=!1}}),x=Lt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);_.useEffect(()=>{if(!c)return;function O(z){if(at(B),j.current=!1,l&&!_r($.current)||xa(b.current)>0&&!wa(v.current,"open"))return;const V=wa(v.current,"open",$.current);V?B.current=window.setTimeout(()=>{C.current||r(!0,z,"hover")},V):n||r(!0,z,"hover")}function y(z){if(x()){E();return}w.current();const V=It(i.floating);if(at(D),A.current=!1,m.current&&o.current.floatingContext){n||at(B),k.current=m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){E(),P(),x()||N(z,!0,"safe-polygon")}});const W=k.current;V.addEventListener("mousemove",W),w.current=()=>{V.removeEventListener("mousemove",W)};return}($.current==="touch"?!Jn(i.floating,z.relatedTarget):!0)&&N(z)}function L(z){x()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){E(),P(),x()||N(z)}})(z))}function F(){at(B)}function U(z){x()||N(z,!1)}if(de(i.domReference)){const z=i.domReference,V=i.floating;return n&&z.addEventListener("mouseleave",L),p&&z.addEventListener("mousemove",O,{once:!0}),z.addEventListener("mouseenter",O),z.addEventListener("mouseleave",y),V&&(V.addEventListener("mouseleave",L),V.addEventListener("mouseenter",F),V.addEventListener("mouseleave",U)),()=>{n&&z.removeEventListener("mouseleave",L),p&&z.removeEventListener("mousemove",O),z.removeEventListener("mouseenter",O),z.removeEventListener("mouseleave",y),V&&(V.removeEventListener("mouseleave",L),V.removeEventListener("mouseenter",F),V.removeEventListener("mouseleave",U))}}},[i,c,e,l,p,N,P,E,r,n,C,d,v,m,o,x,b]),Mt(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&I()){g.current=!0;const L=i.floating;if(de(i.domReference)&&L){var y;const F=It(i.floating).body;F.setAttribute(Xf,"");const U=i.domReference,z=d==null||(y=d.nodesRef.current.find(V=>V.id===h))==null||(y=y.context)==null?void 0:y.elements.floating;return z&&(z.style.pointerEvents=""),F.style.pointerEvents="none",U.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{F.style.pointerEvents="",U.style.pointerEvents="",L.style.pointerEvents=""}}}},[c,n,h,i,d,m,I]),Mt(()=>{n||($.current=void 0,A.current=!1,P(),E())},[n,P,E]),_.useEffect(()=>()=>{P(),at(B),at(D),E()},[c,i.domReference,P,E]);const T=_.useMemo(()=>{function O(y){$.current=y.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(y){const{nativeEvent:L}=y;function F(){!j.current&&!C.current&&r(!0,L,"hover")}l&&!_r($.current)||n||xa(b.current)===0||A.current&&y.movementX**2+y.movementY**2<2||(at(D),$.current==="touch"?F():(A.current=!0,D.current=window.setTimeout(F,xa(b.current))))}}},[l,r,n,C,b]);return _.useMemo(()=>c?{reference:T}:{},[c,T])}const Qf={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},Jf=_.forwardRef(function(t,n){const[r,o]=_.useState();Mt(()=>{Uf()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ur("focus-guard")]:"",style:Qf};return M.jsx("span",{...t,...s})}),ed=_.createContext(null),td=Ur("portal");function uw(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ga(),o=fw(),[s,i]=_.useState(null),c=_.useRef(null);return Mt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Mt(()=>{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(td,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Mt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Mi(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(td,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function lw(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=uw({id:n,root:r}),[i,c]=_.useState(null),a=_.useRef(null),u=_.useRef(null),l=_.useRef(null),f=_.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 _.useEffect(()=>{if(!s||!o||p)return;function m(v){s&&ma(v)&&(v.type==="focusin"?Gf:J1)(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]),_.useEffect(()=>{s&&(d||Gf(s))},[d,s]),M.jsxs(ed.Provider,{value:_.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&M.jsx(Jf,{"data-type":"outside",ref:a,onFocus:m=>{if(ma(m,s)){var v;(v=l.current)==null||v.focus()}else{const C=i?i.domReference:null,b=Q1(C);b==null||b.focus()}}}),h&&s&&M.jsx("span",{"aria-owns":s.id,style:Qf}),s&&Ar.createPortal(t,s),h&&s&&M.jsx(Jf,{"data-type":"outside",ref:u,onFocus:m=>{if(ma(m,s)){var v;(v=f.current)==null||v.focus()}else{const C=i?i.domReference:null,b=X1(C);b==null||b.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const fw=()=>_.useContext(ed);function nd(e){return ke(e.target)&&e.target.tagName==="BUTTON"}function dw(e){return ke(e.target)&&e.target.tagName==="A"}function rd(e){return Wf(e)}function pw(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=_.useRef(),d=_.useRef(!1),h=_.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const v=p.current;m.button===0&&c!=="click"&&(_r(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const v=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}_r(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!l||nd(m))&&(m.key===" "&&!rd(s)&&(m.preventDefault(),d.current=!0),!dw(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||nd(m)||rd(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return _.useMemo(()=>i?{reference:h}:{},[i,h])}const hw={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},mw={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},od=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 gw(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=va(),v=Lt(typeof a=="function"?a:()=>!1),C=typeof a=="function"?v:a,b=_.useRef(!1),{escapeKey:$,outsidePress:B}=od(d),{escapeKey:k,outsidePress:D}=od(h),j=_.useRef(!1),g=Lt(E=>{var x;if(!n||!i||!c||E.key!=="Escape"||j.current)return;const T=(x=s.current.floatingContext)==null?void 0:x.nodeId,O=m?ps(m.nodesRef.current,T):[];if(!$&&(E.stopPropagation(),O.length>0)){let y=!0;if(O.forEach(L=>{var F;if((F=L.context)!=null&&F.open&&!L.context.dataRef.current.__escapeKeyBubbles){y=!1;return}}),!y)return}r(!1,G1(E)?E.nativeEvent:E,"escape-key")}),w=Lt(E=>{var x;const T=()=>{var O;g(E),(O=er(E))==null||O.removeEventListener("keydown",T)};(x=er(E))==null||x.addEventListener("keydown",T)}),A=Lt(E=>{var x;const T=s.current.insideReactTree;s.current.insideReactTree=!1;const O=b.current;if(b.current=!1,u==="click"&&O||T||typeof C=="function"&&!C(E))return;const y=er(E),L="["+Ur("inert")+"]",F=It(o.floating).querySelectorAll(L);let U=de(y)?y:null;for(;U&&!Wt(U);){const W=Ht(U);if(Wt(W)||!de(W))break;U=W}if(F.length&&de(y)&&!W1(y)&&!Jn(y,o.floating)&&Array.from(F).every(W=>!Jn(U,W)))return;if(ke(y)&&P){const W=Wt(y),K=it(y),G=/auto|scroll/,X=W||G.test(K.overflowX),ee=W||G.test(K.overflowY),fe=X&&y.clientWidth>0&&y.scrollWidth>y.clientWidth,xe=ee&&y.clientHeight>0&&y.scrollHeight>y.clientHeight,oe=K.direction==="rtl",ue=xe&&(oe?E.offsetX<=y.offsetWidth-y.clientWidth:E.offsetX>y.clientWidth),pe=fe&&E.offsetY>y.clientHeight;if(ue||pe)return}const z=(x=s.current.floatingContext)==null?void 0:x.nodeId,V=m&&ps(m.nodesRef.current,z).some(W=>{var K;return ha(E,(K=W.context)==null?void 0:K.elements.floating)});if(ha(E,o.floating)||ha(E,o.domReference)||V)return;const Z=m?ps(m.nodesRef.current,z):[];if(Z.length>0){let W=!0;if(Z.forEach(K=>{var G;if((G=K.context)!=null&&G.open&&!K.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,E,"outside-press")}),I=Lt(E=>{var x;const T=()=>{var O;A(E),(O=er(E))==null||O.removeEventListener(u,T)};(x=er(E))==null||x.addEventListener(u,T)});_.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=$,s.current.__outsidePressBubbles=B;let E=-1;function x(F){r(!1,F,"ancestor-scroll")}function T(){window.clearTimeout(E),j.current=!0}function O(){E=window.setTimeout(()=>{j.current=!1},Vo()?5:0)}const y=It(o.floating);c&&(y.addEventListener("keydown",k?w:g,k),y.addEventListener("compositionstart",T),y.addEventListener("compositionend",O)),C&&y.addEventListener(u,D?I:A,D);let L=[];return p&&(de(o.domReference)&&(L=pn(o.domReference)),de(o.floating)&&(L=L.concat(pn(o.floating))),!de(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat(pn(o.reference.contextElement)))),L=L.filter(F=>{var U;return F!==((U=y.defaultView)==null?void 0:U.visualViewport)}),L.forEach(F=>{F.addEventListener("scroll",x,{passive:!0})}),()=>{c&&(y.removeEventListener("keydown",k?w:g,k),y.removeEventListener("compositionstart",T),y.removeEventListener("compositionend",O)),C&&y.removeEventListener(u,D?I:A,D),L.forEach(F=>{F.removeEventListener("scroll",x)}),window.clearTimeout(E)}},[s,o,c,C,u,n,r,p,i,$,B,g,k,w,A,D,I]),_.useEffect(()=>{s.current.insideReactTree=!1},[s,C,u]);const N=_.useMemo(()=>({onKeyDown:g,...l&&{[hw[f]]:E=>{r(!1,E.nativeEvent,"reference-press")},...f!=="click"&&{onClick(E){r(!1,E.nativeEvent,"reference-press")}}}}),[g,r,l,f]),P=_.useMemo(()=>({onKeyDown:g,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[mw[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return _.useMemo(()=>i?{reference:N,floating:P}:{},[i,N,P])}function bw(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ga(),s=_.useRef({}),[i]=_.useState(()=>sw()),c=ya()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&ow("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]=_.useState(r.reference),l=Lt((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=_.useMemo(()=>({setPositionReference:u}),[]),p=_.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return _.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function yw(e){e===void 0&&(e={});const{nodeId:t}=e,n=bw({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=_.useState(null),[c,a]=_.useState(null),l=(o==null?void 0:o.domReference)||s,f=_.useRef(null),p=va();Mt(()=>{l&&(f.current=l)},[l]);const d=zl({...e,elements:{...o,...c&&{reference:c}}}),h=_.useCallback($=>{const B=de($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),getClientRects:()=>$.getClientRects(),contextElement:$}:$;a(B),d.refs.setReference(B)},[d.refs]),m=_.useCallback($=>{(de($)||$===null)&&(f.current=$,i($)),(de(d.refs.reference.current)||d.refs.reference.current===null||$!==null&&!de($))&&d.refs.setReference($)},[d.refs]),v=_.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),C=_.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),b=_.useMemo(()=>({...d,...r,refs:v,elements:C,nodeId:t}),[d,v,C,t,r]);return Mt(()=>{r.dataRef.current.floatingContext=b;const $=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);$&&($.context=b)}),_.useMemo(()=>({...d,context:b,refs:v,elements:C}),[d,v,C,b])}function Ea(){return _1()&&Uf()}function vw(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=_.useRef(!1),l=_.useRef(-1),f=_.useRef(!0);_.useEffect(()=>{if(!c)return;const d=Ue(i.domReference);function h(){!n&&ke(i.domReference)&&i.domReference===pa(It(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function v(){f.current=!1}return d.addEventListener("blur",h),Ea()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",v,!0)),()=>{d.removeEventListener("blur",h),Ea()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",v,!0))}},[i.domReference,n,c]),_.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]),_.useEffect(()=>()=>{at(l)},[]);const p=_.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=er(d.nativeEvent);if(a&&de(h)){if(Ea()&&!d.relatedTarget){if(!f.current&&!Wf(h))return}else if(!H1(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,v=de(h)&&h.hasAttribute(Ur("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var C;const b=pa(i.domReference?i.domReference.ownerDocument:document);!h&&b===i.domReference||Jn((C=s.current.floatingContext)==null?void 0:C.refs.floating.current,b)||Jn(i.domReference,b)||v||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return _.useMemo(()=>c?{reference:p}:{},[c,p])}function Sa(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[qf]:i,[Zf]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[ew]:""},...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&&[qf,Zf].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(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function ww(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=_.useCallback(c=>Sa(c,e,"reference"),t),s=_.useCallback(c=>Sa(c,e,"floating"),n),i=_.useCallback(c=>Sa(c,e,"item"),r);return _.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const xw=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Ew(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=ga(),l=((n=s.domReference)==null?void 0:n.id)||u,f=_.useMemo(()=>{var b;return((b=V1(s.floating))==null?void 0:b.id)||i},[s.floating,i]),p=(r=xw.get(a))!=null?r:a,h=ya()!=null,m=_.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]),v=_.useMemo(()=>{const b={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?b:{...b,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),C=_.useCallback(b=>{let{active:$,selected:B}=b;const k={role:"option",...$&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...k,"aria-selected":B}}return{}},[f,a]);return _.useMemo(()=>c?{reference:m,floating:v,item:C}:{},[c,m,v,C])}const sd=S.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})});sd.displayName="TooltipArrow";const zr=({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]=S.useState(!1),f=S.useRef(null),{refs:p,floatingStyles:d,context:h}=yw({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:Dl,middleware:[Vi(o?12:8),Hl({fallbackAxisSideDirection:"start",padding:8}),Wl({padding:8}),...o?[Dy({element:f})]:[]]}),m=cw(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),v=vw(h,{enabled:a.includes("focus")}),C=pw(h,{enabled:a.includes("click")}),b=gw(h),$=Ew(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:k}=ww([m,v,C,b,$]);return i?M.jsx(M.Fragment,{children:e}):M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:p.setReference,...B(),children:e}),u&&M.jsx(lw,{children:M.jsxs("div",{ref:p.setFloating,...k(),style:d,className:`
|
|
112
|
+
z-50 px-3 py-2
|
|
113
|
+
bg-fill-page-secondary
|
|
114
|
+
text-text-primary text-sm font-medium
|
|
115
|
+
rounded-lg shadow-lg
|
|
116
|
+
relative
|
|
117
|
+
${c}
|
|
118
|
+
${s}
|
|
119
|
+
`,children:[t,o&&M.jsx(sd,{ref:f,placement:h.placement||n})]})})]})},ms="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",Sw=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var c;const{t:s}=pt(),i=S.useMemo(()=>a1(n||{}),[n]);return M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex justify-center mt-4 mb-3",children:(e==null?void 0:e.getDisplayAddress())&&M.jsx("div",{className:"bg-white rounded-lg",children:M.jsx(_f,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),(e==null?void 0:e.getDisplayAddress())&&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:e==null?void 0:e.getDisplayAddress()}),M.jsx(C1,{onCopy:()=>{const a=(e==null?void 0:e.getDisplayAddress())||"";o&&o(a)},text:e==null?void 0:e.getDisplayAddress(),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:ms,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:s("deposit.depositAllTip",{coin:t,v:n==null?void 0:n.chain})})})]}),i&&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:s("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:s("deposit.arrivalTime")}),M.jsx(zr,{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:s("deposit.arrivaltimeTooltip1",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60,v1:n==null?void 0:n.txConfirm})}),M.jsx("p",{children:s("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:s("deposit.arrivalEstimated",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60})})})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.minDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((c=r==null?void 0:r.multiChain)==null?void 0:c.minDeposit)||10," ",t]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.maxDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]})]})},Pw=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onCopy:i,onClose:c})=>{var m;const{t:a}=pt(),[u,l]=S.useState(()=>{var v;return!e||e.length===0?1:t||((v=e[0])==null?void 0:v.chainId)||1}),[f,p]=S.useState(()=>{var $;if(!e||e.length===0)return"";const v=t||(($=e[0])==null?void 0:$.chainId),C=e.find(B=>B.chainId===v);if(!C||!C.tokenList||C.tokenList.length===0)return"";const b=C.tokenList.find(B=>B.tokenAddress===n)||C.tokenList[0];return(b==null?void 0:b.token)||""}),d=e&&e.length>0?e.find(v=>v.chainId===u)||e[0]:null,h=(m=d==null?void 0:d.tokenList)==null?void 0:m.find(v=>v.token===f);return!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):d?M.jsxs(M.Fragment,{children:[M.jsx(na,{currentActiveChain:d,chainList:e,onChainChange:l,curSelectToken:f,onTokenChange:p,walletType:"mpc"}),M.jsx(Sw,{walletAdapter:r,curSelectToken:f,currentActiveChain:d,metadata:o,onCopy:i}),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:()=>{s&&s({amount:"",chainId:u,tokenAddress:(h==null?void 0:h.tokenAddress)||"",tokenSymbol:f}),c()},children:a("deposit.title")})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},$w="1.0.8";let Ke=class ru extends Error{constructor(t,n={}){var i;const r=n.cause instanceof ru?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof ru&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${$w}`].join(`
|
|
120
|
+
`);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function qt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const id=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ad=/^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)?$/,cd=/^\(.+?\).*?$/,ud=/^tuple(?<array>(\[(\d*)\])*)$/;function Pa(e){let t=e.type;if(ud.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=Pa(s),o<n-1&&(t+=", ")}const r=qt(ud,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Pa({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Wr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Pa(o),r!==n-1&&(t+=", ")}return t}function gs(e){var t;return e.type==="function"?`function ${e.name}(${Wr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Wr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Wr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Wr(e.inputs)})`:e.type==="constructor"?`constructor(${Wr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const ld=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Aw(e){return ld.test(e)}function Tw(e){return qt(ld,e)}const fd=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Cw(e){return fd.test(e)}function Ow(e){return qt(fd,e)}const dd=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Nw(e){return dd.test(e)}function Iw(e){return qt(dd,e)}const pd=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function $a(e){return pd.test(e)}function Mw(e){return qt(pd,e)}const hd=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Lw(e){return hd.test(e)}function Bw(e){return qt(hd,e)}const md=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function kw(e){return md.test(e)}function Rw(e){return qt(md,e)}const Fw=/^receive\(\) external payable$/;function Dw(e){return Fw.test(e)}const jw=new Set(["indexed"]),Aa=new Set(["calldata","memory","storage"]);class _w extends Ke{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Uw extends Ke{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class zw extends Ke{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Ww extends Ke{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Hw extends Ke{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Vw extends Ke{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Gw extends Ke{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class qw extends Ke{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class tr extends Ke{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Zw extends Ke{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Kw extends Ke{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Yw extends Ke{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Xw extends Ke{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Qw(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 Ta=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Ca(e,t={}){if(Nw(e))return Jw(e,t);if(Cw(e))return ex(e,t);if(Aw(e))return tx(e,t);if(Lw(e))return nx(e,t);if(kw(e))return rx(e);if(Dw(e))return{type:"receive",stateMutability:"payable"};throw new Zw({signature:e})}function Jw(e,t={}){const n=Iw(e);if(!n)throw new tr({signature:e,type:"function"});const r=bt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Nn(r[c],{modifiers:Aa,structs:t,type:"function"}));const i=[];if(n.returns){const c=bt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(Nn(c[u],{modifiers:Aa,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function ex(e,t={}){const n=Ow(e);if(!n)throw new tr({signature:e,type:"event"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{modifiers:jw,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function tx(e,t={}){const n=Tw(e);if(!n)throw new tr({signature:e,type:"error"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function nx(e,t={}){const n=Bw(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function rx(e){const t=Rw(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const ox=/^(?<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$_]*))?$/,sx=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ix=/^u?int$/;function Nn(e,t){var f,p;const n=Qw(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Ta.has(n))return Ta.get(n);const r=cd.test(e),o=qt(r?sx:ox,e);if(!o)throw new Ww({param:e});if(o.name&&cx(o.name))throw new Hw({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const d=bt(o.type),h=[],m=d.length;for(let v=0;v<m;v++)h.push(Nn(d[v],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(ix.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!gd(a))throw new zw({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 Vw({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Aa.has(o.modifier)&&!ux(a,!!o.array))throw new Gw({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Ta.set(n,l),l}function bt(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?bt(c,[...t,n.trim()]):bt(c,t,`${n}${i}`,r);case"(":return bt(c,t,`${n}${i}`,r+1);case")":return bt(c,t,`${n}${i}`,r-1);default:return bt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Xw({current:n,depth:r});return t.push(n.trim()),t}function gd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||id.test(e)||ad.test(e)}const ax=/^(?: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 cx(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||id.test(e)||ad.test(e)||ax.test(e)}function ux(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function bd(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!$a(c))continue;const a=Mw(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=Nn(h,{type:"struct"});l.push(m)}if(!l.length)throw new Kw({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]=yd(a,t)}return r}const lx=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function yd(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(cd.test(i.type))r.push(i);else{const a=qt(lx,i.type);if(!(a!=null&&a.type))throw new qw({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Yw({type:l});r.push({...i,type:`tuple${u??""}`,components:yd(t[l]??[],t,new Set([...n,l]))})}else if(gd(l))r.push(i);else throw new Uw({type:l})}}return r}function vd(e){const t=bd(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];$a(s)||n.push(Ca(s,t))}return n}function wd(e){let t;if(typeof e=="string")t=Ca(e);else{const n=bd(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!$a(s)){t=Ca(s,n);break}}}if(!t)throw new _w({signature:e});return t}function J(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function yt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Sx(e.type);return`${e.name}(${bs(e.inputs,{includeName:t})})`}function bs(e,{includeName:t=!1}={}){return e?e.map(n=>fx(n,{includeName:t})).join(t?", ":","):""}function fx(e,{includeName:t}){return e.type.startsWith("tuple")?`(${bs(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function vt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return vt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const xd="2.34.0";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${xd}`},H=class ou extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof ou?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ou&&n.cause.docsPath||n.docsPath,s=(c=Hr.getDocsUrl)==null?void 0:c.call(Hr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
|
|
121
|
+
`);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=xd}walk(t){return Ed(this,t)}};function Ed(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Ed(e.cause,t):t?null:e}class dx extends H{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
122
|
+
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Sd extends H{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
123
|
+
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Pd extends H{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
124
|
+
`),{metaMessages:[`Params: (${bs(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class Vr extends H{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class px extends H{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
125
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class hx extends H{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${we(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class mx extends H{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
126
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class gx extends H{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
|
|
127
|
+
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class $d extends H{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
|
|
128
|
+
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Ad extends H{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
129
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class bx extends H{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Td extends H{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
130
|
+
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Cd extends H{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
|
|
131
|
+
`),{docsPath:n,name:"AbiEventNotFoundError"})}}class nr extends H{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
132
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Od extends H{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
133
|
+
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class yx extends H{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
134
|
+
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class vx extends H{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${yt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${yt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let wx=class extends H{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Gr extends H{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
|
|
135
|
+
`),{metaMessages:[`Params: (${bs(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 ys extends H{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${yt(t,{includeName:!0})}".`].join(`
|
|
136
|
+
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class xx extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
137
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Ex extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
138
|
+
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Nd=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
139
|
+
`),{name:"InvalidArrayError"})}};class Sx extends H{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
140
|
+
`),{name:"InvalidDefinitionTypeError"})}}class Px extends H{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Id=class extends H{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Md=class extends H{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Ld extends H{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?gn(e,{dir:t,size:n}):$x(e,{dir:t,size:n})}function gn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Md({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function $x(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Md({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o<n;o++){const s=t==="right";r[s?o:n-o-1]=e[s?o:e.length-o-1]}return r}let Bd=class extends H{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class Ax extends H{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class Tx extends H{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Cx=class extends H{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function In(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function wt(e,{size:t}){if(we(e)>t)throw new Cx({givenSize:we(e),maxSize:t})}function Bt(e,t={}){const{signed:n}=t;t.size&&wt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Ox(e,t={}){let n=e;if(t.size&&(wt(n,{size:t.size}),n=In(n)),In(n)==="0x00")return!1;if(In(n)==="0x01")return!0;throw new Tx(n)}function Zt(e,t={}){return Number(Bt(e,t))}const Nx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Q(e,t):typeof e=="string"?qr(e,t):typeof e=="boolean"?kd(e,t):$e(e,t)}function kd(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Nx[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(wt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function Q(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Bd({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?rr(c,{size:r}):c}const Ix=new TextEncoder;function qr(e,t={}){const n=Ix.encode(e);return $e(n,t)}const Mx=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?Bx(e,t):typeof e=="boolean"?Lx(e,t):vt(e)?xt(e,t):Mn(e,t)}function Lx(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}const Yt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Rd(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 xt(e,t={}){let n=e;t.size&&(wt(n,{size:t.size}),n=rr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=Rd(r.charCodeAt(c++)),u=Rd(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new H(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function Bx(e,t){const n=Q(e,t);return xt(n)}function Mn(e,t={}){const n=Mx.encode(e);return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const vs=BigInt(2**32-1),Fd=BigInt(32);function kx(e,t=!1){return t?{h:Number(e&vs),l:Number(e>>Fd&vs)}:{h:Number(e>>Fd&vs)|0,l:Number(e&vs)|0}}function Rx(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}=kx(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Fx=(e,t,n)=>e<<n|t>>>32-n,Dx=(e,t,n)=>t<<n|e>>>32-n,jx=(e,t,n)=>t<<n-32|e>>>64-n,_x=(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 ws(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xt(e,...t){if(!ws(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 Dd(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Zr(e.outputLen),Zr(e.blockLen)}function ir(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function jd(e,t){Xt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ux(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ar(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Oa(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function kt(e,t){return e<<32-t|e>>>t}const zx=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Wx(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Hx(e){for(let t=0;t<e.length;t++)e[t]=Wx(e[t]);return e}const _d=zx?e=>e:Hx,Ud=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Vx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cr(e){if(Xt(e),Ud)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Vx[e[n]];return t}const Qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function zd(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 xs(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Ud)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=zd(e.charCodeAt(s)),c=zd(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 Gx(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Es(e){return typeof e=="string"&&(e=Gx(e)),Xt(e),e}function bn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Xt(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class Na{}function Wd(e){const t=r=>e().update(Es(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Hd(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 qx=BigInt(0),Kr=BigInt(1),Zx=BigInt(2),Kx=BigInt(7),Yx=BigInt(256),Xx=BigInt(113),Vd=[],Gd=[],qd=[];for(let e=0,t=Kr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Vd.push(2*(5*r+n)),Gd.push((e+1)*(e+2)/2%64);let o=qx;for(let s=0;s<7;s++)t=(t<<Kr^(t>>Kx)*Xx)%Yx,t&Zx&&(o^=Kr<<(Kr<<BigInt(s))-Kr);qd.push(o)}const Zd=Rx(qd,!0),Qx=Zd[0],Jx=Zd[1],Kd=(e,t,n)=>n>32?jx(e,t,n):Fx(e,t,n),Yd=(e,t,n)=>n>32?_x(e,t,n):Dx(e,t,n);function eE(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=Kd(u,l,1)^n[c],p=Yd(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=Gd[i],a=Kd(o,s,c),u=Yd(o,s,c),l=Vd[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]^=Qx[r],e[1]^=Jx[r]}ar(n)}class Ia extends Na{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,Zr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ux(this.state)}clone(){return this._cloneInto()}keccak(){_d(this.state32),eE(this.state32,this.rounds),_d(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=Es(t),Xt(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){ir(this,!1),Xt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Zr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(jd(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 Ia(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 tE=(e,t,n)=>Wd(()=>new Ia(t,e,n)),Xd=tE(1,136,256/8);function Ne(e,t){const n=t||"hex",r=Xd(vt(e,{strict:!1})?or(e):e);return n==="bytes"?r:Kt(r)}const nE=e=>Ne(or(e));function rE(e){return nE(e)}function oE(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new H("Unable to normalize signature.");return o}const sE=e=>{const t=typeof e=="string"?e:gs(e);return oE(t)};function Qd(e){return rE(sE(e))}const Ss=Qd;let yn=class extends H{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Ma=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const La=new Ma(8192);function Ps(e,t){if(La.has(`${e}.${t}`))return La.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ne(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 La.set(`${e}.${t}`,s),s}function iE(e,t){if(!ct(e,{strict:!1}))throw new yn({address:e});return Ps(e,t)}const aE=/^0x[a-fA-F0-9]{40}$/,Ba=new Ma(8192);function ct(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ba.has(r))return Ba.get(r);const o=aE.test(e)?e.toLowerCase()===e?!0:n?Ps(e)===e:!0:!1;return Ba.set(r,o),o}function Et(e){return typeof e[0]=="string"?ur(e):cE(e)}function cE(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function ur(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function lr(e,t,n,{strict:r}={}){return vt(e,{strict:!1})?np(e,t,n,{strict:r}):tp(e,t,n,{strict:r})}function Jd(e,t){if(typeof t=="number"&&t>0&&t>we(e)-1)throw new Id({offset:t,position:"start",size:we(e)})}function ep(e,t,n){if(typeof t=="number"&&typeof n=="number"&&we(e)!==n-t)throw new Id({offset:n,position:"end",size:we(e)})}function tp(e,t,n,{strict:r}={}){Jd(e,t);const o=e.slice(t,n);return r&&ep(o,t,n),o}function np(e,t,n,{strict:r}={}){Jd(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&ep(o,t,n),o}const uE=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,rp=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Jt(e,t){if(e.length!==t.length)throw new mx({expectedLength:e.length,givenLength:t.length});const n=lE({params:e,values:t}),r=Ra(n);return r.length===0?"0x":r}function lE({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(ka({param:e[r],value:t[r]}));return n}function ka({param:e,value:t}){const n=Fa(e.type);if(n){const[r,o]=n;return dE(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return bE(t,{param:e});if(e.type==="address")return fE(t);if(e.type==="bool")return hE(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=rp.exec(e.type)??[];return mE(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return pE(t,{param:e});if(e.type==="string")return gE(t);throw new xx(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Ra(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=we(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Q(t+o,{size:32})),r.push(c),o+=we(c)):n.push(c)}return Et([...n,...r])}function fE(e){if(!ct(e))throw new yn({address:e});return{dynamic:!1,encoded:gn(e.toLowerCase())}}function dE(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Nd(e);if(!r&&e.length!==t)throw new px({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=ka({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Ra(s);if(r){const c=Q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Et([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Et(s.map(({encoded:i})=>i))}}function pE(e,{param:t}){const[,n]=t.type.split("bytes"),r=we(e);if(!n){let o=e;return r%32!==0&&(o=gn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Et([gn(Q(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new hx({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:gn(e,{dir:"right"})}}function hE(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:gn(kd(e))}}function mE(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new Bd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Q(e,{size:32,signed:t})}}function gE(e){const t=qr(e),n=Math.ceil(we(t)/32),r=[];for(let o=0;o<n;o++)r.push(gn(lr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Et([gn(Q(we(t),{size:32})),...r])}}function bE(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=ka({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Ra(r):Et(r.map(({encoded:o})=>o))}}function Fa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Yr=e=>lr(Qd(e),0,4);function Ln(e){const{abi:t,args:n=[],name:r}=e,o=vt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Yr(c)===r:c.type==="event"?Ss(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?Da(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=op(c.inputs,i.inputs,n);if(u)throw new vx({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Da(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ct(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>Da(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=>Da(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function op(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 op(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ct(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ct(n[r],{strict:!1}):!1)return i}}const sp="/docs/contract/encodeEventTopics";function Xr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=Ln({abi:t,name:n});if(!u)throw new Cd(n,{docsPath:sp});o=u}if(o.type!=="event")throw new Cd(void 0,{docsPath:sp});const s=yt(o),i=Ss(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)=>ip({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?ip({param:f,value:l[p]}):null))??[])}return[i,...c]}function ip({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ne(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Px(e.type);return Jt([e],[t])}function $s(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 ap(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=$s(e,{method:"eth_newFilter"}),l=s?Xr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?Q(i):i,toBlock:typeof a=="bigint"?Q(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function St(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const cp="/docs/contract/encodeFunctionData";function yE(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Ln({abi:t,args:n,name:r});if(!s)throw new nr(r,{docsPath:cp});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:cp});return{abi:[o],functionName:Yr(yt(o))}}function Rt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:yE(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Jt(o.inputs,t??[]):void 0;return ur([s,i??"0x"])}const up={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."},lp={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},vE={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class fp extends H{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class dp extends H{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class wE extends H{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const xE={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 wE({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new dp({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new fp({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 fp({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function ja(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(xE);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function EE(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Bt(n,t)}function SE(e,t={}){let n=e;if(typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n)),n.length>1||n[0]>1)throw new Ax(n);return!!n[0]}function en(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Zt(n,t)}function PE(e,t={}){let n=e;return typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n,{dir:"right"})),new TextDecoder().decode(n)}function Qr(e,t){const n=typeof t=="string"?xt(t):t,r=ja(n);if(we(n)===0&&e.length>0)throw new Vr;if(we(t)&&we(t)<32)throw new Pd({data:typeof t=="string"?t:$e(t),params:e,size:we(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=fr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function fr(e,t,{staticPosition:n}){const r=Fa(t.type);if(r){const[o,s]=r;return AE(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return NE(e,t,{staticPosition:n});if(t.type==="address")return $E(e);if(t.type==="bool")return TE(e);if(t.type.startsWith("bytes"))return CE(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return OE(e,t);if(t.type==="string")return IE(e,{staticPosition:n});throw new Ex(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const pp=32,_a=32;function $E(e){const t=e.readBytes(32);return[Ps($e(tp(t,-20))),32]}function AE(e,t,{length:n,staticPosition:r}){if(!n){const i=en(e.readBytes(_a)),c=r+i,a=c+pp;e.setPosition(c);const u=en(e.readBytes(pp)),l=Jr(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=fr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Jr(t)){const i=en(e.readBytes(_a)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=fr(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=fr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function TE(e){return[SE(e.readBytes(32),{size:32}),32]}function CE(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),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o),32)),32]}function OE(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?EE(o,{signed:n}):en(o,{signed:n}),32]}function NE(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Jr(t)){const i=en(e.readBytes(_a)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=fr(e,u,{staticPosition:c});s+=f,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=fr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function IE(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=PE(In(s));return e.setPosition(t+32),[i,32]}function Jr(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(Jr);const n=Fa(e.type);return!!(n&&Jr({...e,type:n[1]}))}function hp(e){const{abi:t,data:n}=e,r=lr(n,0,4);if(r==="0x")throw new Vr;const s=[...t||[],lp,vE].find(i=>i.type==="error"&&r===Yr(yt(i)));if(!s)throw new Ad(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Qr(s.inputs,lr(n,4)):void 0,errorName:s.name}}const Ae=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function mp({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 ME={gwei:9,wei:18},LE={ether:-9,wei:9};function gp(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${s?`.${s}`:""}`}function bp(e,t="wei"){return gp(e,ME[t])}function Pt(e,t="wei"){return gp(e,LE[t])}class BE extends H{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class kE extends H{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function yp(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
141
|
+
`,"")}function RE(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
|
|
142
|
+
`;return r.nonce&&(o+=` nonce: ${r.nonce}
|
|
143
|
+
`),r.balance&&(o+=` balance: ${r.balance}
|
|
144
|
+
`),r.code&&(o+=` code: ${r.code}
|
|
145
|
+
`),r.state&&(o+=` state:
|
|
146
|
+
`,o+=yp(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
147
|
+
`,o+=yp(r.stateDiff)),o},` State Override:
|
|
148
|
+
`).slice(0,-1)}function As(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
|
|
149
|
+
`)}class FE extends H{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
150
|
+
`),{name:"FeeConflictError"})}}class DE extends H{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",As(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class vp extends H{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class wp extends H{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class jE extends H{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const _E=e=>e,eo=e=>e;class xp extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p,stateOverride:d}){var v;const h=n?St(n):void 0;let m=As({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${bp(p)} ${((v=o==null?void 0:o.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(u)} gwei`,nonce:l});d&&(m+=`
|
|
151
|
+
${RE(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 UE extends H{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Ln({abi:n,args:r,name:i}),u=a?mp({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?yt(a,{includeName:!0}):void 0,f=As({address:o&&_E(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 Ua extends H{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=hp({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=up[d]}else{const d=l?yt(l,{includeName:!0}):void 0,h=l&&p?mp({abiItem:l,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(l){s=l}else o&&(a=o);let u;s instanceof Ad&&(u=s.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
|
|
152
|
+
`):`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 zE extends H{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class WE extends H{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Ts extends H{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Bn extends H{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${eo(i)}`,t&&`Request body: ${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 za extends H{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${eo(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}),this.code=n.code,this.data=n.data}}class Ep extends H{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${eo(n)}`,`Request body: ${Ae(t)}`],name:"TimeoutError"})}}const HE=-1;class ze extends H{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof za?t.code:n??HE}}class Ye extends ze{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class to extends ze{constructor(t){super(t,{code:to.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class no extends ze{constructor(t){super(t,{code:no.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ro extends ze{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class oo extends ze{constructor(t){super(t,{code:oo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
153
|
+
`)})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class kn extends ze{constructor(t){super(t,{code:kn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Rn extends ze{constructor(t){super(t,{code:Rn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
154
|
+
`)})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class so extends ze{constructor(t){super(t,{code:so.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class io extends ze{constructor(t){super(t,{code:io.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class ao extends ze{constructor(t){super(t,{code:ao.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Fn extends ze{constructor(t,{method:n}={}){super(t,{code:Fn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class dr extends ze{constructor(t){super(t,{code:dr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class co extends ze{constructor(t){super(t,{code:co.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class pr extends Ye{constructor(t){super(t,{code:pr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(pr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class uo extends Ye{constructor(t){super(t,{code:uo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class lo extends Ye{constructor(t,{method:n}={}){super(t,{code:lo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class fo extends Ye{constructor(t){super(t,{code:fo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class po extends Ye{constructor(t){super(t,{code:po.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ho extends Ye{constructor(t){super(t,{code:ho.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class mo extends Ye{constructor(t){super(t,{code:mo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class go extends Ye{constructor(t){super(t,{code:go.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class bo extends Ye{constructor(t){super(t,{code:bo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class yo extends Ye{constructor(t){super(t,{code:yo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class vo extends Ye{constructor(t){super(t,{code:vo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class wo extends Ye{constructor(t){super(t,{code:wo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class xo extends Ye{constructor(t){super(t,{code:xo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class VE extends ze{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const GE=3;function hr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Ts?e:e instanceof H?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof Vr?new zE({functionName:s}):[GE,kn.code].includes(a)&&(u||l||f||p)?new Ua({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof za?l:p??f}):e;return new UE(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function qE(e){const t=Ne(`0x${e.substring(4)}`).substring(26);return Ps(`0x${t}`)}async function ZE({hash:e,signature:t}){const n=vt(e)?e:Kt(e),{secp256k1:r}=await Promise.resolve().then(()=>jS);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:p}=t,d=Number(p??f),h=Sp(d);return new r.Signature(Bt(u),Bt(l)).addRecoveryBit(h)}const i=vt(t)?t:Kt(t);if(we(i)!==65)throw new Error("invalid signature length");const c=Zt(`0x${i.slice(130)}`),a=Sp(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Sp(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function Pp({hash:e,signature:t}){return qE(await ZE({hash:e,signature:t}))}function KE(e,t="hex"){const n=$p(e),r=ja(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function $p(e){return Array.isArray(e)?YE(e.map(t=>$p(t))):XE(e)}function YE(e){const t=e.reduce((o,s)=>o+s.length,0),n=Ap(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 XE(e){const t=typeof e=="string"?xt(e):e,n=Ap(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 Ap(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new H("Length is too large.")}function QE(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ne(ur(["0x05",KE([t?Q(t):"0x",o,n?Q(n):"0x"])]));return r==="bytes"?xt(s):s}async function JE(e){const{authorization:t,signature:n}=e;return Pp({hash:QE(t),signature:n??t})}class e2 extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p}){var h;const d=As({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${bp(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class mr extends H{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(mr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(mr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Cs extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Cs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Wa extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Wa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Ha extends H{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Ha,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Va extends H{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
155
|
+
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Va,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Ga extends H{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Ga,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class qa extends H{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
156
|
+
`),{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(qa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Za extends H{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Za,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ka extends H{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Ka,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ya extends H{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ya,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Os extends H{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Pt(r)} gwei`:""}).`].join(`
|
|
157
|
+
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Os,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Ns extends H{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Xa(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof H?e.walk(o=>(o==null?void 0:o.code)===mr.code):e;return r instanceof H?new mr({cause:e,message:r.details}):mr.nodeMessage.test(n)?new mr({cause:e,message:e.details}):Cs.nodeMessage.test(n)?new Cs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Wa.nodeMessage.test(n)?new Wa({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ha.nodeMessage.test(n)?new Ha({cause:e,nonce:t==null?void 0:t.nonce}):Va.nodeMessage.test(n)?new Va({cause:e,nonce:t==null?void 0:t.nonce}):Ga.nodeMessage.test(n)?new Ga({cause:e,nonce:t==null?void 0:t.nonce}):qa.nodeMessage.test(n)?new qa({cause:e}):Za.nodeMessage.test(n)?new Za({cause:e,gas:t==null?void 0:t.gas}):Ka.nodeMessage.test(n)?new Ka({cause:e,gas:t==null?void 0:t.gas}):Ya.nodeMessage.test(n)?new Ya({cause:e}):Os.nodeMessage.test(n)?new Os({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Ns({cause:e})}function t2(e,{docsPath:t,...n}){const r=(()=>{const o=Xa(e,n);return o instanceof Ns?e:o})();return new e2(r,{docsPath:t,...n})}function Qa(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 n2={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Is(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=r2(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>$e(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=Q(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=Q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=Q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=Q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=Q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=Q(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=n2[e.type]),typeof e.value<"u"&&(t.value=Q(e.value)),t}function r2(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 Tp(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Ld({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Ld({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function o2(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=Tp(r)),o!==void 0){if(i.state)throw new kE;i.stateDiff=Tp(o)}return i}function Ja(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ct(n,{strict:!1}))throw new yn({address:n});if(t[n])throw new BE({address:n});t[n]=o2(r)}return t}const s2=2n**256n-1n;function Eo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?St(t):void 0;if(i&&!ct(i.address))throw new yn({address:i.address});if(s&&!ct(s))throw new yn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new FE;if(r&&r>s2)throw new Cs({maxFeePerGas:r});if(o&&r&&o>r)throw new Os({maxFeePerGas:r,maxPriorityFeePerGas:o})}class i2 extends H{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class ec extends H{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class a2 extends H{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Pt(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Cp extends H{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Op={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Np(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?Op[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(t.authorizationList=c2(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 c2(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 Ip(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Np(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 Ft(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,f;const s=o??!1,i=n!==void 0?Q(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new Cp({blockHash:t,blockNumber:n});return(((f=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:f.format)||Ip)(c)}async function tc(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function u2(e,t){return Mp(e,t)}async function Mp(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const u=n||await J(e,Ft,"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 Bt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):J(e,Ft,"getBlock")({}),J(e,tc,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new ec;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function l2(e,t){return nc(e,t)}async function nc(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 i2;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await J(e,Ft,"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 ec;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Mp(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await J(e,tc,"getGasPrice")({}))}}async function Lp(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 Bp(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>xt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>$e(s))}function kp(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>xt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>xt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>$e(i))}function f2(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 d2(e,t,n){return e&t^~e&n}function p2(e,t,n){return e&t^e&n^t&n}class h2 extends Na{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=Oa(this.buffer)}update(t){ir(this),t=Es(t),Xt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=Oa(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ir(this),jd(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;f2(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Oa(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)c.setUint32(4*f,l[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const vn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),m2=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 g2 extends h2{constructor(t=32){super(64,t,8,!1),this.A=vn[0]|0,this.B=vn[1]|0,this.C=vn[2]|0,this.D=vn[3]|0,this.E=vn[4]|0,this.F=vn[5]|0,this.G=vn[6]|0,this.H=vn[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=kt(p,7)^kt(p,18)^p>>>3,m=kt(d,17)^kt(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=kt(c,6)^kt(c,11)^kt(c,25),d=l+p+d2(c,a,u)+m2[f]+wn[f]|0,m=(kt(r,2)^kt(r,13)^kt(r,22))+p2(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 Rp=Wd(()=>new g2),b2=Rp;function y2(e,t){return b2(vt(e,{strict:!1})?or(e):e)}function v2(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=y2(t);return o.set([n],0),r==="bytes"?o:$e(o)}function w2(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(v2({commitment:s,to:r,version:n}));return o}const Fp=6,Dp=32,rc=4096,jp=Dp*rc,_p=jp*Fp-1-1*rc*Fp;class x2 extends H{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class E2 extends H{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function S2(e){const t=typeof e.data=="string"?xt(e.data):e.data,n=we(t);if(!n)throw new E2;if(n>_p)throw new x2({maxSize:_p,size:n});const r=[];let o=!0,s=0;for(;o;){const i=ja(new Uint8Array(jp));let c=0;for(;c<rc;){const a=t.slice(s,s+(Dp-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 P2(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??S2({data:t}),s=e.commitments??Bp({blobs:o,kzg:n,to:r}),i=e.proofs??kp({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 $2(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 DE({transaction:e})}async function Up(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Zt(t)}const A2=["blobVersionedHashes","chainId","fees","gas","nonce","type"],zp=new Map;async function Wp(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=A2,type:l}=t,f=n&&St(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await J(e,Ft,"getBlock")({blockTag:"latest"}),d)}let m;async function v(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await J(e,Up,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const C=await v();p.nonce=await a.consume({address:f.address,chainId:C,client:e})}else p.nonce=await J(e,Lp,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const C=Bp({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const b=w2({commitments:C,to:"hex"});p.blobVersionedHashes=b}if(u.includes("sidecars")){const b=kp({blobs:r,commitments:C,kzg:i}),$=P2({blobs:r,commitments:C,proofs:b,to:"hex"});p.sidecars=$}}if(u.includes("chainId")&&(p.chainId=await v()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{p.type=$2(p)}catch{let C=zp.get(e.uid);if(typeof C>"u"){const b=await h();C=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",zp.set(e.uid,C)}p.type=C?"eip1559":"legacy"}if(u.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const C=await h(),{maxFeePerGas:b,maxPriorityFeePerGas:$}=await nc(e,{block:C,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<$)throw new a2({maxPriorityFeePerGas:$});p.maxPriorityFeePerGas=$,p.maxFeePerGas=b}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new ec;if(typeof t.gasPrice>"u"){const C=await h(),{gasPrice:b}=await nc(e,{block:C,chain:o,request:p,type:"legacy"});p.gasPrice=b}}return u.includes("gas")&&typeof s>"u"&&(p.gas=await J(e,oc,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),Eo(p),delete p.parameters,p}async function Hp(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?Q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function oc(e,t){var o,s,i;const{account:n=e.account}=t,r=n?St(n):void 0;try{let E=function(T){const{block:O,request:y,rpcStateOverride:L}=T;return e.request({method:"eth_estimateGas",params:L?[y,O??e.experimental_blockTag??"latest",L]:O?[y,O]:[y]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:p,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,value:B,stateOverride:k,...D}=await Wp(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?Q(f):void 0)||p,w=Ja(k),A=await(async()=>{if(D.to)return D.to;if(a&&a.length>0)return await JE({authorization:a[0]}).catch(()=>{throw new H("`to` is required. Could not infer from `authorizationList`")})})();Eo(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||Is)({...Qa(D,{format:I}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,to:A,value:B});let x=BigInt(await E({block:g,request:P,rpcStateOverride:w}));if(a){const T=await Hp(e,{address:P.from}),O=await Promise.all(a.map(async y=>{const{address:L}=y,F=await E({block:g,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:L,value:Q(T)},rpcStateOverride:w}).catch(()=>100000n);return 2n*BigInt(F)}));x+=O.reduce((y,L)=>y+L,0n)}return x}catch(c){throw t2(c,{...t,account:r,chain:e.chain})}}async function T2(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Rt({abi:n,args:o,functionName:s});try{return await J(e,oc,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?St(c.account):void 0;throw hr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Ms(e,t){if(!ct(e,{strict:!1}))throw new yn({address:e});if(!ct(t,{strict:!1}))throw new yn({address:t});return e.toLowerCase()===t.toLowerCase()}const Vp="/docs/contract/decodeEventLog";function sc(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new bx({docsPath:Vp});const a=t.find(m=>m.type==="event"&&i===Ss(yt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Td(i,{docsPath:Vp});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=l.map((m,v)=>[m,v]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[v,C]=d[m],b=c[m];if(!b)throw new ys({abiItem:a,param:v});p[f?C:v.name||C]=C2({param:v,value:b})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Qr(h,n);if(m)if(f)for(let v=0;v<l.length;v++)p[v]=p[v]??m.shift();else for(let v=0;v<h.length;v++)p[h[v].name]=m[v]}catch(m){if(s)throw m instanceof Pd||m instanceof dp?new Gr({abiItem:a,data:n,params:h,size:we(n)}):m}else if(s)throw new Gr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function C2({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Qr([e],t)||[])[0]}function ic(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]===Ss(l));if(!a)return null;const u=sc({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!O2({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Td)return null;if(a instanceof Gr||a instanceof ys){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 O2(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"?Ms(i,c):s.type==="string"||s.type==="bytes"?Ne(or(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function tn(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function ac(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>Xr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?Q(r):r,toBlock:typeof o=="bigint"?Q(o):o}]});const d=p.map(h=>tn(h));return l?ic({abi:l,args:c,logs:d,strict:u}):d}async function Gp(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?Ln({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return J(e,ac,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const cc="/docs/contract/decodeFunctionResult";function Dn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Ln({abi:t,args:n,name:r});if(!c)throw new nr(r,{docsPath:cc});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:cc});if(!s.outputs)throw new Od(s.name,{docsPath:cc});const i=Qr(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const uc=BigInt(0),lc=BigInt(1);function Ls(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function jn(e,t,n=""){const r=ws(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function Bs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function qp(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?uc:BigInt("0x"+e)}function ks(e){return qp(cr(e))}function Zp(e){return Xt(e),qp(cr(Uint8Array.from(e).reverse()))}function fc(e,t){return xs(e.toString(16).padStart(t*2,"0"))}function Kp(e,t){return fc(e,t).reverse()}function We(e,t,n){let r;if(typeof t=="string")try{r=xs(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(ws(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const dc=e=>typeof e=="bigint"&&uc<=e;function N2(e,t,n){return dc(e)&&dc(t)&&dc(n)&&t<=e&&e<n}function I2(e,t,n,r){if(!N2(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Yp(e){let t;for(t=0;e>uc;e>>=lc,t+=1);return t}const So=e=>(lc<<BigInt(e))-lc;function M2(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 bn(...h)};return(d,h)=>{a(),l(d);let m;for(;!(m=h(f()));)l();return a(),m}}function pc(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function Xp(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const L2="0.1.1";function B2(){return L2}class be extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof be){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof be&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
|
|
158
|
+
`);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@${B2()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Qp(this,t)}}function Qp(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Qp(e.cause,t):t?null:e}const k2="#__bigint";function R2(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+k2:o,n)}function F2(e,t){if(th(e)>t)throw new q2({givenSize:th(e),maxSize:t})}const nn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Jp(e){if(e>=nn.zero&&e<=nn.nine)return e-nn.zero;if(e>=nn.A&&e<=nn.F)return e-(nn.A-10);if(e>=nn.a&&e<=nn.f)return e-(nn.a-10)}function D2(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Z2({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 hc(e,t){if(ut(e)>t)throw new J2({givenSize:ut(e),maxSize:t})}function j2(e,t){if(typeof t=="number"&&t>0&&t>ut(e)-1)throw new ah({offset:t,position:"start",size:ut(e)})}function _2(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ut(e)!==n-t)throw new ah({offset:n,position:"end",size:ut(e)})}function eh(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new e6({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const U2=new TextEncoder;function z2(e){return e instanceof Uint8Array?e:typeof e=="string"?H2(e):W2(e)}function W2(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function H2(e,t={}){const{size:n}=t;let r=e;n&&(hc(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=Jp(o.charCodeAt(a++)),l=Jp(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new be(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function V2(e,t={}){const{size:n}=t,r=U2.encode(e);return typeof n=="number"?(F2(r,n),G2(r,n)):r}function G2(e,t){return D2(e,{dir:"right",size:t})}function th(e){return e.length}let q2=class extends be{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Z2=class extends be{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const K2=new TextEncoder,Y2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function X2(e,t={}){const{strict:n=!1}=t;if(!e)throw new sh(e);if(typeof e!="string")throw new sh(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new ih(e);if(!e.startsWith("0x"))throw new ih(e)}function Dt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function nh(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(hc(n,t.size),_n(n,t.size)):n}function rh(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Y2[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(hc(r,t.size),Un(r,t.size)):r}function Re(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const u=typeof e=="bigint"?"n":"";throw new oh({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?_n(a,r):a}function mc(e,t={}){return rh(K2.encode(e),t)}function _n(e,t){return eh(e,{dir:"left",size:t})}function Un(e,t){return eh(e,{dir:"right",size:t})}function gc(e,t,n,r={}){const{strict:o}=r;j2(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&_2(s,t,n),s}function ut(e){return Math.ceil((e.length-2)/2)}function Q2(e,t={}){const{strict:n=!1}=t;try{return X2(e,{strict:n}),!0}catch{return!1}}class oh extends be{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class sh extends be{constructor(t){super(`Value \`${typeof t=="object"?R2(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class ih extends be{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class J2 extends be{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class ah extends be{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class e6 extends be{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function t6(e){return{address:e.address,amount:Re(e.amount),index:Re(e.index),validatorIndex:Re(e.validatorIndex)}}function ch(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Re(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Re(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Re(e.gasLimit)},...typeof e.number=="bigint"&&{number:Re(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Re(e.prevRandao)},...typeof e.time=="bigint"&&{time:Re(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(t6)}}}const bc=[{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"}],yc=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],uh=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],lh=[...uh,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],n6=[...uh,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],fh=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],dh=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],ph=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],r6=[{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"}]}],o6="0x82ad56cb",hh="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",s6="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",i6="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class vc extends H{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class mh extends H{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const wc="/docs/contract/encodeDeployData";function xc(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 dx({docsPath:wc});if(!("inputs"in o))throw new Sd({docsPath:wc});if(!o.inputs||o.inputs.length===0)throw new Sd({docsPath:wc});const s=Jt(o.inputs,n);return ur([r,s])}function gr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new vc({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new vc({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function gh(e,{docsPath:t,...n}){const r=(()=>{const o=Xa(e,n);return o instanceof Ns?e:o})();return new xp(r,{docsPath:t,...n})}function bh(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Ec=new Map;function yh({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<l.length;d++){const{resolve:h}=l[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<l.length;d++){const{reject:h}=l[d];h==null||h(p)}})},i=()=>Ec.delete(t),c=()=>a().map(({args:l})=>l),a=()=>Ec.get(t)||[],u=l=>Ec.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=bh();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:p,reject:d}),f):(u({args:l,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Po(e,t){var P,E,x,T;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:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,to:B,value:k,stateOverride:D,...j}=t,g=n?St(n):void 0;if(l&&(p||d))throw new H("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&B)throw new H("Cannot provide both `code` & `to` as parameters.");const w=l&&f,A=p&&d&&B&&f,I=w||A,N=w?u6({code:l,data:f}):A?l6({data:f,factory:p,factoryData:d,to:B}):f;try{Eo(t);const y=(typeof s=="bigint"?Q(s):void 0)||i,L=u?ch(u):void 0,F=Ja(D),U=(T=(x=(E=e.chain)==null?void 0:E.formatters)==null?void 0:x.transactionRequest)==null?void 0:T.format,V=(U||Is)({...Qa(j,{format:U}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:b,nonce:$,to:I?void 0:B,value:k});if(o&&a6({request:V})&&!F&&!L)try{return await c6(e,{...V,blockNumber:s,blockTag:i})}catch(K){if(!(K instanceof mh)&&!(K instanceof vc))throw K}const Z=(()=>{const K=[V,y];return F&&L?[...K,F,L]:F?[...K,F]:L?[...K,{},L]:K})(),W=await e.request({method:"eth_call",params:Z});return W==="0x"?{data:void 0}:{data:W}}catch(O){const y=f6(O),{offchainLookup:L,offchainLookupSignature:F}=await Promise.resolve().then(()=>h5);if(e.ccipRead!==!1&&(y==null?void 0:y.slice(0,10))===F&&B)return{data:await L(e,{data:y,to:B})};throw I&&(y==null?void 0:y.slice(0,10))==="0x101bb98d"?new WE({factory:p}):gh(O,{...t,account:g,chain:e.chain})}}function a6({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(o6)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function c6(e,t){var m;const{batchSize:n=1024,wait:r=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:i,multicallAddress:c,to:a}=t;let u=c;if(!u){if(!e.chain)throw new mh;u=gr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?Q(o):void 0)||s,{schedule:p}=yh({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(v){return v.reduce((b,{data:$})=>b+($.length-2),0)>n*2},fn:async v=>{const C=v.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),b=Rt({abi:bc,args:[C],functionName:"aggregate3"}),$=await e.request({method:"eth_call",params:[{data:b,to:u},f]});return Dn({abi:bc,args:[C],functionName:"aggregate3",data:$||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Ts({data:d});return d==="0x"?{data:void 0}:{data:d}}function u6(e){const{code:t,data:n}=e;return xc({abi:vd(["constructor(bytes, bytes)"]),bytecode:hh,args:[t,n]})}function l6(e){const{data:t,factory:n,factoryData:r,to:o}=e;return xc({abi:vd(["constructor(address, bytes, address, bytes)"]),bytecode:s6,args:[o,t,n,r]})}function f6(e){var n;if(!(e instanceof H))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function rn(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Rt({abi:n,args:o,functionName:s});try{const{data:a}=await J(e,Po,"call")({...i,data:c,to:r});return Dn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw hr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function d6(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?St(c.account):e.account,u=Rt({abi:n,args:o,functionName:i});try{const{data:l}=await J(e,Po,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Dn({abi:n,args:o,functionName:i,data:l||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw hr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const Sc=new Map,vh=new Map;let p6=0;function xn(e,t,n){const r=++p6,o=()=>Sc.get(e)||[],s=()=>{const l=o();Sc.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=vh.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(Sc.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[l])==null||h.call(d,...f)};const u=n(a);return typeof u=="function"&&vh.set(e,u),i}async function Pc(e){return new Promise(t=>setTimeout(t,e))}function $o(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await Pc(a);const u=async()=>{o&&(await e({unpoll:s}),await Pc(r),u())};u()})(),s}const h6=new Map,m6=new Map;function g6(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,h6),r=t(e,m6);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function b6(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=g6(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 y6=e=>`blockNumber.${e}`;async function Ao(e,{cacheTime:t=e.cacheTime}={}){const n=await b6(()=>e.request({method:"eth_blockNumber"}),{cacheKey:y6(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=>tn(s));return!("abi"in t)||!t.abi?o:ic({abi:t.abi,logs:o,strict:n})}async function Fs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function v6(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 v=p??!1,C=Ae(["watchContractEvent",r,o,s,e.uid,i,f,v,c]);return xn(C,{onLogs:u,onError:a},b=>{let $;c!==void 0&&($=c-1n);let B,k=!1;const D=$o(async()=>{var j;if(!k){try{B=await J(e,ap,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:v,fromBlock:c})}catch{}k=!0;return}try{let g;if(B)g=await J(e,Rs,"getFilterChanges")({filter:B});else{const w=await J(e,Ao,"getBlockNumber")({});$&&$<w?g=await J(e,Gp,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:$+1n,toBlock:w,strict:v}):g=[],$=w}if(g.length===0)return;if(s)b.onLogs(g);else for(const w of g)b.onLogs([w])}catch(g){B&&g instanceof Rn&&(k=!1),(j=b.onError)==null||j.call(b,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await J(e,Fs,"uninstallFilter")({filter:B}),D()}})})():(()=>{const v=p??!1,C=Ae(["watchContractEvent",r,o,s,e.uid,i,f,v]);let b=!0,$=()=>b=!1;return xn(C,{onLogs:u,onError:a},B=>((async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),D=i?Xr({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await k.subscribe({params:["logs",{address:r,topics:D}],onData(g){var A;if(!b)return;const w=g.result;try{const{eventName:I,args:N}=sc({abi:n,data:w.data,topics:w.topics,strict:p}),P=tn(w,{args:N,eventName:I});B.onLogs([P])}catch(I){let N,P;if(I instanceof Gr||I instanceof ys){if(p)return;N=I.abiItem.name,P=(A=I.abiItem.inputs)==null?void 0:A.some(x=>!("name"in x&&x.name))}const E=tn(w,{args:P?[]:{},eventName:N});B.onLogs([E])}},onError(g){var w;(w=B.onError)==null||w.call(B,g)}});$=j,b||$()}catch(k){a==null||a(k)}})(),()=>$()))})()}async function w6(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function $c(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await Pc(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 x6={"0x0":"reverted","0x1":"success"};function E6(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>tn(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Zt(e.transactionIndex):null,status:e.status?x6[e.status]:null,type:e.type?Op[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const Ac=256;let Ds=Ac,js;function wh(e=11){if(!js||Ds+e>Ac*2){js="",Ds=0;for(let t=0;t<Ac;t++)js+=(256+Math.random()*256|0).toString(16).substring(1)}return js.substring(Ds,Ds+++e)}function S6(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,f=e.cacheTime??l,p=e.account?St(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),v={...d,...m},C={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:v,type:i,uid:wh(),...c?{experimental_blockTag:c}:{}};function b($){return B=>{const k=B($);for(const j in C)delete k[j];const D={...$,...k};return Object.assign(D,{extend:b(D)})}}return Object.assign(C,{extend:b(C)})}const _s=new Ma(8192);function P6(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(_s.get(n))return _s.get(n);const r=e().finally(()=>_s.delete(n));return _s.set(n,r),r}function $6(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(u))throw new Fn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Fn(new Error("method not supported"),{method:u});const l=o?qr(`${a}.${Ae(n)}`):void 0;return P6(()=>$c(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d,{method:n.method});case oo.code:throw new oo(d);case kn.code:throw new kn(d);case Rn.code:throw new Rn(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case Fn.code:throw new Fn(d,{method:n.method});case dr.code:throw new dr(d);case co.code:throw new co(d);case pr.code:throw new pr(d);case uo.code:throw new uo(d);case lo.code:throw new lo(d);case fo.code:throw new fo(d);case po.code:throw new po(d);case ho.code:throw new ho(d);case mo.code:throw new mo(d);case go.code:throw new go(d);case bo.code:throw new bo(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case wo.code:throw new wo(d);case xo.code:throw new xo(d);case 5e3:throw new pr(d);default:throw p instanceof H?p:new VE(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Bn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>A6(p)}),{enabled:o,id:l})}}function A6(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===dr.code||e.code===kn.code:e instanceof Bn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function T6({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=wh();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:$6(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class C6 extends H{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 O6(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function N6(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const xh=N6();function I6(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 O6(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ae(r.map($=>({jsonrpc:"2.0",id:$.id??xh.take(),...$}))):Ae({jsonrpc:"2.0",id:r.id??xh.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},v=new Request(e,m),C=await(o==null?void 0:o(v,m))??{...m,url:e};return await fetch(C.url??e,C)},{errorInstance:new Ep({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let d;if((f=p.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))d=await p.json();else{d=await p.text();try{d=JSON.parse(d||"{}")}catch(h){if(p.ok)throw h;d={error:d}}}if(!p.ok)throw new Bn({body:r,details:Ae(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof Bn||p instanceof Ep?p:new Bn({body:r,cause:p,url:e})}}}}function M6(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:{},v=t.retryCount??p,C=d??t.timeout??1e4,b=f==null?void 0:f.rpcUrls.default.http[0];if(!b)throw new C6;const $=I6(b,{fetchOptions:r,onRequest:c,onResponse:a,timeout:C});return T6({key:o,methods:s,name:i,async request({method:B,params:k}){const D={method:B,params:k},{schedule:j}=yh({id:b,wait:m,shouldSplitBatch(I){return I.length>h},fn:I=>$.request({body:I}),sort:(I,N)=>I.id-N.id}),g=async I=>n?j(I):[await $.request({body:I})],[{error:w,result:A}]=await g(D);if(l)return{error:w,result:A};if(w)throw new za({body:D,error:w,url:b});return A},retryCount:v,retryDelay:u,timeout:C,type:"http"},{fetchOptions:r,url:b})}}function Tc(e,t){var r,o,s,i,c,a;if(!(e instanceof H))return!1;const n=e.walk(u=>u instanceof Ua);return n instanceof Ua?!!(((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===up[50]):!1}function L6(e){const{abi:t,data:n}=e,r=lr(n,0,4),o=t.find(s=>s.type==="function"&&r===Yr(yt(s)));if(!o)throw new yx(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Qr(o.inputs,lr(n,4)):void 0}}const Cc="/docs/contract/encodeErrorResult";function Eh(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Ln({abi:t,args:r,name:n});if(!a)throw new $d(n,{docsPath:Cc});o=a}if(o.type!=="error")throw new $d(void 0,{docsPath:Cc});const s=yt(o),i=Yr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new gx(o.name,{docsPath:Cc});c=Jt(o.inputs,r)}return ur([i,c])}const Oc="/docs/contract/encodeFunctionResult";function B6(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Ln({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Oc});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Oc});if(!o.outputs)throw new Od(o.name,{docsPath:Oc});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Nd(r)})();return Jt(o.outputs,s)}const Us="x-batch-gateway:true";async function Sh(e){const{data:t,ccipRequest:n}=e,{args:[r]}=L6({abi:yc,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Us)?await Sh({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=k6(a)}})),B6({abi:yc,functionName:"query",result:[o,s]})}function k6(e){return e.name==="HttpRequestError"&&e.status?Eh({abi:yc,errorName:"HttpError",args:[e.status,e.shortMessage]}):Eh({abi:[lp],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Ph(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return vt(t)?t:null}function zs(e){let t=new Uint8Array(32).fill(0);if(!e)return $e(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=Ph(n[r]),s=o?or(o):Ne(Mn(n[r]),"bytes");t=Ne(Et([t,s]),"bytes")}return $e(t)}function R6(e){return`[${e.slice(2)}]`}function F6(e){const t=new Uint8Array(32).fill(0);return e?Ph(e)||Ne(Mn(e)):$e(t)}function Ws(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(R6(F6(o[s])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function D6(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return gr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f=Rt({abi:dh,functionName:"addr",...o!=null?{args:[zs(s),BigInt(o)]}:{args:[zs(s)]}}),p={address:u,abi:lh,functionName:"resolve",args:[Kt(Ws(s)),f,i??[Us]],blockNumber:n,blockTag:r},h=await J(e,rn,"readContract")(p);if(h[0]==="0x")return null;const m=Dn({abi:dh,args:o!=null?[zs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||In(m)==="0x00"?null:m}catch(f){if(c)throw f;if(Tc(f,"resolve"))return null;throw f}}class j6 extends H{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class To extends H{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Nc extends H{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class _6 extends H{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const U6=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,z6=/^(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>\/.*)?$/,W6=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,H6=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function V6(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function $h(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Ah({uri:e,gatewayUrls:t}){const n=W6.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=$h(t==null?void 0:t.ipfs,"https://ipfs.io"),o=$h(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(U6),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||z6.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(H6,"");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 Nc({uri:e})}function Th(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new j6({data:e});return e.image||e.image_url||e.image_data}async function G6({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Ic({gatewayUrls:e,uri:Th(n)})}catch{throw new Nc({uri:t})}}async function Ic({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Ah({uri:t,gatewayUrls:e});if(r||await V6(n))return n;throw new Nc({uri:t})}function q6(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new To({reason:"Only EIP-155 supported"});if(!i)throw new To({reason:"Chain ID not found"});if(!a)throw new To({reason:"Contract address not found"});if(!o)throw new To({reason:"Token ID not found"});if(!c)throw new To({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Z6(e,{nft:t}){if(t.namespace==="erc721")return rn(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return rn(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new _6({namespace:t.namespace})}async function K6(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Y6(e,{gatewayUrls:t,record:n}):Ic({uri:n,gatewayUrls:t})}async function Y6(e,{gatewayUrls:t,record:n}){const r=q6(n),o=await Z6(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Ah({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return Ic({uri:Th(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),G6({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ch(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return gr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f={address:u,abi:lh,functionName:"resolve",args:[Kt(Ws(s)),Rt({abi:fh,functionName:"text",args:[zs(s),o]}),i??[Us]],blockNumber:n,blockTag:r},d=await J(e,rn,"readContract")(f);if(d[0]==="0x")return null;const h=Dn({abi:fh,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Tc(f,"resolve"))return null;throw f}}async function X6(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await J(e,Ch,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await K6(e,{record:a,gatewayUrls:r})}catch{return null}}async function Q6(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=gr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:n6,functionName:"reverse",args:[Kt(Ws(a))],blockNumber:n,blockTag:r},l=J(e,rn,"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(Tc(u,"reverse"))return null;throw u}}async function J6(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return gr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await J(e,rn,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Kt(Ws(o))],blockNumber:n,blockTag:r});return a}async function Oh(e,t){var v,C,b;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?St(n):void 0;try{Eo(t);const B=(typeof r=="bigint"?Q(r):void 0)||o,k=(b=(C=(v=e.chain)==null?void 0:v.formatters)==null?void 0:C.transactionRequest)==null?void 0:b.format,j=(k||Is)({...Qa(h,{format:k}),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($){throw gh($,{...t,account:m,chain:e.chain})}}async function e5(e){const t=$s(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Nh(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=$s(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>Xr({abi:[d],eventName:d.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?Q(s):s,toBlock:typeof c=="bigint"?Q(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:u(f),strict:!!i,toBlock:c,type:"event"}}async function Ih(e){const t=$s(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function t5(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function n5(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 Mh(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?Q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class r5 extends H{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function o5(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await J(e,rn,"readContract")({abi:s5,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 r5({address:n}):i}}const s5=[{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 i5(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 a5(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 i5(i)}async function c5(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>tn(s));return t.abi?ic({abi:t.abi,logs:o,strict:n}):o}class u5 extends H{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${eo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class l5 extends H{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${eo(n)}`,`Response: ${Ae(t)}`],name:"OffchainLookupResponseMalformedError"})}}class f5 extends H{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const d5="0x556f1830",Lh={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 p5(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=hp({data:r,abi:[Lh]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Bh;try{if(!Ms(o,i))throw new f5({sender:i,to:o});const d=c.includes(Us)?await Sh({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Po(e,{blockNumber:t,blockTag:n,data:Et([u,Jt([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new u5({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function Bh({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let f;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await l.json()).data:f=await l.text(),!l.ok){r=new Bn({body:a,details:f!=null&&f.error?Ae(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!vt(f)){r=new l5({result:f,url:i});continue}return f}catch(l){r=new Bn({body:a,details:l.message,url:i})}}throw r}const h5=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Bh,offchainLookup:p5,offchainLookupAbiItem:Lh,offchainLookupSignature:d5},Symbol.toStringTag,{value:"Module"}));function m5(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class g5 extends H{constructor({domain:t}){super(`Invalid domain "${Ae(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class b5 extends H{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class y5 extends H{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function v5(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:P5({domain:t}),...e.types};S5({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(w5({domain:t,types:o})),r!=="EIP712Domain"&&s.push(kh({data:n,primaryType:r,types:o})),Ne(Et(s))}function w5({domain:e,types:t}){return kh({data:e,primaryType:"EIP712Domain",types:t})}function kh({data:e,primaryType:t,types:n}){const r=Rh({data:e,primaryType:t,types:n});return Ne(r)}function Rh({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[x5({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Dh({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Jt(r,o)}function x5({primaryType:e,types:t}){const n=Kt(E5({primaryType:e,types:t}));return Ne(n)}function E5({primaryType:e,types:t}){let n="";const r=Fh({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 Fh({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])Fh({primaryType:s.type,types:t},n);return n}function Dh({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ne(Rh({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ne(r)];if(n==="string")return[{type:"bytes32"},Ne(Kt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Dh({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ne(Jt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function S5(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(rp);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,v,C]=p;Q(f,{signed:v==="int",size:Number.parseInt(C)/8})}if(l==="address"&&typeof f=="string"&&!ct(f))throw new yn({address:f});const d=l.match(uE);if(d){const[m,v]=d;if(v&&we(f)!==Number.parseInt(v))throw new wx({expectedSize:Number.parseInt(v),givenSize:we(f)})}const h=o[l];h&&($5(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new g5({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new b5({primaryType:r,types:o})}function P5({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 $5(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new y5({type:e})}const A5=`Ethereum Signed Message:
|
|
159
|
+
`;function T5(e){const t=typeof e=="string"?qr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=qr(`${A5}${we(t)}`);return Et([n,t])}function jh(e,t){return Ne(T5(e),t)}const _h="0x6492649264926492649264926492649264926492649264926492649264926492";function C5(e){return np(e,-32)===_h}function O5(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=ur([Jt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),_h]);return o==="hex"?s:xt(s)}function N5(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function I5(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Zt(e.nonce):void 0,storageProof:e.storageProof?N5(e.storageProof):void 0}}async function M5(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 I5(c)}async function L5(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?Q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Mc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,p;const i=r||"latest",c=n!==void 0?Q(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Q(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,Q(s)]},{dedupe:!!c}),!a)throw new vp({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((p=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.transaction)==null?void 0:p.format)||Np)(a)}async function B5(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([J(e,Ao,"getBlockNumber")({}),t?J(e,Mc,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function Hs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new wp({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||E6)(n)}async function k5(e,t){var C;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((C=e.batch)==null?void 0:C.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=gr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let b=0;b<u.length;b++){const{abi:$,address:B,args:k,functionName:D}=u[b];try{const j=Rt({abi:$,args:k,functionName:D});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=hr(j,{abi:$,address:B,args:k,docsPath:"/docs/contract/multicall",functionName:D,sender:n});if(!r)throw g;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(p.map(b=>J(e,rn,"readContract")({abi:bc,account:n,address:f,args:[b],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),v=[];for(let b=0;b<m.length;b++){const $=m[b];if($.status==="rejected"){if(!r)throw $.reason;for(let k=0;k<p[b].length;k++)v.push({status:"failure",error:$.reason,result:void 0});continue}const B=$.value;for(let k=0;k<B.length;k++){const{returnData:D,success:j}=B[k],{callData:g}=p[b][k],{abi:w,address:A,functionName:I,args:N}=u[v.length];try{if(g==="0x")throw new Vr;if(!j)throw new Ts({data:D});const P=Dn({abi:w,args:N,data:D,functionName:I});v.push(r?{result:P,status:"success"}:P)}catch(P){const E=hr(P,{abi:w,address:A,args:N,docsPath:"/docs/contract/multicall",functionName:I});if(!r)throw E;v.push({error:E,result:void 0,status:"failure"})}}}if(v.length!==u.length)throw new H("multicall results mismatch");return v}async function Lc(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?ch(p.blockOverrides):void 0,h=p.calls.map(v=>{const C=v,b=C.account?St(C.account):void 0,$=C.abi?Rt(C):C.data,B={...C,data:C.dataSuffix?Et([$||"0x",C.dataSuffix]):$,from:C.from??(b==null?void 0:b.address)};return Eo(B),Is(B)}),m=p.stateOverrides?Ja(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)=>({...Ip(p),calls:p.calls.map((h,m)=>{var A,I;const{abi:v,args:C,functionName:b,to:$}=o[d].calls[m],B=((A=h.error)==null?void 0:A.data)??h.returnData,k=BigInt(h.gasUsed),D=(I=h.logs)==null?void 0:I.map(N=>tn(N)),j=h.status==="0x1"?"success":"failure",g=v&&j==="success"&&B!=="0x"?Dn({abi:v,data:B,functionName:b}):null,w=(()=>{var P;if(j==="success")return;let N;if(((P=h.error)==null?void 0:P.data)==="0x"?N=new Vr:h.error&&(N=new Ts(h.error)),!!N)return hr(N,{abi:v??[],address:$??"0x",args:C,functionName:b??"<unknown>"})})();return{data:B,gasUsed:k,logs:D,status:j,...j==="success"?{result:g}:{error:w}}})}))}catch(a){const u=a,l=Xa(u,{});throw l instanceof Ns?u:l}}function Uh(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Xd(z2(e));return n==="Bytes"?r:rh(r)}class R5 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 Bc={checksum:new R5(8192)}.checksum,F5=/^0x[a-fA-F0-9]{40}$/;function Vs(e,t={}){const{strict:n=!0}=t;if(!F5.test(e))throw new zh({address:e,cause:new j5});if(n){if(e.toLowerCase()===e)return;if(D5(e)!==e)throw new zh({address:e,cause:new _5})}}function D5(e){if(Bc.has(e))return Bc.get(e);Vs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Uh(V2(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 Bc.set(e,o),o}function kc(e,t={}){const{strict:n=!0}=t??{};try{return Vs(e,{strict:n}),!0}catch{return!1}}class zh extends be{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class j5 extends be{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class _5 extends be{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function 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 be("Unable to normalize signature.");return o}function Fc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return kc(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)=>Fc(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=>Fc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Wh(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return Wh(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?kc(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?kc(n[r],{strict:!1}):!1)return i}}function Hh(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?wd(e):e;return{...r,...n?{hash:br(r)}:{}}}function U5(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Q2(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?Vh(u)===gc(t,0,4):u.type==="event"?br(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Dc({name:t});if(i.length===1)return{...i[0],...o?{hash:br(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:br(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in u&&u.inputs[p];return d?Fc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Wh(u.inputs,c.inputs,r);if(f)throw new W5({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 Dc({name:t});return{...a,...o?{hash:br(a)}:{}}}function Vh(e){return gc(br(e),0,4)}function z5(e){const t=typeof e=="string"?e:gs(e);return Rc(t)}function br(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Uh(mc(z5(e)))}class W5 extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Rc(gs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Rc(gs(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 Dc extends be{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}const H5=/^(.*)\[([0-9]*)\]$/,V5=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Gh=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function G5({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(jc({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function jc({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=eS(r.type);if(o){const[s,i]=o;return Z5(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return J5(n,{checksumAddress:e,parameter:r});if(r.type==="address")return q5(n,{checksum:e});if(r.type==="bool")return Y5(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Gh.exec(r.type)??[];return X5(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return K5(n,{type:r.type});if(r.type==="string")return Q5(n);throw new Yh(r.type)}function _c(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ut(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Re(t+o,{size:32})),r.push(c),o+=ut(c)):n.push(c)}return Dt(...n,...r)}function q5(e,t){const{checksum:n=!1}=t;return Vs(e,{strict:n}),{dynamic:!1,encoded:_n(e.toLowerCase())}}function Z5(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new nS(e);if(!s&&e.length!==r)throw new tS({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=jc({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=_c(c);if(s){const u=Re(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Dt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Dt(...c.map(({encoded:a})=>a))}}function K5(e,{type:t}){const[,n]=t.split("bytes"),r=ut(e);if(!n){let o=e;return r%32!==0&&(o=Un(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Dt(_n(Re(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new Zh({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Un(e)}}function Y5(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:_n(nh(e))}}function X5(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new oh({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Re(e,{size:32,signed:t})}}function Q5(e){const t=mc(e),n=Math.ceil(ut(t)/32),r=[];for(let o=0;o<n;o++)r.push(Un(gc(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Dt(Un(Re(ut(t),{size:32})),...r)}}function J5(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=jc({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?_c(s):Dt(...s.map(({encoded:i})=>i))}}function eS(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function qh(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Kh({expectedLength:e.length,givenLength:t.length});const o=G5({checksumAddress:r,parameters:e,values:t}),s=_c(o);return s.length===0?"0x":s}function Uc(e,t){if(e.length!==t.length)throw new Kh({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(Uc.encode(o,s))}return Dt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Vs(a),_n(a.toLowerCase(),o?32:0)}if(n==="string")return mc(r);if(n==="bytes")return r;if(n==="bool")return _n(nh(r),o?32:1);const s=n.match(Gh);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l)/8;return Re(r,{size:o?32:f,signed:u==="int"})}const i=n.match(V5);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new Zh({expectedSize:Number.parseInt(u),value:r});return Un(r,o?32:0)}const c=n.match(H5);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":Dt(...l)}throw new Yh(n)}e.encode=t})(Uc||(Uc={}));class tS extends be{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class Zh extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ut(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Kh extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
160
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class nS extends be{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Yh extends be{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function rS(e,t){var o;const{bytecode:n,args:r}=t;return Dt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?qh(e.inputs,r):"0x")}function oS(e){return Hh(e)}function sS(e,...t){const{overloads:n}=e,r=n?iS([e,...n],e.name,{args:t[0]}):e,o=aS(r),s=t.length>0?qh(r.inputs,t[0]):void 0;return s?Dt(o,s):o}function yr(e,t={}){return Hh(e,t)}function iS(e,t,n){const r=U5(e,t,n);if(r.type!=="function")throw new Dc({name:t,type:"function"});return r}function aS(e){return Vh(e)}const cS="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",jt="0x0000000000000000000000000000000000000000",uS="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function lS(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?St(t.account):void 0;if(i&&!u)throw new H("`account` is required when `traceAssetChanges` is true");const l=u?rS(oS("constructor(bytes, bytes)"),{bytecode:hh,args:[uS,sS(yr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async y=>{if(!y.data&&!y.abi)return;const{accessList:L}=await Oh(e,{account:u.address,...y,data:y.abi?Rt(y):y.data});return L.map(({address:F,storageKeys:U})=>U.length>0?F:null)})).then(y=>y.flat().filter(Boolean)):[],p=await Lc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((y,L)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]}]:[],{calls:[...o,{}].map(y=>({...y,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((y,L)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((y,L)=>({to:y,abi:[yr("function decimals() returns (uint256)")],functionName:"decimals",from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((y,L)=>({to:y,abi:[yr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((y,L)=>({to:y,abi:[yr("function symbol() returns (string)")],functionName:"symbol",from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,v,C,b,$,B]=i?p:[],{calls:k,...D}=d,j=k.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],w=(m==null?void 0:m.calls)??[],A=[...g,...w].map(y=>y.status==="success"?Bt(y.data):null),I=(v==null?void 0:v.calls)??[],N=(C==null?void 0:C.calls)??[],P=[...I,...N].map(y=>y.status==="success"?Bt(y.data):null),E=((b==null?void 0:b.calls)??[]).map(y=>y.status==="success"?y.result:null),x=((B==null?void 0:B.calls)??[]).map(y=>y.status==="success"?y.result:null),T=(($==null?void 0:$.calls)??[]).map(y=>y.status==="success"?y.result:null),O=[];for(const[y,L]of P.entries()){const F=A[y];if(typeof L!="bigint"||typeof F!="bigint")continue;const U=E[y-1],z=x[y-1],V=T[y-1],Z=y===0?{address:cS,decimals:18,symbol:"ETH"}:{address:f[y-1],decimals:V||U?Number(U??1):void 0,symbol:z??void 0};O.some(W=>W.token.address===Z.address)||O.push({token:Z,value:{pre:F,post:L,diff:L-F}})}return{assetChanges:O,block:D,results:j}}class Xh extends Na{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Dd(t);const r=Es(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),ar(s)}update(t){return ir(this),this.iHash.update(t),this}digestInto(t){ir(this),Xt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Qh=(e,t,n)=>new Xh(e,t).update(n).digest();Qh.create=(e,t)=>new Xh(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const He=BigInt(0),Fe=BigInt(1),zn=BigInt(2),Jh=BigInt(3),e0=BigInt(4),t0=BigInt(5),fS=BigInt(7),n0=BigInt(8),dS=BigInt(9),r0=BigInt(16);function $t(e,t){const n=e%t;return n>=He?n:t+n}function lt(e,t,n){let r=e;for(;t-- >He;)r*=r,r%=n;return r}function o0(e,t){if(e===He)throw new Error("invert: expected non-zero number");if(t<=He)throw new Error("invert: expected positive modulus, got "+t);let n=$t(e,t),r=t,o=He,s=Fe;for(;n!==He;){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 $t(o,t)}function zc(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function s0(e,t){const n=(e.ORDER+Fe)/e0,r=e.pow(t,n);return zc(e,r,t),r}function pS(e,t){const n=(e.ORDER-t0)/n0,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));return zc(e,c,t),c}function hS(e){const t=Co(e),n=i0(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+fS)/r0;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const f=c.mul(u,o),p=c.mul(u,s),d=c.eql(c.sqr(l),a),h=c.eql(c.sqr(f),a);u=c.cmov(u,l,d),l=c.cmov(p,f,h);const m=c.eql(c.sqr(l),a),v=c.cmov(u,l,m);return zc(c,v,a),v}}function i0(e){if(e<Jh)throw new Error("sqrt is not defined for small field");let t=e-Fe,n=0;for(;t%zn===He;)t/=zn,n++;let r=zn;const o=Co(e);for(;c0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return s0;let s=o.pow(r,t);const i=(t+Fe)/zn;return function(a,u){if(a.is0(u))return u;if(c0(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),p=a.pow(u,t),d=a.pow(u,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const v=Fe<<BigInt(l-h-1),C=a.pow(f,v);l=h,f=a.sqr(C),p=a.mul(p,f),d=a.mul(d,C)}return d}}function mS(e){return e%e0===Jh?s0:e%n0===t0?pS:e%r0===dS?hS(e):i0(e)}const gS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function bS(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=gS.reduce((r,o)=>(r[o]="function",r),t);return pc(e,n),e}function yS(e,t,n){if(n<He)throw new Error("invalid exponent, negatives unsupported");if(n===He)return e.ONE;if(n===Fe)return t;let r=e.ONE,o=t;for(;n>He;)n&Fe&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Fe;return r}function a0(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function c0(e,t){const n=(e.ORDER-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 u0(e,t){t!==void 0&&Zr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Co(e,t,n=!1,r={}){if(e<=He)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=t;p.BITS&&(o=p.BITS),p.sqrt&&(s=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(i=p.modFromBytes),c=p.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=u0(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:So(a),ZERO:He,ONE:Fe,allowedLengths:c,create:p=>$t(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return He<=p&&p<e},is0:p=>p===He,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Fe)===Fe,neg:p=>$t(-p,e),eql:(p,d)=>p===d,sqr:p=>$t(p*p,e),add:(p,d)=>$t(p+d,e),sub:(p,d)=>$t(p-d,e),mul:(p,d)=>$t(p*d,e),pow:(p,d)=>yS(f,p,d),div:(p,d)=>$t(p*o0(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>o0(p,e),sqrt:s||(p=>(l||(l=mS(e)),l(f,p))),toBytes:p=>n?Kp(p,u):fc(p,u),fromBytes:(p,d=!0)=>{if(c){if(!c.includes(p.length)||p.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+p.length);const m=new Uint8Array(u);m.set(p,n?0:m.length-p.length),p=m}if(p.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+p.length);let h=n?Zp(p):ks(p);if(i&&(h=$t(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>a0(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function l0(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function f0(e){const t=l0(e);return t+Math.ceil(t/2)}function vS(e,t,n=!1){const r=e.length,o=l0(t),s=f0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Zp(e):ks(e),c=$t(i,t-Fe)+Fe;return n?Kp(c,o):fc(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vr=BigInt(0),Wn=BigInt(1);function Gs(e,t){const n=t.negate();return e?n:t}function Wc(e,t){const n=a0(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function d0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Hc(e,t){d0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=So(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function p0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Wn);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 wS(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 xS(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 Vc=new WeakMap,h0=new WeakMap;function Gc(e){return h0.get(e)||1}function m0(e){if(e!==vr)throw new Error("invalid wNAF")}class ES{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>vr;)n&Wn&&(r=r.add(o)),o=o.double(),n>>=Wn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Hc(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let u=1;u<o;u++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=Hc(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:p,offsetF:d}=p0(r,c,i);r=a,l?s=s.add(Gs(p,n[d])):o=o.add(Gs(f,n[u]))}return m0(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Hc(t,this.bits);for(let i=0;i<s.windows&&r!==vr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=p0(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return m0(r),o}getPrecomputes(t,n,r){let o=Vc.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Vc.set(n,o))),o}cached(t,n,r){const o=Gc(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Gc(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){d0(n,this.bits),h0.set(t,n),Vc.delete(t)}hasCache(t){return Gc(t)!==1}}function SS(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>vr||r>vr;)n&Wn&&(s=s.add(o)),r&Wn&&(i=i.add(o)),o=o.double(),n>>=Wn,r>>=Wn;return{p1:s,p2:i}}function PS(e,t,n,r){wS(n,e),xS(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,c=Yp(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=So(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){l.fill(i);for(let m=0;m<s;m++){const v=r[m],C=Number(v>>BigInt(d)&u);l[C]=l[C].add(n[m])}let h=i;for(let m=l.length-1,v=i;m>0;m--)v=v.add(l[m]),h=h.add(v);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function g0(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return bS(t),t}else return Co(e,{isLE:n})}function $S(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const u=t[a];if(!(typeof u=="bigint"&&u>vr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=g0(t.p,n.Fp,r),s=g0(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!o.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const b0=(e,t)=>(e+(e>=0?t:-t)/y0)/t;function AS(e,t,n){const[[r,o],[s,i]]=t,c=b0(i*e,n),a=b0(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<sn,p=l<sn;f&&(u=-u),p&&(l=-l);const d=So(Math.ceil(Yp(n)/2))+wr;if(u<sn||u>=d||l<sn||l>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}function qc(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Zc(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Ls(n.lowS,"lowS"),Ls(n.prehash,"prehash"),n.format!==void 0&&qc(n.format),n}class TS extends Error{constructor(t=""){super(t)}}const on={Err:TS,_tlv:{encode:(e,t)=>{const{Err:n}=on;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=Bs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Bs(o.length/2|128):"";return Bs(e)+s+o+t},decode(e,t){const{Err:n}=on;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+a);if(u.length!==a)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=on;if(e<sn)throw new t("integer: negative integers are not allowed");let n=Bs(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=on;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ks(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=on,o=We("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=on,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},sn=BigInt(0),wr=BigInt(1),y0=BigInt(2),qs=BigInt(3),CS=BigInt(4);function xr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=We("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 OS(e,t={}){const n=$S("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;pc(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=w0(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(N,P,E){const{x,y:T}=P.toAffine(),O=r.toBytes(x);if(Ls(E,"isCompressed"),E){l();const y=!r.isOdd(T);return bn(v0(y),O)}else return bn(Uint8Array.of(4),O,r.toBytes(T))}function p(N){jn(N,void 0,"Point");const{publicKey:P,publicKeyUncompressed:E}=u,x=N.length,T=N[0],O=N.subarray(1);if(x===P&&(T===2||T===3)){const y=r.fromBytes(O);if(!r.isValid(y))throw new Error("bad point: is not on curve, wrong x");const L=m(y);let F;try{F=r.sqrt(L)}catch(V){const Z=V instanceof Error?": "+V.message:"";throw new Error("bad point: is not on curve, sqrt error"+Z)}l();const U=r.isOdd(F);return(T&1)===1!==U&&(F=r.neg(F)),{x:y,y:F}}else if(x===E&&T===4){const y=r.BYTES,L=r.fromBytes(O.subarray(0,y)),F=r.fromBytes(O.subarray(y,y*2));if(!v(L,F))throw new Error("bad point: is not on curve");return{x:L,y:F}}else throw new Error(`bad point: got length ${x}, expected compressed=${P} or uncompressed=${E}`)}const d=t.toBytes||f,h=t.fromBytes||p;function m(N){const P=r.sqr(N),E=r.mul(P,N);return r.add(r.add(E,r.mul(N,s.a)),s.b)}function v(N,P){const E=r.sqr(P),x=m(N);return r.eql(E,x)}if(!v(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const C=r.mul(r.pow(s.a,qs),CS),b=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(C,b)))throw new Error("bad curve params: a or b");function $(N,P,E=!1){if(!r.isValid(P)||E&&r.is0(P))throw new Error(`bad point coordinate ${N}`);return P}function B(N){if(!(N instanceof w))throw new Error("ProjectivePoint expected")}function k(N){if(!a||!a.basises)throw new Error("no endo");return AS(N,a.basises,o.ORDER)}const D=Xp((N,P)=>{const{X:E,Y:x,Z:T}=N;if(r.eql(T,r.ONE))return{x:E,y:x};const O=N.is0();P==null&&(P=O?r.ONE:r.inv(T));const y=r.mul(E,P),L=r.mul(x,P),F=r.mul(T,P);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(F,r.ONE))throw new Error("invZ was invalid");return{x:y,y:L}}),j=Xp(N=>{if(N.is0()){if(t.allowInfinityPoint&&!r.is0(N.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:E}=N.toAffine();if(!r.isValid(P)||!r.isValid(E))throw new Error("bad point: x or y not field elements");if(!v(P,E))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(N,P,E,x,T){return E=new w(r.mul(E.X,N),E.Y,E.Z),P=Gs(x,P),E=Gs(T,E),P.add(E)}class w{constructor(P,E,x){this.X=$("x",P),this.Y=$("y",E,!0),this.Z=$("z",x),Object.freeze(this)}static CURVE(){return s}static fromAffine(P){const{x:E,y:x}=P||{};if(!P||!r.isValid(E)||!r.isValid(x))throw new Error("invalid affine point");if(P instanceof w)throw new Error("projective point not allowed");return r.is0(E)&&r.is0(x)?w.ZERO:new w(E,x,r.ONE)}static fromBytes(P){const E=w.fromAffine(h(jn(P,void 0,"point")));return E.assertValidity(),E}static fromHex(P){return w.fromBytes(We("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,E=!0){return I.createCache(this,P),E||this.multiply(qs),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:E,Y:x,Z:T}=this,{X:O,Y:y,Z:L}=P,F=r.eql(r.mul(E,L),r.mul(O,T)),U=r.eql(r.mul(x,L),r.mul(y,T));return F&&U}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:E}=s,x=r.mul(E,qs),{X:T,Y:O,Z:y}=this;let L=r.ZERO,F=r.ZERO,U=r.ZERO,z=r.mul(T,T),V=r.mul(O,O),Z=r.mul(y,y),W=r.mul(T,O);return W=r.add(W,W),U=r.mul(T,y),U=r.add(U,U),L=r.mul(P,U),F=r.mul(x,Z),F=r.add(L,F),L=r.sub(V,F),F=r.add(V,F),F=r.mul(L,F),L=r.mul(W,L),U=r.mul(x,U),Z=r.mul(P,Z),W=r.sub(z,Z),W=r.mul(P,W),W=r.add(W,U),U=r.add(z,z),z=r.add(U,z),z=r.add(z,Z),z=r.mul(z,W),F=r.add(F,z),Z=r.mul(O,y),Z=r.add(Z,Z),z=r.mul(Z,W),L=r.sub(L,z),U=r.mul(Z,V),U=r.add(U,U),U=r.add(U,U),new w(L,F,U)}add(P){B(P);const{X:E,Y:x,Z:T}=this,{X:O,Y:y,Z:L}=P;let F=r.ZERO,U=r.ZERO,z=r.ZERO;const V=s.a,Z=r.mul(s.b,qs);let W=r.mul(E,O),K=r.mul(x,y),G=r.mul(T,L),X=r.add(E,x),ee=r.add(O,y);X=r.mul(X,ee),ee=r.add(W,K),X=r.sub(X,ee),ee=r.add(E,T);let fe=r.add(O,L);return ee=r.mul(ee,fe),fe=r.add(W,G),ee=r.sub(ee,fe),fe=r.add(x,T),F=r.add(y,L),fe=r.mul(fe,F),F=r.add(K,G),fe=r.sub(fe,F),z=r.mul(V,ee),F=r.mul(Z,G),z=r.add(F,z),F=r.sub(K,z),z=r.add(K,z),U=r.mul(F,z),K=r.add(W,W),K=r.add(K,W),G=r.mul(V,G),ee=r.mul(Z,ee),K=r.add(K,G),G=r.sub(W,G),G=r.mul(V,G),ee=r.add(ee,G),W=r.mul(K,ee),U=r.add(U,W),W=r.mul(fe,ee),F=r.mul(X,F),F=r.sub(F,W),W=r.mul(X,K),z=r.mul(fe,z),z=r.add(z,W),new w(F,U,z)}subtract(P){return this.add(P.negate())}is0(){return this.equals(w.ZERO)}multiply(P){const{endo:E}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let x,T;const O=y=>I.cached(this,y,L=>Wc(w,L));if(E){const{k1neg:y,k1:L,k2neg:F,k2:U}=k(P),{p:z,f:V}=O(L),{p:Z,f:W}=O(U);T=V.add(W),x=g(E.beta,z,Z,y,F)}else{const{p:y,f:L}=O(P);x=y,T=L}return Wc(w,[x,T])[0]}multiplyUnsafe(P){const{endo:E}=t,x=this;if(!o.isValid(P))throw new Error("invalid scalar: out of range");if(P===sn||x.is0())return w.ZERO;if(P===wr)return x;if(I.hasCache(this))return this.multiply(P);if(E){const{k1neg:T,k1:O,k2neg:y,k2:L}=k(P),{p1:F,p2:U}=SS(w,x,O,L);return g(E.beta,F,U,T,y)}else return I.unsafe(x,P)}multiplyAndAddUnsafe(P,E,x){const T=this.multiplyUnsafe(E).add(P.multiplyUnsafe(x));return T.is0()?void 0:T}toAffine(P){return D(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===wr?!0:P?P(w,this):I.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===wr?this:P?P(w,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return Ls(P,"isCompressed"),this.assertValidity(),d(w,this,P)}toHex(P=!0){return cr(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 Wc(w,P)}static msm(P,E){return PS(w,o,P,E)}static fromPrivateKey(P){return w.BASE.multiply(xr(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 A=o.BITS,I=new ES(w,t.endo?Math.ceil(A/2):A);return w.BASE.precompute(8),w}function v0(e){return Uint8Array.of(e?2:3)}function w0(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function NS(e,t={}){const{Fn:n}=e,r=t.randomBytes||Hd,o=Object.assign(w0(e.Fp,n),{seed:f0(n.ORDER)});function s(d){try{return!!xr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:v}=o;try{const C=d.length;return h===!0&&C!==m||h===!1&&C!==v?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return vS(jn(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(xr(n,d)).toBytes(h)}function u(d){const h=c(d);return{secretKey:h,publicKey:a(h)}}function l(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:v}=o;if(n.allowedLengths||h===m)return;const C=We("key",d).length;return C===m||C===v}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 v=xr(n,d);return e.fromHex(h).multiply(v).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:d=>xr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function IS(e,t,n={}){Dd(t),pc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Hd,o=n.hmac||((E,...x)=>Qh(t,E,bn(...x))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d}=NS(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function v(E){const x=c>>wr;return E>x}function C(E,x){if(!i.isValidNot0(x))throw new Error(`invalid signature ${E}: out of range 1..Point.Fn.ORDER`);return x}function b(E,x){qc(x);const T=d.signature,O=x==="compact"?T:x==="recovered"?T+1:void 0;return jn(E,O,`${x} signature`)}class ${constructor(x,T,O){this.r=C("r",x),this.s=C("s",T),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(x,T=m){b(x,T);let O;if(T==="der"){const{r:U,s:z}=on.toSig(jn(x));return new $(U,z)}T==="recovered"&&(O=x[0],T="compact",x=x.subarray(1));const y=i.BYTES,L=x.subarray(0,y),F=x.subarray(y,y*2);return new $(i.fromBytes(L),i.fromBytes(F),O)}static fromHex(x,T){return this.fromBytes(xs(x),T)}addRecoveryBit(x){return new $(this.r,this.s,x)}recoverPublicKey(x){const T=s.ORDER,{r:O,s:y,recovery:L}=this;if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");if(c*y0<T&&L>1)throw new Error("recovery id is ambiguous for h>1 curve");const U=L===2||L===3?O+c:O;if(!s.isValid(U))throw new Error("recovery id 2 or 3 invalid");const z=s.toBytes(U),V=e.fromBytes(bn(v0((L&1)===0),z)),Z=i.inv(U),W=k(We("msgHash",x)),K=i.create(-W*Z),G=i.create(y*Z),X=e.BASE.multiplyUnsafe(K).add(V.multiplyUnsafe(G));if(X.is0())throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return v(this.s)}toBytes(x=m){if(qc(x),x==="der")return xs(on.hexFromSig(this));const T=i.toBytes(this.r),O=i.toBytes(this.s);if(x==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return bn(Uint8Array.of(this.recovery),T,O)}return bn(T,O)}toHex(x){return cr(this.toBytes(x))}assertValidity(){}static fromCompact(x){return $.fromBytes(We("sig",x),"compact")}static fromDER(x){return $.fromBytes(We("sig",x),"der")}normalizeS(){return this.hasHighS()?new $(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return cr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return cr(this.toBytes("compact"))}}const B=n.bits2int||function(x){if(x.length>8192)throw new Error("input is too large");const T=ks(x),O=x.length*8-a;return O>0?T>>BigInt(O):T},k=n.bits2int_modN||function(x){return i.create(B(x))},D=So(a);function j(E){return I2("num < 2^"+a,E,sn,D),i.toBytes(E)}function g(E,x){return jn(E,void 0,"message"),x?jn(t(E),void 0,"prehashed message"):E}function w(E,x,T){if(["recovered","canonical"].some(K=>K in T))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:y,extraEntropy:L}=Zc(T,h);E=g(E,y);const F=k(E),U=xr(i,x),z=[j(U),j(F)];if(L!=null&&L!==!1){const K=L===!0?r(d.secretKey):L;z.push(We("extraEntropy",K))}const V=bn(...z),Z=F;function W(K){const G=B(K);if(!i.isValidNot0(G))return;const X=i.inv(G),ee=e.BASE.multiply(G).toAffine(),fe=i.create(ee.x);if(fe===sn)return;const xe=i.create(X*i.create(Z+fe*U));if(xe===sn)return;let oe=(ee.x===fe?0:2)|Number(ee.y&wr),ue=xe;return O&&v(xe)&&(ue=i.neg(xe),oe^=1),new $(fe,ue,oe)}return{seed:V,k2sig:W}}function A(E,x,T={}){E=We("message",E);const{seed:O,k2sig:y}=w(E,x,T);return M2(t.outputLen,i.BYTES,o)(O,y)}function I(E){let x;const T=typeof E=="string"||ws(E),O=!T&&E!==null&&typeof E=="object"&&typeof E.r=="bigint"&&typeof E.s=="bigint";if(!T&&!O)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(O)x=new $(E.r,E.s);else if(T){try{x=$.fromBytes(We("sig",E),"der")}catch(y){if(!(y instanceof on.Err))throw y}if(!x)try{x=$.fromBytes(We("sig",E),"compact")}catch{return!1}}return x||!1}function N(E,x,T,O={}){const{lowS:y,prehash:L,format:F}=Zc(O,h);if(T=We("publicKey",T),x=g(We("message",x),L),"strict"in O)throw new Error("options.strict was renamed to lowS");const U=F===void 0?I(E):$.fromBytes(We("sig",E),F);if(U===!1)return!1;try{const z=e.fromBytes(T);if(y&&U.hasHighS())return!1;const{r:V,s:Z}=U,W=k(x),K=i.inv(Z),G=i.create(W*K),X=i.create(V*K),ee=e.BASE.multiplyUnsafe(G).add(z.multiplyUnsafe(X));return ee.is0()?!1:i.create(ee.x)===V}catch{return!1}}function P(E,x,T={}){const{prehash:O}=Zc(T,h);return x=g(x,O),$.fromBytes(E,"recovered").recoverPublicKey(x).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:A,verify:N,recoverPublicKey:P,Signature:$,hash:t})}function MS(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=Co(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function LS(e){const{CURVE:t,curveOpts:n}=MS(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function BS(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,u0(n.Fn.ORDER,n.Fn.BITS))})}function kS(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=LS(e),s=OS(t,n),i=IS(s,r,o);return BS(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function RS(e,t){const n=r=>kS({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Kc={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},FS={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},x0=BigInt(2);function DS(e){const t=Kc.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=lt(l,n,t)*l%t,p=lt(f,n,t)*l%t,d=lt(p,x0,t)*u%t,h=lt(d,o,t)*d%t,m=lt(h,s,t)*h%t,v=lt(m,c,t)*m%t,C=lt(v,a,t)*v%t,b=lt(C,c,t)*m%t,$=lt(b,n,t)*l%t,B=lt($,i,t)*h%t,k=lt(B,r,t)*u%t,D=lt(k,x0,t);if(!Yc.eql(Yc.sqr(D),e))throw new Error("Cannot find square root");return D}const Yc=Co(Kc.p,{sqrt:DS}),E0=RS({...Kc,Fp:Yc,lowS:!0,endo:FS},Rp),jS=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:E0},Symbol.toStringTag,{value:"Module"}));function _S({r:e,s:t,to:n="hex",v:r,yParity:o}){const s=(()=>{if(o===0||o===1)return o;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new E0.Signature(Bt(e),Bt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:xt(i)}async function Xc(e,t){var f,p,d;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(d=(p=(f=e.chain)==null?void 0:f.contracts)==null?void 0:p.universalSignatureVerifier)==null?void 0:d.address,...a}=t,u=vt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?_S(i):$e(i),l=await(async()=>!r&&!o||C5(u)?u:O5({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Rt({abi:ph,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:xc({abi:ph,args:[n,s,l],bytecode:i6}),...a},{data:m}=await J(e,Po,"call")(h);return Ox(m??"0x0")}catch(h){try{if(Ms(iE(n),await Pp({hash:s,signature:i})))return!0}catch{}if(h instanceof xp)return!1;throw h}}async function US(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=jh(n);return Xc(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function zS(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=v5({message:i,primaryType:c,types:a,domain:u});return Xc(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function S0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return c?(()=>{const f=Ae(["watchBlockNumber",e.uid,t,n,i]);return xn(f,{onBlockNumber:r,onError:o},p=>$o(async()=>{var d;try{const h=await J(e,Ao,"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 xn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const C=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return C?C.value:e.transport}return e.transport})(),{unsubscribe:v}=await m.subscribe({params:["newHeads"],onData(C){var $;if(!d)return;const b=Bt(($=C.result)==null?void 0:$.number);p.onBlockNumber(b,a),a=b},onError(C){var b;(b=p.onError)==null||b.call(p,C)}});h=v,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function WS(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:k})=>~~(1<<k)*200,timeout:a=18e4}=t,u=Ae(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var k;return t.pollingInterval?t.pollingInterval:(k=e.chain)!=null&&k.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,v;const{promise:C,resolve:b,reject:$}=bh(),B=a?setTimeout(()=>{v(),m(),$(new jE({hash:o}))},a):void 0;return m=xn(u,{onReplaced:s,resolve:b,reject:$},async k=>{if(d=await J(e,Hs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(B),k.resolve(d),m();return}v=J(e,S0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(D){const j=w=>{clearTimeout(B),v(),w(),m()};let g=D;if(!h)try{if(d){if(r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>k.resolve(d));return}if(n&&!f&&(h=!0,await $c(async()=>{f=await J(e,Mc,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await J(e,Hs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>k.resolve(d))}catch(w){if(w instanceof vp||w instanceof wp){if(!f){h=!1;return}try{p=f,h=!0;const A=await $c(()=>J(e,Ft,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof Cp});h=!1;const I=A.transactions.find(({from:P,nonce:E})=>P===p.from&&E===p.nonce);if(!I||(d=await J(e,Hs,"getTransactionReceipt")({hash:I.hash}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r)))return;let N="replaced";I.to===p.to&&I.value===p.value&&I.input===p.input?N="repriced":I.from===I.to&&I.value===0n&&(N="cancelled"),j(()=>{var P;(P=k.onReplaced)==null||P.call(k,{reason:N,replacedTransaction:p,transaction:I,transactionReceipt:d}),k.resolve(d)})}catch(A){j(()=>k.reject(A))}}else j(()=>k.reject(w))}}})}),C}function HS(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 xn(h,{onBlock:o,onError:s},m=>$o(async()=>{var v;try{const C=await J(e,Ft,"getBlock")({blockTag:t,includeTransactions:l});if(C.number!==null&&(f==null?void 0:f.number)!=null){if(C.number===f.number)return;if(C.number-f.number>1&&n)for(let b=(f==null?void 0:f.number)+1n;b<C.number;b++){const $=await J(e,Ft,"getBlock")({blockNumber:b,includeTransactions:l});m.onBlock($,f),f=$}}((f==null?void 0:f.number)==null||t==="pending"&&(C==null?void 0:C.number)==null||C.number!==null&&C.number>f.number)&&(m.onBlock(C,f),f=C)}catch(C){(v=m.onError)==null||v.call(m,C)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,v=()=>h=!1;return(async()=>{try{r&&J(e,Ft,"getBlock")({blockTag:t,includeTransactions:l}).then($=>{h&&m&&(o($,void 0),m=!1)}).catch(s);const C=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),{unsubscribe:b}=await C.subscribe({params:["newHeads"],async onData($){var k;if(!h)return;const B=await J(e,Ft,"getBlock")({blockNumber:(k=$.result)==null?void 0:k.number,includeTransactions:l}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError($){s==null||s($)}});v=b,h||v()}catch(C){s==null||s(C)}})(),()=>v()})()}function VS(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 v=Ae(["watchEvent",t,n,r,e.uid,o,l,i]);return xn(v,{onLogs:a,onError:c},C=>{let b;i!==void 0&&(b=i-1n);let $,B=!1;const k=$o(async()=>{var D;if(!B){try{$=await J(e,Nh,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}B=!0;return}try{let j;if($)j=await J(e,Rs,"getFilterChanges")({filter:$});else{const g=await J(e,Ao,"getBlockNumber")({});b&&b!==g?j=await J(e,ac,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:b+1n,toBlock:g}):j=[],b=g}if(j.length===0)return;if(r)C.onLogs(j);else for(const g of j)C.onLogs([g])}catch(j){$&&j instanceof Rn&&(B=!1),(D=C.onError)==null||D.call(C,j)}},{emitOnBegin:!0,interval:l});return async()=>{$&&await J(e,Fs,"uninstallFilter")({filter:$}),k()}})})():(()=>{let v=!0,C=()=>v=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const D=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return D?D.value:e.transport}return e.transport})(),$=s??(o?[o]:void 0);let B=[];$&&(B=[$.flatMap(j=>Xr({abi:[j],eventName:j.name,args:n}))],o&&(B=B[0]));const{unsubscribe:k}=await b.subscribe({params:["logs",{address:t,topics:B}],onData(D){var g;if(!v)return;const j=D.result;try{const{eventName:w,args:A}=sc({abi:$??[],data:j.data,topics:j.topics,strict:d}),I=tn(j,{args:A,eventName:w});a([I])}catch(w){let A,I;if(w instanceof Gr||w instanceof ys){if(f)return;A=w.abiItem.name,I=(g=w.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const N=tn(j,{args:I?[]:{},eventName:A});a([N])}},onError(D){c==null||c(D)}});C=k,v||C()}catch(b){c==null||c(b)}})(),()=>C()})()}function GS(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 xn(u,{onTransactions:r,onError:n},l=>{let f;const p=$o(async()=>{var d;try{if(!f)try{f=await J(e,Ih,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await J(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 J(e,Fs,"uninstallFilter")({filter:f}),p()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!u)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function qS(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(ZS))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(KS))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
161
|
+
- `).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 ZS=/^(?:(?<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)?/,KS=/(?: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 YS(e){const{address:t,domain:n,message:r,nonce:o,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||o&&r.nonce!==o||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!ct(r.address,{strict:!1})||t&&!Ms(r.address,t))return!1}catch{return!1}return!0}async function XS(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=qS(o);if(!l.address||!YS({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const p=jh(o);return Xc(e,{address:l.address,hash:p,signature:c,...u})}function QS(e){return{call:t=>Po(e,t),createAccessList:t=>Oh(e,t),createBlockFilter:()=>e5(e),createContractEventFilter:t=>ap(e,t),createEventFilter:t=>Nh(e,t),createPendingTransactionFilter:()=>Ih(e),estimateContractGas:t=>T2(e,t),estimateGas:t=>oc(e,t),getBalance:t=>Hp(e,t),getBlobBaseFee:()=>t5(e),getBlock:t=>Ft(e,t),getBlockNumber:t=>Ao(e,t),getBlockTransactionCount:t=>n5(e,t),getBytecode:t=>Mh(e,t),getChainId:()=>Up(e),getCode:t=>Mh(e,t),getContractEvents:t=>Gp(e,t),getEip712Domain:t=>o5(e,t),getEnsAddress:t=>D6(e,t),getEnsAvatar:t=>X6(e,t),getEnsName:t=>Q6(e,t),getEnsResolver:t=>J6(e,t),getEnsText:t=>Ch(e,t),getFeeHistory:t=>a5(e,t),estimateFeesPerGas:t=>l2(e,t),getFilterChanges:t=>Rs(e,t),getFilterLogs:t=>c5(e,t),getGasPrice:()=>tc(e),getLogs:t=>ac(e,t),getProof:t=>M5(e,t),estimateMaxPriorityFeePerGas:t=>u2(e,t),getStorageAt:t=>L5(e,t),getTransaction:t=>Mc(e,t),getTransactionConfirmations:t=>B5(e,t),getTransactionCount:t=>Lp(e,t),getTransactionReceipt:t=>Hs(e,t),multicall:t=>k5(e,t),prepareTransactionRequest:t=>Wp(e,t),readContract:t=>rn(e,t),sendRawTransaction:t=>w6(e,t),simulate:t=>Lc(e,t),simulateBlocks:t=>Lc(e,t),simulateCalls:t=>lS(e,t),simulateContract:t=>d6(e,t),verifyMessage:t=>US(e,t),verifySiweMessage:t=>XS(e,t),verifyTypedData:t=>zS(e,t),uninstallFilter:t=>Fs(e,t),waitForTransactionReceipt:t=>WS(e,t),watchBlocks:t=>HS(e,t),watchBlockNumber:t=>S0(e,t),watchContractEvent:t=>v6(e,t),watchEvent:t=>VS(e,t),watchPendingTransactions:t=>GS(e,t)}}function JS(e){const{key:t="public",name:n="Public Client"}=e;return S6({...e,key:t,name:n,type:"publicClient"}).extend(QS)}const eP=m5({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}}}),tP=Object.values({MAINNET:1,SEPOLIA:11155111}),an=e=>{const t=typeof e=="string"?parseInt(e,10):e;return tP.includes(t)},nP={USDT:!0},P0=(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:!nP[t.toUpperCase()]:!0},Oo=({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"})},rP=({depositAmount:e,curSelectToken:t,approved:n,currentActiveChain:r,tokenBalance:o,platformBalance:s="0",showLayerZeroTip:i=!1,layerZeroTipKey:c,onDepositAmountChange:a,onApproved:u})=>{const{t:l}=pt(),[f,p]=S.useState(!1);S.useEffect(()=>{n&&f&&p(!1)},[n,f]);const d=S.useCallback(async()=>{if(!f)try{p(!0),await u()}catch(b){p(!1),console.error("Approve failed:",b)}},[u,f]),h=S.useCallback(()=>{let b=o||"0";if(P0(r==null?void 0:r.chainId,t))try{const $=new Ie(b),B=new Ie("200000");$.gt(B)&&(b="200000")}catch($){console.warn("Error calculating max amount limit:",$)}return b},[o,r==null?void 0:r.chainId,t]),m=S.useMemo(()=>{if(!P0(r==null?void 0:r.chainId,t))return!1;try{const b=new Ie(e||"0"),$=new Ie("200000");return b.isNaN()||$.isNaN()?!1:b.gte($)}catch{return!1}},[r,e,t]),v=b=>{const $=b.target.value,B=h(),k=ra($,B);if(k.isValid)a(k.formattedValue),k.errorType;else return k.errorType==="exceed_balance",void 0},C=()=>{const b=parseFloat(o||"0"),$=parseFloat(e||"0");if($>0){const B=b-$,k=gt(Math.max(0,B).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[gt(o||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),k," ",t]})}return`${gt(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:l("deposit.amount"),value:e,onChange:v,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 b=h();a(b)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("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(zr,{content:l("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:C()})]})]}),!n&&o1(e||"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:l("deposit.enableSystemProWithToken",{token:t,network:r==null?void 0:r.chain})}),M.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:l("deposit.enableTokenDesc",{token:t,network:r==null?void 0:r.chain})}),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:d,disabled:f,children:f?M.jsx(Oo,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:t})})]}),i&&M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(c||"deposit.layerZeroDepositTip")})]}),M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),m&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.depositTipFor25w")})]}),m&&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:!(m||i)&&M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.noPrivateKeyWalletWarning")})]}),M.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:l("deposit.equity")}),M.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?M.jsxs("span",{className:"flex items-center gap-1",children:[gt(s),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),gt((parseFloat(s)+parseFloat(e)).toString())," ",t]}):`${gt(s)} ${t}`})]})})]})},oP=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var a,u;const i=(a=o==null?void 0:o.useBalance)==null?void 0:a.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),c=(u=o==null?void 0:o.useReadContract)==null?void 0:u.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return S.useEffect(()=>{s(e.tokenAddress,{balance:i,allowance:c})},[i,c,e.tokenAddress,s]),null},$0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var h;const s=S.useMemo(()=>r.filter(m=>m.tokenAddress&&m.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=S.useState({}),a=S.useCallback((m,v)=>{c(C=>({...C,[m]:v}))},[]),u=(h=o==null?void 0:o.useBalance)==null?void 0:h.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),l=S.useMemo(()=>s.map(m=>S.createElement(oP,{key:m.tokenAddress,token:m,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a]),f=S.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const m=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},v=s.map($=>{const B=i[$.tokenAddress],k=B==null?void 0:B.balance,D=k==null?void 0:k.data;return{address:$.tokenAddress,value:(D==null?void 0:D.value)||BigInt(0),formatted:(D==null?void 0:D.formatted)||"0",decimals:(D==null?void 0:D.decimals)||$.decimals}}).filter($=>$.address),C=s.map($=>{const B=i[$.tokenAddress],k=B==null?void 0:B.allowance,D=k==null?void 0:k.data,j=BigInt(D?D.toString():0);return{address:$.tokenAddress,value:j,formatted:(j/BigInt(10)**BigInt($.decimals)).toString(),decimals:$.decimals}}).filter($=>$.address),b=v.reduce(($,B)=>{const k=C.find(D=>D.address===B.address);return{...$,[B.address]:{balance:B,allowance:k||{address:B.address,value:BigInt(0),formatted:"0",decimals:B.decimals}}}},{});return{balanceList:v,allowanceList:C,baseTokenBalance:m,combinedData:b}},[u,i,s,o==null?void 0:o.useBalance]),p=S.useCallback(async()=>f,[f]),d=S.useMemo(()=>{const m=(u==null?void 0:u.isLoading)||!1,v=Object.values(i).some(C=>{var b,$;return((b=C.balance)==null?void 0:b.isLoading)||(($=C.allowance)==null?void 0:$.isLoading)});return m||v},[u==null?void 0:u.isLoading,i]);return{multicallRun:p,multicallResult:f,validErcTokens:s,isLoading:d,queryComponents:l}};let Ve=null;const sP={symbol:"USDT"},A0=S.forwardRef((e,t)=>{const[n,r]=S.useState(!1),[o,s]=S.useState(!1),[i,c]=S.useState({chains:[]}),a=S.useCallback(h=>{c(h),r(!0)},[]),u=S.useCallback(h=>{c(m=>({...m,...h}))},[]),l=S.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=S.useCallback(h=>{s(h)},[]),p=S.useCallback(()=>n,[n]),d=S.useCallback(()=>o,[o]);return S.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),S.useEffect(()=>(Ve={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,l,u,f,p,d]),M.jsx(I0,{isOpen:n,isLoading:o,onClose:l,config:i.config||sP,currentActiveAccount:i.currentActiveAccount||oa,smartWallet:i.smartWallet||sa,chains:i.chains||c1,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||ia,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",wagmiHooks:i.wagmiHooks,approved:i.approved,onApproved:i.onApproved,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange})});A0.displayName="DepositManager";const T0=e=>{if(!Ve){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ve.openDeposit(e||{chains:[]})},C0=()=>{if(!Ve){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ve.closeDeposit()},O0=e=>{Ve&&Ve.updateDepositOptions(e)},Zs=e=>{if(!Ve){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ve.setDepositLoading(e)},iP=()=>Ve?Ve.isOpen():!1,N0=()=>Ve?Ve.isLoading():!1,aP=()=>({openDeposit:T0,closeDeposit:C0,updateDepositOptions:O0,setDepositLoading:Zs,isOpen:iP,isLoading:N0}),cP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",isLoading:a=!1,wagmiHooks:u,approved:l,onApproved:f,onDeposit:p,onClose:d,onChainChange:h,onTokenChange:m})=>{var xe;const{t:v}=pt(),C=u==null?void 0:u.useAccount(),[b,$]=S.useState(()=>{var oe;return!e||e.length===0?1:t||((oe=e[0])==null?void 0:oe.chainId)||1}),[B,k]=S.useState(()=>{var se;if(!e||e.length===0)return"";const oe=t||((se=e[0])==null?void 0:se.chainId),ue=e.find(Le=>Le.chainId===oe);if(!ue||!ue.tokenList||ue.tokenList.length===0)return"";const pe=ue.tokenList.find(Le=>Le.tokenAddress===n)||ue.tokenList[0];return(pe==null?void 0:pe.token)||""}),[D,j]=S.useState(r),g=S.useCallback(oe=>{$(oe),h==null||h(oe)},[h]),w=S.useCallback(oe=>{k(oe),m==null||m(oe)},[m]),A=S.useRef(!0),I=S.useRef(B),N=S.useRef(b);S.useEffect(()=>{if(A.current){A.current=!1,I.current=B,N.current=b;return}(I.current!==B||N.current!==b)&&(j(""),I.current=B,N.current=b)},[B,b]);const P=e&&e.length>0?e.find(oe=>oe.chainId===b)||e[0]:null,E=(xe=P==null?void 0:P.tokenList)==null?void 0:xe.find(oe=>oe.token===B),x=o==null?void 0:o.getDisplayAddress(),{multicallResult:T,queryComponents:O}=$0({account:x,chainId:b,contractAddress:void 0,tokens:(P==null?void 0:P.tokenList)||[],wagmiHooks:u}),y=S.useMemo(()=>{var ue;if(!E)return;if(!E.tokenAddress||E.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return T.baseTokenBalance.formatted;const oe=T.combinedData[E.tokenAddress];return((ue=oe==null?void 0:oe.balance)==null?void 0:ue.formatted)||"0"},[E,T]),L="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",F="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",U=S.useMemo(()=>JS({chain:eP,transport:M6()}),[]),[z,V]=S.useState("0");S.useEffect(()=>{const oe=+b==42161,ue=(B==null?void 0:B.toUpperCase())==="USDT";if(!(oe&&ue)){V("0");return}let pe=!1;return(async()=>{try{const se=await U.readContract({address:L,abi:r6,functionName:"balanceOf",args:[F]});if(!pe){const Le=new Ie(se.toString()).div(1e6).toString();V(Le)}}catch(se){pe||(console.warn("Failed to read pool USDT balance via viem:",se),V("0"))}})(),()=>{pe=!0}},[U,B,b]);const Z=l??!1,W=S.useMemo(()=>+C.chainId!=+b,[C.chainId,b]),{showLayerZeroTip:K,layerZeroTipKey:G}=S.useMemo(()=>{const oe=+b==42161||+b==421614,ue=(B==null?void 0:B.toUpperCase())==="USDT",pe=new Ie(D||"0"),se=new Ie("200000");let Le=!1,Er;if(oe&&ue&&D)if(pe.gte(se))Le=!0,Er="deposit.layerZeroDepositTipGte200k";else{const Sr=z;if(typeof Sr=="string"&&Sr.length>0){const Xs=new Ie(Sr);!Xs.isNaN()&&pe.gte(Xs)&&(Le=!0,Er="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:Le,layerZeroTipKey:Er}},[b,B,D,z]),X=S.useMemo(()=>{if(W)return{text:v("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const oe=parseFloat(D||"0"),ue=10,se=s1(D,y||"0",Z);return!D||oe===0||!Z?{text:v(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:oe<ue?{text:v("deposit.minDepositParsed",{amount:ue,token:B}),disabled:!0,isNetworkSwitch:!1}:{text:v(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!se,isNetworkSwitch:!1}},[D,B,y,Z,W,K,v]),ee=S.useCallback(async()=>{g&&g(b)},[g,b]),fe=S.useCallback(async()=>{Zs(!0);try{p&&p({amount:D,chainId:b,tokenAddress:(E==null?void 0:E.tokenAddress)||"",tokenSymbol:B})}catch(oe){console.error("Deposit error:",oe),Zs(!1)}},[p,D,b,E==null?void 0:E.tokenAddress,B]);return!(u!=null&&u.useBalance)||!(u!=null&&u.useReadContract)||!(u!=null&&u.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):P?M.jsxs(M.Fragment,{children:[O,M.jsx(na,{currentActiveChain:P,chainList:e,onChainChange:g,curSelectToken:B,onTokenChange:w,walletType:"evm"}),M.jsx(rP,{depositAmount:D,curSelectToken:B,curSelectTokenData:{balance:E==null?void 0:E.balance,allowance:E==null?void 0:E.allowance},approved:Z,currentActiveChain:P,tokenBalance:y,platformBalance:c,showLayerZeroTip:K,layerZeroTipKey:G,onDepositAmountChange:j,onApproved:async()=>{f&&await f()}}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${X.disabled||a?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:X.isNetworkSwitch?ee:fe,disabled:X.disabled||a,children:[a&&M.jsx(Oo,{size:"xs"}),X.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},I0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",wagmiHooks:d,approved:h,onApproved:m,onDeposit:v,onCopy:C,onChainChange:b,onTokenChange:$})=>{const{t:B}=pt(),k=S.useMemo(()=>{var j;return o?bu(o,s,!1,(j=i[0])==null?void 0:j.chainId,"0","0"):null},[o,s,i]),D=(k==null?void 0:k.getWalletType())==="mpc";return e?Be.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},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",onClick:j=>{j.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("deposit.title")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(mu,{className:"h-4 w-4"})})]}),D?M.jsx(Pw,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:k,metadata:l,currentEquity:f,onDeposit:v,onCopy:C,onClose:n}):M.jsx(cP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:k,metadata:l,currentEquity:f,platformBalance:p,isLoading:t,wagmiHooks:d,approved:h,onApproved:m,onDeposit:v,onClose:n,onChainChange:b,onTokenChange:$})]})})}),document.body):null};S.createContext(null);const uP=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",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)"})})})]}),lP=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",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)"})})})]}),Ks=({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<=e?M.jsx(uP,{}):M.jsx(lP,{})},o))})};class cn{}Xe(cn,"FAST",3),Xe(cn,"Medium",2),Xe(cn,"SLOW",1),Xe(cn,"NONE",0);const fP=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:s="evm",receiverAddress:i="",onWithdrawAmountChange:c,onReceiverAddressChange:a,onAmountChanged:u})=>{const{t:l}=pt(),f=S.useMemo(()=>{if(!an(n==null?void 0:n.chainId)){const v=new Ie(e||"0").minus(o||"0").decimalPlaces(2,Ie.ROUND_DOWN);return v.isNegative()?"0.00":v.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=S.useMemo(()=>r||"0",[r]),d=v=>{const C=v.target.value,$=ra(C,p||"0");if($.isValid)c($.formattedValue),$.errorType;else return $.errorType==="exceed_balance",void 0;u==null||u($.formattedValue)},h=()=>{c(p),u==null||u(p)},m=()=>{const v=parseFloat(r||"0"),C=parseFloat(e||"0");if(C>0){const b=v-C,$=gt(Math.max(0,b).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[gt(r||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),$," ",t]})}return`${gt(r||"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:l("deposit.amount"),value:e,onChange:d,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:h,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(zr,{content:l("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:m()})]})]}),s==="mpc"&&!an(n==null?void 0:n.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:l("withdraw.receiverAddress"),value:i,onChange:v=>a==null?void 0:a(v.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:an(n==null?void 0:n.chainId)?M.jsxs(M.Fragment,{children:[M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("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:l("withdraw.commonWithdraw")})]}):M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.crossChainTips")})}),M.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("span",{className:"text-text-tertiary text-xs",children:l("withdraw.speed")}),M.jsx("div",{className:"flex items-center",children:M.jsx(zr,{content:M.jsxs("div",{children:[M.jsx("div",{children:l("withdraw.speedNote")}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.FAST,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed1")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.Medium,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed2")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.SLOW,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed3")})]})]}),children:M.jsx(Ks,{selectedLevel:an(n==null?void 0:n.chainId)?cn.SLOW:cn.FAST,maxLevel:3})})})]}),!an(n==null?void 0:n.chainId)&&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:l("withdraw.fee")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),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:l(an(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[gt(f)," ",t]})]})]})]})},dP=[],pP={};let Ge=null;const M0=S.forwardRef((e,t)=>{const[n,r]=S.useState(!1),[o,s]=S.useState(!1),[i,c]=S.useState({chains:[]}),a=S.useCallback(h=>{c(h||{chains:[]}),r(!0)},[]),u=S.useCallback(h=>{c(m=>({...m,...h}))},[]),l=S.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=S.useCallback(h=>{s(h)},[]),p=S.useCallback(()=>n,[n]),d=S.useCallback(()=>o,[o]);return S.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),S.useEffect(()=>(Ge={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ge=null}),[a,l,u,f,p,d]),M.jsx(F0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,smartWallet:i.smartWallet,chains:i.chains||dP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||pP,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})});M0.displayName="WithdrawManager";const L0=e=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.openWithdraw(e||{chains:[]})},B0=()=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.closeWithdraw()},k0=e=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.updateWithdrawOptions(e)},Ys=e=>{if(!Ge){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ge.setWithdrawLoading(e)},hP=()=>Ge?Ge.isOpen():!1,R0=()=>Ge?Ge.isLoading():!1,mP=()=>({openWithdraw:L0,closeWithdraw:B0,updateWithdrawOptions:k0,setWithdrawLoading:Ys,isOpen:hP,isLoading:R0}),gP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",fee:a="0.00",isLoading:u=!1,wagmiHooks:l,onWithdraw:f,onClose:p,onChainChange:d,onTokenChange:h,onAmountChanged:m})=>{var V;const{t:v}=pt(),[C,b]=S.useState(()=>{var Z;return!e||e.length===0?1:t||((Z=e[0])==null?void 0:Z.chainId)||1}),[$,B]=S.useState(()=>{var G;if(!e||e.length===0)return"";const Z=t||((G=e[0])==null?void 0:G.chainId),W=e.find(X=>X.chainId===Z);if(!W||!W.tokenList||W.tokenList.length===0)return"";const K=W.tokenList.find(X=>X.tokenAddress===n)||W.tokenList[0];return(K==null?void 0:K.token)||""}),[k,D]=S.useState(r),[j,g]=S.useState(""),w=(o==null?void 0:o.getWalletType())||"evm",A=S.useCallback(Z=>{b(Z),d==null||d(Z)},[d]),I=S.useCallback(Z=>{B(Z),h==null||h(Z)},[h]),N=S.useRef(!0),P=S.useRef($),E=S.useRef(C);S.useEffect(()=>{if(N.current){N.current=!1,P.current=$,E.current=C;return}(P.current!==$||E.current!==C)&&(D(""),P.current=$,E.current=C)},[$,C]);const x=e&&e.length>0?e.find(Z=>Z.chainId===C)||e[0]:null,T=(V=x==null?void 0:x.tokenList)==null?void 0:V.find(Z=>Z.token===$),O=o==null?void 0:o.getDisplayAddress(),{multicallResult:y,queryComponents:L}=$0({account:O,chainId:C,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:l}),F=S.useMemo(()=>{var W;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return y.baseTokenBalance.formatted;const Z=y.combinedData[T.tokenAddress];return((W=Z==null?void 0:Z.balance)==null?void 0:W.formatted)||"0"},[T,y]),U=S.useMemo(()=>{const Z=new Ie(k||"0"),W=new Ie(a||"0"),K=an(C);return!k||Z.isZero()||!K&&Z.isLessThan(W)?{text:v("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&!K&&!j.trim()?{text:v("withdraw.invalidReceiverAddress"),disabled:!0}:{text:v("withdraw.confirmWithdraw"),disabled:!1}},[v,C,k,w,j,a]),z=S.useCallback(async()=>{Ys(!0);try{if(f){const Z=new Ie(k||"0"),W=new Ie(a||"0"),G={amount:(an(C)?Z:Z.minus(W)).toString(),chainId:C,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:$};w==="mpc"&&!an(C)&&(G.receiverAddress=j),f(G)}}catch{Ys(!1)}},[f,k,a,C,T==null?void 0:T.tokenAddress,$,w,j]);return!(l!=null&&l.useBalance)||!(l!=null&&l.useReadContract)||!(l!=null&&l.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?M.jsxs(M.Fragment,{children:[L,M.jsx(na,{currentActiveChain:x,chainList:e,onChainChange:A,curSelectToken:$,onTokenChange:I,walletType:"evm"}),M.jsx(fP,{withdrawAmount:k,curSelectToken:$,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},currentActiveChain:x,currentEquity:i||0,amount:k,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:F,platformBalance:c,fee:a,walletType:w,receiverAddress:j,onWithdrawAmountChange:D,onReceiverAddressChange:g,onAmountChanged:m}),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||u?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:U.disabled||u,children:[u&&M.jsx(Oo,{size:"xs"}),U.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},F0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",fee:d,wagmiHooks:h,onWithdraw:m,onChainChange:v,onTokenChange:C,onAmountChanged:b})=>{const{t:$}=pt(),B=S.useMemo(()=>{var k;return o?bu(o,s,!1,(k=i[0])==null?void 0:k.chainId,"0","0"):null},[o,s,i]);return e?Be.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},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",onClick:k=>{k.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:$("withdraw.withdraw")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(mu,{className:"h-4 w-4"})})]}),M.jsx(gP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:B,metadata:l,currentEquity:f,platformBalance:p,fee:d,isLoading:t,wagmiHooks:h,onWithdraw:m,onClose:n,onChainChange:v,onTokenChange:C,onAmountChanged:b})]})})}),document.body):null};re.ChromeLoader=Oo,re.ComponentProvider=cm,re.DEFAULT_LOCALE=Io,re.Deposit=I0,re.DepositManager=A0,re.LOCALE_NAMES=sm,re.LoadingSpinner=Oo,re.SUPPORTED_LOCALES=Js,re.Tooltip=zr,re.Withdraw=F0,re.WithdrawManager=M0,re.closeDeposit=C0,re.closeWithdraw=B0,re.formatThousands=lm,re.isDepositLoading=N0,re.isWithdrawLoading=R0,re.openDeposit=T0,re.openWithdraw=L0,re.setDepositLoading=Zs,re.setWithdrawLoading=Ys,re.updateDepositOptions=O0,re.updateWithdrawOptions=k0,re.useComponentConfig=lu,re.useDeposit=fm,re.useDepositManager=aP,re.useTranslation=pt,re.useWithdraw=dm,re.useWithdrawManager=mP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|
|
123
162
|
//# sourceMappingURL=index.umd.js.map
|