@edgex-web/components 0.1.0-beta.5 → 0.1.0-beta.7
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-1aCtQ0Wi.mjs +240 -0
- package/dist/ccip-1aCtQ0Wi.mjs.map +1 -0
- package/dist/components/Deposit/index.d.ts +0 -2
- package/dist/components/Deposit/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
- package/dist/components/Deposit/src/evm/WalletView.d.ts +1 -0
- package/dist/components/Deposit/src/evm/WalletView.d.ts.map +1 -1
- package/dist/components/Deposit/src/evm/index.d.ts +8 -2
- package/dist/components/Deposit/src/evm/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts +40 -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/mpc/WalletView.d.ts.map +1 -1
- package/dist/components/Deposit/src/mpc/index.d.ts +6 -2
- package/dist/components/Deposit/src/mpc/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/selector/Asset.d.ts +1 -0
- package/dist/components/Deposit/src/selector/Asset.d.ts.map +1 -1
- package/dist/components/Deposit/src/selector/Chain.d.ts +1 -0
- package/dist/components/Deposit/src/selector/Chain.d.ts.map +1 -1
- package/dist/components/Deposit/src/selector/index.d.ts +1 -0
- package/dist/components/Deposit/src/selector/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/utils.d.ts +56 -1
- package/dist/components/Deposit/src/utils.d.ts.map +1 -1
- package/dist/components/Deposit/types/index.d.ts +16 -5
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/index-CJsCUMB-.mjs +12255 -0
- package/dist/index-CJsCUMB-.mjs.map +1 -0
- package/dist/index.esm.js +11 -6970
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +64 -47
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -2
- package/dist/components/Deposit/src/Deposit.d.ts +0 -15
- package/dist/components/Deposit/src/Deposit.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(oe,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],m):(oe=typeof globalThis<"u"?globalThis:oe||self,m(oe.EdgeXComponents={},oe.React,oe.ReactDOM))})(this,function(oe,m,ye){"use strict";var Ty=Object.defineProperty;var Iy=(oe,m,ye)=>m in oe?Ty(oe,m,{enumerable:!0,configurable:!0,writable:!0,value:ye}):oe[m]=ye;var nt=(oe,m,ye)=>Iy(oe,typeof m!="symbol"?m+"":m,ye);function Ts(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 N=Ts(m),zn=Ts(ye);function ec(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fr={exports:{}},Qt={};/**
|
|
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 Is;function tc(){if(Is)return Qt;Is=1;var e=m,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 a(u,i,l){var c,d={},p=null,f=null;l!==void 0&&(p=""+l),i.key!==void 0&&(p=""+i.key),i.ref!==void 0&&(f=i.ref);for(c in i)r.call(i,c)&&!s.hasOwnProperty(c)&&(d[c]=i[c]);if(u&&u.defaultProps)for(c in i=u.defaultProps,i)d[c]===void 0&&(d[c]=i[c]);return{$$typeof:t,type:u,key:p,ref:f,props:d,_owner:o.current}}return Qt.Fragment=n,Qt.jsx=a,Qt.jsxs=a,Qt}var Zt={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,48 +14,48 @@
|
|
|
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 Ms;function nc(){return Ms||(Ms=1,process.env.NODE_ENV!=="production"&&function(){var e=m,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"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),h=Symbol.iterator,g="@@iterator";function b(w){if(w===null||typeof w!="object")return null;var T=h&&w[h]||w[g];return typeof T=="function"?T:null}var $=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(w){{for(var T=arguments.length,F=new Array(T>1?T-1:0),U=1;U<T;U++)F[U-1]=arguments[U];v("error",w,F)}}function v(w,T,F){{var U=$.ReactDebugCurrentFrame,Q=U.getStackAddendum();Q!==""&&(T+="%s",F=F.concat([Q]));var J=F.map(function(Y){return String(Y)});J.unshift("Warning: "+T),Function.prototype.apply.call(console[w],console,J)}}var E=!1,y=!1,C=!1,S=!1,A=!1,j;j=Symbol.for("react.module.reference");function I(w){return!!(typeof w=="string"||typeof w=="function"||w===r||w===s||A||w===o||w===l||w===c||S||w===f||E||y||C||typeof w=="object"&&w!==null&&(w.$$typeof===p||w.$$typeof===d||w.$$typeof===a||w.$$typeof===u||w.$$typeof===i||w.$$typeof===j||w.getModuleId!==void 0))}function M(w,T,F){var U=w.displayName;if(U)return U;var Q=T.displayName||T.name||"";return Q!==""?F+"("+Q+")":F}function W(w){return w.displayName||"Context"}function D(w){if(w==null)return null;if(typeof w.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof w=="function")return w.displayName||w.name||null;if(typeof w=="string")return w;switch(w){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case c:return"SuspenseList"}if(typeof w=="object")switch(w.$$typeof){case u:var T=w;return W(T)+".Consumer";case a:var F=w;return W(F._context)+".Provider";case i:return M(w,w.render,"ForwardRef");case d:var U=w.displayName||null;return U!==null?U:D(w.type)||"Memo";case p:{var Q=w,J=Q._payload,Y=Q._init;try{return D(Y(J))}catch{return null}}}return null}var L=Object.assign,R=0,B,z,O,_,V,ce,ee;function X(){}X.__reactDisabledLog=!0;function tt(){{if(R===0){B=console.log,z=console.info,O=console.warn,_=console.error,V=console.group,ce=console.groupCollapsed,ee=console.groupEnd;var w={configurable:!0,enumerable:!0,value:X,writable:!0};Object.defineProperties(console,{info:w,log:w,warn:w,error:w,group:w,groupCollapsed:w,groupEnd:w})}R++}}function Me(){{if(R--,R===0){var w={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},w,{value:B}),info:L({},w,{value:z}),warn:L({},w,{value:O}),error:L({},w,{value:_}),group:L({},w,{value:V}),groupCollapsed:L({},w,{value:ce}),groupEnd:L({},w,{value:ee})})}R<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=$.ReactCurrentDispatcher,H;function ne(w,T,F){{if(H===void 0)try{throw Error()}catch(Q){var U=Q.stack.trim().match(/\n( *(at )?)/);H=U&&U[1]||""}return`
|
|
18
|
+
`+H+w}}var me=!1,pt;{var oy=typeof WeakMap=="function"?WeakMap:Map;pt=new oy}function _u(w,T){if(!w||me)return"";{var F=pt.get(w);if(F!==void 0)return F}var U;me=!0;var Q=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var J;J=he.current,he.current=null,tt();try{if(T){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(xe){U=xe}Reflect.construct(w,[],Y)}else{try{Y.call()}catch(xe){U=xe}w.call(Y.prototype)}}else{try{throw Error()}catch(xe){U=xe}w()}}catch(xe){if(xe&&U&&typeof xe.stack=="string"){for(var q=xe.stack.split(`
|
|
19
|
+
`),be=U.stack.split(`
|
|
20
|
+
`),ie=q.length-1,ae=be.length-1;ie>=1&&ae>=0&&q[ie]!==be[ae];)ae--;for(;ie>=1&&ae>=0;ie--,ae--)if(q[ie]!==be[ae]){if(ie!==1||ae!==1)do if(ie--,ae--,ae<0||q[ie]!==be[ae]){var je=`
|
|
21
|
+
`+q[ie].replace(" at new "," at ");return w.displayName&&je.includes("<anonymous>")&&(je=je.replace("<anonymous>",w.displayName)),typeof w=="function"&&pt.set(w,je),je}while(ie>=1&&ae>=0);break}}}finally{me=!1,he.current=J,Me(),Error.prepareStackTrace=Q}var Xt=w?w.displayName||w.name:"",It=Xt?ne(Xt):"";return typeof w=="function"&&pt.set(w,It),It}function sy(w,T,F){return _u(w,!1)}function iy(w){var T=w.prototype;return!!(T&&T.isReactComponent)}function jr(w,T,F){if(w==null)return"";if(typeof w=="function")return _u(w,iy(w));if(typeof w=="string")return ne(w);switch(w){case l:return ne("Suspense");case c:return ne("SuspenseList")}if(typeof w=="object")switch(w.$$typeof){case i:return sy(w.render);case d:return jr(w.type,T,F);case p:{var U=w,Q=U._payload,J=U._init;try{return jr(J(Q),T,F)}catch{}}}return""}var Un=Object.prototype.hasOwnProperty,Ru={},Bu=$.ReactDebugCurrentFrame;function kr(w){if(w){var T=w._owner,F=jr(w.type,w._source,T?T.type:null);Bu.setExtraStackFrame(F)}else Bu.setExtraStackFrame(null)}function ay(w,T,F,U,Q){{var J=Function.call.bind(Un);for(var Y in w)if(J(w,Y)){var q=void 0;try{if(typeof w[Y]!="function"){var be=Error((U||"React class")+": "+F+" type `"+Y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof w[Y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw be.name="Invariant Violation",be}q=w[Y](T,Y,U,F,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ie){q=ie}q&&!(q instanceof Error)&&(kr(Q),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",U||"React class",F,Y,typeof q),kr(null)),q instanceof Error&&!(q.message in Ru)&&(Ru[q.message]=!0,kr(Q),x("Failed %s type: %s",F,q.message),kr(null))}}}var ly=Array.isArray;function xs(w){return ly(w)}function uy(w){{var T=typeof Symbol=="function"&&Symbol.toStringTag,F=T&&w[Symbol.toStringTag]||w.constructor.name||"Object";return F}}function cy(w){try{return Uu(w),!1}catch{return!0}}function Uu(w){return""+w}function zu(w){if(cy(w))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",uy(w)),Uu(w)}var Hu=$.ReactCurrentOwner,fy={key:!0,ref:!0,__self:!0,__source:!0},Wu,Vu;function dy(w){if(Un.call(w,"ref")){var T=Object.getOwnPropertyDescriptor(w,"ref").get;if(T&&T.isReactWarning)return!1}return w.ref!==void 0}function py(w){if(Un.call(w,"key")){var T=Object.getOwnPropertyDescriptor(w,"key").get;if(T&&T.isReactWarning)return!1}return w.key!==void 0}function hy(w,T){typeof w.ref=="string"&&Hu.current}function my(w,T){{var F=function(){Wu||(Wu=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",T))};F.isReactWarning=!0,Object.defineProperty(w,"key",{get:F,configurable:!0})}}function gy(w,T){{var F=function(){Vu||(Vu=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",T))};F.isReactWarning=!0,Object.defineProperty(w,"ref",{get:F,configurable:!0})}}var by=function(w,T,F,U,Q,J,Y){var q={$$typeof:t,type:w,key:T,ref:F,props:Y,_owner:J};return q._store={},Object.defineProperty(q._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(q,"_self",{configurable:!1,enumerable:!1,writable:!1,value:U}),Object.defineProperty(q,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Q}),Object.freeze&&(Object.freeze(q.props),Object.freeze(q)),q};function yy(w,T,F,U,Q){{var J,Y={},q=null,be=null;F!==void 0&&(zu(F),q=""+F),py(T)&&(zu(T.key),q=""+T.key),dy(T)&&(be=T.ref,hy(T,Q));for(J in T)Un.call(T,J)&&!fy.hasOwnProperty(J)&&(Y[J]=T[J]);if(w&&w.defaultProps){var ie=w.defaultProps;for(J in ie)Y[J]===void 0&&(Y[J]=ie[J])}if(q||be){var ae=typeof w=="function"?w.displayName||w.name||"Unknown":w;q&&my(Y,ae),be&&gy(Y,ae)}return by(w,q,be,Q,U,Hu.current,Y)}}var Es=$.ReactCurrentOwner,Gu=$.ReactDebugCurrentFrame;function Yt(w){if(w){var T=w._owner,F=jr(w.type,w._source,T?T.type:null);Gu.setExtraStackFrame(F)}else Gu.setExtraStackFrame(null)}var $s;$s=!1;function Ss(w){return typeof w=="object"&&w!==null&&w.$$typeof===t}function qu(){{if(Es.current){var w=D(Es.current.type);if(w)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+w+"`."}return""}}function vy(w){return""}var Ku={};function wy(w){{var T=qu();if(!T){var F=typeof w=="string"?w:w.displayName||w.name;F&&(T=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+F+">.")}return T}}function Yu(w,T){{if(!w._store||w._store.validated||w.key!=null)return;w._store.validated=!0;var F=wy(T);if(Ku[F])return;Ku[F]=!0;var U="";w&&w._owner&&w._owner!==Es.current&&(U=" It was passed a child from "+D(w._owner.type)+"."),Yt(w),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',F,U),Yt(null)}}function Xu(w,T){{if(typeof w!="object")return;if(xs(w))for(var F=0;F<w.length;F++){var U=w[F];Ss(U)&&Yu(U,T)}else if(Ss(w))w._store&&(w._store.validated=!0);else if(w){var Q=b(w);if(typeof Q=="function"&&Q!==w.entries)for(var J=Q.call(w),Y;!(Y=J.next()).done;)Ss(Y.value)&&Yu(Y.value,T)}}}function xy(w){{var T=w.type;if(T==null||typeof T=="string")return;var F;if(typeof T=="function")F=T.propTypes;else if(typeof T=="object"&&(T.$$typeof===i||T.$$typeof===d))F=T.propTypes;else return;if(F){var U=D(T);ay(F,w.props,"prop",U,w)}else if(T.PropTypes!==void 0&&!$s){$s=!0;var Q=D(T);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Q||"Unknown")}typeof T.getDefaultProps=="function"&&!T.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ey(w){{for(var T=Object.keys(w.props),F=0;F<T.length;F++){var U=T[F];if(U!=="children"&&U!=="key"){Yt(w),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",U),Yt(null);break}}w.ref!==null&&(Yt(w),x("Invalid attribute `ref` supplied to `React.Fragment`."),Yt(null))}}var Qu={};function Zu(w,T,F,U,Q,J){{var Y=I(w);if(!Y){var q="";(w===void 0||typeof w=="object"&&w!==null&&Object.keys(w).length===0)&&(q+=" 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 be=vy();be?q+=be:q+=qu();var ie;w===null?ie="null":xs(w)?ie="array":w!==void 0&&w.$$typeof===t?(ie="<"+(D(w.type)||"Unknown")+" />",q=" Did you accidentally export a JSX literal instead of a component?"):ie=typeof w,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ie,q)}var ae=yy(w,T,F,Q,J);if(ae==null)return ae;if(Y){var je=T.children;if(je!==void 0)if(U)if(xs(je)){for(var Xt=0;Xt<je.length;Xt++)Xu(je[Xt],w);Object.freeze&&Object.freeze(je)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Xu(je,w)}if(Un.call(T,"key")){var It=D(w),xe=Object.keys(T).filter(function(Ay){return Ay!=="key"}),Cs=xe.length>0?"{key: someKey, "+xe.join(": ..., ")+": ...}":"{key: someKey}";if(!Qu[It+Cs]){var Oy=xe.length>0?"{"+xe.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
30
|
+
<%s key={someKey} {...props} />`,Cs,It,Oy,It),Qu[It+Cs]=!0}}return w===r?Ey(ae):xy(ae),ae}}function $y(w,T,F){return Zu(w,T,F,!0)}function Sy(w,T,F){return Zu(w,T,F,!1)}var Cy=Sy,Py=$y;Zt.Fragment=r,Zt.jsx=Cy,Zt.jsxs=Py}()),Zt}process.env.NODE_ENV==="production"?Fr.exports=tc():Fr.exports=nc();var P=Fr.exports;const rc=m.createContext(null),oc=({config:e,children:t})=>P.jsx(rc.Provider,{value:e,children:t}),js={emit:(e,t)=>{console.log("Event emitted:",e,t)}},sc=()=>({openDeposit:m.useCallback(t=>{js.emit("deposit:open",t)},[])}),ic=()=>({openWithdraw:m.useCallback(t=>{js.emit("withdraw:open",t)},[])});/**
|
|
31
31
|
* @license lucide-react v0.540.0 - ISC
|
|
32
32
|
*
|
|
33
33
|
* This source code is licensed under the ISC license.
|
|
34
34
|
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/const
|
|
35
|
+
*/const ac=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),ks=e=>{const t=lc(e);return t.charAt(0).toUpperCase()+t.slice(1)},Fs=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),uc=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
36
36
|
* @license lucide-react v0.540.0 - ISC
|
|
37
37
|
*
|
|
38
38
|
* This source code is licensed under the ISC license.
|
|
39
39
|
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var
|
|
40
|
+
*/var cc={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
41
|
* @license lucide-react v0.540.0 - ISC
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the ISC license.
|
|
44
44
|
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const
|
|
45
|
+
*/const fc=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...u},i)=>m.createElement("svg",{ref:i,...cc,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Fs("lucide",o),...!s&&!uc(u)&&{"aria-hidden":"true"},...u},[...a.map(([l,c])=>m.createElement(l,c)),...Array.isArray(s)?s:[s]]));/**
|
|
46
46
|
* @license lucide-react v0.540.0 - ISC
|
|
47
47
|
*
|
|
48
48
|
* This source code is licensed under the ISC license.
|
|
49
49
|
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/const
|
|
50
|
+
*/const dc=(e,t)=>{const n=m.forwardRef(({className:r,...o},s)=>m.createElement(fc,{ref:s,iconNode:t,className:Fs(`lucide-${ac(ks(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ks(e),n};/**
|
|
51
51
|
* @license lucide-react v0.540.0 - ISC
|
|
52
52
|
*
|
|
53
53
|
* This source code is licensed under the ISC license.
|
|
54
54
|
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const Ms=As("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Tr{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 _s extends Tr{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 Ls extends Tr{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 Ds(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new _s(t,e);default:return new Ls(e,!1,r||1,o,s)}}const $r=typeof document<"u"?h.useLayoutEffect:()=>{};var dn;const Fs=(dn=h.useInsertionEffect)!==null&&dn!==void 0?dn:$r;function Is(e){const t=h.useRef(null);return Fs(()=>{t.current=e},[e]),h.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},Ze=e=>e&&"window"in e&&e.window===e?e:Ge(e).defaultView||window;function ks(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Ns(e){return ks(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let js=!1;function pn(){return js}function Pr(e,t){if(!pn())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:Ns(n)?n=n.host:n=n.parentNode}return!1}const hn=(e=document)=>{var t;if(!pn())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 Ar(e){return pn()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function kt(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 mn(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 vn=Ue(function(){return mn(/^Mac/i)}),Rs=Ue(function(){return mn(/^iPhone/i)}),Ws=Ue(function(){return mn(/^iPad/i)||vn()&&navigator.maxTouchPoints>1}),Bs=Ue(function(){return Rs()||Ws()});Ue(function(){return vn()||Bs()}),Ue(function(){return kt(/AppleWebKit/i)&&!Hs()});const Hs=Ue(function(){return kt(/Chrome/i)}),Us=Ue(function(){return kt(/Android/i)});Ue(function(){return kt(/Firefox/i)});function Mr(){let e=h.useRef(new Map),t=h.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=h.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=h.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return h.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Vs(e){return e.mozInputSource===0&&e.isTrusted?!0:Us()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function _r(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function zs(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Lr(e){let t=h.useRef({isFocused:!1,observer:null});$r(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Is(r=>{e==null||e(r)});return h.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=_r(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 Ys=!1,xt=null,gn=new Set,Ct=new Map,et=!1,bn=!1;const Gs={Tab:!0,Escape:!0};function yn(e,t){for(let n of gn)n(e,t)}function qs(e){return!(e.metaKey||!vn()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Nt(e){et=!0,qs(e)&&(xt="keyboard",yn("keyboard",e))}function Te(e){xt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(et=!0,yn("pointer",e))}function Dr(e){Vs(e)&&(et=!0,xt="virtual")}function Fr(e){e.target===window||e.target===document||Ys||!e.isTrusted||(!et&&!bn&&(xt="virtual",yn("virtual",e)),et=!1,bn=!1)}function Ir(){et=!1,bn=!0}function En(e){if(typeof window>"u"||typeof document>"u"||Ct.get(Ze(e)))return;const t=Ze(e),n=Ge(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){et=!0,r.apply(this,arguments)},n.addEventListener("keydown",Nt,!0),n.addEventListener("keyup",Nt,!0),n.addEventListener("click",Dr,!0),t.addEventListener("focus",Fr,!0),t.addEventListener("blur",Ir,!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",()=>{kr(e)},{once:!0}),Ct.set(t,{focus:r})}const kr=(e,t)=>{const n=Ze(e),r=Ge(e);t&&r.removeEventListener("DOMContentLoaded",t),Ct.has(n)&&(n.HTMLElement.prototype.focus=Ct.get(n).focus,r.removeEventListener("keydown",Nt,!0),r.removeEventListener("keyup",Nt,!0),r.removeEventListener("click",Dr,!0),n.removeEventListener("focus",Fr,!0),n.removeEventListener("blur",Ir,!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 Ks(e){const t=Ge(e);let n;return t.readyState!=="loading"?En(e):(n=()=>{En(e)},t.addEventListener("DOMContentLoaded",n)),()=>kr(e,n)}typeof document<"u"&&Ks();function Nr(){return xt!=="pointer"}const Qs=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Xs(e,t,n){let r=Ge(n==null?void 0:n.target);const o=typeof window<"u"?Ze(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Ze(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?Ze(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?Ze(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Qs.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof c&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Gs[n.key])}function Js(e,t,n){En(),h.useEffect(()=>{let r=(o,s)=>{Xs(!!(n!=null&&n.isTextInput),o,s)&&e(Nr())};return gn.add(r),()=>{gn.delete(r)}},t)}function Zs(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=h.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),c=Lr(s),u=h.useCallback(i=>{const l=Ge(i.target),a=l?hn(l):hn();i.target===i.currentTarget&&a===Ar(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 el(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=h.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:u}=Mr(),i=h.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=Lr(i),a=h.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const f=Ge(d.target),p=hn(f);if(!s.current.isFocusWithin&&p===Ar(d.nativeEvent)){r&&r(d),o&&o(!0),s.current.isFocusWithin=!0,l(d);let m=d.currentTarget;c(f,"focus",g=>{if(s.current.isFocusWithin&&!Pr(m,g.target)){let b=new f.defaultView.FocusEvent("blur",{relatedTarget:g.target});zs(b,m);let x=_r(b);i(x)}},{capture:!0})}},[r,o,l,c,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:a,onBlur:i}}}let jt=!1,Rt=0;function wn(){jt=!0,setTimeout(()=>{jt=!1},50)}function jr(e){e.pointerType==="touch"&&wn()}function tl(){if(!(typeof document>"u"))return Rt===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",jr):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",wn)),Rt++,()=>{Rt--,!(Rt>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",jr):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",wn))}}function nl(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,c]=h.useState(!1),u=h.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;h.useEffect(tl,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Mr(),{hoverProps:a,triggerHoverEnd:d}=h.useMemo(()=>{let f=(g,b)=>{if(u.pointerType=b,o||b==="touch"||u.isHovered||!g.currentTarget.contains(g.target))return;u.isHovered=!0;let x=g.currentTarget;u.target=x,i(Ge(g.target),"pointerover",w=>{u.isHovered&&u.target&&!Pr(u.target,w.target)&&p(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:x,pointerType:b}),n&&n(!0),c(!0)},p=(g,b)=>{let x=u.target;u.pointerType="",u.target=null,!(b==="touch"||!u.isHovered||!x)&&(u.isHovered=!1,l(),r&&r({type:"hoverend",target:x,pointerType:b}),n&&n(!1),c(!1))},m={};return typeof PointerEvent<"u"?(m.onPointerEnter=g=>{jt&&g.pointerType==="mouse"||f(g,g.pointerType)},m.onPointerLeave=g=>{!o&&g.currentTarget.contains(g.target)&&p(g,g.pointerType)}):process.env.NODE_ENV==="test"&&(m.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},m.onMouseEnter=g=>{!u.ignoreEmulatedMouseEvents&&!jt&&f(g,"mouse"),u.ignoreEmulatedMouseEvents=!1},m.onMouseLeave=g=>{!o&&g.currentTarget.contains(g.target)&&p(g,"mouse")}),{hoverProps:m,triggerHoverEnd:p}},[t,n,r,o,u,i,l]);return h.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:a,isHovered:s}}function rl(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=h.useRef({isFocused:!1,isFocusVisible:t||Nr()}),[s,c]=h.useState(!1),[u,i]=h.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=h.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),a=h.useCallback(p=>{o.current.isFocused=p,c(p),l()},[l]);Js(p=>{o.current.isFocusVisible=p,l()},[],{isTextInput:n});let{focusProps:d}=Zs({isDisabled:r,onFocusChange:a}),{focusWithinProps:f}=el({isDisabled:!r,onFocusWithinChange:a});return{isFocused:s,isFocusVisible:u,focusProps:r?f:d}}var ol=Object.defineProperty,il=(e,t,n)=>t in e?ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xn=(e,t,n)=>(il(e,typeof t!="symbol"?t+"":t,n),n);let sl=class{constructor(){xn(this,"current",this.detect()),xn(this,"handoffState","pending"),xn(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"}},ke=new sl;function St(e){var t,n;return ke.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 Rr(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function De(){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 Rr(()=>{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=De();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 at(){let[e]=h.useState(De);return h.useEffect(()=>()=>e.dispose(),[e]),e}let ue=(e,t)=>{ke.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function tt(e){let t=h.useRef(e);return ue(()=>{t.current=e},[e]),t}let ne=function(e){let t=tt(e);return h.useCallback((...n)=>t.current(...n),[t])};function ll(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 al(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function ul({disabled:e=!1}={}){let t=h.useRef(null),[n,r]=h.useState(!1),o=at(),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=ll(l);r(al(a,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:c,onPointerUp:s,onClick:s}}}let cl=h.createContext(void 0);function Cn(){return h.useContext(cl)}function Sn(...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 Wt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Wt||{}),qe=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(qe||{});function Se(){let e=dl();return h.useCallback(t=>fl({mergeRefs:e,...t}),[e])}function fl({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:c,mergeRefs:u}){u=u??pl;let i=Wr(t,e);if(s)return Bt(i,n,r,c,u);let l=o??0;if(l&2){let{static:a=!1,...d}=i;if(a)return Bt(d,n,r,c,u)}if(l&1){let{unmount:a=!0,...d}=i;return $e(a?0:1,{0(){return null},1(){return Bt({...d,hidden:!0,style:{display:"none"}},n,r,c,u)}})}return Bt(i,n,r,c,u)}function Bt(e,t={},n,r,o){let{as:s=n,children:c,refName:u="ref",...i}=On(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 f=!1,p=[];for(let[m,g]of Object.entries(t))typeof g=="boolean"&&(f=!0),g===!0&&p.push(m.replace(/([A-Z])/g,b=>`-${b.toLowerCase()}`));if(f){d["data-headlessui-state"]=p.join(" ");for(let m of p)d[`data-${m}`]=""}}if(s===h.Fragment&&(Object.keys(Ke(i)).length>0||Object.keys(Ke(d)).length>0))if(!h.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(f=>` - ${f}`).join(`
|
|
56
|
-
`),"","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(
|
|
55
|
+
*/const pc=dc("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Ns{constructor(){nt(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 hc extends Ns{constructor(n,r){super();nt(this,"smartWallet");nt(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 mc extends Ns{constructor(n,r,o,s="0",a="0"){super();nt(this,"currentActiveAccount");nt(this,"approved");nt(this,"chainId");nt(this,"balance");nt(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=a}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 gc(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new hc(t,e);default:return new mc(e,!1,r||1,o,s)}}const Ls=typeof document<"u"?m.useLayoutEffect:()=>{};var Nr;const bc=(Nr=m.useInsertionEffect)!==null&&Nr!==void 0?Nr:Ls;function yc(e){const t=m.useRef(null);return bc(()=>{t.current=e},[e]),m.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const rt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},ht=e=>e&&"window"in e&&e.window===e?e:rt(e).defaultView||window;function vc(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function wc(e){return vc(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let xc=!1;function Lr(){return xc}function Ds(e,t){if(!Lr())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:wc(n)?n=n.host:n=n.parentNode}return!1}const Dr=(e=document)=>{var t;if(!Lr())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 _s(e){return Lr()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Hn(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 _r(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 qe(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Rr=qe(function(){return _r(/^Mac/i)}),Ec=qe(function(){return _r(/^iPhone/i)}),$c=qe(function(){return _r(/^iPad/i)||Rr()&&navigator.maxTouchPoints>1}),Sc=qe(function(){return Ec()||$c()});qe(function(){return Rr()||Sc()}),qe(function(){return Hn(/AppleWebKit/i)&&!Cc()});const Cc=qe(function(){return Hn(/Chrome/i)}),Pc=qe(function(){return Hn(/Android/i)});qe(function(){return Hn(/Firefox/i)});function Rs(){let e=m.useRef(new Map),t=m.useCallback((o,s,a,u)=>{let i=u!=null&&u.once?(...l)=>{e.current.delete(a),a(...l)}:a;e.current.set(a,{type:s,eventTarget:o,fn:i,options:u}),o.addEventListener(s,i,u)},[]),n=m.useCallback((o,s,a,u)=>{var i;let l=((i=e.current.get(a))===null||i===void 0?void 0:i.fn)||a;o.removeEventListener(s,l,u),e.current.delete(a)},[]),r=m.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return m.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Oc(e){return e.mozInputSource===0&&e.isTrusted?!0:Pc()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Bs(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Ac(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Us(e){let t=m.useRef({isFocused:!1,observer:null});Ls(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=yc(r=>{e==null||e(r)});return m.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=a=>{if(t.current.isFocused=!1,o.disabled){let u=Bs(a);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 a;(a=t.current.observer)===null||a===void 0||a.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 Tc=!1,Jt=null,Br=new Set,en=new Map,mt=!1,Ur=!1;const Ic={Tab:!0,Escape:!0};function zr(e,t){for(let n of Br)n(e,t)}function Mc(e){return!(e.metaKey||!Rr()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Wn(e){mt=!0,Mc(e)&&(Jt="keyboard",zr("keyboard",e))}function Ce(e){Jt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(mt=!0,zr("pointer",e))}function zs(e){Oc(e)&&(mt=!0,Jt="virtual")}function Hs(e){e.target===window||e.target===document||Tc||!e.isTrusted||(!mt&&!Ur&&(Jt="virtual",zr("virtual",e)),mt=!1,Ur=!1)}function Ws(){mt=!1,Ur=!0}function Hr(e){if(typeof window>"u"||typeof document>"u"||en.get(ht(e)))return;const t=ht(e),n=rt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){mt=!0,r.apply(this,arguments)},n.addEventListener("keydown",Wn,!0),n.addEventListener("keyup",Wn,!0),n.addEventListener("click",zs,!0),t.addEventListener("focus",Hs,!0),t.addEventListener("blur",Ws,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Ce,!0),n.addEventListener("pointermove",Ce,!0),n.addEventListener("pointerup",Ce,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Ce,!0),n.addEventListener("mousemove",Ce,!0),n.addEventListener("mouseup",Ce,!0)),t.addEventListener("beforeunload",()=>{Vs(e)},{once:!0}),en.set(t,{focus:r})}const Vs=(e,t)=>{const n=ht(e),r=rt(e);t&&r.removeEventListener("DOMContentLoaded",t),en.has(n)&&(n.HTMLElement.prototype.focus=en.get(n).focus,r.removeEventListener("keydown",Wn,!0),r.removeEventListener("keyup",Wn,!0),r.removeEventListener("click",zs,!0),n.removeEventListener("focus",Hs,!0),n.removeEventListener("blur",Ws,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Ce,!0),r.removeEventListener("pointermove",Ce,!0),r.removeEventListener("pointerup",Ce,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Ce,!0),r.removeEventListener("mousemove",Ce,!0),r.removeEventListener("mouseup",Ce,!0)),en.delete(n))};function jc(e){const t=rt(e);let n;return t.readyState!=="loading"?Hr(e):(n=()=>{Hr(e)},t.addEventListener("DOMContentLoaded",n)),()=>Vs(e,n)}typeof document<"u"&&jc();function Gs(){return Jt!=="pointer"}const kc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Fc(e,t,n){let r=rt(n==null?void 0:n.target);const o=typeof window<"u"?ht(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?ht(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,a=typeof window<"u"?ht(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?ht(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!kc.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof a&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Ic[n.key])}function Nc(e,t,n){Hr(),m.useEffect(()=>{let r=(o,s)=>{Fc(!!(n!=null&&n.isTextInput),o,s)&&e(Gs())};return Br.add(r),()=>{Br.delete(r)}},t)}function Lc(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=m.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),a=Us(s),u=m.useCallback(i=>{const l=rt(i.target),c=l?Dr(l):Dr();i.target===i.currentTarget&&c===_s(i.nativeEvent)&&(n&&n(i),o&&o(!0),a(i))},[o,n,a]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Dc(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=m.useRef({isFocusWithin:!1}),{addGlobalListener:a,removeAllGlobalListeners:u}=Rs(),i=m.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=Us(i),c=m.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const p=rt(d.target),f=Dr(p);if(!s.current.isFocusWithin&&f===_s(d.nativeEvent)){r&&r(d),o&&o(!0),s.current.isFocusWithin=!0,l(d);let h=d.currentTarget;a(p,"focus",g=>{if(s.current.isFocusWithin&&!Ds(h,g.target)){let b=new p.defaultView.FocusEvent("blur",{relatedTarget:g.target});Ac(b,h);let $=Bs(b);i($)}},{capture:!0})}},[r,o,l,a,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:i}}}let Vn=!1,Gn=0;function Wr(){Vn=!0,setTimeout(()=>{Vn=!1},50)}function qs(e){e.pointerType==="touch"&&Wr()}function _c(){if(!(typeof document>"u"))return Gn===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",qs):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Wr)),Gn++,()=>{Gn--,!(Gn>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",qs):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Wr))}}function Rc(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,a]=m.useState(!1),u=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(_c,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Rs(),{hoverProps:c,triggerHoverEnd:d}=m.useMemo(()=>{let p=(g,b)=>{if(u.pointerType=b,o||b==="touch"||u.isHovered||!g.currentTarget.contains(g.target))return;u.isHovered=!0;let $=g.currentTarget;u.target=$,i(rt(g.target),"pointerover",x=>{u.isHovered&&u.target&&!Ds(u.target,x.target)&&f(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:$,pointerType:b}),n&&n(!0),a(!0)},f=(g,b)=>{let $=u.target;u.pointerType="",u.target=null,!(b==="touch"||!u.isHovered||!$)&&(u.isHovered=!1,l(),r&&r({type:"hoverend",target:$,pointerType:b}),n&&n(!1),a(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=g=>{Vn&&g.pointerType==="mouse"||p(g,g.pointerType)},h.onPointerLeave=g=>{!o&&g.currentTarget.contains(g.target)&&f(g,g.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=g=>{!u.ignoreEmulatedMouseEvents&&!Vn&&p(g,"mouse"),u.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=g=>{!o&&g.currentTarget.contains(g.target)&&f(g,"mouse")}),{hoverProps:h,triggerHoverEnd:f}},[t,n,r,o,u,i,l]);return m.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:c,isHovered:s}}function Bc(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=m.useRef({isFocused:!1,isFocusVisible:t||Gs()}),[s,a]=m.useState(!1),[u,i]=m.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=m.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),c=m.useCallback(f=>{o.current.isFocused=f,a(f),l()},[l]);Nc(f=>{o.current.isFocusVisible=f,l()},[],{isTextInput:n});let{focusProps:d}=Lc({isDisabled:r,onFocusChange:c}),{focusWithinProps:p}=Dc({isDisabled:!r,onFocusWithinChange:c});return{isFocused:s,isFocusVisible:u,focusProps:r?p:d}}var Uc=Object.defineProperty,zc=(e,t,n)=>t in e?Uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vr=(e,t,n)=>(zc(e,typeof t!="symbol"?t+"":t,n),n);let Hc=class{constructor(){Vr(this,"current",this.detect()),Vr(this,"handoffState","pending"),Vr(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"}},_e=new Hc;function tn(e){var t,n;return _e.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 Ks(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ke(){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 Ks(()=>{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=ke();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 Mt(){let[e]=m.useState(ke);return m.useEffect(()=>()=>e.dispose(),[e]),e}let te=(e,t)=>{_e.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function gt(e){let t=m.useRef(e);return te(()=>{t.current=e},[e]),t}let K=function(e){let t=gt(e);return m.useCallback((...n)=>t.current(...n),[t])};function Wc(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 Vc(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Gc({disabled:e=!1}={}){let t=m.useRef(null),[n,r]=m.useState(!1),o=Mt(),s=K(()=>{t.current=null,r(!1),o.dispose()}),a=K(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let i=tn(u.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let c=Wc(l);r(Vc(c,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:a,onPointerUp:s,onClick:s}}}let qc=m.createContext(void 0);function Gr(){return m.useContext(qc)}function qr(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Pe(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,Pe),r}var qn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(qn||{}),ot=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ot||{});function Ee(){let e=Yc();return m.useCallback(t=>Kc({mergeRefs:e,...t}),[e])}function Kc({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:a,mergeRefs:u}){u=u??Xc;let i=Ys(t,e);if(s)return Kn(i,n,r,a,u);let l=o??0;if(l&2){let{static:c=!1,...d}=i;if(c)return Kn(d,n,r,a,u)}if(l&1){let{unmount:c=!0,...d}=i;return Pe(c?0:1,{0(){return null},1(){return Kn({...d,hidden:!0,style:{display:"none"}},n,r,a,u)}})}return Kn(i,n,r,a,u)}function Kn(e,t={},n,r,o){let{as:s=n,children:a,refName:u="ref",...i}=Kr(e,["unmount","static"]),l=e.ref!==void 0?{[u]:e.ref}:{},c=typeof a=="function"?a(t):a;"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 p=!1,f=[];for(let[h,g]of Object.entries(t))typeof g=="boolean"&&(p=!0),g===!0&&f.push(h.replace(/([A-Z])/g,b=>`-${b.toLowerCase()}`));if(p){d["data-headlessui-state"]=f.join(" ");for(let h of f)d[`data-${h}`]=""}}if(s===m.Fragment&&(Object.keys(st(i)).length>0||Object.keys(st(d)).length>0))if(!m.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(st(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(st(i)).concat(Object.keys(st(d))).map(p=>` - ${p}`).join(`
|
|
56
|
+
`),"","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(`
|
|
57
57
|
`)].join(`
|
|
58
|
-
`))}else{let f=a.props,p=f==null?void 0:f.className,m=typeof p=="function"?(...x)=>Sn(p(...x),i.className):Sn(p,i.className),g=m?{className:m}:{},b=Wr(a.props,Ke(On(i,["ref"])));for(let x in d)x in b&&delete d[x];return h.cloneElement(a,Object.assign({},b,d,l,{ref:o(hl(a),l.ref)},g))}return h.createElement(s,Object.assign({},On(i,["ref"]),s!==h.Fragment&&l,s!==h.Fragment&&d),a)}function dl(){let e=h.useRef([]),t=h.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 pl(...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 Wr(...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 Br(...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(h.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 On(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function hl(e){return h.version.split(".")[0]>="19"?e.props.ref:e.ref}function ml(e,t,n){let[r,o]=h.useState(n),s=e!==void 0,c=h.useRef(s),u=h.useRef(!1),i=h.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 vl(e){let[t]=h.useState(e);return t}function Hr(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Vr(n,Ur(t,r),o);return n}function Ur(e,t){return e?e+"["+t+"]":t}function Vr(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Vr(e,Ur(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,""]):Hr(n,t,e)}function gl(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 bl="span";var Tn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Tn||{});function yl(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:bl,name:"Hidden"})}let zr=xe(yl),El=h.createContext(null);function wl({children:e}){let t=h.useContext(El);if(!t)return h.createElement(h.Fragment,null,e);let{target:n}=t;return n?we.createPortal(h.createElement(h.Fragment,null,e),n):null}function xl({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,c]=h.useState(null),u=at();return h.useEffect(()=>{if(r&&s)return u.addEventListener(s,"reset",r)},[s,t,r]),h.createElement(wl,null,h.createElement(Cl,{setForm:c,formId:t}),Hr(e).map(([i,l])=>h.createElement(zr,{features:Tn.Hidden,...Ke({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function Cl({setForm:e,formId:t}){return h.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:h.createElement(zr,{features:Tn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Sl=h.createContext(void 0);function Yr(){return h.useContext(Sl)}function $n(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ht(e){return $n(e)&&"tagName"in e}function Ve(e){return Ht(e)&&"accessKey"in e}function ut(e){return Ht(e)&&"tabIndex"in e}function Ol(e){return Ht(e)&&"style"in e}function Tl(e){return Ve(e)&&e.nodeName==="IFRAME"}function Gr(e){return Ve(e)&&e.nodeName==="INPUT"}function qr(e){return Ve(e)&&e.nodeName==="LABEL"}function $l(e){return Ve(e)&&e.nodeName==="FIELDSET"}function Kr(e){return Ve(e)&&e.nodeName==="LEGEND"}function Pl(e){return Ht(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Al(e){let t=e.parentElement,n=null;for(;t&&!$l(t);)Kr(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Ml(n)?!1:r}function Ml(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Kr(t))return!1;t=t.previousElementSibling}return!0}let Qr=Symbol();function _l(e,t=!0){return Object.assign(e,{[Qr]:t})}function Pe(...e){let t=h.useRef(e);h.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[Qr]))?void 0:n}let Pn=h.createContext(null);Pn.displayName="DescriptionContext";function Xr(){let e=h.useContext(Pn);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,Xr),t}return e}function Ll(){var e,t;return(t=(e=h.useContext(Pn))==null?void 0:e.value)!=null?t:void 0}let Dl="p";function Fl(e,t){let n=h.useId(),r=Cn(),{id:o=`headlessui-description-${n}`,...s}=e,c=Xr(),u=Pe(t);ue(()=>c.register(o),[o,c.register]);let i=r||!1,l=h.useMemo(()=>({...c.slot,disabled:i}),[c.slot,i]),a={ref:u,...c.props,id:o};return Se()({ourProps:a,theirProps:s,slot:l,defaultTag:Dl,name:c.name||"Description"})}let Il=xe(Fl);Object.assign(Il,{});var me=(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))(me||{});let Ut=h.createContext(null);Ut.displayName="LabelContext";function Jr(){let e=h.useContext(Ut);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,Jr),t}return e}function Zr(e){var t,n,r;let o=(n=(t=h.useContext(Ut))==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 kl({inherit:e=!1}={}){let t=Zr(),[n,r]=h.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,h.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=h.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 h.createElement(Ut.Provider,{value:u},s.children)},[r])]}let Nl="label";function jl(e,t){var n;let r=h.useId(),o=Jr(),s=Yr(),c=Cn(),{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 f=ne(b=>{let x=b.currentTarget;if(!(b.target!==b.currentTarget&&Pl(b.target))&&(qr(x)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),qr(x))){let w=document.getElementById(x.htmlFor);if(w){let y=w.getAttribute("disabled");if(y==="true"||y==="")return;let S=w.getAttribute("aria-disabled");if(S==="true"||S==="")return;(Gr(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),p=c||!1,m=h.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),g={ref:d,...o.props,id:u,htmlFor:i,onClick:f};return l&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in a&&delete a.onClick),Se()({ourProps:g,theirProps:a,slot:m,defaultTag:i?Nl:"div",name:o.name||"Label"})}let Rl=xe(jl),Wl=Object.assign(Rl,{});function Bl(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 Hl(e=Bl){return h.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 Ul(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Vl(e,t=!1){let[n,r]=h.useReducer(()=>({}),{}),o=h.useMemo(()=>Ul(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 eo=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 zl=Object.defineProperty,Yl=(e,t,n)=>t in e?zl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gl=(e,t,n)=>(Yl(e,t+"",n),n),to=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ae=(e,t,n)=>(to(e,t,"read from private field"),n?n.call(e):t.get(e)),An=(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)},no=(e,t,n,r)=>(to(e,t,"write to private field"),t.set(e,n),n),Ne,Ot,Tt;let ro=class{constructor(t){An(this,Ne,{}),An(this,Ot,new eo(()=>new Set)),An(this,Tt,new Set),Gl(this,"disposables",De()),no(this,Ne,t),ke.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Ae(this,Ne)}subscribe(t,n){if(ke.isServer)return()=>{};let r={selector:t,callback:n,current:t(Ae(this,Ne))};return Ae(this,Tt).add(r),this.disposables.add(()=>{Ae(this,Tt).delete(r)})}on(t,n){return ke.isServer?()=>{}:(Ae(this,Ot).get(t).add(n),this.disposables.add(()=>{Ae(this,Ot).get(t).delete(n)}))}send(t){let n=this.reduce(Ae(this,Ne),t);if(n!==Ae(this,Ne)){no(this,Ne,n);for(let r of Ae(this,Tt)){let o=r.selector(Ae(this,Ne));oo(r.current,o)||(r.current=o,r.callback(o))}for(let r of Ae(this,Ot).get(t.type))r(Ae(this,Ne),t)}}};Ne=new WeakMap,Ot=new WeakMap,Tt=new WeakMap;function oo(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:Mn(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Mn(e.entries(),t.entries()):io(e)&&io(t)?Mn(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Mn(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 io(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function _n(e){let[t,n]=e(),r=De();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var ql=Object.defineProperty,Kl=(e,t,n)=>t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,so=(e,t,n)=>(Kl(e,typeof t!="symbol"?t+"":t,n),n),lo=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(lo||{});let Ql={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}}},Xl=class vs extends ro{constructor(){super(...arguments),so(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),so(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new vs({stack:[]})}reduce(t,n){return $e(n.type,Ql,t,n)}};const Ln=new eo(()=>Xl.new());var Dn={exports:{}},Fn={};/**
|
|
58
|
+
`))}else{let p=c.props,f=p==null?void 0:p.className,h=typeof f=="function"?(...$)=>qr(f(...$),i.className):qr(f,i.className),g=h?{className:h}:{},b=Ys(c.props,st(Kr(i,["ref"])));for(let $ in d)$ in b&&delete d[$];return m.cloneElement(c,Object.assign({},b,d,l,{ref:o(Qc(c),l.ref)},g))}return m.createElement(s,Object.assign({},Kr(i,["ref"]),s!==m.Fragment&&l,s!==m.Fragment&&d),c)}function Yc(){let e=m.useRef([]),t=m.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 Xc(...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 Ys(...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 a=n[r];for(let u of a){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...s)}}});return t}function Xs(...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 a of s)a==null||a(...o)}});return t}function ve(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function st(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Kr(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Qc(e){return m.version.split(".")[0]>="19"?e.props.ref:e.ref}function Zc(e,t,n){let[r,o]=m.useState(n),s=e!==void 0,a=m.useRef(s),u=m.useRef(!1),i=m.useRef(!1);return s&&!a.current&&!u.current?(u.current=!0,a.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&&a.current&&!i.current&&(i.current=!0,a.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,K(l=>(s||o(l),t==null?void 0:t(l)))]}function Jc(e){let[t]=m.useState(e);return t}function Qs(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Js(n,Zs(t,r),o);return n}function Zs(e,t){return e?e+"["+t+"]":t}function Js(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Js(e,Zs(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,""]):Qs(n,t,e)}function ef(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 tf="span";var Yr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Yr||{});function nf(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 Ee()({ourProps:s,theirProps:o,slot:{},defaultTag:tf,name:"Hidden"})}let ei=ve(nf),rf=m.createContext(null);function of({children:e}){let t=m.useContext(rf);if(!t)return m.createElement(m.Fragment,null,e);let{target:n}=t;return n?ye.createPortal(m.createElement(m.Fragment,null,e),n):null}function sf({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,a]=m.useState(null),u=Mt();return m.useEffect(()=>{if(r&&s)return u.addEventListener(s,"reset",r)},[s,t,r]),m.createElement(of,null,m.createElement(af,{setForm:a,formId:t}),Qs(e).map(([i,l])=>m.createElement(ei,{features:Yr.Hidden,...st({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function af({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:m.createElement(ei,{features:Yr.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let lf=m.createContext(void 0);function ti(){return m.useContext(lf)}function Xr(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Yn(e){return Xr(e)&&"tagName"in e}function Ke(e){return Yn(e)&&"accessKey"in e}function jt(e){return Yn(e)&&"tabIndex"in e}function uf(e){return Yn(e)&&"style"in e}function cf(e){return Ke(e)&&e.nodeName==="IFRAME"}function ni(e){return Ke(e)&&e.nodeName==="INPUT"}function ri(e){return Ke(e)&&e.nodeName==="LABEL"}function ff(e){return Ke(e)&&e.nodeName==="FIELDSET"}function oi(e){return Ke(e)&&e.nodeName==="LEGEND"}function df(e){return Yn(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function pf(e){let t=e.parentElement,n=null;for(;t&&!ff(t);)oi(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&hf(n)?!1:r}function hf(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(oi(t))return!1;t=t.previousElementSibling}return!0}let si=Symbol();function mf(e,t=!0){return Object.assign(e,{[si]:t})}function Oe(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=K(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[si]))?void 0:n}let Qr=m.createContext(null);Qr.displayName="DescriptionContext";function ii(){let e=m.useContext(Qr);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,ii),t}return e}function gf(){var e,t;return(t=(e=m.useContext(Qr))==null?void 0:e.value)!=null?t:void 0}let bf="p";function yf(e,t){let n=m.useId(),r=Gr(),{id:o=`headlessui-description-${n}`,...s}=e,a=ii(),u=Oe(t);te(()=>a.register(o),[o,a.register]);let i=r||!1,l=m.useMemo(()=>({...a.slot,disabled:i}),[a.slot,i]),c={ref:u,...a.props,id:o};return Ee()({ourProps:c,theirProps:s,slot:l,defaultTag:bf,name:a.name||"Description"})}let vf=ve(yf);Object.assign(vf,{});var le=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(le||{});let Xn=m.createContext(null);Xn.displayName="LabelContext";function ai(){let e=m.useContext(Xn);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,ai),t}return e}function li(e){var t,n,r;let o=(n=(t=m.useContext(Xn))==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 wf({inherit:e=!1}={}){let t=li(),[n,r]=m.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,m.useMemo(()=>function(s){let a=K(i=>(r(l=>[...l,i]),()=>r(l=>{let c=l.slice(),d=c.indexOf(i);return d!==-1&&c.splice(d,1),c}))),u=m.useMemo(()=>({register:a,slot:s.slot,name:s.name,props:s.props,value:s.value}),[a,s.slot,s.name,s.props,s.value]);return m.createElement(Xn.Provider,{value:u},s.children)},[r])]}let xf="label";function Ef(e,t){var n;let r=m.useId(),o=ai(),s=ti(),a=Gr(),{id:u=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...c}=e,d=Oe(t);te(()=>o.register(u),[u,o.register]);let p=K(b=>{let $=b.currentTarget;if(!(b.target!==b.currentTarget&&df(b.target))&&(ri($)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),ri($))){let x=document.getElementById($.htmlFor);if(x){let v=x.getAttribute("disabled");if(v==="true"||v==="")return;let E=x.getAttribute("aria-disabled");if(E==="true"||E==="")return;(ni(x)&&(x.type==="file"||x.type==="radio"||x.type==="checkbox")||x.role==="radio"||x.role==="checkbox"||x.role==="switch")&&x.click(),x.focus({preventScroll:!0})}}}),f=a||!1,h=m.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),g={ref:d,...o.props,id:u,htmlFor:i,onClick:p};return l&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in c&&delete c.onClick),Ee()({ourProps:g,theirProps:c,slot:h,defaultTag:i?xf:"div",name:o.name||"Label"})}let $f=ve(Ef),Sf=Object.assign($f,{});function Cf(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 Pf(e=Cf){return m.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 Of(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Af(e,t=!1){let[n,r]=m.useReducer(()=>({}),{}),o=m.useMemo(()=>Of(e),[e,n]);return te(()=>{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 ui=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 Tf=Object.defineProperty,If=(e,t,n)=>t in e?Tf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mf=(e,t,n)=>(If(e,t+"",n),n),ci=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ae=(e,t,n)=>(ci(e,t,"read from private field"),n?n.call(e):t.get(e)),Zr=(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)},fi=(e,t,n,r)=>(ci(e,t,"write to private field"),t.set(e,n),n),Re,nn,rn;let di=class{constructor(t){Zr(this,Re,{}),Zr(this,nn,new ui(()=>new Set)),Zr(this,rn,new Set),Mf(this,"disposables",ke()),fi(this,Re,t),_e.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Ae(this,Re)}subscribe(t,n){if(_e.isServer)return()=>{};let r={selector:t,callback:n,current:t(Ae(this,Re))};return Ae(this,rn).add(r),this.disposables.add(()=>{Ae(this,rn).delete(r)})}on(t,n){return _e.isServer?()=>{}:(Ae(this,nn).get(t).add(n),this.disposables.add(()=>{Ae(this,nn).get(t).delete(n)}))}send(t){let n=this.reduce(Ae(this,Re),t);if(n!==Ae(this,Re)){fi(this,Re,n);for(let r of Ae(this,rn)){let o=r.selector(Ae(this,Re));pi(r.current,o)||(r.current=o,r.callback(o))}for(let r of Ae(this,nn).get(t.type))r(Ae(this,Re),t)}}};Re=new WeakMap,nn=new WeakMap,rn=new WeakMap;function pi(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:Jr(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Jr(e.entries(),t.entries()):hi(e)&&hi(t)?Jr(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Jr(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 hi(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function eo(e){let[t,n]=e(),r=ke();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var jf=Object.defineProperty,kf=(e,t,n)=>t in e?jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t,n)=>(kf(e,typeof t!="symbol"?t+"":t,n),n),gi=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(gi||{});let Ff={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}}},Nf=class Ju extends di{constructor(){super(...arguments),mi(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),mi(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Ju({stack:[]})}reduce(t,n){return Pe(n.type,Ff,t,n)}};const to=new ui(()=>Nf.new());var no={exports:{}},ro={};/**
|
|
59
59
|
* @license React
|
|
60
60
|
* use-sync-external-store-with-selector.production.js
|
|
61
61
|
*
|
|
@@ -63,7 +63,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the MIT license found in the
|
|
65
65
|
* LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/var
|
|
66
|
+
*/var bi;function Lf(){if(bi)return ro;bi=1;var e=m;function t(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,u=e.useDebugValue;return ro.useSyncExternalStoreWithSelector=function(i,l,c,d,p){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=a(function(){function b(y){if(!$){if($=!0,x=y,y=d(y),p!==void 0&&h.hasValue){var C=h.value;if(p(C,y))return v=C}return v=y}if(C=v,n(x,y))return C;var S=d(y);return p!==void 0&&p(C,S)?(x=y,C):(x=y,v=S)}var $=!1,x,v,E=c===void 0?null:c;return[function(){return b(l())},E===null?void 0:function(){return b(E())}]},[l,c,d,p]);var g=r(i,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=g},[g]),u(g),g},ro}var oo={};/**
|
|
67
67
|
* @license React
|
|
68
68
|
* use-sync-external-store-with-selector.development.js
|
|
69
69
|
*
|
|
@@ -71,53 +71,70 @@ React keys must be passed directly to JSX without using spread:
|
|
|
71
71
|
*
|
|
72
72
|
* This source code is licensed under the MIT license found in the
|
|
73
73
|
* LICENSE file in the root directory of this source tree.
|
|
74
|
-
*/var uo;function Zl(){return uo||(uo=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=h,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,u=t.useDebugValue;In.useSyncExternalStoreWithSelector=function(i,l,a,d,f){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=c(function(){function b(E){if(!x){if(x=!0,w=E,E=d(E),f!==void 0&&m.hasValue){var F=m.value;if(f(F,E))return y=F}return y=E}if(F=y,n(w,E))return F;var j=d(E);return f!==void 0&&f(F,j)?(w=E,F):(w=E,y=j)}var x=!1,w,y,S=a===void 0?null:a;return[function(){return b(l())},S===null?void 0:function(){return b(S())}]},[l,a,d,f]);var g=r(i,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=g},[g]),u(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),In}process.env.NODE_ENV==="production"?Dn.exports=Jl():Dn.exports=Zl();var ea=Dn.exports;function Me(e,t,n=oo){return ea.useSyncExternalStoreWithSelector(ne(r=>e.subscribe(ta,r)),ne(()=>e.state),ne(()=>e.state),ne(t),n)}function ta(e){return e}function co(e,t){let n=h.useId(),r=Ln.get(t),[o,s]=Me(r,h.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 kn=new Map,$t=new Map;function fo(e){var t;let n=(t=$t.get(e))!=null?t:0;return $t.set(e,n+1),n!==0?()=>po(e):(kn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>po(e))}function po(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=kn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,kn.delete(e))}function na(e,{allowed:t,disallowed:n}={}){let r=co(e,"inert-others");ue(()=>{var o,s;if(!r)return;let c=De();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&c.add(fo(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(f=>d.contains(f))||c.add(fo(d));a=a.parentElement}}return c.dispose},[r,t,n])}function ra(e,t,n){let r=tt(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});h.useEffect(()=>{if(!e)return;let o=t===null?null:Ve(t)?t:t.current;if(!o)return;let s=De();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 Nn=["[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(","),oa=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var jn=(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))(jn||{}),ia=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ia||{}),sa=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(sa||{});function ho(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Nn)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function la(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(oa)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Rn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Rn||{});function mo(e,t=0){var n;return e===((n=St(e))==null?void 0:n.body)?!1:$e(t,{0(){return e.matches(Nn)},1(){let r=e;for(;r!==null;){if(r.matches(Nn))return!0;r=r.parentElement}return!1}})}var aa=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(aa||{});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 ua=["textarea","input"].join(",");function ca(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,ua))!=null?n:!1}function vo(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 fa(e,t){return da(ho(),t,{relativeTo:e})}function da(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?vo(e):e:t&64?la(e):ho(e);o.length>0&&c.length>1&&(c=c.filter(p=>!o.some(m=>m!=null&&"current"in m?(m==null?void 0:m.current)===p:m===p))),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,f;do{if(a>=d||a+d<=0)return 0;let p=i+a;if(t&16)p=(p+d)%d;else{if(p<0)return 3;if(p>=d)return 1}f=c[p],f==null||f.focus(l),a+=u}while(f!==s.activeElement);return t&6&&ca(f)&&f.select(),2}function go(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function pa(){return/Android/gi.test(window.navigator.userAgent)}function bo(){return go()||pa()}function ct(e,t,n,r){let o=tt(n);h.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 ha(e,t,n,r){let o=tt(n);h.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 yo=30;function ma(e,t,n){let r=tt(n),o=h.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(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(t);for(let d of a)if(d!==null&&(d.contains(l)||u.composed&&u.composedPath().includes(d)))return;return!mo(l,Rn.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),s=h.useRef(null);ct(e,"pointerdown",u=>{var i,l;bo()||(s.current=((l=(i=u.composedPath)==null?void 0:i.call(u))==null?void 0:l[0])||u.target)},!0),ct(e,"pointerup",u=>{if(bo()||!s.current)return;let i=s.current;return s.current=null,o(u,()=>i)},!0);let c=h.useRef({x:0,y:0});ct(e,"touchstart",u=>{c.current.x=u.touches[0].clientX,c.current.y=u.touches[0].clientY},!0),ct(e,"touchend",u=>{let i={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(i.x-c.current.x)>=yo||Math.abs(i.y-c.current.y)>=yo))return o(u,()=>ut(u.target)?u.target:null)},!0),ha(e,"blur",u=>o(u,()=>Tl(window.document.activeElement)?window.document.activeElement:null),!0)}function Wn(...e){return h.useMemo(()=>St(...e),[...e])}var va=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(va||{});const Vt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},ga=200,Eo=5;function ba(e,{trigger:t,action:n,close:r,select:o}){let s=h.useRef(null),c=h.useRef(null),u=h.useRef(null);ct(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)}),ct(e&&t!==null,"pointerup",i=>{var l,a;let d=s.current;if(d===null||(s.current=null,!ut(i.target))||Math.abs(i.x-((l=c.current)!=null?l:i.x))<Eo&&Math.abs(i.y-((a=u.current)!=null?a:i.y))<Eo)return;let f=n(i);switch(f.kind){case 0:return;case 1:{i.timeStamp-d>ga&&(o(f.target),r());break}case 2:{r();break}}},{capture:!0})}function ya(e,t){return h.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 Ea(e){return h.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function wa(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 xa(){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 Ca(){return go()?{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=De();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(ut(u.target))try{let i=u.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),a=e.querySelector(l);ut(a)&&!r(a)&&(c=a)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(ut(u.target)&&Ol(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(ut(u.target)){if(Gr(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 Sa(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Oa(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let nt=wa(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:De(),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:Oa(n)},o=[Ca(),xa(),Sa()];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)}});nt.subscribe(()=>{let e=nt.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)&&nt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&nt.dispatch("TEARDOWN",n)}});function Ta(e,t,n=()=>({containers:[]})){let r=Ea(nt),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ue(()=>{if(!(!t||!e))return nt.dispatch("PUSH",t,n),()=>nt.dispatch("POP",t,n)},[e,t]),s}function $a(e,t,n=()=>[document.body]){let r=co(e,"scroll-lock");Ta(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function wo(e){return[e.screenX,e.screenY]}function Pa(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=wo(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=wo(t)}}}function Aa(e=0){let[t,n]=h.useState(e),r=h.useCallback(i=>n(i),[t]),o=h.useCallback(i=>n(l=>l|i),[t]),s=h.useCallback(i=>(t&i)===i,[t]),c=h.useCallback(i=>n(l=>l&~i),[n]),u=h.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:c,toggleFlag:u}}var xo,Co;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((xo=process==null?void 0:process.env)==null?void 0:xo.NODE_ENV)==="test"&&typeof((Co=Element==null?void 0:Element.prototype)==null?void 0:Co.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(`
|
|
75
|
-
`)),[]});var Ma=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Ma||{});function So(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Oo(e,t,n,r){let[o,s]=h.useState(n),{hasFlag:c,addFlag:u,removeFlag:i}=Aa(e&&o?3:0),l=h.useRef(!1),a=h.useRef(!1),d=at();return ue(()=>{var f;if(e){if(n&&s(!0),!t){n&&u(3);return}return(f=r==null?void 0:r.start)==null||f.call(r,n),_a(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 p;a.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(p=r==null?void 0:r.end)==null||p.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 _a(e,{prepare:t,run:n,done:r,inFlight:o}){let s=De();return Da(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(La(e,r))})}),s.dispose}function La(e,t){var n,r;let o=De();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 Da(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 zt(){return typeof window<"u"}function ft(e){return To(e)?(e.nodeName||"").toLowerCase():"#document"}function Oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function je(e){var t;return(t=(To(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function To(e){return zt()?e instanceof Node||e instanceof Oe(e).Node:!1}function ge(e){return zt()?e instanceof Element||e instanceof Oe(e).Element:!1}function Re(e){return zt()?e instanceof HTMLElement||e instanceof Oe(e).HTMLElement:!1}function $o(e){return!zt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oe(e).ShadowRoot}const Fa=new Set(["inline","contents"]);function Pt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Fe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Fa.has(o)}const Ia=new Set(["table","td","th"]);function ka(e){return Ia.has(ft(e))}const Na=[":popover-open",":modal"];function Yt(e){return Na.some(t=>{try{return e.matches(t)}catch{return!1}})}const ja=["transform","translate","scale","rotate","perspective"],Ra=["transform","translate","scale","rotate","perspective","filter"],Wa=["paint","layout","strict","content"];function Bn(e){const t=Hn(),n=ge(e)?Fe(e):e;return ja.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)||Ra.some(r=>(n.willChange||"").includes(r))||Wa.some(r=>(n.contain||"").includes(r))}function Ba(e){let t=Qe(e);for(;Re(t)&&!dt(t);){if(Bn(t))return t;if(Yt(t))return null;t=Qe(t)}return null}function Hn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ha=new Set(["html","body","#document"]);function dt(e){return Ha.has(ft(e))}function Fe(e){return Oe(e).getComputedStyle(e)}function Gt(e){return ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qe(e){if(ft(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$o(e)&&e.host||je(e);return $o(t)?t.host:t}function Po(e){const t=Qe(e);return dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Re(t)&&Pt(t)?t:Po(t)}function At(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Po(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=Oe(o);if(s){const u=Un(c);return t.concat(c,c.visualViewport||[],Pt(o)?o:[],u&&n?At(u):[])}return t.concat(o,At(o,[],n))}function Un(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ua(){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 rt=Math.min,be=Math.max,Mt=Math.round,qt=Math.floor,We=e=>({x:e,y:e}),Va={left:"right",right:"left",bottom:"top",top:"bottom"},za={start:"end",end:"start"};function Ao(e,t,n){return be(e,rt(t,n))}function pt(e,t){return typeof e=="function"?e(t):e}function Xe(e){return e.split("-")[0]}function _t(e){return e.split("-")[1]}function Mo(e){return e==="x"?"y":"x"}function _o(e){return e==="y"?"height":"width"}const Ya=new Set(["top","bottom"]);function ze(e){return Ya.has(Xe(e))?"y":"x"}function Lo(e){return Mo(ze(e))}function Ga(e,t,n){n===void 0&&(n=!1);const r=_t(e),o=Lo(e),s=_o(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=Kt(c)),[c,Kt(c)]}function qa(e){const t=Kt(e);return[Vn(e),t,Vn(t)]}function Vn(e){return e.replace(/start|end/g,t=>za[t])}const Do=["left","right"],Fo=["right","left"],Ka=["top","bottom"],Qa=["bottom","top"];function Xa(e,t,n){switch(e){case"top":case"bottom":return n?t?Fo:Do:t?Do:Fo;case"left":case"right":return t?Ka:Qa;default:return[]}}function Ja(e,t,n,r){const o=_t(e);let s=Xa(Xe(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(Vn)))),s}function Kt(e){return e.replace(/left|right|bottom|top/g,t=>Va[t])}function Za(e){return{top:0,right:0,bottom:0,left:0,...e}}function eu(e){return typeof e!="number"?Za(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 Io(e,t,n){let{reference:r,floating:o}=e;const s=ze(t),c=Lo(t),u=_o(c),i=Xe(t),l=s==="y",a=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[u]/2-o[u]/2;let p;switch(i){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(_t(t)){case"start":p[c]-=f*(n&&l?-1:1);break;case"end":p[c]+=f*(n&&l?-1:1);break}return p}const tu=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}=Io(l,r,i),f=r,p={},m=0;for(let g=0;g<u.length;g++){const{name:b,fn:x}=u[g],{x:w,y,data:S,reset:E}=await x({x:a,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:l,platform:c,elements:{reference:e,floating:t}});a=w??a,d=y??d,p={...p,[b]:{...p[b],...S}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(l=E.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:a,y:d}=Io(l,f,i)),g=-1)}return{x:a,y:d,placement:f,strategy:o,middlewareData:p}};async function Xt(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:f=!1,padding:p=0}=pt(t,e),m=eu(p),b=u[f?d==="floating"?"reference":"floating":d],x=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})),w=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)),S=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},E=Qt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:w,offsetParent:y,strategy:i}):w);return{top:(x.top-E.top+m.top)/S.y,bottom:(E.bottom-x.bottom+m.bottom)/S.y,left:(x.left-E.left+m.left)/S.x,right:(E.right-x.right+m.right)/S.x}}const nu=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:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...b}=pt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=Xe(o),w=ze(u),y=Xe(u)===u,S=await(i.isRTL==null?void 0:i.isRTL(l.floating)),E=f||(y||!g?[Kt(u)]:qa(u)),F=m!=="none";!f&&F&&E.push(...Ja(u,g,m,S));const j=[u,...E],K=await Xt(t,b),ee=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&ee.push(K[x]),d){const W=Ga(o,c,S);ee.push(K[W[0]],K[W[1]])}if(L=[...L,{placement:o,overflows:ee}],!ee.every(W=>W<=0)){var N,oe;const W=(((N=s.flip)==null?void 0:N.index)||0)+1,X=j[W];if(X&&(!(d==="alignment"?w!==ze(X):!1)||L.every(P=>ze(P.placement)===w?P.overflows[0]>0:!0)))return{data:{index:W,overflows:L},reset:{placement:X}};let G=(oe=L.filter(J=>J.overflows[0]<=0).sort((J,P)=>J.overflows[1]-P.overflows[1])[0])==null?void 0:oe.placement;if(!G)switch(p){case"bestFit":{var H;const J=(H=L.filter(P=>{if(F){const U=ze(P.placement);return U===w||U==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(U=>U>0).reduce((U,C)=>U+C,0)]).sort((P,U)=>P[1]-U[1])[0])==null?void 0:H[0];J&&(G=J);break}case"initialPlacement":G=u;break}if(o!==G)return{reset:{placement:G}}}return{}}}},ru=new Set(["left","top"]);async function ou(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Xe(n),u=_t(n),i=ze(n)==="y",l=ru.has(c)?-1:1,a=s&&i?-1:1,d=pt(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return u&&typeof m=="number"&&(p=u==="end"?m*-1:m),i?{x:p*a,y:f*l}:{x:f*l,y:p*a}}const iu=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 ou(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,y:w}=b;return{x,y:w}}},...i}=pt(e,t),l={x:n,y:r},a=await Xt(t,i),d=ze(Xe(o)),f=Mo(d);let p=l[f],m=l[d];if(s){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",w=p+a[b],y=p-a[x];p=Ao(w,p,y)}if(c){const b=d==="y"?"top":"left",x=d==="y"?"bottom":"right",w=m+a[b],y=m-a[x];m=Ao(w,m,y)}const g=u.fn({...t,[f]:p,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[f]:s,[d]:c}}}}}},lu=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}=pt(e,t),a=await Xt(t,l),d=Xe(o),f=_t(o),p=ze(o)==="y",{width:m,height:g}=s.floating;let b,x;d==="top"||d==="bottom"?(b=d,x=f===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(x=d,b=f==="end"?"top":"bottom");const w=g-a.top-a.bottom,y=m-a.left-a.right,S=rt(g-a[b],w),E=rt(m-a[x],y),F=!t.middlewareData.shift;let j=S,K=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(K=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=w),F&&!f){const L=be(a.left,0),N=be(a.right,0),oe=be(a.top,0),H=be(a.bottom,0);p?K=m-2*(L!==0||N!==0?L+N:be(a.left,a.right)):j=g-2*(oe!==0||H!==0?oe+H:be(a.top,a.bottom))}await i({...t,availableWidth:K,availableHeight:j});const ee=await c.getDimensions(u.floating);return m!==ee.width||g!==ee.height?{reset:{rects:!0}}:{}}}};function ko(e){const t=Fe(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=Mt(n)!==s||Mt(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}function zn(e){return ge(e)?e:e.contextElement}function ht(e){const t=zn(e);if(!Re(t))return We(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ko(t);let c=(s?Mt(n.width):n.width)/r,u=(s?Mt(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const au=We(0);function No(e){const t=Oe(e);return!Hn()||!t.visualViewport?au:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Oe(e)?!1:t}function ot(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=zn(e);let c=We(1);t&&(r?ge(r)&&(c=ht(r)):c=ht(e));const u=uu(s,n,r)?No(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 f=Oe(s),p=r&&ge(r)?Oe(r):r;let m=f,g=Un(m);for(;g&&r&&p!==m;){const b=ht(g),x=g.getBoundingClientRect(),w=Fe(g),y=x.left+(g.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(g.clientTop+parseFloat(w.paddingTop))*b.y;i*=b.x,l*=b.y,a*=b.x,d*=b.y,i+=y,l+=S,m=Oe(g),g=Un(m)}}return Qt({width:a,height:d,x:i,y:l})}function Jt(e,t){const n=Gt(e).scrollLeft;return t?t.left+n:ot(je(e)).left+n}function jo(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function cu(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=je(r),u=t?Yt(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)&&((ft(r)!=="body"||Pt(c))&&(i=Gt(r)),Re(r))){const p=ot(r);l=ht(r),a.x=p.x+r.clientLeft,a.y=p.y+r.clientTop}const f=c&&!d&&!s?jo(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+f.x,y:n.y*l.y-i.scrollTop*l.y+a.y+f.y}}function fu(e){return Array.from(e.getClientRects())}function du(e){const t=je(e),n=Gt(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+Jt(e);const u=-n.scrollTop;return Fe(r).direction==="rtl"&&(c+=be(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:u}}const Ro=25;function pu(e,t){const n=Oe(e),r=je(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=Hn();(!a||a&&t==="fixed")&&(u=o.offsetLeft,i=o.offsetTop)}const l=Jt(r);if(l<=0){const a=r.ownerDocument,d=a.body,f=getComputedStyle(d),p=a.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-p);m<=Ro&&(s-=m)}else l<=Ro&&(s+=l);return{width:s,height:c,x:u,y:i}}const hu=new Set(["absolute","fixed"]);function mu(e,t){const n=ot(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 Wo(e,t,n){let r;if(t==="viewport")r=pu(e,n);else if(t==="document")r=du(je(e));else if(ge(t))r=mu(t,n);else{const o=No(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Qt(r)}function Bo(e,t){const n=Qe(e);return n===t||!ge(n)||dt(n)?!1:Fe(n).position==="fixed"||Bo(n,t)}function vu(e,t){const n=t.get(e);if(n)return n;let r=At(e,[],!1).filter(u=>ge(u)&&ft(u)!=="body"),o=null;const s=Fe(e).position==="fixed";let c=s?Qe(e):e;for(;ge(c)&&!dt(c);){const u=Fe(c),i=Bn(c);!i&&u.position==="fixed"&&(o=null),(s?!i&&!o:!i&&u.position==="static"&&!!o&&hu.has(o.position)||Pt(c)&&!i&&Bo(e,c))?r=r.filter(a=>a!==c):o=u,c=Qe(c)}return t.set(e,r),r}function gu(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Yt(t)?[]:vu(t,this._c):[].concat(n),r],u=c[0],i=c.reduce((l,a)=>{const d=Wo(t,a,o);return l.top=be(d.top,l.top),l.right=rt(d.right,l.right),l.bottom=rt(d.bottom,l.bottom),l.left=be(d.left,l.left),l},Wo(t,u,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function bu(e){const{width:t,height:n}=ko(e);return{width:t,height:n}}function yu(e,t,n){const r=Re(t),o=je(t),s=n==="fixed",c=ot(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const i=We(0);function l(){i.x=Jt(o)}if(r||!r&&!s)if((ft(t)!=="body"||Pt(o))&&(u=Gt(t)),r){const p=ot(t,!0,s,t);i.x=p.x+t.clientLeft,i.y=p.y+t.clientTop}else o&&l();s&&!r&&o&&l();const a=o&&!r&&!s?jo(o,u):We(0),d=c.left+u.scrollLeft-i.x-a.x,f=c.top+u.scrollTop-i.y-a.y;return{x:d,y:f,width:c.width,height:c.height}}function Yn(e){return Fe(e).position==="static"}function Ho(e,t){if(!Re(e)||Fe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return je(e)===n&&(n=n.ownerDocument.body),n}function Uo(e,t){const n=Oe(e);if(Yt(e))return n;if(!Re(e)){let o=Qe(e);for(;o&&!dt(o);){if(ge(o)&&!Yn(o))return o;o=Qe(o)}return n}let r=Ho(e,t);for(;r&&ka(r)&&Yn(r);)r=Ho(r,t);return r&&dt(r)&&Yn(r)&&!Bn(r)?n:r||Ba(e)||n}const Eu=async function(e){const t=this.getOffsetParent||Uo,n=this.getDimensions,r=await n(e.floating);return{reference:yu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wu(e){return Fe(e).direction==="rtl"}const xu={convertOffsetParentRelativeRectToViewportRelativeRect:cu,getDocumentElement:je,getClippingRect:gu,getOffsetParent:Uo,getElementRects:Eu,getClientRects:fu,getDimensions:bu,getScale:ht,isElement:ge,isRTL:wu};function Vo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Cu(e,t){let n=null,r;const o=je(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:f,height:p}=l;if(u||t(),!f||!p)return;const m=qt(d),g=qt(o.clientWidth-(a+f)),b=qt(o.clientHeight-(d+p)),x=qt(a),y={rootMargin:-m+"px "+-g+"px "+-b+"px "+-x+"px",threshold:be(0,rt(1,i))||1};let S=!0;function E(F){const j=F[0].intersectionRatio;if(j!==i){if(!S)return c();j?c(!1,j):r=setTimeout(()=>{c(!1,1e-7)},1e3)}j===1&&!Vo(l,e.getBoundingClientRect())&&c(),S=!1}try{n=new IntersectionObserver(E,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,y)}n.observe(e)}return c(!0),s}function Su(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=zn(e),a=o||s?[...l?At(l):[],...At(t)]:[];a.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const d=l&&u?Cu(l,n):null;let f=-1,p=null;c&&(p=new ResizeObserver(x=>{let[w]=x;w&&w.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var y;(y=p)==null||y.observe(t)})),n()}),l&&!i&&p.observe(l),p.observe(t));let m,g=i?ot(e):null;i&&b();function b(){const x=ot(e);g&&!Vo(g,x)&&n(),g=x,m=requestAnimationFrame(b)}return n(),()=>{var x;a.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),d==null||d(),(x=p)==null||x.disconnect(),p=null,i&&cancelAnimationFrame(m)}}const Gn=Xt,Ou=iu,Tu=su,$u=nu,Pu=lu,Au=(e,t,n)=>{const r=new Map,o={platform:xu,...n},s={...o.platform,_c:r};return tu(e,t,{...o,platform:s})};var Mu=typeof document<"u",_u=function(){},Zt=Mu?h.useLayoutEffect:_u;function en(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(!en(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)&&!en(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function zo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yo(e,t){const n=zo(e);return Math.round(t*n)/n}function qn(e){const t=D.useRef(e);return Zt(()=>{t.current=e}),t}function Lu(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]=D.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=D.useState(r);en(f,r)||p(r);const[m,g]=D.useState(null),[b,x]=D.useState(null),w=D.useCallback(P=>{P!==F.current&&(F.current=P,g(P))},[]),y=D.useCallback(P=>{P!==j.current&&(j.current=P,x(P))},[]),S=s||m,E=c||b,F=D.useRef(null),j=D.useRef(null),K=D.useRef(a),ee=i!=null,L=qn(i),N=qn(o),oe=qn(l),H=D.useCallback(()=>{if(!F.current||!j.current)return;const P={placement:t,strategy:n,middleware:f};N.current&&(P.platform=N.current),Au(F.current,j.current,P).then(U=>{const C={...U,isPositioned:oe.current!==!1};W.current&&!en(K.current,C)&&(K.current=C,It.flushSync(()=>{d(C)}))})},[f,t,n,N,oe]);Zt(()=>{l===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,d(P=>({...P,isPositioned:!1})))},[l]);const W=D.useRef(!1);Zt(()=>(W.current=!0,()=>{W.current=!1}),[]),Zt(()=>{if(S&&(F.current=S),E&&(j.current=E),S&&E){if(L.current)return L.current(S,E,H);H()}},[S,E,H,L,ee]);const X=D.useMemo(()=>({reference:F,floating:j,setReference:w,setFloating:y}),[w,y]),G=D.useMemo(()=>({reference:S,floating:E}),[S,E]),J=D.useMemo(()=>{const P={position:n,left:0,top:0};if(!G.floating)return P;const U=Yo(G.floating,a.x),C=Yo(G.floating,a.y);return u?{...P,transform:"translate("+U+"px, "+C+"px)",...zo(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:C}},[n,u,G.floating,a.x,a.y]);return D.useMemo(()=>({...a,update:H,refs:X,elements:G,floatingStyles:J}),[a,H,X,G,J])}const Go=(e,t)=>({...Ou(e),options:[e,t]}),Du=(e,t)=>({...Tu(e),options:[e,t]}),Fu=(e,t)=>({...$u(e),options:[e,t]}),Iu=(e,t)=>({...Pu(e),options:[e,t]}),qo={...D},ku=qo.useInsertionEffect||(e=>e());function Ko(e){const t=D.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return ku(()=>{t.current=e}),D.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 Kn=typeof document<"u"?h.useLayoutEffect:h.useEffect;let Qo=!1,Nu=0;const Xo=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Nu++;function ju(){const[e,t]=D.useState(()=>Qo?Xo():void 0);return Kn(()=>{e==null&&t(Xo())},[]),D.useEffect(()=>{Qo=!0},[]),e}const Ru=qo.useId||ju;let Lt;process.env.NODE_ENV!=="production"&&(Lt=new Set);function Wu(){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=Lt)!=null&&e.has(o))){var s;(s=Lt)==null||s.add(o),console.warn(o)}}function Bu(){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=Lt)!=null&&e.has(o))){var s;(s=Lt)==null||s.add(o),console.error(o)}}function Hu(){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 Uu=D.createContext(null),Vu=D.createContext(null),zu=()=>{var e;return((e=D.useContext(Uu))==null?void 0:e.id)||null},Yu=()=>D.useContext(Vu),Gu="data-floating-ui-focusable";function qu(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Ru(),s=D.useRef({}),[c]=D.useState(()=>Hu()),u=zu()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!ge(p)&&Bu("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]=D.useState(r.reference),a=Ko((p,m,g)=>{s.current.openEvent=p?m:void 0,c.emit("openchange",{open:p,event:m,reason:g,nested:u}),n==null||n(p,m,g)}),d=D.useMemo(()=>({setPositionReference:l}),[]),f=D.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return D.useMemo(()=>({dataRef:s,open:t,onOpenChange:a,elements:f,events:c,floatingId:o,refs:d}),[t,a,f,c,o,d])}function Ku(e){e===void 0&&(e={});const{nodeId:t}=e,n=qu({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=D.useState(null),[u,i]=D.useState(null),a=(o==null?void 0:o.domReference)||s,d=D.useRef(null),f=Yu();Kn(()=>{a&&(d.current=a)},[a]);const p=Lu({...e,elements:{...o,...u&&{reference:u}}}),m=D.useCallback(y=>{const S=ge(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;i(S),p.refs.setReference(S)},[p.refs]),g=D.useCallback(y=>{(ge(y)||y===null)&&(d.current=y,c(y)),(ge(p.refs.reference.current)||p.refs.reference.current===null||y!==null&&!ge(y))&&p.refs.setReference(y)},[p.refs]),b=D.useMemo(()=>({...p.refs,setReference:g,setPositionReference:m,domReference:d}),[p.refs,g,m]),x=D.useMemo(()=>({...p.elements,domReference:a}),[p.elements,a]),w=D.useMemo(()=>({...p,...r,refs:b,elements:x,nodeId:t}),[p,b,x,t,r]);return Kn(()=>{r.dataRef.current.floatingContext=w;const y=f==null?void 0:f.nodesRef.current.find(S=>S.id===t);y&&(y.context=w)}),D.useMemo(()=>({...p,context:w,refs:b,elements:x}),[p,b,x,w])}const Jo="active",Zo="selected";function Qn(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Jo]:c,[Zo]:u,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[Gu]:""},...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&&[Jo,Zo].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 f,p=arguments.length,m=new Array(p),g=0;g<p;g++)m[g]=arguments[g];return(f=r.get(l))==null?void 0:f.map(b=>b(...m)).find(b=>b!==void 0)}}}else c[l]=a}),c),{})}}function Qu(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=D.useCallback(u=>Qn(u,e,"reference"),t),s=D.useCallback(u=>Qn(u,e,"floating"),n),c=D.useCallback(u=>Qn(u,e,"item"),r);return D.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}function ei(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Xu=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}=pt(e,t),{rects:d,elements:{floating:f}}=t,p=n.current[c],m=(l==null?void 0:l.current)||f,g=f.clientTop||m.clientTop,b=f.clientTop!==0,x=m.clientTop!==0,w=f===m;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Wu('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const y={...t,...await Go(-p.offsetTop-f.clientTop-d.reference.height/2-p.offsetHeight/2-s).fn(t)},S=await Gn(ei(y,m.scrollHeight+g+f.clientTop),a),E=await Gn(y,{...a,elementContext:"reference"}),F=be(0,S.top),j=y.y+F,L=(m.scrollHeight>m.clientHeight?N=>N:Mt)(be(0,m.scrollHeight+(b&&w||x?g*2:0)-F-be(0,S.bottom)));if(m.style.maxHeight=L+"px",m.scrollTop=F,o){const N=m.offsetHeight<p.offsetHeight*rt(u,n.current.length)-1||E.top>=-i||E.bottom>=-i;It.flushSync(()=>o(N))}return r&&(r.current=await Gn(ei({...y,y:j},m.offsetHeight+g+f.clientTop),a)),{y:j}}});function Ju(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:c,onChange:u}=t,i=Ko(u),l=D.useRef(!1),a=D.useRef(null),d=D.useRef(null);D.useEffect(()=>{if(!o)return;function p(g){if(g.ctrlKey||!m||s.current==null)return;const b=g.deltaY,x=s.current.top>=-.5,w=s.current.bottom>=-.5,y=m.scrollHeight-m.clientHeight,S=b<0?-1:1,E=b<0?"max":"min";m.scrollHeight<=m.clientHeight||(!x&&b>0||!w&&b<0?(g.preventDefault(),It.flushSync(()=>{i(F=>F+Math[E](b,y*S))})):/firefox/i.test(Ua())&&(m.scrollTop+=b))}const m=(c==null?void 0:c.current)||r.floating;if(n&&m)return m.addEventListener("wheel",p),requestAnimationFrame(()=>{a.current=m.scrollTop,s.current!=null&&(d.current={...s.current})}),()=>{a.current=null,d.current=null,m.removeEventListener("wheel",p)}},[o,n,r.floating,s,c,i]);const f=D.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const p=(c==null?void 0:c.current)||r.floating;if(!(!s.current||!p||!l.current)){if(a.current!==null){const m=p.scrollTop-a.current;(s.current.bottom<-.5&&m<-1||s.current.top<-.5&&m>1)&&It.flushSync(()=>i(g=>g+m))}requestAnimationFrame(()=>{a.current=p.scrollTop})}}}),[r.floating,i,s,c]);return D.useMemo(()=>o?{floating:f}:{},[o,f])}let mt=h.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});mt.displayName="FloatingContext";let Xn=h.createContext(null);Xn.displayName="PlacementContext";function Zu(e){return h.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function ec(){return h.useContext(mt).setReference}function tc(){return h.useContext(mt).getReferenceProps}function nc(){let{getFloatingProps:e,slot:t}=h.useContext(mt);return h.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function rc(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=h.useContext(Xn),n=h.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=h.useContext(mt);return h.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let ti=4;function oc({children:e,enabled:t=!0}){let[n,r]=h.useState(null),[o,s]=h.useState(0),c=h.useRef(null),[u,i]=h.useState(null);ic(u);let l=t&&n!==null&&u!==null,{to:a="bottom",gap:d=0,offset:f=0,padding:p=0,inner:m}=sc(n,u),[g,b="center"]=a.split(" ");ue(()=>{l&&s(0)},[l]);let{refs:x,floatingStyles:w,context:y}=Ku({open:l,placement:g==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${g}`:`${g}-${b}`,strategy:"absolute",transform:!1,middleware:[Go({mainAxis:g==="selection"?0:d,crossAxis:f}),Du({padding:p}),g!=="selection"&&Fu({padding:p}),g==="selection"&&m?Xu({...m,padding:p,overflowRef:c,offset:o,minItemsVisible:ti,referenceOverflowThreshold:p,onFallbackChange(N){var oe,H;if(!N)return;let W=y.elements.floating;if(!W)return;let X=parseFloat(getComputedStyle(W).scrollPaddingBottom)||0,G=Math.min(ti,W.childElementCount),J=0,P=0;for(let U of(H=(oe=y.elements.floating)==null?void 0:oe.childNodes)!=null?H:[])if(Ve(U)){let C=U.offsetTop,A=C+U.clientHeight+X,k=W.scrollTop,I=k+W.clientHeight;if(C>=k&&A<=I)G--;else{P=Math.max(0,Math.min(A,I)-Math.max(C,k)),J=U.clientHeight;break}}G>=1&&s(U=>{let C=J*G-P+X;return U>=C?U:C})}}):null,Iu({padding:p,apply({availableWidth:N,availableHeight:oe,elements:H}){Object.assign(H.floating.style,{overflow:"auto",maxWidth:`${N}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${oe}px)`})}})].filter(Boolean),whileElementsMounted:Su}),[S=g,E=b]=y.placement.split("-");g==="selection"&&(S="selection");let F=h.useMemo(()=>({anchor:[S,E].filter(Boolean).join(" ")}),[S,E]),j=Ju(y,{overflowRef:c,onChange:s}),{getReferenceProps:K,getFloatingProps:ee}=Qu([j]),L=ne(N=>{i(N),x.setFloating(N)});return D.createElement(Xn.Provider,{value:r},D.createElement(mt.Provider,{value:{setFloating:L,setReference:x.setReference,styles:w,getReferenceProps:K,getFloatingProps:ee,slot:F}},e))}function ic(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=Jn((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),c=Jn((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Jn((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:c,padding:u}}function Jn(e,t,n=void 0){let r=at(),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=ri(i,l);return[a,d=>{let f=ni(i);{let p=f.map(m=>window.getComputedStyle(l).getPropertyValue(m));r.requestAnimationFrame(function m(){r.nextFrame(m);let g=!1;for(let[x,w]of f.entries()){let y=window.getComputedStyle(l).getPropertyValue(w);if(p[x]!==y){p[x]=y,g=!0;break}}if(!g)return;let b=ri(i,l);a!==b&&(d(b),a=b)})}return r.dispose}]}return[n,null]}),s=h.useMemo(()=>o(e,t)[0],[e,t]),[c=s,u]=h.useState();return ue(()=>{let[i,l]=o(e,t);if(u(i),!!l)return l(u)},[e,t]),c}function ni(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,...ni(o)]:[r]}return[]}function ri(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 lc(e,t){let[n,r]=h.useState(t);return!e&&n!==t&&r(t),e?n:t}let Zn=h.createContext(null);Zn.displayName="OpenClosedContext";var Ie=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ie||{});function er(){return h.useContext(Zn)}function oi({value:e,children:t}){return h.createElement(Zn.Provider,{value:e},t)}function ac(e){throw new Error("Unexpected object: "+e)}var ce=(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))(ce||{});function tn(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:ac(e)}}var ii=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ii||{});function si(e){let t=ne(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,Rr(()=>{n.current&&t()})}),[t])}function uc(){let e=typeof document>"u";return"useSyncExternalStore"in D?(t=>t.useSyncExternalStore)(D)(()=>()=>{},()=>!1,()=>!e):!1}function tr(){let e=uc(),[t,n]=D.useState(ke.isHandoffComplete);return t&&ke.isHandoffComplete===!1&&n(!1),D.useEffect(()=>{t!==!0&&n(!0)},[t]),D.useEffect(()=>ke.handoff(),[]),e?!1:t}let cc=h.createContext(!1);function fc(){return h.useContext(cc)}function dc(e){let t=fc(),n=h.useContext(ai),[r,o]=h.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(ke.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 h.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),h.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let li=h.Fragment,pc=xe(function(e,t){let{ownerDocument:n=null,...r}=e,o=h.useRef(null),s=Pe(_l(p=>{o.current=p}),t),c=Wn(o),u=n??c,i=dc(u),[l]=h.useState(()=>{var p;return ke.isServer?null:(p=u==null?void 0:u.createElement("div"))!=null?p:null}),a=h.useContext(gc),d=tr();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]),si(()=>{var p;!i||!l||($n(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((p=i.parentElement)==null||p.removeChild(i)))});let f=Se();return d?!i||!l?null:we.createPortal(f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:li,name:"Portal"}),l):null});function hc(e,t){let n=Pe(t),{enabled:r=!0,ownerDocument:o,...s}=e,c=Se();return r?h.createElement(pc,{...s,ownerDocument:o,ref:n}):c({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:li,name:"Portal"})}let mc=h.Fragment,ai=h.createContext(null);function vc(e,t){let{target:n,...r}=e,o={ref:Pe(t)},s=Se();return h.createElement(ai.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:mc,name:"Popover.Group"}))}let gc=h.createContext(null),bc=xe(hc),yc=xe(vc),Ec=Object.assign(bc,{Group:yc});function wc(){let e=h.useRef(!1);return ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ui(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:fi)!==h.Fragment||h.Children.count(e.children)===1}let nn=h.createContext(null);nn.displayName="TransitionContext";var xc=(e=>(e.Visible="visible",e.Hidden="hidden",e))(xc||{});function Cc(){let e=h.useContext(nn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Sc(){let e=h.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}let rn=h.createContext(null);rn.displayName="NestingContext";function on(e){return"children"in e?on(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function ci(e,t){let n=tt(e),r=h.useRef([]),o=wc(),s=at(),c=ne((p,m=qe.Hidden)=>{let g=r.current.findIndex(({el:b})=>b===p);g!==-1&&($e(m,{[qe.Unmount](){r.current.splice(g,1)},[qe.Hidden](){r.current[g].state="hidden"}}),s.microTask(()=>{var b;!on(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),u=ne(p=>{let m=r.current.find(({el:g})=>g===p);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:p,state:"visible"}),()=>c(p,qe.Unmount)}),i=h.useRef([]),l=h.useRef(Promise.resolve()),a=h.useRef({enter:[],leave:[]}),d=ne((p,m,g)=>{i.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([b])=>b!==p)),t==null||t.chains.current[m].push([p,new Promise(b=>{i.current.push(b)})]),t==null||t.chains.current[m].push([p,new Promise(b=>{Promise.all(a.current[m].map(([x,w])=>w)).then(()=>b())})]),m==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(m)):g(m)}),f=ne((p,m,g)=>{Promise.all(a.current[m].splice(0).map(([b,x])=>x)).then(()=>{var b;(b=i.current.shift())==null||b()}).then(()=>g(m))});return h.useMemo(()=>({children:r,register:u,unregister:c,onStart:d,onStop:f,wait:l,chains:a}),[u,c,r,d,f,a,l])}let fi=h.Fragment,di=Wt.RenderStrategy;function Oc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:u,afterLeave:i,enter:l,enterFrom:a,enterTo:d,entered:f,leave:p,leaveFrom:m,leaveTo:g,...b}=e,[x,w]=h.useState(null),y=h.useRef(null),S=ui(e),E=Pe(...S?[y,t,w]:t===null?[]:[t]),F=(n=b.unmount)==null||n?qe.Unmount:qe.Hidden,{show:j,appear:K,initial:ee}=Cc(),[L,N]=h.useState(j?"visible":"hidden"),oe=Sc(),{register:H,unregister:W}=oe;ue(()=>H(y),[H,y]),ue(()=>{if(F===qe.Hidden&&y.current){if(j&&L!=="visible"){N("visible");return}return $e(L,{hidden:()=>W(y),visible:()=>H(y)})}},[L,y,H,W,j,F]);let X=tr();ue(()=>{if(S&&X&&L==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,L,X,S]);let G=ee&&!K,J=K&&j&&ee,P=h.useRef(!1),U=ci(()=>{P.current||(N("hidden"),W(y))},oe),C=ne($=>{P.current=!0;let R=$?"enter":"leave";U.onStart(y,R,V=>{V==="enter"?s==null||s():V==="leave"&&(u==null||u())})}),A=ne($=>{let R=$?"enter":"leave";P.current=!1,U.onStop(y,R,V=>{V==="enter"?c==null||c():V==="leave"&&(i==null||i())}),R==="leave"&&!on(U)&&(N("hidden"),W(y))});h.useEffect(()=>{S&&o||(C(j),A(j))},[j,S,o]);let k=!(!o||!S||!X||G),[,I]=Oo(k,x,j,{start:C,end:A}),B=Ke({ref:E,className:((r=Sn(b.className,J&&l,J&&a,I.enter&&l,I.enter&&I.closed&&a,I.enter&&!I.closed&&d,I.leave&&p,I.leave&&!I.closed&&m,I.leave&&I.closed&&g,!I.transition&&j&&f))==null?void 0:r.trim())||void 0,...So(I)}),q=0;L==="visible"&&(q|=Ie.Open),L==="hidden"&&(q|=Ie.Closed),j&&L==="hidden"&&(q|=Ie.Opening),!j&&L==="visible"&&(q|=Ie.Closing);let Y=Se();return h.createElement(rn.Provider,{value:U},h.createElement(oi,{value:q},Y({ourProps:B,theirProps:b,defaultTag:fi,features:di,visible:L==="visible",name:"Transition.Child"})))}function Tc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,c=h.useRef(null),u=ui(e),i=Pe(...u?[c,t]:t===null?[]:[t]);tr();let l=er();if(n===void 0&&l!==null&&(n=(l&Ie.Open)===Ie.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,d]=h.useState(n?"visible":"hidden"),f=ci(()=>{n||d("hidden")}),[p,m]=h.useState(!0),g=h.useRef([n]);ue(()=>{p!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),m(!1))},[g,n]);let b=h.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);ue(()=>{n?d("visible"):!on(f)&&c.current!==null&&d("hidden")},[n,f]);let x={unmount:o},w=ne(()=>{var E;p&&m(!1),(E=e.beforeEnter)==null||E.call(e)}),y=ne(()=>{var E;p&&m(!1),(E=e.beforeLeave)==null||E.call(e)}),S=Se();return h.createElement(rn.Provider,{value:f},h.createElement(nn.Provider,{value:b},S({ourProps:{...x,as:h.Fragment,children:h.createElement(pi,{ref:i,...x,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:di,visible:a==="visible",name:"Transition"})))}function $c(e,t){let n=h.useContext(nn)!==null,r=er()!==null;return h.createElement(h.Fragment,null,!n&&r?h.createElement(nr,{ref:t,...e}):h.createElement(pi,{ref:t,...e}))}let nr=xe(Tc),pi=xe(Oc),Pc=xe($c),hi=Object.assign(nr,{Child:Pc,Root:nr});function Ac(e,t){let n=h.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 mi=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function vi(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 mi.test(c)&&(c=c.replace(mi,"")),c}function Mc(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():vi(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return vi(e).trim()}function _c(e){let t=h.useRef(""),n=h.useRef("");return ne(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Mc(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Lc=Object.defineProperty,Dc=(e,t,n)=>t in e?Lc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gi=(e,t,n)=>(Dc(e,typeof t!="symbol"?t+"":t,n),n),ve=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ve||{}),Be=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Be||{}),sn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(sn||{}),bi=(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))(bi||{});function yi(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=vo(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 Fc={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ce.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===ce.Nothing)return{...u,activeOptionIndex:null};if(t.focus===ce.Specific)return{...u,activeOptionIndex:e.options.findIndex(a=>a.id===t.id)};if(t.focus===ce.Previous){let a=e.activeOptionIndex;if(a!==null){let d=e.options[a].dataRef.current.domRef,f=tn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...u,activeOptionIndex:f}}}}else if(t.focus===ce.Next){let a=e.activeOptionIndex;if(a!==null){let d=e.options[a].dataRef.current.domRef,f=tn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(f!==null){let p=e.options[f].dataRef.current.domRef;if(((s=d.current)==null?void 0:s.nextElementSibling)===p.current||((c=p.current)==null?void 0:c.nextElementSibling)===null)return{...u,activeOptionIndex:f}}}}let i=yi(e),l=tn(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!==ce.Nothing&&(r=tn(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:ce.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,...yi(e),pendingShouldSort:!1}:e};class rr extends ro{constructor(t){super(t),gi(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:_n(()=>{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:_n(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:_n(()=>{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:ce.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})}}),gi(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=Ln.get(null);this.disposables.add(r.on(lo.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 rr({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ce.Nothing},__demoMode:n})}reduce(t,n){return $e(n.type,Fc,t,n)}}const Ei=h.createContext(null);function or(e){let t=h.useContext(Ei);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,wi),n}return t}function wi({id:e,__demoMode:t=!1}){let n=h.useMemo(()=>rr.new({id:e,__demoMode:t}),[]);return si(()=>n.dispose()),n}let ln=h.createContext(null);ln.displayName="ListboxDataContext";function Dt(e){let t=h.useContext(ln);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Dt),n}return t}let Ic=h.Fragment;function kc(e,t){let n=h.useId(),r=Cn(),{value:o,defaultValue:s,form:c,name:u,onChange:i,by:l,invalid:a=!1,disabled:d=r||!1,horizontal:f=!1,multiple:p=!1,__demoMode:m=!1,...g}=e;const b=f?"horizontal":"vertical";let x=Pe(t),w=vl(s),[y=p?[]:void 0,S]=ml(o,i,w),E=wi({id:n,__demoMode:m}),F=h.useRef({static:!1,hold:!1}),j=h.useRef(new Map),K=Hl(l),ee=h.useCallback(k=>$e(L.mode,{[Be.Multi]:()=>y.some(I=>K(I,k)),[Be.Single]:()=>K(y,k)}),[y]),L=h.useMemo(()=>({value:y,disabled:d,invalid:a,mode:p?Be.Multi:Be.Single,orientation:b,onChange:S,compare:K,isSelected:ee,optionsPropsRef:F,listRef:j}),[y,d,a,p,b,S,K,ee,F,j]);ue(()=>{E.state.dataRef.current=L},[L]);let N=Me(E,k=>k.listboxState),oe=Ln.get(null),H=Me(oe,h.useCallback(k=>oe.selectors.isTop(k,n),[oe,n])),[W,X]=Me(E,k=>[k.buttonElement,k.optionsElement]);ma(H,[W,X],(k,I)=>{E.send({type:bi.CloseListbox}),mo(I,Rn.Loose)||(k.preventDefault(),W==null||W.focus())});let G=h.useMemo(()=>({open:N===ve.Open,disabled:d,invalid:a,value:y}),[N,d,a,y]),[J,P]=kl({inherit:!0}),U={ref:x},C=h.useCallback(()=>{if(w!==void 0)return S==null?void 0:S(w)},[S,w]),A=Se();return h.createElement(P,{value:J,props:{htmlFor:W==null?void 0:W.id},slot:{open:N===ve.Open,disabled:d}},h.createElement(oc,null,h.createElement(Ei.Provider,{value:E},h.createElement(ln.Provider,{value:L},h.createElement(oi,{value:$e(N,{[ve.Open]:Ie.Open,[ve.Closed]:Ie.Closed})},u!=null&&y!=null&&h.createElement(xl,{disabled:d,data:{[u]:y},form:c,onReset:C}),A({ourProps:U,theirProps:g,slot:G,defaultTag:Ic,name:"Listbox"}))))))}let Nc="button";function jc(e,t){let n=h.useId(),r=Yr(),o=Dt("Listbox.Button"),s=or("Listbox.Button"),{id:c=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:i=!1,...l}=e,a=Pe(t,ec(),s.actions.setButtonElement),d=tc(),[f,p,m]=Me(s,P=>[P.listboxState,P.buttonElement,P.optionsElement]),g=f===ve.Open;ba(g,{trigger:p,action:h.useCallback(P=>{if(p!=null&&p.contains(P.target))return Vt.Ignore;let U=P.target.closest('[role="option"]:not([data-disabled])');return Ve(U)?Vt.Select(U):m!=null&&m.contains(P.target)?Vt.Ignore:Vt.Close},[p,m]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let b=ne(P=>{switch(P.key){case me.Enter:gl(P.currentTarget);break;case me.Space:case me.ArrowDown:P.preventDefault(),s.actions.openListbox({focus:o.value?ce.Nothing:ce.First});break;case me.ArrowUp:P.preventDefault(),s.actions.openListbox({focus:o.value?ce.Nothing:ce.Last});break}}),x=ne(P=>{switch(P.key){case me.Space:P.preventDefault();break}}),w=ne(P=>{var U;if(P.button===ii.Left){if(Al(P.currentTarget))return P.preventDefault();s.state.listboxState===ve.Open?(we.flushSync(()=>s.actions.closeListbox()),(U=s.state.buttonElement)==null||U.focus({preventScroll:!0})):(P.preventDefault(),s.actions.openListbox({focus:ce.Nothing}))}}),y=h.useRef(null),S=ne(P=>{y.current=P.pointerType,P.pointerType==="mouse"&&w(P)}),E=ne(P=>{y.current!=="mouse"&&w(P)}),F=ne(P=>P.preventDefault()),j=Zr([c]),K=Ll(),{isFocusVisible:ee,focusProps:L}=rl({autoFocus:i}),{isHovered:N,hoverProps:oe}=nl({isDisabled:u}),{pressed:H,pressProps:W}=ul({disabled:u}),X=h.useMemo(()=>({open:f===ve.Open,active:H||f===ve.Open,disabled:u,invalid:o.invalid,value:o.value,hover:N,focus:ee,autofocus:i}),[f,o.value,u,N,ee,H,o.invalid,i]),G=Me(s,P=>P.listboxState===ve.Open),J=Br(d(),{ref:a,id:c,type:ya(e,p),"aria-haspopup":"listbox","aria-controls":m==null?void 0:m.id,"aria-expanded":G,"aria-labelledby":j,"aria-describedby":K,disabled:u||void 0,autoFocus:i,onKeyDown:b,onKeyUp:x,onKeyPress:F,onPointerDown:S,onClick:E},L,oe,W);return Se()({ourProps:J,theirProps:l,slot:X,defaultTag:Nc,name:"Listbox.Button"})}let xi=h.createContext(!1),Rc="div",Wc=Wt.RenderStrategy|Wt.Static;function Bc(e,t){let n=h.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:c=!0,transition:u=!1,...i}=e,l=Zu(o),[a,d]=h.useState(null);l&&(s=!0);let f=Dt("Listbox.Options"),p=or("Listbox.Options"),[m,g,b,x]=Me(p,$=>[$.listboxState,$.buttonElement,$.optionsElement,$.__demoMode]),w=Wn(g),y=Wn(b),S=er(),[E,F]=Oo(u,a,S!==null?(S&Ie.Open)===Ie.Open:m===ve.Open);ra(E,g,p.actions.closeListbox);let j=x?!1:c&&m===ve.Open;$a(j,y);let K=x?!1:c&&m===ve.Open;na(K,{allowed:h.useCallback(()=>[g,b],[g,b])});let ee=m!==ve.Open,L=Ac(ee,g)?!1:E,N=E&&m===ve.Closed,oe=lc(N,f.value),H=ne($=>f.compare(oe,$)),W=Me(p,$=>{var R;if(l==null||!((R=l==null?void 0:l.to)!=null&&R.includes("selection")))return null;let V=$.options.findIndex(Q=>H(Q.dataRef.current.value));return V===-1&&(V=0),V}),X=(()=>{if(l==null)return;if(W===null)return{...l,inner:void 0};let $=Array.from(f.listRef.current.values());return{...l,inner:{listRef:{current:$},index:W}}})(),[G,J]=rc(X),P=nc(),U=Pe(t,l?G:null,p.actions.setOptionsElement,d),C=at();h.useEffect(()=>{var $;let R=b;R&&m===ve.Open&&R!==(($=St(R))==null?void 0:$.activeElement)&&(R==null||R.focus({preventScroll:!0}))},[m,b]);let A=ne($=>{var R,V;switch(C.dispose(),$.key){case me.Space:if(p.state.searchQuery!=="")return $.preventDefault(),$.stopPropagation(),p.actions.search($.key);case me.Enter:if($.preventDefault(),$.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:Q}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(Q.current.value)}f.mode===Be.Single&&(we.flushSync(()=>p.actions.closeListbox()),(R=p.state.buttonElement)==null||R.focus({preventScroll:!0}));break;case $e(f.orientation,{vertical:me.ArrowDown,horizontal:me.ArrowRight}):return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.Next});case $e(f.orientation,{vertical:me.ArrowUp,horizontal:me.ArrowLeft}):return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.Previous});case me.Home:case me.PageUp:return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.First});case me.End:case me.PageDown:return $.preventDefault(),$.stopPropagation(),p.actions.goToOption({focus:ce.Last});case me.Escape:$.preventDefault(),$.stopPropagation(),we.flushSync(()=>p.actions.closeListbox()),(V=p.state.buttonElement)==null||V.focus({preventScroll:!0});return;case me.Tab:$.preventDefault(),$.stopPropagation(),we.flushSync(()=>p.actions.closeListbox()),fa(p.state.buttonElement,$.shiftKey?jn.Previous:jn.Next);break;default:$.key.length===1&&(p.actions.search($.key),C.setTimeout(()=>p.actions.clearSearch(),350));break}}),k=Me(p,$=>{var R;return(R=$.buttonElement)==null?void 0:R.id}),I=h.useMemo(()=>({open:m===ve.Open}),[m]),B=Br(l?P():{},{id:r,ref:U,"aria-activedescendant":Me(p,p.selectors.activeDescendantId),"aria-multiselectable":f.mode===Be.Multi?!0:void 0,"aria-labelledby":k,"aria-orientation":f.orientation,onKeyDown:A,role:"listbox",tabIndex:m===ve.Open?0:void 0,style:{...i.style,...J,"--button-width":Vl(g,!0).width},...So(F)}),q=Se(),Y=h.useMemo(()=>f.mode===Be.Multi?f:{...f,isSelected:H},[f,H]);return h.createElement(Ec,{enabled:s?e.static||E:!1,ownerDocument:w},h.createElement(ln.Provider,{value:Y},q({ourProps:B,theirProps:i,slot:I,defaultTag:Rc,features:Wc,visible:L,name:"Listbox.Options"})))}let Hc="div";function Uc(e,t){let n=h.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...c}=e,u=h.useContext(xi)===!0,i=Dt("Listbox.Option"),l=or("Listbox.Option"),a=Me(l,L=>l.selectors.isActive(L,r)),d=i.isSelected(s),f=h.useRef(null),p=_c(f),m=tt({disabled:o,value:s,domRef:f,get textValue(){return p()}}),g=Pe(t,f,L=>{L?i.listRef.current.set(r,L):i.listRef.current.delete(r)}),b=Me(l,L=>l.selectors.shouldScrollIntoView(L,r));ue(()=>{if(b)return De().requestAnimationFrame(()=>{var L,N;(N=(L=f.current)==null?void 0:L.scrollIntoView)==null||N.call(L,{block:"nearest"})})},[b,f]),ue(()=>{if(!u)return l.actions.registerOption(r,m),()=>l.actions.unregisterOption(r)},[m,r,u]);let x=ne(L=>{var N;if(o)return L.preventDefault();l.actions.onChange(s),i.mode===Be.Single&&(we.flushSync(()=>l.actions.closeListbox()),(N=l.state.buttonElement)==null||N.focus({preventScroll:!0}))}),w=ne(()=>{if(o)return l.actions.goToOption({focus:ce.Nothing});l.actions.goToOption({focus:ce.Specific,id:r})}),y=Pa(),S=ne(L=>y.update(L)),E=ne(L=>{y.wasMoved(L)&&(o||a&&l.state.activationTrigger===sn.Pointer||l.actions.goToOption({focus:ce.Specific,id:r},sn.Pointer))}),F=ne(L=>{y.wasMoved(L)&&(o||a&&l.state.activationTrigger===sn.Pointer&&l.actions.goToOption({focus:ce.Nothing}))}),j=h.useMemo(()=>({active:a,focus:a,selected:d,disabled:o,selectedOption:d&&u}),[a,d,o,u]),K=u?{}:{id:r,ref:g,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:x,onFocus:w,onPointerEnter:S,onMouseEnter:S,onPointerMove:E,onMouseMove:E,onPointerLeave:F,onMouseLeave:F},ee=Se();return!d&&u?null:ee({ourProps:K,theirProps:c,slot:j,defaultTag:Hc,name:"Listbox.Option"})}let Vc=h.Fragment;function zc(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pe(t)},c=Dt("ListboxSelectedOption"),u=h.useMemo(()=>({}),[]),i=c.value===void 0||c.value===null||c.mode===Be.Multi&&Array.isArray(c.value)&&c.value.length===0,l=Se();return h.createElement(xi.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:h.createElement(h.Fragment,null,r&&i?r:n)},slot:u,defaultTag:Vc,name:"ListboxSelectedOption"}))}let Yc=xe(kc),Gc=xe(jc),qc=Wl,Kc=xe(Bc),Qc=xe(Uc),Xc=xe(zc),Je=Object.assign(Yc,{Button:Gc,Label:qc,Options:Kc,Option:Qc,SelectedOption:Xc});function Jc({title:e,titleId:t,...n},r){return D.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?D.createElement("title",{id:t},e):null,D.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 Ci=D.forwardRef(Jc);function Zc({title:e,titleId:t,...n},r){return D.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?D.createElement("title",{id:t},e):null,D.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 Si=D.forwardRef(Zc),ef=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>O.jsx("div",{className:`relative ${o}`,children:O.jsx(Je,{value:t,onChange:n,disabled:r,children:({open:s})=>O.jsxs(O.Fragment,{children:[O.jsxs(Je.Button,{className:`
|
|
74
|
+
*/var yi;function Df(){return yi||(yi=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=m,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,a=t.useMemo,u=t.useDebugValue;oo.useSyncExternalStoreWithSelector=function(i,l,c,d,p){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=a(function(){function b(y){if(!$){if($=!0,x=y,y=d(y),p!==void 0&&h.hasValue){var C=h.value;if(p(C,y))return v=C}return v=y}if(C=v,n(x,y))return C;var S=d(y);return p!==void 0&&p(C,S)?(x=y,C):(x=y,v=S)}var $=!1,x,v,E=c===void 0?null:c;return[function(){return b(l())},E===null?void 0:function(){return b(E())}]},[l,c,d,p]);var g=r(i,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=g},[g]),u(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),oo}process.env.NODE_ENV==="production"?no.exports=Lf():no.exports=Df();var _f=no.exports;function Te(e,t,n=pi){return _f.useSyncExternalStoreWithSelector(K(r=>e.subscribe(Rf,r)),K(()=>e.state),K(()=>e.state),K(t),n)}function Rf(e){return e}function vi(e,t){let n=m.useId(),r=to.get(t),[o,s]=Te(r,m.useCallback(a=>[r.selectors.isTop(a,n),r.selectors.inStack(a,n)],[r,n]));return te(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let so=new Map,on=new Map;function wi(e){var t;let n=(t=on.get(e))!=null?t:0;return on.set(e,n+1),n!==0?()=>xi(e):(so.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>xi(e))}function xi(e){var t;let n=(t=on.get(e))!=null?t:1;if(n===1?on.delete(e):on.set(e,n-1),n!==1)return;let r=so.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,so.delete(e))}function Bf(e,{allowed:t,disallowed:n}={}){let r=vi(e,"inert-others");te(()=>{var o,s;if(!r)return;let a=ke();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&a.add(wi(i));let u=(s=t==null?void 0:t())!=null?s:[];for(let i of u){if(!i)continue;let l=tn(i);if(!l)continue;let c=i.parentElement;for(;c&&c!==l.body;){for(let d of c.children)u.some(p=>d.contains(p))||a.add(wi(d));c=c.parentElement}}return a.dispose},[r,t,n])}function Uf(e,t,n){let r=gt(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});m.useEffect(()=>{if(!e)return;let o=t===null?null:Ke(t)?t:t.current;if(!o)return;let s=ke();if(typeof ResizeObserver<"u"){let a=new ResizeObserver(()=>r.current(o));a.observe(o),s.add(()=>a.disconnect())}if(typeof IntersectionObserver<"u"){let a=new IntersectionObserver(()=>r.current(o));a.observe(o),s.add(()=>a.disconnect())}return()=>s.dispose()},[t,r,e])}let io=["[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(","),zf=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ao=(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))(ao||{}),Hf=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Hf||{}),Wf=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Wf||{});function Ei(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(io)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Vf(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(zf)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var lo=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(lo||{});function $i(e,t=0){var n;return e===((n=tn(e))==null?void 0:n.body)?!1:Pe(t,{0(){return e.matches(io)},1(){let r=e;for(;r!==null;){if(r.matches(io))return!0;r=r.parentElement}return!1}})}var Gf=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Gf||{});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 qf=["textarea","input"].join(",");function Kf(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,qf))!=null?n:!1}function Si(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 a=o.compareDocumentPosition(s);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Yf(e,t){return Xf(Ei(),t,{relativeTo:e})}function Xf(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?Si(e):e:t&64?Vf(e):Ei(e);o.length>0&&a.length>1&&(a=a.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,a.indexOf(r))-1;if(t&4)return Math.max(0,a.indexOf(r))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},c=0,d=a.length,p;do{if(c>=d||c+d<=0)return 0;let f=i+c;if(t&16)f=(f+d)%d;else{if(f<0)return 3;if(f>=d)return 1}p=a[f],p==null||p.focus(l),c+=u}while(p!==s.activeElement);return t&6&&Kf(p)&&p.select(),2}function Ci(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Qf(){return/Android/gi.test(window.navigator.userAgent)}function Pi(){return Ci()||Qf()}function kt(e,t,n,r){let o=gt(n);m.useEffect(()=>{if(!e)return;function s(a){o.current(a)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function Zf(e,t,n,r){let o=gt(n);m.useEffect(()=>{if(!e)return;function s(a){o.current(a)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Oi=30;function Jf(e,t,n){let r=gt(n),o=m.useCallback(function(u,i){if(u.defaultPrevented)return;let l=i(u);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let d of c)if(d!==null&&(d.contains(l)||u.composed&&u.composedPath().includes(d)))return;return!$i(l,lo.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),s=m.useRef(null);kt(e,"pointerdown",u=>{var i,l;Pi()||(s.current=((l=(i=u.composedPath)==null?void 0:i.call(u))==null?void 0:l[0])||u.target)},!0),kt(e,"pointerup",u=>{if(Pi()||!s.current)return;let i=s.current;return s.current=null,o(u,()=>i)},!0);let a=m.useRef({x:0,y:0});kt(e,"touchstart",u=>{a.current.x=u.touches[0].clientX,a.current.y=u.touches[0].clientY},!0),kt(e,"touchend",u=>{let i={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(i.x-a.current.x)>=Oi||Math.abs(i.y-a.current.y)>=Oi))return o(u,()=>jt(u.target)?u.target:null)},!0),Zf(e,"blur",u=>o(u,()=>cf(window.document.activeElement)?window.document.activeElement:null),!0)}function uo(...e){return m.useMemo(()=>tn(...e),[...e])}var ed=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(ed||{});const Qn={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},td=200,Ai=5;function nd(e,{trigger:t,action:n,close:r,select:o}){let s=m.useRef(null),a=m.useRef(null),u=m.useRef(null);kt(e&&t!==null,"pointerdown",i=>{Xr(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(a.current=i.x,u.current=i.y,s.current=i.timeStamp)}),kt(e&&t!==null,"pointerup",i=>{var l,c;let d=s.current;if(d===null||(s.current=null,!jt(i.target))||Math.abs(i.x-((l=a.current)!=null?l:i.x))<Ai&&Math.abs(i.y-((c=u.current)!=null?c:i.y))<Ai)return;let p=n(i);switch(p.kind){case 0:return;case 1:{i.timeStamp-d>td&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function rd(e,t){return m.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 od(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function sd(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 a=t[o].call(n,...s);a&&(n=a,r.forEach(u=>u()))}}}function id(){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 ad(){return Ci()?{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=ke();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,a=null;t.addEventListener(e,"click",u=>{if(jt(u.target))try{let i=u.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),c=e.querySelector(l);jt(c)&&!r(c)&&(a=c)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(jt(u.target)&&uf(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(jt(u.target)){if(ni(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),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)})})}}:{}}function ld(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function ud(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let bt=sd(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ke(),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:ud(n)},o=[ad(),id(),ld()];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)}});bt.subscribe(()=>{let e=bt.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)&&bt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&bt.dispatch("TEARDOWN",n)}});function cd(e,t,n=()=>({containers:[]})){let r=od(bt),o=t?r.get(t):void 0,s=o?o.count>0:!1;return te(()=>{if(!(!t||!e))return bt.dispatch("PUSH",t,n),()=>bt.dispatch("POP",t,n)},[e,t]),s}function fd(e,t,n=()=>[document.body]){let r=vi(e,"scroll-lock");cd(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Ti(e){return[e.screenX,e.screenY]}function dd(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=Ti(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Ti(t)}}}function pd(e=0){let[t,n]=m.useState(e),r=m.useCallback(i=>n(i),[t]),o=m.useCallback(i=>n(l=>l|i),[t]),s=m.useCallback(i=>(t&i)===i,[t]),a=m.useCallback(i=>n(l=>l&~i),[n]),u=m.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:a,toggleFlag:u}}var Ii,Mi;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Ii=process==null?void 0:process.env)==null?void 0:Ii.NODE_ENV)==="test"&&typeof((Mi=Element==null?void 0:Element.prototype)==null?void 0:Mi.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(`
|
|
75
|
+
`)),[]});var hd=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(hd||{});function ji(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function ki(e,t,n,r){let[o,s]=m.useState(n),{hasFlag:a,addFlag:u,removeFlag:i}=pd(e&&o?3:0),l=m.useRef(!1),c=m.useRef(!1),d=Mt();return te(()=>{var p;if(e){if(n&&s(!0),!t){n&&u(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),md(t,{inFlight:l,prepare(){c.current?c.current=!1:c.current=l.current,l.current=!0,!c.current&&(n?(u(3),i(4)):(u(4),i(2)))},run(){c.current?n?(i(3),u(4)):(i(4),u(3)):n?i(1):u(1)},done(){var f;c.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:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function md(e,{prepare:t,run:n,done:r,inFlight:o}){let s=ke();return bd(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(gd(e,r))})}),s.dispose}function gd(e,t){var n,r;let o=ke();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let a=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return a.length===0?(t(),o.dispose):(Promise.allSettled(a.map(u=>u.finished)).then(()=>{s||t()}),o.dispose)}function bd(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 Zn(){return typeof window<"u"}function Ft(e){return Fi(e)?(e.nodeName||"").toLowerCase():"#document"}function $e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Be(e){var t;return(t=(Fi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Fi(e){return Zn()?e instanceof Node||e instanceof $e(e).Node:!1}function fe(e){return Zn()?e instanceof Element||e instanceof $e(e).Element:!1}function Ue(e){return Zn()?e instanceof HTMLElement||e instanceof $e(e).HTMLElement:!1}function Ni(e){return!Zn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $e(e).ShadowRoot}const yd=new Set(["inline","contents"]);function sn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Fe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!yd.has(o)}const vd=new Set(["table","td","th"]);function wd(e){return vd.has(Ft(e))}const xd=[":popover-open",":modal"];function Jn(e){return xd.some(t=>{try{return e.matches(t)}catch{return!1}})}const Ed=["transform","translate","scale","rotate","perspective"],$d=["transform","translate","scale","rotate","perspective","filter"],Sd=["paint","layout","strict","content"];function co(e){const t=fo(),n=fe(e)?Fe(e):e;return Ed.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)||$d.some(r=>(n.willChange||"").includes(r))||Sd.some(r=>(n.contain||"").includes(r))}function Cd(e){let t=it(e);for(;Ue(t)&&!Nt(t);){if(co(t))return t;if(Jn(t))return null;t=it(t)}return null}function fo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Pd=new Set(["html","body","#document"]);function Nt(e){return Pd.has(Ft(e))}function Fe(e){return $e(e).getComputedStyle(e)}function er(e){return fe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function it(e){if(Ft(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ni(e)&&e.host||Be(e);return Ni(t)?t.host:t}function Li(e){const t=it(e);return Nt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ue(t)&&sn(t)?t:Li(t)}function an(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Li(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=$e(o);if(s){const u=po(a);return t.concat(a,a.visualViewport||[],sn(o)?o:[],u&&n?an(u):[])}return t.concat(o,an(o,[],n))}function po(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Od(){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 yt=Math.min,de=Math.max,ln=Math.round,tr=Math.floor,ze=e=>({x:e,y:e}),Ad={left:"right",right:"left",bottom:"top",top:"bottom"},Td={start:"end",end:"start"};function Di(e,t,n){return de(e,yt(t,n))}function Lt(e,t){return typeof e=="function"?e(t):e}function at(e){return e.split("-")[0]}function un(e){return e.split("-")[1]}function _i(e){return e==="x"?"y":"x"}function Ri(e){return e==="y"?"height":"width"}const Id=new Set(["top","bottom"]);function Ye(e){return Id.has(at(e))?"y":"x"}function Bi(e){return _i(Ye(e))}function Md(e,t,n){n===void 0&&(n=!1);const r=un(e),o=Bi(e),s=Ri(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=nr(a)),[a,nr(a)]}function jd(e){const t=nr(e);return[ho(e),t,ho(t)]}function ho(e){return e.replace(/start|end/g,t=>Td[t])}const Ui=["left","right"],zi=["right","left"],kd=["top","bottom"],Fd=["bottom","top"];function Nd(e,t,n){switch(e){case"top":case"bottom":return n?t?zi:Ui:t?Ui:zi;case"left":case"right":return t?kd:Fd;default:return[]}}function Ld(e,t,n,r){const o=un(e);let s=Nd(at(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(ho)))),s}function nr(e){return e.replace(/left|right|bottom|top/g,t=>Ad[t])}function Dd(e){return{top:0,right:0,bottom:0,left:0,...e}}function _d(e){return typeof e!="number"?Dd(e):{top:e,right:e,bottom:e,left:e}}function rr(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 Hi(e,t,n){let{reference:r,floating:o}=e;const s=Ye(t),a=Bi(t),u=Ri(a),i=at(t),l=s==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[u]/2-o[u]/2;let f;switch(i){case"top":f={x:c,y:r.y-o.height};break;case"bottom":f={x:c,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(un(t)){case"start":f[a]-=p*(n&&l?-1:1);break;case"end":f[a]+=p*(n&&l?-1:1);break}return f}const Rd=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,u=s.filter(Boolean),i=await(a.isRTL==null?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=Hi(l,r,i),p=r,f={},h=0;for(let g=0;g<u.length;g++){const{name:b,fn:$}=u[g],{x,y:v,data:E,reset:y}=await $({x:c,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:l,platform:a,elements:{reference:e,floating:t}});c=x??c,d=v??d,f={...f,[b]:{...f[b],...E}},y&&h<=50&&(h++,typeof y=="object"&&(y.placement&&(p=y.placement),y.rects&&(l=y.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):y.rects),{x:c,y:d}=Hi(l,p,i)),g=-1)}return{x:c,y:d,placement:p,strategy:o,middlewareData:f}};async function or(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:a,elements:u,strategy:i}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Lt(t,e),h=_d(f),b=u[p?d==="floating"?"reference":"floating":d],$=rr(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:c,strategy:i})),x=d==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),E=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},y=rr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:x,offsetParent:v,strategy:i}):x);return{top:($.top-y.top+h.top)/E.y,bottom:(y.bottom-$.bottom+h.bottom)/E.y,left:($.left-y.left+h.left)/E.x,right:(y.right-$.right+h.right)/E.x}}const Bd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:u,platform:i,elements:l}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...b}=Lt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const $=at(o),x=Ye(u),v=at(u)===u,E=await(i.isRTL==null?void 0:i.isRTL(l.floating)),y=p||(v||!g?[nr(u)]:jd(u)),C=h!=="none";!p&&C&&y.push(...Ld(u,g,h,E));const S=[u,...y],A=await or(t,b),j=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(c&&j.push(A[$]),d){const L=Md(o,a,E);j.push(A[L[0]],A[L[1]])}if(I=[...I,{placement:o,overflows:j}],!j.every(L=>L<=0)){var M,W;const L=(((M=s.flip)==null?void 0:M.index)||0)+1,R=S[L];if(R&&(!(d==="alignment"?x!==Ye(R):!1)||I.every(O=>Ye(O.placement)===x?O.overflows[0]>0:!0)))return{data:{index:L,overflows:I},reset:{placement:R}};let B=(W=I.filter(z=>z.overflows[0]<=0).sort((z,O)=>z.overflows[1]-O.overflows[1])[0])==null?void 0:W.placement;if(!B)switch(f){case"bestFit":{var D;const z=(D=I.filter(O=>{if(C){const _=Ye(O.placement);return _===x||_==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(_=>_>0).reduce((_,V)=>_+V,0)]).sort((O,_)=>O[1]-_[1])[0])==null?void 0:D[0];z&&(B=z);break}case"initialPlacement":B=u;break}if(o!==B)return{reset:{placement:B}}}return{}}}},Ud=new Set(["left","top"]);async function zd(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=at(n),u=un(n),i=Ye(n)==="y",l=Ud.has(a)?-1:1,c=s&&i?-1:1,d=Lt(t,e);let{mainAxis:p,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*c,y:p*l}:{x:p*l,y:f*c}}const Hd=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:u}=t,i=await zd(t,e);return a===((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:a}}}}},Wd=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:a=!1,limiter:u={fn:b=>{let{x:$,y:x}=b;return{x:$,y:x}}},...i}=Lt(e,t),l={x:n,y:r},c=await or(t,i),d=Ye(at(o)),p=_i(d);let f=l[p],h=l[d];if(s){const b=p==="y"?"top":"left",$=p==="y"?"bottom":"right",x=f+c[b],v=f-c[$];f=Di(x,f,v)}if(a){const b=d==="y"?"top":"left",$=d==="y"?"bottom":"right",x=h+c[b],v=h-c[$];h=Di(x,h,v)}const g=u.fn({...t,[p]:f,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:s,[d]:a}}}}}},Vd=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:u}=t,{apply:i=()=>{},...l}=Lt(e,t),c=await or(t,l),d=at(o),p=un(o),f=Ye(o)==="y",{width:h,height:g}=s.floating;let b,$;d==="top"||d==="bottom"?(b=d,$=p===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):($=d,b=p==="end"?"top":"bottom");const x=g-c.top-c.bottom,v=h-c.left-c.right,E=yt(g-c[b],x),y=yt(h-c[$],v),C=!t.middlewareData.shift;let S=E,A=y;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=x),C&&!p){const I=de(c.left,0),M=de(c.right,0),W=de(c.top,0),D=de(c.bottom,0);f?A=h-2*(I!==0||M!==0?I+M:de(c.left,c.right)):S=g-2*(W!==0||D!==0?W+D:de(c.top,c.bottom))}await i({...t,availableWidth:A,availableHeight:S});const j=await a.getDimensions(u.floating);return h!==j.width||g!==j.height?{reset:{rects:!0}}:{}}}};function Wi(e){const t=Fe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ue(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,u=ln(n)!==s||ln(r)!==a;return u&&(n=s,r=a),{width:n,height:r,$:u}}function mo(e){return fe(e)?e:e.contextElement}function Dt(e){const t=mo(e);if(!Ue(t))return ze(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Wi(t);let a=(s?ln(n.width):n.width)/r,u=(s?ln(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const Gd=ze(0);function Vi(e){const t=$e(e);return!fo()||!t.visualViewport?Gd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==$e(e)?!1:t}function vt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=mo(e);let a=ze(1);t&&(r?fe(r)&&(a=Dt(r)):a=Dt(e));const u=qd(s,n,r)?Vi(s):ze(0);let i=(o.left+u.x)/a.x,l=(o.top+u.y)/a.y,c=o.width/a.x,d=o.height/a.y;if(s){const p=$e(s),f=r&&fe(r)?$e(r):r;let h=p,g=po(h);for(;g&&r&&f!==h;){const b=Dt(g),$=g.getBoundingClientRect(),x=Fe(g),v=$.left+(g.clientLeft+parseFloat(x.paddingLeft))*b.x,E=$.top+(g.clientTop+parseFloat(x.paddingTop))*b.y;i*=b.x,l*=b.y,c*=b.x,d*=b.y,i+=v,l+=E,h=$e(g),g=po(h)}}return rr({width:c,height:d,x:i,y:l})}function sr(e,t){const n=er(e).scrollLeft;return t?t.left+n:vt(Be(e)).left+n}function Gi(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-sr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Kd(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Be(r),u=t?Jn(t.floating):!1;if(r===a||u&&s)return n;let i={scrollLeft:0,scrollTop:0},l=ze(1);const c=ze(0),d=Ue(r);if((d||!d&&!s)&&((Ft(r)!=="body"||sn(a))&&(i=er(r)),Ue(r))){const f=vt(r);l=Dt(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const p=a&&!d&&!s?Gi(a,i):ze(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+c.x+p.x,y:n.y*l.y-i.scrollTop*l.y+c.y+p.y}}function Yd(e){return Array.from(e.getClientRects())}function Xd(e){const t=Be(e),n=er(e),r=e.ownerDocument.body,o=de(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=de(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+sr(e);const u=-n.scrollTop;return Fe(r).direction==="rtl"&&(a+=de(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:u}}const qi=25;function Qd(e,t){const n=$e(e),r=Be(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,u=0,i=0;if(o){s=o.width,a=o.height;const c=fo();(!c||c&&t==="fixed")&&(u=o.offsetLeft,i=o.offsetTop)}const l=sr(r);if(l<=0){const c=r.ownerDocument,d=c.body,p=getComputedStyle(d),f=c.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-d.clientWidth-f);h<=qi&&(s-=h)}else l<=qi&&(s+=l);return{width:s,height:a,x:u,y:i}}const Zd=new Set(["absolute","fixed"]);function Jd(e,t){const n=vt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ue(e)?Dt(e):ze(1),a=e.clientWidth*s.x,u=e.clientHeight*s.y,i=o*s.x,l=r*s.y;return{width:a,height:u,x:i,y:l}}function Ki(e,t,n){let r;if(t==="viewport")r=Qd(e,n);else if(t==="document")r=Xd(Be(e));else if(fe(t))r=Jd(t,n);else{const o=Vi(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return rr(r)}function Yi(e,t){const n=it(e);return n===t||!fe(n)||Nt(n)?!1:Fe(n).position==="fixed"||Yi(n,t)}function ep(e,t){const n=t.get(e);if(n)return n;let r=an(e,[],!1).filter(u=>fe(u)&&Ft(u)!=="body"),o=null;const s=Fe(e).position==="fixed";let a=s?it(e):e;for(;fe(a)&&!Nt(a);){const u=Fe(a),i=co(a);!i&&u.position==="fixed"&&(o=null),(s?!i&&!o:!i&&u.position==="static"&&!!o&&Zd.has(o.position)||sn(a)&&!i&&Yi(e,a))?r=r.filter(c=>c!==a):o=u,a=it(a)}return t.set(e,r),r}function tp(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Jn(t)?[]:ep(t,this._c):[].concat(n),r],u=a[0],i=a.reduce((l,c)=>{const d=Ki(t,c,o);return l.top=de(d.top,l.top),l.right=yt(d.right,l.right),l.bottom=yt(d.bottom,l.bottom),l.left=de(d.left,l.left),l},Ki(t,u,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function np(e){const{width:t,height:n}=Wi(e);return{width:t,height:n}}function rp(e,t,n){const r=Ue(t),o=Be(t),s=n==="fixed",a=vt(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const i=ze(0);function l(){i.x=sr(o)}if(r||!r&&!s)if((Ft(t)!=="body"||sn(o))&&(u=er(t)),r){const f=vt(t,!0,s,t);i.x=f.x+t.clientLeft,i.y=f.y+t.clientTop}else o&&l();s&&!r&&o&&l();const c=o&&!r&&!s?Gi(o,u):ze(0),d=a.left+u.scrollLeft-i.x-c.x,p=a.top+u.scrollTop-i.y-c.y;return{x:d,y:p,width:a.width,height:a.height}}function go(e){return Fe(e).position==="static"}function Xi(e,t){if(!Ue(e)||Fe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Be(e)===n&&(n=n.ownerDocument.body),n}function Qi(e,t){const n=$e(e);if(Jn(e))return n;if(!Ue(e)){let o=it(e);for(;o&&!Nt(o);){if(fe(o)&&!go(o))return o;o=it(o)}return n}let r=Xi(e,t);for(;r&&wd(r)&&go(r);)r=Xi(r,t);return r&&Nt(r)&&go(r)&&!co(r)?n:r||Cd(e)||n}const op=async function(e){const t=this.getOffsetParent||Qi,n=this.getDimensions,r=await n(e.floating);return{reference:rp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sp(e){return Fe(e).direction==="rtl"}const ip={convertOffsetParentRelativeRectToViewportRelativeRect:Kd,getDocumentElement:Be,getClippingRect:tp,getOffsetParent:Qi,getElementRects:op,getClientRects:Yd,getDimensions:np,getScale:Dt,isElement:fe,isRTL:sp};function Zi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ap(e,t){let n=null,r;const o=Be(e);function s(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,i){u===void 0&&(u=!1),i===void 0&&(i=1),s();const l=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=l;if(u||t(),!p||!f)return;const h=tr(d),g=tr(o.clientWidth-(c+p)),b=tr(o.clientHeight-(d+f)),$=tr(c),v={rootMargin:-h+"px "+-g+"px "+-b+"px "+-$+"px",threshold:de(0,yt(1,i))||1};let E=!0;function y(C){const S=C[0].intersectionRatio;if(S!==i){if(!E)return a();S?a(!1,S):r=setTimeout(()=>{a(!1,1e-7)},1e3)}S===1&&!Zi(l,e.getBoundingClientRect())&&a(),E=!1}try{n=new IntersectionObserver(y,{...v,root:o.ownerDocument})}catch{n=new IntersectionObserver(y,v)}n.observe(e)}return a(!0),s}function lp(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,l=mo(e),c=o||s?[...l?an(l):[],...an(t)]:[];c.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),s&&$.addEventListener("resize",n)});const d=l&&u?ap(l,n):null;let p=-1,f=null;a&&(f=new ResizeObserver($=>{let[x]=$;x&&x.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),n()}),l&&!i&&f.observe(l),f.observe(t));let h,g=i?vt(e):null;i&&b();function b(){const $=vt(e);g&&!Zi(g,$)&&n(),g=$,h=requestAnimationFrame(b)}return n(),()=>{var $;c.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),d==null||d(),($=f)==null||$.disconnect(),f=null,i&&cancelAnimationFrame(h)}}const bo=or,up=Hd,cp=Wd,fp=Bd,dp=Vd,pp=(e,t,n)=>{const r=new Map,o={platform:ip,...n},s={...o.platform,_c:r};return Rd(e,t,{...o,platform:s})};var hp=typeof document<"u",mp=function(){},ir=hp?m.useLayoutEffect:mp;function ar(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(!ar(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)&&!ar(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ji(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ea(e,t){const n=Ji(e);return Math.round(t*n)/n}function yo(e){const t=N.useRef(e);return ir(()=>{t.current=e}),t}function gp(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:u=!0,whileElementsMounted:i,open:l}=e,[c,d]=N.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=N.useState(r);ar(p,r)||f(r);const[h,g]=N.useState(null),[b,$]=N.useState(null),x=N.useCallback(O=>{O!==C.current&&(C.current=O,g(O))},[]),v=N.useCallback(O=>{O!==S.current&&(S.current=O,$(O))},[]),E=s||h,y=a||b,C=N.useRef(null),S=N.useRef(null),A=N.useRef(c),j=i!=null,I=yo(i),M=yo(o),W=yo(l),D=N.useCallback(()=>{if(!C.current||!S.current)return;const O={placement:t,strategy:n,middleware:p};M.current&&(O.platform=M.current),pp(C.current,S.current,O).then(_=>{const V={..._,isPositioned:W.current!==!1};L.current&&!ar(A.current,V)&&(A.current=V,zn.flushSync(()=>{d(V)}))})},[p,t,n,M,W]);ir(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[l]);const L=N.useRef(!1);ir(()=>(L.current=!0,()=>{L.current=!1}),[]),ir(()=>{if(E&&(C.current=E),y&&(S.current=y),E&&y){if(I.current)return I.current(E,y,D);D()}},[E,y,D,I,j]);const R=N.useMemo(()=>({reference:C,floating:S,setReference:x,setFloating:v}),[x,v]),B=N.useMemo(()=>({reference:E,floating:y}),[E,y]),z=N.useMemo(()=>{const O={position:n,left:0,top:0};if(!B.floating)return O;const _=ea(B.floating,c.x),V=ea(B.floating,c.y);return u?{...O,transform:"translate("+_+"px, "+V+"px)",...Ji(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:V}},[n,u,B.floating,c.x,c.y]);return N.useMemo(()=>({...c,update:D,refs:R,elements:B,floatingStyles:z}),[c,D,R,B,z])}const ta=(e,t)=>({...up(e),options:[e,t]}),bp=(e,t)=>({...cp(e),options:[e,t]}),yp=(e,t)=>({...fp(e),options:[e,t]}),vp=(e,t)=>({...dp(e),options:[e,t]}),na={...N},wp=na.useInsertionEffect||(e=>e());function ra(e){const t=N.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return wp(()=>{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 vo=typeof document<"u"?m.useLayoutEffect:m.useEffect;let oa=!1,xp=0;const sa=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+xp++;function Ep(){const[e,t]=N.useState(()=>oa?sa():void 0);return vo(()=>{e==null&&t(sa())},[]),N.useEffect(()=>{oa=!0},[]),e}const $p=na.useId||Ep;let cn;process.env.NODE_ENV!=="production"&&(cn=new Set);function Sp(){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=cn)!=null&&e.has(o))){var s;(s=cn)==null||s.add(o),console.warn(o)}}function Cp(){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=cn)!=null&&e.has(o))){var s;(s=cn)==null||s.add(o),console.error(o)}}function Pp(){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 Op=N.createContext(null),Ap=N.createContext(null),Tp=()=>{var e;return((e=N.useContext(Op))==null?void 0:e.id)||null},Ip=()=>N.useContext(Ap),Mp="data-floating-ui-focusable";function jp(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=$p(),s=N.useRef({}),[a]=N.useState(()=>Pp()),u=Tp()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!fe(f)&&Cp("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),c=ra((f,h,g)=>{s.current.openEvent=f?h:void 0,a.emit("openchange",{open:f,event:h,reason:g,nested:u}),n==null||n(f,h,g)}),d=N.useMemo(()=>({setPositionReference:l}),[]),p=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:c,elements:p,events:a,floatingId:o,refs:d}),[t,c,p,a,o,d])}function kp(e){e===void 0&&(e={});const{nodeId:t}=e,n=jp({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,a]=N.useState(null),[u,i]=N.useState(null),c=(o==null?void 0:o.domReference)||s,d=N.useRef(null),p=Ip();vo(()=>{c&&(d.current=c)},[c]);const f=gp({...e,elements:{...o,...u&&{reference:u}}}),h=N.useCallback(v=>{const E=fe(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),contextElement:v}:v;i(E),f.refs.setReference(E)},[f.refs]),g=N.useCallback(v=>{(fe(v)||v===null)&&(d.current=v,a(v)),(fe(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!fe(v))&&f.refs.setReference(v)},[f.refs]),b=N.useMemo(()=>({...f.refs,setReference:g,setPositionReference:h,domReference:d}),[f.refs,g,h]),$=N.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),x=N.useMemo(()=>({...f,...r,refs:b,elements:$,nodeId:t}),[f,b,$,t,r]);return vo(()=>{r.dataRef.current.floatingContext=x;const v=p==null?void 0:p.nodesRef.current.find(E=>E.id===t);v&&(v.context=x)}),N.useMemo(()=>({...f,context:x,refs:b,elements:$}),[f,b,$,x])}const ia="active",aa="selected";function wo(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[ia]:a,[aa]:u,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[Mp]:""},...s,...t.map(a=>{const u=a?a[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((a,u)=>(u&&Object.entries(u).forEach(i=>{let[l,c]=i;if(!(o&&[ia,aa].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof c=="function"){var d;(d=r.get(l))==null||d.push(c),a[l]=function(){for(var p,f=arguments.length,h=new Array(f),g=0;g<f;g++)h[g]=arguments[g];return(p=r.get(l))==null?void 0:p.map(b=>b(...h)).find(b=>b!==void 0)}}}else a[l]=c}),a),{})}}function Fp(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=>wo(u,e,"reference"),t),s=N.useCallback(u=>wo(u,e,"floating"),n),a=N.useCallback(u=>wo(u,e,"item"),r);return N.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:a}),[o,s,a])}function la(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Np=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:a=0,minItemsVisible:u=4,referenceOverflowThreshold:i=0,scrollRef:l,...c}=Lt(e,t),{rects:d,elements:{floating:p}}=t,f=n.current[a],h=(l==null?void 0:l.current)||p,g=p.clientTop||h.clientTop,b=p.clientTop!==0,$=h.clientTop!==0,x=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Sp('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const v={...t,...await ta(-f.offsetTop-p.clientTop-d.reference.height/2-f.offsetHeight/2-s).fn(t)},E=await bo(la(v,h.scrollHeight+g+p.clientTop),c),y=await bo(v,{...c,elementContext:"reference"}),C=de(0,E.top),S=v.y+C,I=(h.scrollHeight>h.clientHeight?M=>M:ln)(de(0,h.scrollHeight+(b&&x||$?g*2:0)-C-de(0,E.bottom)));if(h.style.maxHeight=I+"px",h.scrollTop=C,o){const M=h.offsetHeight<f.offsetHeight*yt(u,n.current.length)-1||y.top>=-i||y.bottom>=-i;zn.flushSync(()=>o(M))}return r&&(r.current=await bo(la({...v,y:S},h.offsetHeight+g+p.clientTop),c)),{y:S}}});function Lp(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:a,onChange:u}=t,i=ra(u),l=N.useRef(!1),c=N.useRef(null),d=N.useRef(null);N.useEffect(()=>{if(!o)return;function f(g){if(g.ctrlKey||!h||s.current==null)return;const b=g.deltaY,$=s.current.top>=-.5,x=s.current.bottom>=-.5,v=h.scrollHeight-h.clientHeight,E=b<0?-1:1,y=b<0?"max":"min";h.scrollHeight<=h.clientHeight||(!$&&b>0||!x&&b<0?(g.preventDefault(),zn.flushSync(()=>{i(C=>C+Math[y](b,v*E))})):/firefox/i.test(Od())&&(h.scrollTop+=b))}const h=(a==null?void 0:a.current)||r.floating;if(n&&h)return h.addEventListener("wheel",f),requestAnimationFrame(()=>{c.current=h.scrollTop,s.current!=null&&(d.current={...s.current})}),()=>{c.current=null,d.current=null,h.removeEventListener("wheel",f)}},[o,n,r.floating,s,a,i]);const p=N.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const f=(a==null?void 0:a.current)||r.floating;if(!(!s.current||!f||!l.current)){if(c.current!==null){const h=f.scrollTop-c.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&zn.flushSync(()=>i(g=>g+h))}requestAnimationFrame(()=>{c.current=f.scrollTop})}}}),[r.floating,i,s,a]);return N.useMemo(()=>o?{floating:p}:{},[o,p])}let _t=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});_t.displayName="FloatingContext";let xo=m.createContext(null);xo.displayName="PlacementContext";function Dp(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function _p(){return m.useContext(_t).setReference}function Rp(){return m.useContext(_t).getReferenceProps}function Bp(){let{getFloatingProps:e,slot:t}=m.useContext(_t);return m.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Up(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(xo),n=m.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var a;return(a=s==null?void 0:s.outerHTML)!=null?a:s})]);te(()=>{t==null||t(n??null)},[t,n]);let r=m.useContext(_t);return m.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let ua=4;function zp({children:e,enabled:t=!0}){let[n,r]=m.useState(null),[o,s]=m.useState(0),a=m.useRef(null),[u,i]=m.useState(null);Hp(u);let l=t&&n!==null&&u!==null,{to:c="bottom",gap:d=0,offset:p=0,padding:f=0,inner:h}=Wp(n,u),[g,b="center"]=c.split(" ");te(()=>{l&&s(0)},[l]);let{refs:$,floatingStyles:x,context:v}=kp({open:l,placement:g==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${g}`:`${g}-${b}`,strategy:"absolute",transform:!1,middleware:[ta({mainAxis:g==="selection"?0:d,crossAxis:p}),bp({padding:f}),g!=="selection"&&yp({padding:f}),g==="selection"&&h?Np({...h,padding:f,overflowRef:a,offset:o,minItemsVisible:ua,referenceOverflowThreshold:f,onFallbackChange(M){var W,D;if(!M)return;let L=v.elements.floating;if(!L)return;let R=parseFloat(getComputedStyle(L).scrollPaddingBottom)||0,B=Math.min(ua,L.childElementCount),z=0,O=0;for(let _ of(D=(W=v.elements.floating)==null?void 0:W.childNodes)!=null?D:[])if(Ke(_)){let V=_.offsetTop,ce=V+_.clientHeight+R,ee=L.scrollTop,X=ee+L.clientHeight;if(V>=ee&&ce<=X)B--;else{O=Math.max(0,Math.min(ce,X)-Math.max(V,ee)),z=_.clientHeight;break}}B>=1&&s(_=>{let V=z*B-O+R;return _>=V?_:V})}}):null,vp({padding:f,apply({availableWidth:M,availableHeight:W,elements:D}){Object.assign(D.floating.style,{overflow:"auto",maxWidth:`${M}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${W}px)`})}})].filter(Boolean),whileElementsMounted:lp}),[E=g,y=b]=v.placement.split("-");g==="selection"&&(E="selection");let C=m.useMemo(()=>({anchor:[E,y].filter(Boolean).join(" ")}),[E,y]),S=Lp(v,{overflowRef:a,onChange:s}),{getReferenceProps:A,getFloatingProps:j}=Fp([S]),I=K(M=>{i(M),$.setFloating(M)});return N.createElement(xo.Provider,{value:r},N.createElement(_t.Provider,{value:{setFloating:I,setReference:$.setReference,styles:x,getReferenceProps:A,getFloatingProps:j,slot:C}},e))}function Hp(e){te(()=>{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 Wp(e,t){var n,r,o;let s=Eo((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),a=Eo((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Eo((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:a,padding:u}}function Eo(e,t,n=void 0){let r=Mt(),o=K((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 c=fa(i,l);return[c,d=>{let p=ca(i);{let f=p.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let g=!1;for(let[$,x]of p.entries()){let v=window.getComputedStyle(l).getPropertyValue(x);if(f[$]!==v){f[$]=v,g=!0;break}}if(!g)return;let b=fa(i,l);c!==b&&(d(b),c=b)})}return r.dispose}]}return[n,null]}),s=m.useMemo(()=>o(e,t)[0],[e,t]),[a=s,u]=m.useState();return te(()=>{let[i,l]=o(e,t);if(u(i),!!l)return l(u)},[e,t]),a}function ca(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,...ca(o)]:[r]}return[]}function fa(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 Vp(e,t){let[n,r]=m.useState(t);return!e&&n!==t&&r(t),e?n:t}let $o=m.createContext(null);$o.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 So(){return m.useContext($o)}function da({value:e,children:t}){return m.createElement($o.Provider,{value:e},t)}function Gp(e){throw new Error("Unexpected object: "+e)}var re=(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))(re||{});function lr(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:Gp(e)}}var pa=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(pa||{});function ha(e){let t=K(e),n=m.useRef(!1);m.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ks(()=>{n.current&&t()})}),[t])}function qp(){let e=typeof document>"u";return"useSyncExternalStore"in N?(t=>t.useSyncExternalStore)(N)(()=>()=>{},()=>!1,()=>!e):!1}function Co(){let e=qp(),[t,n]=N.useState(_e.isHandoffComplete);return t&&_e.isHandoffComplete===!1&&n(!1),N.useEffect(()=>{t!==!0&&n(!0)},[t]),N.useEffect(()=>_e.handoff(),[]),e?!1:t}let Kp=m.createContext(!1);function Yp(){return m.useContext(Kp)}function Xp(e){let t=Yp(),n=m.useContext(ga),[r,o]=m.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(_e.isServer)return null;let a=e==null?void 0:e.getElementById("headlessui-portal-root");if(a)return a;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return m.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),m.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let ma=m.Fragment,Qp=ve(function(e,t){let{ownerDocument:n=null,...r}=e,o=m.useRef(null),s=Oe(mf(f=>{o.current=f}),t),a=uo(o),u=n??a,i=Xp(u),[l]=m.useState(()=>{var f;return _e.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),c=m.useContext(th),d=Co();te(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),te(()=>{if(l&&c)return c.register(l)},[c,l]),ha(()=>{var f;!i||!l||(Xr(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let p=Ee();return d?!i||!l?null:ye.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:ma,name:"Portal"}),l):null});function Zp(e,t){let n=Oe(t),{enabled:r=!0,ownerDocument:o,...s}=e,a=Ee();return r?m.createElement(Qp,{...s,ownerDocument:o,ref:n}):a({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:ma,name:"Portal"})}let Jp=m.Fragment,ga=m.createContext(null);function eh(e,t){let{target:n,...r}=e,o={ref:Oe(t)},s=Ee();return m.createElement(ga.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:Jp,name:"Popover.Group"}))}let th=m.createContext(null),nh=ve(Zp),rh=ve(eh),oh=Object.assign(nh,{Group:rh});function sh(){let e=m.useRef(!1);return te(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ba(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:va)!==m.Fragment||m.Children.count(e.children)===1}let ur=m.createContext(null);ur.displayName="TransitionContext";var ih=(e=>(e.Visible="visible",e.Hidden="hidden",e))(ih||{});function ah(){let e=m.useContext(ur);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function lh(){let e=m.useContext(cr);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let cr=m.createContext(null);cr.displayName="NestingContext";function fr(e){return"children"in e?fr(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function ya(e,t){let n=gt(e),r=m.useRef([]),o=sh(),s=Mt(),a=K((f,h=ot.Hidden)=>{let g=r.current.findIndex(({el:b})=>b===f);g!==-1&&(Pe(h,{[ot.Unmount](){r.current.splice(g,1)},[ot.Hidden](){r.current[g].state="hidden"}}),s.microTask(()=>{var b;!fr(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),u=K(f=>{let h=r.current.find(({el:g})=>g===f);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:f,state:"visible"}),()=>a(f,ot.Unmount)}),i=m.useRef([]),l=m.useRef(Promise.resolve()),c=m.useRef({enter:[],leave:[]}),d=K((f,h,g)=>{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(c.current[h].map(([$,x])=>x)).then(()=>b())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(h)):g(h)}),p=K((f,h,g)=>{Promise.all(c.current[h].splice(0).map(([b,$])=>$)).then(()=>{var b;(b=i.current.shift())==null||b()}).then(()=>g(h))});return m.useMemo(()=>({children:r,register:u,unregister:a,onStart:d,onStop:p,wait:l,chains:c}),[u,a,r,d,p,c,l])}let va=m.Fragment,wa=qn.RenderStrategy;function uh(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:a,beforeLeave:u,afterLeave:i,enter:l,enterFrom:c,enterTo:d,entered:p,leave:f,leaveFrom:h,leaveTo:g,...b}=e,[$,x]=m.useState(null),v=m.useRef(null),E=ba(e),y=Oe(...E?[v,t,x]:t===null?[]:[t]),C=(n=b.unmount)==null||n?ot.Unmount:ot.Hidden,{show:S,appear:A,initial:j}=ah(),[I,M]=m.useState(S?"visible":"hidden"),W=lh(),{register:D,unregister:L}=W;te(()=>D(v),[D,v]),te(()=>{if(C===ot.Hidden&&v.current){if(S&&I!=="visible"){M("visible");return}return Pe(I,{hidden:()=>L(v),visible:()=>D(v)})}},[I,v,D,L,S,C]);let R=Co();te(()=>{if(E&&R&&I==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,I,R,E]);let B=j&&!A,z=A&&S&&j,O=m.useRef(!1),_=ya(()=>{O.current||(M("hidden"),L(v))},W),V=K(H=>{O.current=!0;let ne=H?"enter":"leave";_.onStart(v,ne,me=>{me==="enter"?s==null||s():me==="leave"&&(u==null||u())})}),ce=K(H=>{let ne=H?"enter":"leave";O.current=!1,_.onStop(v,ne,me=>{me==="enter"?a==null||a():me==="leave"&&(i==null||i())}),ne==="leave"&&!fr(_)&&(M("hidden"),L(v))});m.useEffect(()=>{E&&o||(V(S),ce(S))},[S,E,o]);let ee=!(!o||!E||!R||B),[,X]=ki(ee,$,S,{start:V,end:ce}),tt=st({ref:y,className:((r=qr(b.className,z&&l,z&&c,X.enter&&l,X.enter&&X.closed&&c,X.enter&&!X.closed&&d,X.leave&&f,X.leave&&!X.closed&&h,X.leave&&X.closed&&g,!X.transition&&S&&p))==null?void 0:r.trim())||void 0,...ji(X)}),Me=0;I==="visible"&&(Me|=Ne.Open),I==="hidden"&&(Me|=Ne.Closed),S&&I==="hidden"&&(Me|=Ne.Opening),!S&&I==="visible"&&(Me|=Ne.Closing);let he=Ee();return m.createElement(cr.Provider,{value:_},m.createElement(da,{value:Me},he({ourProps:tt,theirProps:b,defaultTag:va,features:wa,visible:I==="visible",name:"Transition.Child"})))}function ch(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,a=m.useRef(null),u=ba(e),i=Oe(...u?[a,t]:t===null?[]:[t]);Co();let l=So();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[c,d]=m.useState(n?"visible":"hidden"),p=ya(()=>{n||d("hidden")}),[f,h]=m.useState(!0),g=m.useRef([n]);te(()=>{f!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),h(!1))},[g,n]);let b=m.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);te(()=>{n?d("visible"):!fr(p)&&a.current!==null&&d("hidden")},[n,p]);let $={unmount:o},x=K(()=>{var y;f&&h(!1),(y=e.beforeEnter)==null||y.call(e)}),v=K(()=>{var y;f&&h(!1),(y=e.beforeLeave)==null||y.call(e)}),E=Ee();return m.createElement(cr.Provider,{value:p},m.createElement(ur.Provider,{value:b},E({ourProps:{...$,as:m.Fragment,children:m.createElement(xa,{ref:i,...$,...s,beforeEnter:x,beforeLeave:v})},theirProps:{},defaultTag:m.Fragment,features:wa,visible:c==="visible",name:"Transition"})))}function fh(e,t){let n=m.useContext(ur)!==null,r=So()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(Po,{ref:t,...e}):m.createElement(xa,{ref:t,...e}))}let Po=ve(ch),xa=ve(uh),dh=ve(fh),Ea=Object.assign(Po,{Child:dh,Root:Po});function ph(e,t){let n=m.useRef({left:0,top:0});if(te(()=>{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 $a=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Sa(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Ke(o))return r;let s=!1;for(let u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),s=!0;let a=s?(n=o.innerText)!=null?n:"":r;return $a.test(a)&&(a=a.replace($a,"")),a}function hh(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 a=s.getAttribute("aria-label");return typeof a=="string"?a.trim():Sa(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Sa(e).trim()}function mh(e){let t=m.useRef(""),n=m.useRef("");return K(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=hh(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var gh=Object.defineProperty,bh=(e,t,n)=>t in e?gh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ca=(e,t,n)=>(bh(e,typeof t!="symbol"?t+"":t,n),n),ue=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ue||{}),He=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(He||{}),dr=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(dr||{}),Pa=(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))(Pa||{});function Oa(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Si(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 yh={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:re.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,a;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===re.Nothing)return{...u,activeOptionIndex:null};if(t.focus===re.Specific)return{...u,activeOptionIndex:e.options.findIndex(c=>c.id===t.id)};if(t.focus===re.Previous){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=lr(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].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:p}}}}else if(t.focus===re.Next){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=lr(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].dataRef.current.domRef;if(((s=d.current)==null?void 0:s.nextElementSibling)===f.current||((a=f.current)==null?void 0:a.nextElementSibling)===null)return{...u,activeOptionIndex:p}}}}let i=Oa(e),l=lr(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.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(a=>{var u;return!a.dataRef.current.disabled&&((u=a.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!==re.Nothing&&(r=lr(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(a=>o==null?void 0:o(a.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:re.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,a]of n.entries())if(o.has(a.id)&&(r.push(s),o.delete(a.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,...Oa(e),pendingShouldSort:!1}:e};class Oo extends di{constructor(t){super(t),Ca(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:a}=this.state.dataRef.current;return Pe(s,{0:()=>r==null?void 0:r(n),1:()=>{let u=a.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:eo(()=>{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:eo(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:eo(()=>{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:re.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})}}),Ca(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,a=n.options;return s!==null?((o=a[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=to.get(null);this.disposables.add(r.on(gi.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 Oo({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:re.Nothing},__demoMode:n})}reduce(t,n){return Pe(n.type,yh,t,n)}}const Aa=m.createContext(null);function Ao(e){let t=m.useContext(Aa);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ta),n}return t}function Ta({id:e,__demoMode:t=!1}){let n=m.useMemo(()=>Oo.new({id:e,__demoMode:t}),[]);return ha(()=>n.dispose()),n}let pr=m.createContext(null);pr.displayName="ListboxDataContext";function fn(e){let t=m.useContext(pr);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fn),n}return t}let vh=m.Fragment;function wh(e,t){let n=m.useId(),r=Gr(),{value:o,defaultValue:s,form:a,name:u,onChange:i,by:l,invalid:c=!1,disabled:d=r||!1,horizontal:p=!1,multiple:f=!1,__demoMode:h=!1,...g}=e;const b=p?"horizontal":"vertical";let $=Oe(t),x=Jc(s),[v=f?[]:void 0,E]=Zc(o,i,x),y=Ta({id:n,__demoMode:h}),C=m.useRef({static:!1,hold:!1}),S=m.useRef(new Map),A=Pf(l),j=m.useCallback(ee=>Pe(I.mode,{[He.Multi]:()=>v.some(X=>A(X,ee)),[He.Single]:()=>A(v,ee)}),[v]),I=m.useMemo(()=>({value:v,disabled:d,invalid:c,mode:f?He.Multi:He.Single,orientation:b,onChange:E,compare:A,isSelected:j,optionsPropsRef:C,listRef:S}),[v,d,c,f,b,E,A,j,C,S]);te(()=>{y.state.dataRef.current=I},[I]);let M=Te(y,ee=>ee.listboxState),W=to.get(null),D=Te(W,m.useCallback(ee=>W.selectors.isTop(ee,n),[W,n])),[L,R]=Te(y,ee=>[ee.buttonElement,ee.optionsElement]);Jf(D,[L,R],(ee,X)=>{y.send({type:Pa.CloseListbox}),$i(X,lo.Loose)||(ee.preventDefault(),L==null||L.focus())});let B=m.useMemo(()=>({open:M===ue.Open,disabled:d,invalid:c,value:v}),[M,d,c,v]),[z,O]=wf({inherit:!0}),_={ref:$},V=m.useCallback(()=>{if(x!==void 0)return E==null?void 0:E(x)},[E,x]),ce=Ee();return m.createElement(O,{value:z,props:{htmlFor:L==null?void 0:L.id},slot:{open:M===ue.Open,disabled:d}},m.createElement(zp,null,m.createElement(Aa.Provider,{value:y},m.createElement(pr.Provider,{value:I},m.createElement(da,{value:Pe(M,{[ue.Open]:Ne.Open,[ue.Closed]:Ne.Closed})},u!=null&&v!=null&&m.createElement(sf,{disabled:d,data:{[u]:v},form:a,onReset:V}),ce({ourProps:_,theirProps:g,slot:B,defaultTag:vh,name:"Listbox"}))))))}let xh="button";function Eh(e,t){let n=m.useId(),r=ti(),o=fn("Listbox.Button"),s=Ao("Listbox.Button"),{id:a=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:i=!1,...l}=e,c=Oe(t,_p(),s.actions.setButtonElement),d=Rp(),[p,f,h]=Te(s,O=>[O.listboxState,O.buttonElement,O.optionsElement]),g=p===ue.Open;nd(g,{trigger:f,action:m.useCallback(O=>{if(f!=null&&f.contains(O.target))return Qn.Ignore;let _=O.target.closest('[role="option"]:not([data-disabled])');return Ke(_)?Qn.Select(_):h!=null&&h.contains(O.target)?Qn.Ignore:Qn.Close},[f,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let b=K(O=>{switch(O.key){case le.Enter:ef(O.currentTarget);break;case le.Space:case le.ArrowDown:O.preventDefault(),s.actions.openListbox({focus:o.value?re.Nothing:re.First});break;case le.ArrowUp:O.preventDefault(),s.actions.openListbox({focus:o.value?re.Nothing:re.Last});break}}),$=K(O=>{switch(O.key){case le.Space:O.preventDefault();break}}),x=K(O=>{var _;if(O.button===pa.Left){if(pf(O.currentTarget))return O.preventDefault();s.state.listboxState===ue.Open?(ye.flushSync(()=>s.actions.closeListbox()),(_=s.state.buttonElement)==null||_.focus({preventScroll:!0})):(O.preventDefault(),s.actions.openListbox({focus:re.Nothing}))}}),v=m.useRef(null),E=K(O=>{v.current=O.pointerType,O.pointerType==="mouse"&&x(O)}),y=K(O=>{v.current!=="mouse"&&x(O)}),C=K(O=>O.preventDefault()),S=li([a]),A=gf(),{isFocusVisible:j,focusProps:I}=Bc({autoFocus:i}),{isHovered:M,hoverProps:W}=Rc({isDisabled:u}),{pressed:D,pressProps:L}=Gc({disabled:u}),R=m.useMemo(()=>({open:p===ue.Open,active:D||p===ue.Open,disabled:u,invalid:o.invalid,value:o.value,hover:M,focus:j,autofocus:i}),[p,o.value,u,M,j,D,o.invalid,i]),B=Te(s,O=>O.listboxState===ue.Open),z=Xs(d(),{ref:c,id:a,type:rd(e,f),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":B,"aria-labelledby":S,"aria-describedby":A,disabled:u||void 0,autoFocus:i,onKeyDown:b,onKeyUp:$,onKeyPress:C,onPointerDown:E,onClick:y},I,W,L);return Ee()({ourProps:z,theirProps:l,slot:R,defaultTag:xh,name:"Listbox.Button"})}let Ia=m.createContext(!1),$h="div",Sh=qn.RenderStrategy|qn.Static;function Ch(e,t){let n=m.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:a=!0,transition:u=!1,...i}=e,l=Dp(o),[c,d]=m.useState(null);l&&(s=!0);let p=fn("Listbox.Options"),f=Ao("Listbox.Options"),[h,g,b,$]=Te(f,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),x=uo(g),v=uo(b),E=So(),[y,C]=ki(u,c,E!==null?(E&Ne.Open)===Ne.Open:h===ue.Open);Uf(y,g,f.actions.closeListbox);let S=$?!1:a&&h===ue.Open;fd(S,v);let A=$?!1:a&&h===ue.Open;Bf(A,{allowed:m.useCallback(()=>[g,b],[g,b])});let j=h!==ue.Open,I=ph(j,g)?!1:y,M=y&&h===ue.Closed,W=Vp(M,p.value),D=K(H=>p.compare(W,H)),L=Te(f,H=>{var ne;if(l==null||!((ne=l==null?void 0:l.to)!=null&&ne.includes("selection")))return null;let me=H.options.findIndex(pt=>D(pt.dataRef.current.value));return me===-1&&(me=0),me}),R=(()=>{if(l==null)return;if(L===null)return{...l,inner:void 0};let H=Array.from(p.listRef.current.values());return{...l,inner:{listRef:{current:H},index:L}}})(),[B,z]=Up(R),O=Bp(),_=Oe(t,l?B:null,f.actions.setOptionsElement,d),V=Mt();m.useEffect(()=>{var H;let ne=b;ne&&h===ue.Open&&ne!==((H=tn(ne))==null?void 0:H.activeElement)&&(ne==null||ne.focus({preventScroll:!0}))},[h,b]);let ce=K(H=>{var ne,me;switch(V.dispose(),H.key){case le.Space:if(f.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),f.actions.search(H.key);case le.Enter:if(H.preventDefault(),H.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:pt}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(pt.current.value)}p.mode===He.Single&&(ye.flushSync(()=>f.actions.closeListbox()),(ne=f.state.buttonElement)==null||ne.focus({preventScroll:!0}));break;case Pe(p.orientation,{vertical:le.ArrowDown,horizontal:le.ArrowRight}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:re.Next});case Pe(p.orientation,{vertical:le.ArrowUp,horizontal:le.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:re.Previous});case le.Home:case le.PageUp:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:re.First});case le.End:case le.PageDown:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:re.Last});case le.Escape:H.preventDefault(),H.stopPropagation(),ye.flushSync(()=>f.actions.closeListbox()),(me=f.state.buttonElement)==null||me.focus({preventScroll:!0});return;case le.Tab:H.preventDefault(),H.stopPropagation(),ye.flushSync(()=>f.actions.closeListbox()),Yf(f.state.buttonElement,H.shiftKey?ao.Previous:ao.Next);break;default:H.key.length===1&&(f.actions.search(H.key),V.setTimeout(()=>f.actions.clearSearch(),350));break}}),ee=Te(f,H=>{var ne;return(ne=H.buttonElement)==null?void 0:ne.id}),X=m.useMemo(()=>({open:h===ue.Open}),[h]),tt=Xs(l?O():{},{id:r,ref:_,"aria-activedescendant":Te(f,f.selectors.activeDescendantId),"aria-multiselectable":p.mode===He.Multi?!0:void 0,"aria-labelledby":ee,"aria-orientation":p.orientation,onKeyDown:ce,role:"listbox",tabIndex:h===ue.Open?0:void 0,style:{...i.style,...z,"--button-width":Af(g,!0).width},...ji(C)}),Me=Ee(),he=m.useMemo(()=>p.mode===He.Multi?p:{...p,isSelected:D},[p,D]);return m.createElement(oh,{enabled:s?e.static||y:!1,ownerDocument:x},m.createElement(pr.Provider,{value:he},Me({ourProps:tt,theirProps:i,slot:X,defaultTag:$h,features:Sh,visible:I,name:"Listbox.Options"})))}let Ph="div";function Oh(e,t){let n=m.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...a}=e,u=m.useContext(Ia)===!0,i=fn("Listbox.Option"),l=Ao("Listbox.Option"),c=Te(l,I=>l.selectors.isActive(I,r)),d=i.isSelected(s),p=m.useRef(null),f=mh(p),h=gt({disabled:o,value:s,domRef:p,get textValue(){return f()}}),g=Oe(t,p,I=>{I?i.listRef.current.set(r,I):i.listRef.current.delete(r)}),b=Te(l,I=>l.selectors.shouldScrollIntoView(I,r));te(()=>{if(b)return ke().requestAnimationFrame(()=>{var I,M;(M=(I=p.current)==null?void 0:I.scrollIntoView)==null||M.call(I,{block:"nearest"})})},[b,p]),te(()=>{if(!u)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,u]);let $=K(I=>{var M;if(o)return I.preventDefault();l.actions.onChange(s),i.mode===He.Single&&(ye.flushSync(()=>l.actions.closeListbox()),(M=l.state.buttonElement)==null||M.focus({preventScroll:!0}))}),x=K(()=>{if(o)return l.actions.goToOption({focus:re.Nothing});l.actions.goToOption({focus:re.Specific,id:r})}),v=dd(),E=K(I=>v.update(I)),y=K(I=>{v.wasMoved(I)&&(o||c&&l.state.activationTrigger===dr.Pointer||l.actions.goToOption({focus:re.Specific,id:r},dr.Pointer))}),C=K(I=>{v.wasMoved(I)&&(o||c&&l.state.activationTrigger===dr.Pointer&&l.actions.goToOption({focus:re.Nothing}))}),S=m.useMemo(()=>({active:c,focus:c,selected:d,disabled:o,selectedOption:d&&u}),[c,d,o,u]),A=u?{}:{id:r,ref:g,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:$,onFocus:x,onPointerEnter:E,onMouseEnter:E,onPointerMove:y,onMouseMove:y,onPointerLeave:C,onMouseLeave:C},j=Ee();return!d&&u?null:j({ourProps:A,theirProps:a,slot:S,defaultTag:Ph,name:"Listbox.Option"})}let Ah=m.Fragment;function Th(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Oe(t)},a=fn("ListboxSelectedOption"),u=m.useMemo(()=>({}),[]),i=a.value===void 0||a.value===null||a.mode===He.Multi&&Array.isArray(a.value)&&a.value.length===0,l=Ee();return m.createElement(Ia.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:m.createElement(m.Fragment,null,r&&i?r:n)},slot:u,defaultTag:Ah,name:"ListboxSelectedOption"}))}let Ih=ve(wh),Mh=ve(Eh),jh=Sf,kh=ve(Ch),Fh=ve(Oh),Nh=ve(Th),lt=Object.assign(Ih,{Button:Mh,Label:jh,Options:kh,Option:Fh,SelectedOption:Nh});function Lh({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 Ma=N.forwardRef(Lh);function Dh({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 ja=N.forwardRef(Dh),_h=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>P.jsx("div",{className:`relative ${o}`,children:P.jsx(lt,{value:t,onChange:n,disabled:r,children:({open:a})=>P.jsxs(P.Fragment,{children:[P.jsxs(lt.Button,{className:`
|
|
76
76
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
77
77
|
items-center justify-between flex px-3 rounded-lg
|
|
78
78
|
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
|
79
79
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
80
|
-
${
|
|
81
|
-
`,children:[
|
|
80
|
+
${a?"ring-2 ring-blue-500":""}
|
|
81
|
+
`,children:[P.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Asset"}),P.jsxs("div",{className:"flex items-center",children:[t.iconUrl?P.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):P.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:P.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),P.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),P.jsx(ja,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${a?"rotate-180":""}`})]})]}),P.jsx(Ea,{as:m.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:P.jsx(lt.Options,{className:`
|
|
82
82
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
83
83
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
84
84
|
focus:outline-none
|
|
85
|
-
`,children:e.map(
|
|
85
|
+
`,children:e.map(u=>P.jsx(lt.Option,{value:u,className:({active:i,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":i?"bg-fill-input-secondary":""}`,children:({selected:i,active:l})=>P.jsxs("div",{className:"flex items-center justify-between",children:[P.jsxs("div",{className:"flex items-center space-x-3",children:[u.iconUrl?P.jsx("img",{src:u.iconUrl,alt:u.token,className:"w-5 h-5 rounded-full"}):P.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:P.jsx("span",{className:"text-xs text-white font-bold",children:u.token.charAt(0)})}),P.jsx("div",{className:"flex flex-col",children:P.jsx("span",{className:`text-sm font-medium ${i||l?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),i&&P.jsx(Ma,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})}),Rh=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>P.jsx("div",{className:`relative ${o}`,children:P.jsx(lt,{value:t,onChange:n,disabled:r,children:({open:a})=>P.jsxs(P.Fragment,{children:[P.jsxs(lt.Button,{className:`
|
|
86
86
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
87
87
|
items-center justify-between flex px-3 rounded-lg
|
|
88
88
|
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
|
89
89
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
90
|
-
${
|
|
91
|
-
`,children:[
|
|
90
|
+
${a?"ring-2 ring-blue-500":""}
|
|
91
|
+
`,children:[P.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Chain"}),P.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?P.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):P.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:P.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),P.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),P.jsx(ja,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${a?"rotate-180":""}`})]})]}),P.jsx(Ea,{as:m.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:P.jsx(lt.Options,{className:`
|
|
92
92
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
93
93
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
94
94
|
focus:outline-none
|
|
95
|
-
`,children:e.filter(
|
|
95
|
+
`,children:e.filter(u=>u[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(u=>P.jsx(lt.Option,{value:u,className:({active:i,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":i?"bg-fill-input-secondary":""}`,children:({selected:i,active:l})=>P.jsxs("div",{className:"flex items-center justify-between",children:[P.jsxs("div",{className:"flex items-center space-x-3",children:[u.chainIconUrl?P.jsx("img",{src:u.chainIconUrl,alt:u.chain,className:"w-5 h-5 rounded-full"}):P.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:P.jsx("span",{className:"text-xs text-white font-bold",children:u.chain.charAt(0)})}),P.jsx("div",{className:"flex flex-col",children:P.jsx("span",{className:`text-sm font-medium ${i||l?"text-text-primary":"text-text-tertiary"}`,children:u.chain})})]}),i&&P.jsx(Ma,{className:"w-4 h-4 text-blue-400"})]})},u.chainId))})})]})})}),ka=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const a=m.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),u=f=>{if(n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(g=>g.token===r||g.symbol===r)){const g=f.tokenList[0];o(g.symbol||g.token)}},i=f=>{o(f.symbol||f.token)},l=m.useMemo(()=>t.map(f=>f),[t]),c=m.useMemo(()=>l.find(f=>f.chainId===e.chainId)||l[0],[l,e.chainId]),d=m.useMemo(()=>a.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[a]),p=m.useMemo(()=>{if(d.length!==0)return d.find(f=>f.token===r||f.symbol===r)||d[0]},[d,r]);return P.jsxs("div",{className:"space-y-4",children:[P.jsx(Rh,{chains:l,selectedChain:c,onChainChange:f=>{const h=t.find(g=>g.chainId===f.chainId);h&&u(h)},walletType:s,className:"w-full"}),d.length>0?p&&P.jsx(_h,{tokens:d,selectedToken:p,onTokenChange:i,walletType:s,className:"w-full"}):P.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:P.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})};var Bh=Object.defineProperty,hr=Object.getOwnPropertySymbols,Fa=Object.prototype.hasOwnProperty,Na=Object.prototype.propertyIsEnumerable,La=(e,t,n)=>t in e?Bh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,To=(e,t)=>{for(var n in t||(t={}))Fa.call(t,n)&&La(e,n,t[n]);if(hr)for(var n of hr(t))Na.call(t,n)&&La(e,n,t[n]);return e},Io=(e,t)=>{var n={};for(var r in e)Fa.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hr)for(var r of hr(e))t.indexOf(r)<0&&Na.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
96
96
|
* @license QR Code generator library (TypeScript)
|
|
97
97
|
* Copyright (c) Project Nayuki.
|
|
98
98
|
* SPDX-License-Identifier: MIT
|
|
99
|
-
*/var it;(e=>{const t=class Z{constructor(i,l,a,d){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<Z.MIN_VERSION||i>Z.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 f=[];for(let m=0;m<this.size;m++)f.push(!1);for(let m=0;m<this.size;m++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(a);if(this.drawCodewords(p),d==-1){let m=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const b=this.getPenaltyScore();b<m&&(d=g,m=b),this.applyMask(g)}}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 Z.encodeSegments(a,l)}static encodeBinary(i,l){const a=e.QrSegment.makeBytes(i);return Z.encodeSegments([a],l)}static encodeSegments(i,l,a=1,d=40,f=-1,p=!0){if(!(Z.MIN_VERSION<=a&&a<=d&&d<=Z.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let m,g;for(m=a;;m++){const y=Z.getNumDataCodewords(m,l)*8,S=c.getTotalBits(i,m);if(S<=y){g=S;break}if(m>=d)throw new RangeError("Data too long")}for(const y of[Z.Ecc.MEDIUM,Z.Ecc.QUARTILE,Z.Ecc.HIGH])p&&g<=Z.getNumDataCodewords(m,y)*8&&(l=y);let b=[];for(const y of i){n(y.mode.modeBits,4,b),n(y.numChars,y.mode.numCharCountBits(m),b);for(const S of y.getData())b.push(S)}o(b.length==g);const x=Z.getNumDataCodewords(m,l)*8;o(b.length<=x),n(0,Math.min(4,x-b.length),b),n(0,(8-b.length%8)%8,b),o(b.length%8==0);for(let y=236;b.length<x;y^=253)n(y,8,b);let w=[];for(;w.length*8<b.length;)w.push(0);return b.forEach((y,S)=>w[S>>>3]|=y<<7-(S&7)),new Z(m,l,w,f)}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 f=0;f<10;f++)a=a<<1^(a>>>9)*1335;const d=(l<<10|a)^21522;o(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,r(d,f));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,r(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,r(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,r(d,f));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),f=this.size-11+a%3,p=Math.floor(a/3);this.setFunctionModule(f,p,d),this.setFunctionModule(p,f,d)}}drawFinderPattern(i,l){for(let a=-4;a<=4;a++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(a)),p=i+d,m=l+a;0<=p&&p<this.size&&0<=m&&m<this.size&&this.setFunctionModule(p,m,f!=2&&f!=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!=Z.getNumDataCodewords(l,a))throw new RangeError("Invalid argument");const d=Z.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][l],f=Z.ECC_CODEWORDS_PER_BLOCK[a.ordinal][l],p=Math.floor(Z.getNumRawDataModules(l)/8),m=d-p%d,g=Math.floor(p/d);let b=[];const x=Z.reedSolomonComputeDivisor(f);for(let y=0,S=0;y<d;y++){let E=i.slice(S,S+g-f+(y<m?0:1));S+=E.length;const F=Z.reedSolomonComputeRemainder(E,x);y<m&&E.push(0),b.push(E.concat(F))}let w=[];for(let y=0;y<b[0].length;y++)b.forEach((S,E)=>{(y!=g-f||E>=m)&&w.push(S[y])});return o(w.length==p),w}drawCodewords(i){if(i.length!=Math.floor(Z.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 f=0;f<2;f++){const p=a-f,g=(a+1&2)==0?this.size-1-d:d;!this.isFunction[g][p]&&l<i.length*8&&(this.modules[g][p]=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 f=0;f<this.size;f++){let p=!1,m=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[f][b]==p?(m++,m==5?i+=Z.PENALTY_N1:m>5&&i++):(this.finderPenaltyAddHistory(m,g),p||(i+=this.finderPenaltyCountPatterns(g)*Z.PENALTY_N3),p=this.modules[f][b],m=1);i+=this.finderPenaltyTerminateAndCount(p,m,g)*Z.PENALTY_N3}for(let f=0;f<this.size;f++){let p=!1,m=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[b][f]==p?(m++,m==5?i+=Z.PENALTY_N1:m>5&&i++):(this.finderPenaltyAddHistory(m,g),p||(i+=this.finderPenaltyCountPatterns(g)*Z.PENALTY_N3),p=this.modules[b][f],m=1);i+=this.finderPenaltyTerminateAndCount(p,m,g)*Z.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let p=0;p<this.size-1;p++){const m=this.modules[f][p];m==this.modules[f][p+1]&&m==this.modules[f+1][p]&&m==this.modules[f+1][p+1]&&(i+=Z.PENALTY_N2)}let l=0;for(const f of this.modules)l=f.reduce((p,m)=>p+(m?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*Z.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<Z.MIN_VERSION||i>Z.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(Z.getNumRawDataModules(i)/8)-Z.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*Z.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 f=0;f<l.length;f++)l[f]=Z.reedSolomonMultiply(l[f],a),f+1<l.length&&(l[f]^=l[f+1]);a=Z.reedSolomonMultiply(a,2)}return l}static reedSolomonComputeRemainder(i,l){let a=l.map(d=>0);for(const d of i){const f=d^a.shift();a.push(0),l.forEach((p,m)=>a[m]^=Z.reedSolomonMultiply(p,f))}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 f=d.mode.numCharCountBits(l);if(d.numChars>=1<<f)return 1/0;a+=4+f+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})(it||(it={})),(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={}))})(it||(it={})),(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={}))})(it||(it={}));var vt=it;/**
|
|
99
|
+
*/var wt;(e=>{const t=class G{constructor(i,l,c,d){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<G.MIN_VERSION||i>G.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 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 f=this.addEccAndInterleave(c);if(this.drawCodewords(f),d==-1){let h=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const b=this.getPenaltyScore();b<h&&(d=g,h=b),this.applyMask(g)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(i,l){const c=e.QrSegment.makeSegments(i);return G.encodeSegments(c,l)}static encodeBinary(i,l){const c=e.QrSegment.makeBytes(i);return G.encodeSegments([c],l)}static encodeSegments(i,l,c=1,d=40,p=-1,f=!0){if(!(G.MIN_VERSION<=c&&c<=d&&d<=G.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,g;for(h=c;;h++){const v=G.getNumDataCodewords(h,l)*8,E=a.getTotalBits(i,h);if(E<=v){g=E;break}if(h>=d)throw new RangeError("Data too long")}for(const v of[G.Ecc.MEDIUM,G.Ecc.QUARTILE,G.Ecc.HIGH])f&&g<=G.getNumDataCodewords(h,v)*8&&(l=v);let b=[];for(const v of i){n(v.mode.modeBits,4,b),n(v.numChars,v.mode.numCharCountBits(h),b);for(const E of v.getData())b.push(E)}o(b.length==g);const $=G.getNumDataCodewords(h,l)*8;o(b.length<=$),n(0,Math.min(4,$-b.length),b),n(0,(8-b.length%8)%8,b),o(b.length%8==0);for(let v=236;b.length<$;v^=253)n(v,8,b);let x=[];for(;x.length*8<b.length;)x.push(0);return b.forEach((v,E)=>x[E>>>3]|=v<<7-(E&7)),new G(h,l,x,p)}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 c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%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 c=0;c<l;c++)for(let d=0;d<l;d++)c==0&&d==0||c==0&&d==l-1||c==l-1&&d==0||this.drawAlignmentPattern(i[c],i[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let c=l;for(let p=0;p<10;p++)c=c<<1^(c>>>9)*1335;const d=(l<<10|c)^21522;o(d>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(d,p));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(d,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(d,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(d,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let c=0;c<12;c++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let c=0;c<18;c++){const d=r(l,c),p=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(p,f,d),this.setFunctionModule(f,p,d)}}drawFinderPattern(i,l){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const p=Math.max(Math.abs(d),Math.abs(c)),f=i+d,h=l+c;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,p!=2&&p!=4)}}drawAlignmentPattern(i,l){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(i+d,l+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(i,l,c){this.modules[l][i]=c,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,c=this.errorCorrectionLevel;if(i.length!=G.getNumDataCodewords(l,c))throw new RangeError("Invalid argument");const d=G.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l],p=G.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l],f=Math.floor(G.getNumRawDataModules(l)/8),h=d-f%d,g=Math.floor(f/d);let b=[];const $=G.reedSolomonComputeDivisor(p);for(let v=0,E=0;v<d;v++){let y=i.slice(E,E+g-p+(v<h?0:1));E+=y.length;const C=G.reedSolomonComputeRemainder(y,$);v<h&&y.push(0),b.push(y.concat(C))}let x=[];for(let v=0;v<b[0].length;v++)b.forEach((E,y)=>{(v!=g-p||y>=h)&&x.push(E[v])});return o(x.length==f),x}drawCodewords(i){if(i.length!=Math.floor(G.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let p=0;p<2;p++){const f=c-p,g=(c+1&2)==0?this.size-1-d:d;!this.isFunction[g][f]&&l<i.length*8&&(this.modules[g][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 c=0;c<this.size;c++){let d;switch(i){case 0:d=(c+l)%2==0;break;case 1:d=l%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+l)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(l/2))%2==0;break;case 5:d=c*l%2+c*l%3==0;break;case 6:d=(c*l%2+c*l%3)%2==0;break;case 7:d=((c+l)%2+c*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][c]&&d&&(this.modules[l][c]=!this.modules[l][c])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let f=!1,h=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[p][b]==f?(h++,h==5?i+=G.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,g),f||(i+=this.finderPenaltyCountPatterns(g)*G.PENALTY_N3),f=this.modules[p][b],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,g)*G.PENALTY_N3}for(let p=0;p<this.size;p++){let f=!1,h=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[b][p]==f?(h++,h==5?i+=G.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,g),f||(i+=this.finderPenaltyCountPatterns(g)*G.PENALTY_N3),f=this.modules[b][p],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,g)*G.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let f=0;f<this.size-1;f++){const h=this.modules[p][f];h==this.modules[p][f+1]&&h==this.modules[p+1][f]&&h==this.modules[p+1][f+1]&&(i+=G.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((f,h)=>f+(h?1:0),l);const c=this.size*this.size,d=Math.ceil(Math.abs(l*20-c*10)/c)-1;return o(0<=d&&d<=9),i+=d*G.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 c=[6];for(let d=this.size-7;c.length<i;d-=l)c.splice(1,0,d);return c}}static getNumRawDataModules(i){if(i<G.MIN_VERSION||i>G.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const c=Math.floor(i/7)+2;l-=(25*c-10)*c-55,i>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(G.getNumRawDataModules(i)/8)-G.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*G.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 c=1;for(let d=0;d<i;d++){for(let p=0;p<l.length;p++)l[p]=G.reedSolomonMultiply(l[p],c),p+1<l.length&&(l[p]^=l[p+1]);c=G.reedSolomonMultiply(c,2)}return l}static reedSolomonComputeRemainder(i,l){let c=l.map(d=>0);for(const d of i){const p=d^c.shift();c.push(0),l.forEach((f,h)=>c[h]^=G.reedSolomonMultiply(f,p))}return c}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(l>>>d&1)*i;return o(c>>>8==0),c}finderPenaltyCountPatterns(i){const l=i[1];o(l<=this.size*3);const c=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(c&&i[0]>=l*4&&i[6]>=l?1:0)+(c&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,c){return i&&(this.finderPenaltyAddHistory(l,c),l=0),l+=this.size,this.finderPenaltyAddHistory(l,c),this.finderPenaltyCountPatterns(c)}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 c=i-1;c>=0;c--)l.push(u>>>c&1)}function r(u,i){return(u>>>i&1)!=0}function o(u){if(!u)throw new Error("Assertion error")}const s=class se{constructor(i,l,c){if(this.mode=i,this.numChars=l,this.bitData=c,l<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(i){let l=[];for(const c of i)n(c,8,l);return new se(se.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!se.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let c=0;c<i.length;){const d=Math.min(i.length-c,3);n(parseInt(i.substring(c,c+d),10),d*3+1,l),c+=d}return new se(se.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!se.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],c;for(c=0;c+2<=i.length;c+=2){let d=se.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c))*45;d+=se.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c+1)),n(d,11,l)}return c<i.length&&n(se.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)),6,l),new se(se.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:se.isNumeric(i)?[se.makeNumeric(i)]:se.isAlphanumeric(i)?[se.makeAlphanumeric(i)]:[se.makeBytes(se.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 se(se.Mode.ECI,0,l)}static isNumeric(i){return se.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return se.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let c=0;for(const d of i){const p=d.mode.numCharCountBits(l);if(d.numChars>=1<<p)return 1/0;c+=4+p+d.bitData.length}return c}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let c=0;c<i.length;c++)i.charAt(c)!="%"?l.push(i.charCodeAt(c)):(l.push(parseInt(i.substring(c+1,c+3),16)),c+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let a=s;e.QrSegment=s})(wt||(wt={})),(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={}))})(wt||(wt={})),(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={}))})(wt||(wt={}));var Rt=wt;/**
|
|
100
100
|
* @license qrcode.react
|
|
101
101
|
* Copyright (c) Paul O'Shannessy
|
|
102
102
|
* SPDX-License-Identifier: ISC
|
|
103
|
-
*/var of={L:vt.QrCode.Ecc.LOW,M:vt.QrCode.Ecc.MEDIUM,Q:vt.QrCode.Ecc.QUARTILE,H:vt.QrCode.Ecc.HIGH},Pi=128,Ai="L",Mi="#FFFFFF",_i="#000000",Li=!1,Di=1,sf=4,lf=0,af=.1;function Fi(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 Ii(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 uf(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*af),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 f=null;if(r.excavate){let m=Math.floor(l),g=Math.floor(a),b=Math.ceil(u+l-m),x=Math.ceil(i+a-g);f={x:m,y:g,w:b,h:x}}const p=r.crossOrigin;return{x:l,y:a,h:i,w:u,excavation:f,opacity:d,crossOrigin:p}}function cf(e,t){return t!=null?Math.max(Math.floor(t),0):e?sf:lf}function ki({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:c,boostLevel:u}){let i=h.useMemo(()=>{const m=(Array.isArray(e)?e:[e]).reduce((g,b)=>(g.push(...vt.QrSegment.makeSegments(b)),g),[]);return vt.QrCode.encodeSegments(m,of[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:a,numCells:d,calculatedImageSettings:f}=h.useMemo(()=>{let p=i.getModules();const m=cf(r,o),g=p.length+m*2,b=uf(p,c,m,s);return{cells:p,margin:m,numCells:g,calculatedImageSettings:b}},[i,c,s,r,o]);return{qrcode:i,margin:a,cells:l,numCells:d,calculatedImageSettings:f}}var ff=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),df=h.forwardRef(function(t,n){const r=t,{value:o,size:s=Pi,level:c=Ai,bgColor:u=Mi,fgColor:i=_i,includeMargin:l=Li,minVersion:a=Di,boostLevel:d,marginSize:f,imageSettings:p}=r,g=sr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=g,x=sr(g,["style"]),w=p==null?void 0:p.src,y=h.useRef(null),S=h.useRef(null),E=h.useCallback(W=>{y.current=W,typeof n=="function"?n(W):n&&(n.current=W)},[n]),[F,j]=h.useState(!1),{margin:K,cells:ee,numCells:L,calculatedImageSettings:N}=ki({value:o,level:c,minVersion:a,boostLevel:d,includeMargin:l,marginSize:f,imageSettings:p,size:s});h.useEffect(()=>{if(y.current!=null){const W=y.current,X=W.getContext("2d");if(!X)return;let G=ee;const J=S.current,P=N!=null&&J!==null&&J.complete&&J.naturalHeight!==0&&J.naturalWidth!==0;P&&N.excavation!=null&&(G=Ii(ee,N.excavation));const U=window.devicePixelRatio||1;W.height=W.width=s*U;const C=s/L*U;X.scale(C,C),X.fillStyle=u,X.fillRect(0,0,L,L),X.fillStyle=i,ff?X.fill(new Path2D(Fi(G,K))):ee.forEach(function(A,k){A.forEach(function(I,B){I&&X.fillRect(B+K,k+K,1,1)})}),N&&(X.globalAlpha=N.opacity),P&&X.drawImage(J,N.x+K,N.y+K,N.w,N.h)}}),h.useEffect(()=>{j(!1)},[w]);const oe=ir({height:s,width:s},b);let H=null;return w!=null&&(H=h.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{j(!0)},ref:S,crossOrigin:N==null?void 0:N.crossOrigin})),h.createElement(h.Fragment,null,h.createElement("canvas",ir({style:oe,height:s,width:s,ref:E,role:"img"},x)),H)});df.displayName="QRCodeCanvas";var Ni=h.forwardRef(function(t,n){const r=t,{value:o,size:s=Pi,level:c=Ai,bgColor:u=Mi,fgColor:i=_i,includeMargin:l=Li,minVersion:a=Di,boostLevel:d,title:f,marginSize:p,imageSettings:m}=r,g=sr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:x,numCells:w,calculatedImageSettings:y}=ki({value:o,level:c,minVersion:a,boostLevel:d,includeMargin:l,marginSize:p,imageSettings:m,size:s});let S=x,E=null;m!=null&&y!=null&&(y.excavation!=null&&(S=Ii(x,y.excavation)),E=h.createElement("image",{href:m.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=Fi(S,b);return h.createElement("svg",ir({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},g),!!f&&h.createElement("title",null,f),h.createElement("path",{fill:u,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),h.createElement("path",{fill:i,d:F,shapeRendering:"crispEdges"}),E)});Ni.displayName="QRCodeSVG";const pf=({value:e,size:t,level:n,bgColor:r,fgColor:o,includeMargin:s=!0})=>O.jsx(Ni,{value:e,size:t,level:n,bgColor:r,fgColor:o,marginSize:s?4:0}),hf=({text:e,onCopy:t,children:n})=>O.jsx("div",{onClick:()=>{navigator.clipboard.writeText(e).then(t)},style:{cursor:"pointer"},children:n}),mf=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r})=>{var o;return O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"flex justify-center mt-4 mb-3",children:O.jsx("div",{className:"bg-white rounded-lg",children:O.jsx(pf,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",includeMargin:!1})})}),O.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[O.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),O.jsx(hf,{text:(e==null?void 0:e.getDisplayAddress())||"",onCopy:()=>console.log("Copied!"),children:O.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[O.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),O.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),O.jsxs("div",{className:"flex items-start",children:[O.jsx("div",{className:"w-5",children:O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:O.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"})})}),O.jsxs("div",{className:"flex-1",children:[O.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."]}),O.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),O.jsx("div",{className:"flex items-start pl-5 pt-2 text-functional-orange-1 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."}),O.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"}),O.jsxs("div",{className:"text-sm",children:[O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[O.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),O.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"]})]}),O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[O.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),O.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((o=r==null?void 0:r.multiChain)==null?void 0:o.minDeposit)||10," ",t]})]}),O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[O.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),O.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},vf=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onClose:s})=>{const[c,u]=h.useState(()=>{var d;return!e||e.length===0?1:t||((d=e[0])==null?void 0:d.chainId)||1}),[i,l]=h.useState(()=>{var m;if(!e||e.length===0)return"";const d=t||((m=e[0])==null?void 0:m.chainId),f=e.find(g=>g.chainId===d);if(!f||!f.tokenList||f.tokenList.length===0)return"";const p=f.tokenList.find(g=>g.tokenAddress===n)||f.tokenList[0];return(p==null?void 0:p.token)||""}),a=e&&e.length>0?e.find(d=>d.chainId===c)||e[0]:null;return!e||e.length===0?O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"No chains available"})}):a?O.jsxs(O.Fragment,{children:[O.jsx(nf,{currentActiveChain:a,chainList:e,onChainChange:u,curSelectToken:i,onTokenChange:l}),O.jsx(mf,{walletAdapter:r,curSelectToken:i,currentActiveChain:a,metadata:o}),O.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()},children:"Deposit"})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})},gf=[{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}],ji={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Ri={address:"0x1234567890123456789012345678901234567890"},Wi={multiChain:{minDeposit:10}},Bi=({isOpen:e,onClose:t,config:n,isWalletConnected:r=!0,currentActiveAccount:o=ji,smartWallet:s=Ri,chains:c,defaultChainId:u,defaultTokenAddress:i,defaultAmount:l="",metadata:a=Wi,currentEquity:d=5e3,onDepositComplete:f})=>{const p=h.useMemo(()=>{var m;return o?Ds(o,s,!1,(m=c[0])==null?void 0:m.chainId,"0","0"):null},[o,s,c]);return e?we.createPortal(O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{console.log("🔍 Backdrop clicked"),t()},"aria-hidden":"true",children:O.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:m=>{m.stopPropagation()},children:[O.jsxs("div",{className:"flex items-center justify-between mb-4",children:[O.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),O.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:O.jsx(Ms,{className:"h-4 w-4"})})]}),O.jsx(vf,{chains:c,defaultChainId:u,defaultTokenAddress:i,defaultAmount:l,walletAdapter:p,metadata:a,currentEquity:d,onDepositComplete:f,onClose:t})]})})}),document.body):null};var lr={exports:{}},un={exports:{}},ie={};/** @license React v16.13.1
|
|
104
|
-
* react-is.production.min.js
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
(
|
|
120
|
-
@license MIT
|
|
121
|
-
|
|
122
|
-
|
|
103
|
+
*/var Uh={L:Rt.QrCode.Ecc.LOW,M:Rt.QrCode.Ecc.MEDIUM,Q:Rt.QrCode.Ecc.QUARTILE,H:Rt.QrCode.Ecc.HIGH},Da=128,_a="L",Ra="#FFFFFF",Ba="#000000",Ua=!1,za=1,zh=4,Hh=0,Wh=.1;function Ha(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(a,u){if(!a&&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(!a)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}a&&s===null&&(s=u)})}),n.join("")}function Wa(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 Vh(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Wh),a=o/t,u=(r.width||s)*a,i=(r.height||s)*a,l=r.x==null?e.length/2-u/2:r.x*a,c=r.y==null?e.length/2-i/2:r.y*a,d=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(l),g=Math.floor(c),b=Math.ceil(u+l-h),$=Math.ceil(i+c-g);p={x:h,y:g,w:b,h:$}}const f=r.crossOrigin;return{x:l,y:c,h:i,w:u,excavation:p,opacity:d,crossOrigin:f}}function Gh(e,t){return t!=null?Math.max(Math.floor(t),0):e?zh:Hh}function Va({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:a,boostLevel:u}){let i=m.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((g,b)=>(g.push(...Rt.QrSegment.makeSegments(b)),g),[]);return Rt.QrCode.encodeSegments(h,Uh[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:c,numCells:d,calculatedImageSettings:p}=m.useMemo(()=>{let f=i.getModules();const h=Gh(r,o),g=f.length+h*2,b=Vh(f,a,h,s);return{cells:f,margin:h,numCells:g,calculatedImageSettings:b}},[i,a,s,r,o]);return{qrcode:i,margin:c,cells:l,numCells:d,calculatedImageSettings:p}}var qh=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Kh=m.forwardRef(function(t,n){const r=t,{value:o,size:s=Da,level:a=_a,bgColor:u=Ra,fgColor:i=Ba,includeMargin:l=Ua,minVersion:c=za,boostLevel:d,marginSize:p,imageSettings:f}=r,g=Io(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=g,$=Io(g,["style"]),x=f==null?void 0:f.src,v=m.useRef(null),E=m.useRef(null),y=m.useCallback(L=>{v.current=L,typeof n=="function"?n(L):n&&(n.current=L)},[n]),[C,S]=m.useState(!1),{margin:A,cells:j,numCells:I,calculatedImageSettings:M}=Va({value:o,level:a,minVersion:c,boostLevel:d,includeMargin:l,marginSize:p,imageSettings:f,size:s});m.useEffect(()=>{if(v.current!=null){const L=v.current,R=L.getContext("2d");if(!R)return;let B=j;const z=E.current,O=M!=null&&z!==null&&z.complete&&z.naturalHeight!==0&&z.naturalWidth!==0;O&&M.excavation!=null&&(B=Wa(j,M.excavation));const _=window.devicePixelRatio||1;L.height=L.width=s*_;const V=s/I*_;R.scale(V,V),R.fillStyle=u,R.fillRect(0,0,I,I),R.fillStyle=i,qh?R.fill(new Path2D(Ha(B,A))):j.forEach(function(ce,ee){ce.forEach(function(X,tt){X&&R.fillRect(tt+A,ee+A,1,1)})}),M&&(R.globalAlpha=M.opacity),O&&R.drawImage(z,M.x+A,M.y+A,M.w,M.h)}}),m.useEffect(()=>{S(!1)},[x]);const W=To({height:s,width:s},b);let D=null;return x!=null&&(D=m.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{S(!0)},ref:E,crossOrigin:M==null?void 0:M.crossOrigin})),m.createElement(m.Fragment,null,m.createElement("canvas",To({style:W,height:s,width:s,ref:y,role:"img"},$)),D)});Kh.displayName="QRCodeCanvas";var Ga=m.forwardRef(function(t,n){const r=t,{value:o,size:s=Da,level:a=_a,bgColor:u=Ra,fgColor:i=Ba,includeMargin:l=Ua,minVersion:c=za,boostLevel:d,title:p,marginSize:f,imageSettings:h}=r,g=Io(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:$,numCells:x,calculatedImageSettings:v}=Va({value:o,level:a,minVersion:c,boostLevel:d,includeMargin:l,marginSize:f,imageSettings:h,size:s});let E=$,y=null;h!=null&&v!=null&&(v.excavation!=null&&(E=Wa($,v.excavation)),y=m.createElement("image",{href:h.src,height:v.h,width:v.w,x:v.x+b,y:v.y+b,preserveAspectRatio:"none",opacity:v.opacity,crossOrigin:v.crossOrigin}));const C=Ha(E,b);return m.createElement("svg",To({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},g),!!p&&m.createElement("title",null,p),m.createElement("path",{fill:u,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),m.createElement("path",{fill:i,d:C,shapeRendering:"crispEdges"}),y)});Ga.displayName="QRCodeSVG";const Yh=(e,t)=>Number(e)>Number(t),xt=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"},qa=(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 i=o[0]+"."+o[1].substring(0,6);return qa(i,t)}const s=parseFloat(e),a=parseFloat(t);if(!isNaN(s)&&!isNaN(a)&&s>a)return{isValid:!0,formattedValue:xt(t),errorType:"auto_adjusted_to_max"};let u=e;return!isNaN(s)&&!e.endsWith(".")&&e.includes(".")&&(u=e.replace(/\.?0+$/,""),u.includes(".")||(u=u)),{isValid:!0,formattedValue:u}},Xh=(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)},Ka={ETHEREUM:1,SEPOLIA:11155111},Qh=[Ka.ETHEREUM,Ka.SEPOLIA],Zh=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!Qh.includes(t)}return!0},Jh=[{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}],Ya={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Xa={address:"0x1234567890123456789012345678901234567890"},Qa={multiChain:{minDeposit:10}},em=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r})=>{var s;const o=m.useMemo(()=>Zh(n||{}),[n]);return P.jsxs(P.Fragment,{children:[P.jsx("div",{className:"flex justify-center mt-4 mb-3",children:P.jsx("div",{className:"bg-white rounded-lg",children:P.jsx(Ga,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),P.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[P.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),P.jsx("div",{onClick:()=>{navigator.clipboard.writeText((e==null?void 0:e.getDisplayAddress())||"")},style:{cursor:"pointer"},children:P.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[P.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),P.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),P.jsxs("div",{className:"flex items-start",children:[P.jsx("div",{className:"w-5",children:P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:P.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"})})}),P.jsxs("div",{className:"flex-1",children:[P.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."]}),P.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),o&&P.jsxs(P.Fragment,{children:[P.jsx("div",{className:"flex items-start pl-5 pt-2 text-functional-orange-1 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."}),P.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),P.jsxs("div",{className:"text-sm",children:[P.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[P.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),P.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"]})]}),P.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[P.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),P.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((s=r==null?void 0:r.multiChain)==null?void 0:s.minDeposit)||10," ",t]})]}),P.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[P.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),P.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},tm=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onClose:a})=>{var g;const[u,i]=m.useState(()=>{var b;return!e||e.length===0?1:t||((b=e[0])==null?void 0:b.chainId)||1}),[l,c]=m.useState(()=>{var v;if(!e||e.length===0)return"";const b=t||((v=e[0])==null?void 0:v.chainId),$=e.find(E=>E.chainId===b);if(!$||!$.tokenList||$.tokenList.length===0)return"";const x=$.tokenList.find(E=>E.tokenAddress===n)||$.tokenList[0];return(x==null?void 0:x.token)||""}),[d,p]=m.useState(""),f=e&&e.length>0?e.find(b=>b.chainId===u)||e[0]:null,h=(g=f==null?void 0:f.tokenList)==null?void 0:g.find(b=>b.token===l);return!e||e.length===0?P.jsx("div",{className:"text-center py-8",children:P.jsx("p",{className:"text-gray-400",children:"No chains available"})}):f?P.jsxs(P.Fragment,{children:[P.jsx(ka,{currentActiveChain:f,chainList:e,onChainChange:i,curSelectToken:l,onTokenChange:c,walletType:"mpc"}),P.jsx(em,{walletAdapter:r,curSelectToken:l,currentActiveChain:f,metadata:o}),P.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:d,chainId:u,tokenAddress:(h==null?void 0:h.tokenAddress)||"",tokenSymbol:l}),a()},children:"Deposit"})]}):P.jsx("div",{className:"text-center py-8",children:P.jsx("p",{className:"text-gray-400",children:"Loading..."})})},nm=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:a,decimals:u,tokenBalance:i,onDepositAmountChange:l,onApprove:c})=>{const d=f=>{const h=f.target.value,b=qa(h,i||"0");if(b.isValid)l(b.formattedValue),b.errorType;else return b.errorType==="exceed_balance",void 0},p=()=>{const f=parseFloat(i||"0"),h=parseFloat(e||"0");if(h>0){const g=f-h,b=xt(Math.max(0,g).toString());return`${xt(i||"0")} → ${b} ${t}`}return`${xt(i||"0")} ${t}`};return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-[10px] my-4",children:[P.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[P.jsx("input",{type:"text",placeholder:"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"}),P.jsx("button",{onClick:()=>{l(i||"0")},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),P.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),P.jsxs("div",{className:"flex justify-between items-center",children:[P.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),P.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:p()})]})]}),!r&&Yh(e||"0",0)&&P.jsxs("div",{className:"flex justify-center flex-col items-center",children:[P.jsxs("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:["Enable ",t," on ",o==null?void 0:o.chain]}),P.jsxs("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:["You must enable ",t," first before you can deposit on"," ",o==null?void 0:o.chain,"."]}),P.jsxs("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",onClick:c,children:["Enable ",t]})]}),P.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:P.jsxs("div",{className:"flex justify-between items-center",children:[P.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:"总资产"}),P.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?`${xt("0")} → ${xt(e)} ${t}`:`${xt("0")} ${t}`})]})})]})},rm="1.0.8";let Ie=class Ps extends Error{constructor(t,n={}){var a;const r=n.cause instanceof Ps?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details,o=n.cause instanceof Ps&&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@${rm}`].join(`
|
|
104
|
+
`);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 Xe(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Za=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ja=/^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)?$/,el=/^\(.+?\).*?$/,tl=/^tuple(?<array>(\[(\d*)\])*)$/;function Mo(e){let t=e.type;if(tl.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+=Mo(s),o<n-1&&(t+=", ")}const r=Xe(tl,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Mo({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function dn(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Mo(o),r!==n-1&&(t+=", ")}return t}function om(e){var t;return e.type==="function"?`function ${e.name}(${dn(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${dn(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${dn(e.inputs)})`:e.type==="error"?`error ${e.name}(${dn(e.inputs)})`:e.type==="constructor"?`constructor(${dn(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const nl=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function sm(e){return nl.test(e)}function im(e){return Xe(nl,e)}const rl=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function am(e){return rl.test(e)}function lm(e){return Xe(rl,e)}const ol=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function um(e){return ol.test(e)}function cm(e){return Xe(ol,e)}const sl=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function il(e){return sl.test(e)}function fm(e){return Xe(sl,e)}const al=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function dm(e){return al.test(e)}function pm(e){return Xe(al,e)}const ll=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function hm(e){return ll.test(e)}function mm(e){return Xe(ll,e)}const gm=/^receive\(\) external payable$/;function bm(e){return gm.test(e)}const ym=new Set(["indexed"]),jo=new Set(["calldata","memory","storage"]);class vm extends Ie{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 wm extends Ie{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 xm extends Ie{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Em extends Ie{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 $m extends Ie{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 Sm extends Ie{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 Cm extends Ie{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 Bt extends Ie{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Pm extends Ie{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Om extends Ie{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 Am extends Ie{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 Tm extends Ie{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 Im(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const a of o[1])s+=`[${a.type}${a.name?`:${a.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const ko=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 Mm(e,t={}){if(um(e))return jm(e,t);if(am(e))return km(e,t);if(sm(e))return Fm(e,t);if(dm(e))return Nm(e,t);if(hm(e))return Lm(e);if(bm(e))return{type:"receive",stateMutability:"payable"};throw new Pm({signature:e})}function jm(e,t={}){const n=cm(e);if(!n)throw new Bt({signature:e,type:"function"});const r=Le(n.parameters),o=[],s=r.length;for(let u=0;u<s;u++)o.push(Et(r[u],{modifiers:jo,structs:t,type:"function"}));const a=[];if(n.returns){const u=Le(n.returns),i=u.length;for(let l=0;l<i;l++)a.push(Et(u[l],{modifiers:jo,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:a}}function km(e,t={}){const n=lm(e);if(!n)throw new Bt({signature:e,type:"event"});const r=Le(n.parameters),o=[],s=r.length;for(let a=0;a<s;a++)o.push(Et(r[a],{modifiers:ym,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Fm(e,t={}){const n=im(e);if(!n)throw new Bt({signature:e,type:"error"});const r=Le(n.parameters),o=[],s=r.length;for(let a=0;a<s;a++)o.push(Et(r[a],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Nm(e,t={}){const n=pm(e);if(!n)throw new Bt({signature:e,type:"constructor"});const r=Le(n.parameters),o=[],s=r.length;for(let a=0;a<s;a++)o.push(Et(r[a],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Lm(e){const t=mm(e);if(!t)throw new Bt({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Dm=/^(?<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$_]*))?$/,_m=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Rm=/^u?int$/;function Et(e,t){var d,p;const n=Im(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(ko.has(n))return ko.get(n);const r=el.test(e),o=Xe(r?_m:Dm,e);if(!o)throw new xm({param:e});if(o.name&&Um(o.name))throw new Em({param:e,name:o.name});const s=o.name?{name:o.name}:{},a=o.modifier==="indexed"?{indexed:!0}:{},u=(t==null?void 0:t.structs)??{};let i,l={};if(r){i="tuple";const f=Le(o.type),h=[],g=f.length;for(let b=0;b<g;b++)h.push(Et(f[b],{structs:u}));l={components:h}}else if(o.type in u)i="tuple",l={components:u[o.type]};else if(Rm.test(o.type))i=`${o.type}256`;else if(i=o.type,(t==null?void 0:t.type)!=="struct"&&!ul(i))throw new wm({type:i});if(o.modifier){if(!((p=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&p.call(d,o.modifier)))throw new $m({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(jo.has(o.modifier)&&!zm(i,!!o.array))throw new Sm({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const c={type:`${i}${o.array??""}`,...s,...a,...l};return ko.set(n,c),c}function Le(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const a=e[s],u=e.slice(s+1);switch(a){case",":return r===0?Le(u,[...t,n.trim()]):Le(u,t,`${n}${a}`,r);case"(":return Le(u,t,`${n}${a}`,r+1);case")":return Le(u,t,`${n}${a}`,r-1);default:return Le(u,t,`${n}${a}`,r)}}if(n==="")return t;if(r!==0)throw new Tm({current:n,depth:r});return t.push(n.trim()),t}function ul(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Za.test(e)||Ja.test(e)}const Bm=/^(?: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 Um(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Za.test(e)||Ja.test(e)||Bm.test(e)}function zm(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Hm(e){const t={},n=e.length;for(let a=0;a<n;a++){const u=e[a];if(!il(u))continue;const i=fm(u);if(!i)throw new Bt({signature:u,type:"struct"});const l=i.properties.split(";"),c=[],d=l.length;for(let p=0;p<d;p++){const h=l[p].trim();if(!h)continue;const g=Et(h,{type:"struct"});c.push(g)}if(!c.length)throw new Om({signature:u});t[i.name]=c}const r={},o=Object.entries(t),s=o.length;for(let a=0;a<s;a++){const[u,i]=o[a];r[u]=cl(i,t)}return r}const Wm=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function cl(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const a=e[s];if(el.test(a.type))r.push(a);else{const i=Xe(Wm,a.type);if(!(i!=null&&i.type))throw new Cm({abiParameter:a});const{array:l,type:c}=i;if(c in t){if(n.has(c))throw new Am({type:c});r.push({...a,type:`tuple${l??""}`,components:cl(t[c]??[],t,new Set([...n,c]))})}else if(ul(c))r.push(a);else throw new vm({type:c})}}return r}function fl(e){const t=Hm(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];il(s)||n.push(Mm(s,t))}return n}function dl(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 ut(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new ng(e.type);return`${e.name}(${Fo(e.inputs,{includeName:t})})`}function Fo(e,{includeName:t=!1}={}){return e?e.map(n=>Vm(n,{includeName:t})).join(t?", ":","):""}function Vm(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Fo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Ut(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function pe(e){return Ut(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const pl="2.34.0";let pn={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${pl}`},k=class Os extends Error{constructor(t,n={}){var u;const r=(()=>{var i;return n.cause instanceof Os?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details})(),o=n.cause instanceof Os&&n.cause.docsPath||n.docsPath,s=(u=pn.getDocsUrl)==null?void 0:u.call(pn,{...n,docsPath:o}),a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...pn.version?[`Version: ${pn.version}`]:[]].join(`
|
|
105
|
+
`);super(a,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=pl}walk(t){return hl(this,t)}};function hl(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?hl(e.cause,t):t?null:e}class Gm extends k{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(`
|
|
106
|
+
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class ml extends k{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(`
|
|
107
|
+
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class qm extends k{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
108
|
+
`),{metaMessages:[`Params: (${Fo(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 mr extends k{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class Km extends k{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
109
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class Ym extends k{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${pe(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Xm extends k{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
110
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class Qm extends k{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(`
|
|
111
|
+
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class gl extends k{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(`
|
|
112
|
+
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class bl extends k{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(`
|
|
113
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class zt extends k{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(`
|
|
114
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class yl extends k{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(`
|
|
115
|
+
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Zm extends k{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(`
|
|
116
|
+
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class Jm extends k{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${ut(t.abiItem)}\`, and`,`\`${n.type}\` in \`${ut(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class eg extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
117
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class tg extends k{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
118
|
+
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}class vl extends k{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
119
|
+
`),{name:"InvalidArrayError"})}}class ng extends k{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
120
|
+
`),{name:"InvalidDefinitionTypeError"})}}class wl extends k{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}let xl=class extends k{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 El extends k{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 Ht(e,{dir:t,size:n=32}={}){return typeof e=="string"?ct(e,{dir:t,size:n}):rg(e,{dir:t,size:n})}function ct(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new xl({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function rg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new xl({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 $l=class extends k{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 og extends k{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 sg extends k{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function hn(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 De(e,{size:t}){if(pe(e)>t)throw new sg({givenSize:pe(e),maxSize:t})}function Sl(e,t={}){const{signed:n}=t;t.size&&De(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 ig(e,t={}){return Number(Sl(e,t))}function ag(e,t={}){let n=gr(e);return t.size&&(De(n,{size:t.size}),n=hn(n,{dir:"right"})),new TextDecoder().decode(n)}const lg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ug(e,t={}){return typeof e=="number"||typeof e=="bigint"?Z(e,t):typeof e=="string"?No(e,t):typeof e=="boolean"?Cl(e,t):Qe(e,t)}function Cl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(De(n,{size:t.size}),Ht(n,{size:t.size})):n}function Qe(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=lg[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(De(r,{size:t.size}),Ht(r,{dir:"right",size:t.size})):r}function Z(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 a=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<a){const i=typeof e=="bigint"?"n":"";throw new $l({max:s?`${s}${i}`:void 0,min:`${a}${i}`,signed:n,size:r,value:`${e}${i}`})}const u=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Ht(u,{size:r}):u}const cg=new TextEncoder;function No(e,t={}){const n=cg.encode(e);return Qe(n,t)}const fg=new TextEncoder;function Pl(e,t={}){return typeof e=="number"||typeof e=="bigint"?pg(e,t):typeof e=="boolean"?dg(e,t):Ut(e)?gr(e,t):Al(e,t)}function dg(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(De(n,{size:t.size}),Ht(n,{size:t.size})):n}const Ze={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ol(e){if(e>=Ze.zero&&e<=Ze.nine)return e-Ze.zero;if(e>=Ze.A&&e<=Ze.F)return e-(Ze.A-10);if(e>=Ze.a&&e<=Ze.f)return e-(Ze.a-10)}function gr(e,t={}){let n=e;t.size&&(De(n,{size:t.size}),n=Ht(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 a=0,u=0;a<o;a++){const i=Ol(r.charCodeAt(u++)),l=Ol(r.charCodeAt(u++));if(i===void 0||l===void 0)throw new k(`Invalid byte sequence ("${r[u-2]}${r[u-1]}" in "${r}").`);s[a]=i*16+l}return s}function pg(e,t){const n=Z(e,t);return gr(n)}function Al(e,t={}){const n=fg.encode(e);return typeof t.size=="number"?(De(n,{size:t.size}),Ht(n,{dir:"right",size:t.size})):n}const br=BigInt(2**32-1),Tl=BigInt(32);function hg(e,t=!1){return t?{h:Number(e&br),l:Number(e>>Tl&br)}:{h:Number(e>>Tl&br)|0,l:Number(e&br)|0}}function mg(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:a,l:u}=hg(e[s],t);[r[s],o[s]]=[a,u]}return[r,o]}const gg=(e,t,n)=>e<<n|t>>>32-n,bg=(e,t,n)=>t<<n|e>>>32-n,yg=(e,t,n)=>t<<n-32|e>>>64-n,vg=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function wg(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Il(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function yr(e,...t){if(!wg(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 Ml(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 xg(e,t){yr(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Eg(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function jl(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const $g=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Sg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Cg(e){for(let t=0;t<e.length;t++)e[t]=Sg(e[t]);return e}const kl=$g?e=>e:Cg;function Pg(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Fl(e){return typeof e=="string"&&(e=Pg(e)),yr(e),e}class Og{}function Ag(e){const t=r=>e().update(Fl(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const Tg=BigInt(0),mn=BigInt(1),Ig=BigInt(2),Mg=BigInt(7),jg=BigInt(256),kg=BigInt(113),Nl=[],Ll=[],Dl=[];for(let e=0,t=mn,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Nl.push(2*(5*r+n)),Ll.push((e+1)*(e+2)/2%64);let o=Tg;for(let s=0;s<7;s++)t=(t<<mn^(t>>Mg)*kg)%jg,t&Ig&&(o^=mn<<(mn<<BigInt(s))-mn);Dl.push(o)}const _l=mg(Dl,!0),Fg=_l[0],Ng=_l[1],Rl=(e,t,n)=>n>32?yg(e,t,n):gg(e,t,n),Bl=(e,t,n)=>n>32?vg(e,t,n):bg(e,t,n);function Lg(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let a=0;a<10;a++)n[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const u=(a+8)%10,i=(a+2)%10,l=n[i],c=n[i+1],d=Rl(l,c,1)^n[u],p=Bl(l,c,1)^n[u+1];for(let f=0;f<50;f+=10)e[a+f]^=d,e[a+f+1]^=p}let o=e[2],s=e[3];for(let a=0;a<24;a++){const u=Ll[a],i=Rl(o,s,u),l=Bl(o,s,u),c=Nl[a];o=e[c],s=e[c+1],e[c]=i,e[c+1]=l}for(let a=0;a<50;a+=10){for(let u=0;u<10;u++)n[u]=e[a+u];for(let u=0;u<10;u++)e[a+u]^=~n[(u+2)%10]&n[(u+4)%10]}e[0]^=Fg[r],e[1]^=Ng[r]}jl(n)}class Lo extends Og{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,Il(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Eg(this.state)}clone(){return this._cloneInto()}keccak(){kl(this.state32),Lg(this.state32,this.rounds),kl(this.state32),this.posOut=0,this.pos=0}update(t){Ml(this),t=Fl(t),yr(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const a=Math.min(n-this.pos,o-s);for(let u=0;u<a;u++)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){Ml(this,!1),yr(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 a=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+a),o),this.posOut+=a,o+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Il(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(xg(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,jl(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:a}=this;return t||(t=new Lo(n,r,o,a,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=a,t.destroyed=this.destroyed,t}}const Dg=(e,t,n)=>Ag(()=>new Lo(t,e,n)),_g=Dg(1,136,256/8);function Ul(e,t){const n=t||"hex",r=_g(Ut(e,{strict:!1})?Pl(e):e);return n==="bytes"?r:ug(r)}const Rg=e=>Ul(Pl(e));function Bg(e){return Rg(e)}function Ug(e){let t=!0,n="",r=0,o="",s=!1;for(let a=0;a<e.length;a++){const u=e[a];if(["(",")",","].includes(u)&&(t=!0),u==="("&&r++,u===")"&&r--,!!t){if(r===0){if(u===" "&&["event","function",""].includes(o))o="";else if(o+=u,u===")"){s=!0;break}continue}if(u===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=u,n+=u}}if(!s)throw new k("Unable to normalize signature.");return o}const zg=e=>{const t=typeof e=="string"?e:om(e);return Ug(t)};function zl(e){return Bg(zg(e))}const Hg=zl;class $t extends k{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"})}}class Do 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 _o=new Do(8192);function Ro(e,t){if(_o.has(`${e}.${t}`))return _o.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ul(Al(n),"bytes"),o=n.split("");for(let a=0;a<40;a+=2)r[a>>1]>>4>=8&&o[a]&&(o[a]=o[a].toUpperCase()),(r[a>>1]&15)>=8&&o[a+1]&&(o[a+1]=o[a+1].toUpperCase());const s=`0x${o.join("")}`;return _o.set(`${e}.${t}`,s),s}function ft(e,t){if(!We(e,{strict:!1}))throw new $t({address:e});return Ro(e,t)}const Wg=/^0x[a-fA-F0-9]{40}$/,Bo=new Do(8192);function We(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Bo.has(r))return Bo.get(r);const o=Wg.test(e)?e.toLowerCase()===e?!0:n?Ro(e)===e:!0:!1;return Bo.set(r,o),o}function St(e){return typeof e[0]=="string"?vr(e):Vg(e)}function Vg(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 vr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Wt(e,t,n,{strict:r}={}){return Ut(e,{strict:!1})?Gg(e,t,n,{strict:r}):Vl(e,t,n,{strict:r})}function Hl(e,t){if(typeof t=="number"&&t>0&&t>pe(e)-1)throw new wl({offset:t,position:"start",size:pe(e)})}function Wl(e,t,n){if(typeof t=="number"&&typeof n=="number"&&pe(e)!==n-t)throw new wl({offset:n,position:"end",size:pe(e)})}function Vl(e,t,n,{strict:r}={}){Hl(e,t);const o=e.slice(t,n);return r&&Wl(o,t,n),o}function Gg(e,t,n,{strict:r}={}){Hl(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Wl(o,t,n),o}const qg=/^(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 gn(e,t){if(e.length!==t.length)throw new Xm({expectedLength:e.length,givenLength:t.length});const n=Kg({params:e,values:t}),r=zo(n);return r.length===0?"0x":r}function Kg({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Uo({param:e[r],value:t[r]}));return n}function Uo({param:e,value:t}){const n=Ho(e.type);if(n){const[r,o]=n;return Xg(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return t0(t,{param:e});if(e.type==="address")return Yg(t);if(e.type==="bool")return Zg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=qg.exec(e.type)??[];return Jg(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return Qg(t,{param:e});if(e.type==="string")return e0(t);throw new eg(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function zo(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:a,encoded:u}=e[s];a?t+=32:t+=pe(u)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:a,encoded:u}=e[s];a?(n.push(Z(t+o,{size:32})),r.push(u),o+=pe(u)):n.push(u)}return St([...n,...r])}function Yg(e){if(!We(e))throw new $t({address:e});return{dynamic:!1,encoded:ct(e.toLowerCase())}}function Xg(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new vl(e);if(!r&&e.length!==t)throw new Km({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let a=0;a<e.length;a++){const u=Uo({param:n,value:e[a]});u.dynamic&&(o=!0),s.push(u)}if(r||o){const a=zo(s);if(r){const u=Z(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?St([u,a]):u}}if(o)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:St(s.map(({encoded:a})=>a))}}function Qg(e,{param:t}){const[,n]=t.type.split("bytes"),r=pe(e);if(!n){let o=e;return r%32!==0&&(o=ct(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:St([ct(Z(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new Ym({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:ct(e,{dir:"right"})}}function Zg(e){if(typeof e!="boolean")throw new k(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:ct(Cl(e))}}function Jg(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 $l({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Z(e,{size:32,signed:t})}}function e0(e){const t=No(e),n=Math.ceil(pe(t)/32),r=[];for(let o=0;o<n;o++)r.push(ct(Wt(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:St([ct(Z(pe(t),{size:32})),...r])}}function t0(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],a=Array.isArray(e)?o:s.name,u=Uo({param:s,value:e[a]});r.push(u),u.dynamic&&(n=!0)}return{dynamic:n,encoded:n?zo(r):St(r.map(({encoded:o})=>o))}}function Ho(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const bn=e=>Wt(zl(e),0,4);function yn(e){const{abi:t,args:n=[],name:r}=e,o=Ut(r,{strict:!1}),s=t.filter(u=>o?u.type==="function"?bn(u)===r:u.type==="event"?Hg(u)===r:!1:"name"in u&&u.name===r);if(s.length===0)return;if(s.length===1)return s[0];let a;for(const u of s){if(!("inputs"in u))continue;if(!n||n.length===0){if(!u.inputs||u.inputs.length===0)return u;continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==n.length)continue;if(n.every((l,c)=>{const d="inputs"in u&&u.inputs[c];return d?Wo(l,d):!1})){if(a&&"inputs"in a&&a.inputs){const l=Gl(u.inputs,a.inputs,n);if(l)throw new Jm({abiItem:u,type:l[0]},{abiItem:a,type:l[1]})}a=u}}return a||s[0]}function Wo(e,t){const n=typeof e,r=t.type;switch(r){case"address":return We(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)=>Wo(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=>Wo(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Gl(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 Gl(o.components,s.components,n[r]);const a=[o.type,s.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?We(n[r],{strict:!1}):a.includes("address")&&a.includes("bytes")?We(n[r],{strict:!1}):!1)return a}}function wr(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const ql="/docs/contract/encodeFunctionData";function n0(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=yn({abi:t,args:n,name:r});if(!s)throw new zt(r,{docsPath:ql});o=s}if(o.type!=="function")throw new zt(void 0,{docsPath:ql});return{abi:[o],functionName:bn(ut(o))}}function Vo(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var u;return e.abi.length===1&&((u=e.functionName)!=null&&u.startsWith("0x"))?e:n0(e)})(),o=n[0],s=r,a="inputs"in o&&o.inputs?gn(o.inputs,t??[]):void 0;return vr([s,a??"0x"])}const r0={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."},Kl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},o0={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Yl extends k{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class s0 extends k{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class i0 extends k{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const a0={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 i0({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new s0({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Yl({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 Yl({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 l0(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(a0);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function u0(e,t={}){typeof t.size<"u"&&De(e,{size:t.size});const n=Qe(e,t);return Sl(n,t)}function c0(e,t={}){let n=e;if(typeof t.size<"u"&&(De(n,{size:t.size}),n=hn(n)),n.length>1||n[0]>1)throw new og(n);return!!n[0]}function Je(e,t={}){typeof t.size<"u"&&De(e,{size:t.size});const n=Qe(e,t);return ig(n,t)}function f0(e,t={}){let n=e;return typeof t.size<"u"&&(De(n,{size:t.size}),n=hn(n,{dir:"right"})),new TextDecoder().decode(n)}function Go(e,t){const n=typeof t=="string"?gr(t):t,r=l0(n);if(pe(n)===0&&e.length>0)throw new mr;if(pe(t)&&pe(t)<32)throw new qm({data:typeof t=="string"?t:Qe(t),params:e,size:pe(t)});let o=0;const s=[];for(let a=0;a<e.length;++a){const u=e[a];r.setPosition(o);const[i,l]=Vt(r,u,{staticPosition:0});o+=l,s.push(i)}return s}function Vt(e,t,{staticPosition:n}){const r=Ho(t.type);if(r){const[o,s]=r;return p0(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return b0(e,t,{staticPosition:n});if(t.type==="address")return d0(e);if(t.type==="bool")return h0(e);if(t.type.startsWith("bytes"))return m0(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return g0(e,t);if(t.type==="string")return y0(e,{staticPosition:n});throw new tg(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Xl=32,qo=32;function d0(e){const t=e.readBytes(32);return[Ro(Qe(Vl(t,-20))),32]}function p0(e,t,{length:n,staticPosition:r}){if(!n){const a=Je(e.readBytes(qo)),u=r+a,i=u+Xl;e.setPosition(u);const l=Je(e.readBytes(Xl)),c=vn(t);let d=0;const p=[];for(let f=0;f<l;++f){e.setPosition(i+(c?f*32:d));const[h,g]=Vt(e,t,{staticPosition:i});d+=g,p.push(h)}return e.setPosition(r+32),[p,32]}if(vn(t)){const a=Je(e.readBytes(qo)),u=r+a,i=[];for(let l=0;l<n;++l){e.setPosition(u+l*32);const[c]=Vt(e,t,{staticPosition:u});i.push(c)}return e.setPosition(r+32),[i,32]}let o=0;const s=[];for(let a=0;a<n;++a){const[u,i]=Vt(e,t,{staticPosition:r+o});o+=i,s.push(u)}return[s,o]}function h0(e){return[c0(e.readBytes(32),{size:32}),32]}function m0(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const a=Je(e.readBytes(32));e.setPosition(n+a);const u=Je(e.readBytes(32));if(u===0)return e.setPosition(n+32),["0x",32];const i=e.readBytes(u);return e.setPosition(n+32),[Qe(i),32]}return[Qe(e.readBytes(Number.parseInt(o),32)),32]}function g0(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?u0(o,{signed:n}):Je(o,{signed:n}),32]}function b0(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:a})=>!a),o=r?[]:{};let s=0;if(vn(t)){const a=Je(e.readBytes(qo)),u=n+a;for(let i=0;i<t.components.length;++i){const l=t.components[i];e.setPosition(u+s);const[c,d]=Vt(e,l,{staticPosition:u});s+=d,o[r?i:l==null?void 0:l.name]=c}return e.setPosition(n+32),[o,32]}for(let a=0;a<t.components.length;++a){const u=t.components[a],[i,l]=Vt(e,u,{staticPosition:n});o[r?a:u==null?void 0:u.name]=i,s+=l}return[o,s]}function y0(e,{staticPosition:t}){const n=Je(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Je(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),a=f0(hn(s));return e.setPosition(t+32),[a,32]}function vn(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(vn);const n=Ho(e.type);return!!(n&&vn({...e,type:n[1]}))}function Ql(e){const{abi:t,data:n}=e,r=Wt(n,0,4);if(r==="0x")throw new mr;const s=[...t||[],Kl,o0].find(a=>a.type==="error"&&r===bn(ut(a)));if(!s)throw new bl(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Go(s.inputs,Wt(n,4)):void 0,errorName:s.name}}const Ve=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Zl({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"?Ve(t[s]):t[s]}`).join(", ")})`}const v0={gwei:9,wei:18},w0={ether:-9,wei:9},x0={ether:-18,gwei:-9};function xr(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 E0(e,t="wei"){return xr(e,v0[t])}function Ct(e,t="wei"){return xr(e,w0[t])}class $0 extends k{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class S0 extends k{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Jl(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
121
|
+
`,"")}function C0(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
|
|
122
|
+
`;return r.nonce&&(o+=` nonce: ${r.nonce}
|
|
123
|
+
`),r.balance&&(o+=` balance: ${r.balance}
|
|
124
|
+
`),r.code&&(o+=` code: ${r.code}
|
|
125
|
+
`),r.state&&(o+=` state:
|
|
126
|
+
`,o+=Jl(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
127
|
+
`,o+=Jl(r.stateDiff)),o},` State Override:
|
|
128
|
+
`).slice(0,-1)}function eu(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(`
|
|
129
|
+
`)}class P0 extends k{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
130
|
+
`),{name:"FeeConflictError"})}}const O0=e=>e,wn=e=>e;class A0 extends k{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:a,gasPrice:u,maxFeePerGas:i,maxPriorityFeePerGas:l,nonce:c,to:d,value:p,stateOverride:f}){var b;const h=n?wr(n):void 0;let g=eu({from:h==null?void 0:h.address,to:d,value:typeof p<"u"&&`${E0(p)} ${((b=o==null?void 0:o.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:s,gas:a,gasPrice:typeof u<"u"&&`${Ct(u)} gwei`,maxFeePerGas:typeof i<"u"&&`${Ct(i)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ct(l)} gwei`,nonce:c});f&&(g+=`
|
|
131
|
+
${C0(f)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",g].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class tu extends k{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:a,sender:u}){const i=yn({abi:n,args:r,name:a}),l=i?Zl({abiItem:i,args:r,includeFunctionName:!1,includeName:!1}):void 0,c=i?ut(i,{includeName:!0}):void 0,d=eu({address:o&&O0(o),function:c,args:l&&l!=="()"&&`${[...Array((a==null?void 0:a.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:u});super(t.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].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=a,this.sender=u}}class T0 extends k{constructor({abi:t,data:n,functionName:r,message:o}){let s,a,u,i;if(n&&n!=="0x")try{a=Ql({abi:t,data:n});const{abiItem:c,errorName:d,args:p}=a;if(d==="Error")i=p[0];else if(d==="Panic"){const[f]=p;i=r0[f]}else{const f=c?ut(c,{includeName:!0}):void 0,h=c&&p?Zl({abiItem:c,args:p,includeFunctionName:!1,includeName:!1}):void 0;u=[f?`Error: ${f}`:"",h&&h!=="()"?` ${[...Array((d==null?void 0:d.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(c){s=c}else o&&(i=o);let l;s instanceof bl&&(l=s.signature,u=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(i&&i!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,i||l].join(`
|
|
132
|
+
`):`The contract function "${r}" reverted.`,{cause:s,metaMessages:u,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=a,this.raw=n,this.reason=i,this.signature=l}}class I0 extends k{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 M0 extends k{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Ko extends k{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 Pt extends k{constructor({body:t,cause:n,details:r,headers:o,status:s,url:a}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${wn(a)}`,t&&`Request body: ${Ve(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=a}}class Yo extends k{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${wn(r)}`,`Request body: ${Ve(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 nu extends k{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${wn(n)}`,`Request body: ${Ve(t)}`],name:"TimeoutError"})}}const j0=-1;class we extends k{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:a}){super(a,{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 Yo?t.code:n??j0}}class Se extends we{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class xn extends we{constructor(t){super(t,{code:xn.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(xn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class En extends we{constructor(t){super(t,{code:En.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(En,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class $n extends we{constructor(t,{method:n}={}){super(t,{code:$n.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty($n,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Sn extends we{constructor(t){super(t,{code:Sn.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
133
|
+
`)})}}Object.defineProperty(Sn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ot extends we{constructor(t){super(t,{code:Ot.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Cn extends we{constructor(t){super(t,{code:Cn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
134
|
+
`)})}}Object.defineProperty(Cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Pn extends we{constructor(t){super(t,{code:Pn.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Pn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class dt extends we{constructor(t){super(t,{code:dt.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(dt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class On extends we{constructor(t){super(t,{code:On.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class At extends we{constructor(t,{method:n}={}){super(t,{code:At.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(At,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Gt extends we{constructor(t){super(t,{code:Gt.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class An extends we{constructor(t){super(t,{code:An.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(An,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class ge extends Se{constructor(t){super(t,{code:ge.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Tn extends Se{constructor(t){super(t,{code:Tn.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Tn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class In extends Se{constructor(t,{method:n}={}){super(t,{code:In.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Mn extends Se{constructor(t){super(t,{code:Mn.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class jn extends Se{constructor(t){super(t,{code:jn.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Tt extends Se{constructor(t){super(t,{code:Tt.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Tt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class kn extends Se{constructor(t){super(t,{code:kn.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Fn extends Se{constructor(t){super(t,{code:Fn.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Nn extends Se{constructor(t){super(t,{code:Nn.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Ln extends Se{constructor(t){super(t,{code:Ln.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Dn extends Se{constructor(t){super(t,{code:Dn.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Dn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class _n extends Se{constructor(t){super(t,{code:_n.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(_n,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Rn extends Se{constructor(t){super(t,{code:Rn.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class k0 extends we{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const F0=3;function Xo(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:a}){const u=e instanceof Ko?e:e instanceof k?e.walk(h=>"data"in h)||e.walk():{},{code:i,data:l,details:c,message:d,shortMessage:p}=u,f=e instanceof mr?new I0({functionName:s}):[F0,Ot.code].includes(i)&&(l||c||d||p)?new T0({abi:t,data:typeof l=="object"?l.data:l,functionName:s,message:u instanceof Yo?c:p??d}):e;return new tu(f,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:a})}class qt extends k{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(qt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(qt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Er extends k{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ct(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Er,"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 Qo extends k{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ct(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Qo,"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 Zo extends k{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(Zo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Jo extends k{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(`
|
|
135
|
+
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Jo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class es extends k{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(es,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class ts extends k{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
136
|
+
`),{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(ts,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class ns extends k{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(ns,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class rs extends k{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(rs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class os extends k{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(os,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class $r extends k{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Ct(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Ct(r)} gwei`:""}).`].join(`
|
|
137
|
+
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty($r,"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 ru extends k{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function N0(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof k?e.walk(o=>(o==null?void 0:o.code)===qt.code):e;return r instanceof k?new qt({cause:e,message:r.details}):qt.nodeMessage.test(n)?new qt({cause:e,message:e.details}):Er.nodeMessage.test(n)?new Er({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Qo.nodeMessage.test(n)?new Qo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Zo.nodeMessage.test(n)?new Zo({cause:e,nonce:t==null?void 0:t.nonce}):Jo.nodeMessage.test(n)?new Jo({cause:e,nonce:t==null?void 0:t.nonce}):es.nodeMessage.test(n)?new es({cause:e,nonce:t==null?void 0:t.nonce}):ts.nodeMessage.test(n)?new ts({cause:e}):ns.nodeMessage.test(n)?new ns({cause:e,gas:t==null?void 0:t.gas}):rs.nodeMessage.test(n)?new rs({cause:e,gas:t==null?void 0:t.gas}):os.nodeMessage.test(n)?new os({cause:e}):$r.nodeMessage.test(n)?new $r({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new ru({cause:e})}function L0(e,{format:t}){if(!t)return{};const n={};function r(s){const a=Object.keys(s);for(const u of a)u in e&&(n[u]=e[u]),s[u]&&typeof s[u]=="object"&&!Array.isArray(s[u])&&r(s[u])}const o=t(e||{});return r(o),n}const D0={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function _0(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=R0(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=>Qe(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=Z(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=Z(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=Z(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=Z(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=Z(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=Z(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=D0[e.type]),typeof e.value<"u"&&(t.value=Z(e.value)),t}function R0(e){return e.map(t=>({address:t.address,r:t.r?Z(BigInt(t.r)):t.r,s:t.s?Z(BigInt(t.s)):t.s,chainId:Z(t.chainId),nonce:Z(t.nonce),...typeof t.yParity<"u"?{yParity:Z(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Z(t.v)}:{}}))}function ou(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new El({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new El({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function B0(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,a={};if(s!==void 0&&(a.code=s),t!==void 0&&(a.balance=Z(t)),n!==void 0&&(a.nonce=Z(n)),r!==void 0&&(a.state=ou(r)),o!==void 0){if(a.state)throw new S0;a.stateDiff=ou(o)}return a}function U0(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!We(n,{strict:!1}))throw new $t({address:n});if(t[n])throw new $0({address:n});t[n]=B0(r)}return t}const z0=2n**256n-1n;function H0(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,a=t?wr(t):void 0;if(a&&!We(a.address))throw new $t({address:a.address});if(s&&!We(s))throw new $t({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new P0;if(r&&r>z0)throw new Er({maxFeePerGas:r});if(o&&r&&o>r)throw new $r({maxFeePerGas:r,maxPriorityFeePerGas:o})}async function W0(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?Z(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}function V0(e,t){if(!We(e,{strict:!1}))throw new $t({address:e});if(!We(t,{strict:!1}))throw new $t({address:t});return e.toLowerCase()===t.toLowerCase()}const ss="/docs/contract/decodeFunctionResult";function is(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const u=yn({abi:t,args:n,name:r});if(!u)throw new zt(r,{docsPath:ss});s=u}if(s.type!=="function")throw new zt(void 0,{docsPath:ss});if(!s.outputs)throw new yl(s.name,{docsPath:ss});const a=Go(s.outputs,o);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}const G0="0.1.1";function q0(){return G0}let su=class As extends Error{constructor(t,n={}){const r=(()=>{var i;if(n.cause instanceof As){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:(i=n.cause)!=null&&i.message?n.cause.message:n.details})(),o=n.cause instanceof As&&n.cause.docsPath||n.docsPath,a=`https://oxlib.sh${o??""}`,u=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${a}`:void 0]:[]].filter(i=>typeof i=="string").join(`
|
|
138
|
+
`);super(u,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@${q0()}`}),this.cause=n.cause,this.details=r,this.docs=a,this.docsPath=o,this.shortMessage=t}walk(t){return iu(this,t)}};function iu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?iu(e.cause,t):t?null:e}function K0(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 Q0({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}function et(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 a=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<a){const l=typeof e=="bigint"?"n":"";throw new X0({max:s?`${s}${l}`:void 0,min:`${a}${l}`,signed:n,size:r,value:`${e}${l}`})}const i=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Y0(i,r):i}function Y0(e,t){return K0(e,{dir:"left",size:t})}class X0 extends su{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 Q0 extends su{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 Z0(e){return{address:e.address,amount:et(e.amount),index:et(e.index),validatorIndex:et(e.validatorIndex)}}function J0(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:et(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:et(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:et(e.gasLimit)},...typeof e.number=="bigint"&&{number:et(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:et(e.prevRandao)},...typeof e.time=="bigint"&&{time:et(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Z0)}}}const as=[{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"}],ls=[{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"}]}],au=[{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"}]}],eb="0x82ad56cb",tb="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",nb="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";class us extends k{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 lu extends k{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const cs="/docs/contract/encodeDeployData";function uu(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(a=>"type"in a&&a.type==="constructor");if(!o)throw new Gm({docsPath:cs});if(!("inputs"in o))throw new ml({docsPath:cs});if(!o.inputs||o.inputs.length===0)throw new ml({docsPath:cs});const s=gn(o.inputs,n);return vr([r,s])}function cu({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 us({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new us({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function rb(e,{docsPath:t,...n}){const r=(()=>{const o=N0(e,n);return o instanceof ru?e:o})();return new A0(r,{docsPath:t,...n})}function ob(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const fs=new Map;function fu({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const c=i();a();const d=c.map(({args:p})=>p);d.length!==0&&e(d).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let f=0;f<c.length;f++){const{resolve:h}=c[f];h==null||h([p[f],p])}}).catch(p=>{for(let f=0;f<c.length;f++){const{reject:h}=c[f];h==null||h(p)}})},a=()=>fs.delete(t),u=()=>i().map(({args:c})=>c),i=()=>fs.get(t)||[],l=c=>fs.set(t,[...i(),c]);return{flush:a,async schedule(c){const{promise:d,resolve:p,reject:f}=ob();return(n==null?void 0:n([...u(),c]))&&s(),i().length>0?(l({args:c,resolve:p,reject:f}),d):(l({args:c,resolve:p,reject:f}),setTimeout(s,r),d)}}}async function du(e,t){var D,L,R,B;const{account:n=e.account,authorizationList:r,batch:o=!!((D=e.batch)!=null&&D.multicall),blockNumber:s,blockTag:a=e.experimental_blockTag??"latest",accessList:u,blobs:i,blockOverrides:l,code:c,data:d,factory:p,factoryData:f,gas:h,gasPrice:g,maxFeePerBlobGas:b,maxFeePerGas:$,maxPriorityFeePerGas:x,nonce:v,to:E,value:y,stateOverride:C,...S}=t,A=n?wr(n):void 0;if(c&&(p||f))throw new k("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(c&&E)throw new k("Cannot provide both `code` & `to` as parameters.");const j=c&&d,I=p&&f&&E&&d,M=j||I,W=j?ab({code:c,data:d}):I?lb({data:d,factory:p,factoryData:f,to:E}):d;try{H0(t);const O=(typeof s=="bigint"?Z(s):void 0)||a,_=l?J0(l):void 0,V=U0(C),ce=(B=(R=(L=e.chain)==null?void 0:L.formatters)==null?void 0:R.transactionRequest)==null?void 0:B.format,X=(ce||_0)({...L0(S,{format:ce}),from:A==null?void 0:A.address,accessList:u,authorizationList:r,blobs:i,data:W,gas:h,gasPrice:g,maxFeePerBlobGas:b,maxFeePerGas:$,maxPriorityFeePerGas:x,nonce:v,to:M?void 0:E,value:y});if(o&&sb({request:X})&&!V&&!_)try{return await ib(e,{...X,blockNumber:s,blockTag:a})}catch(he){if(!(he instanceof lu)&&!(he instanceof us))throw he}const tt=(()=>{const he=[X,O];return V&&_?[...he,V,_]:V?[...he,V]:_?[...he,{},_]:he})(),Me=await e.request({method:"eth_call",params:tt});return Me==="0x"?{data:void 0}:{data:Me}}catch(z){const O=ub(z),{offchainLookup:_,offchainLookupSignature:V}=await Promise.resolve().then(()=>Ob);if(e.ccipRead!==!1&&(O==null?void 0:O.slice(0,10))===V&&E)return{data:await _(e,{data:O,to:E})};throw M&&(O==null?void 0:O.slice(0,10))==="0x101bb98d"?new M0({factory:p}):rb(z,{...t,account:A,chain:e.chain})}}function sb({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(eb)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function ib(e,t){var g;const{batchSize:n=1024,wait:r=0}=typeof((g=e.batch)==null?void 0:g.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:a,multicallAddress:u,to:i}=t;let l=u;if(!l){if(!e.chain)throw new lu;l=cu({blockNumber:o,chain:e.chain,contract:"multicall3"})}const d=(typeof o=="bigint"?Z(o):void 0)||s,{schedule:p}=fu({id:`${e.uid}.${d}`,wait:r,shouldSplitBatch(b){return b.reduce((x,{data:v})=>x+(v.length-2),0)>n*2},fn:async b=>{const $=b.map(E=>({allowFailure:!0,callData:E.data,target:E.to})),x=Vo({abi:as,args:[$],functionName:"aggregate3"}),v=await e.request({method:"eth_call",params:[{data:x,to:l},d]});return is({abi:as,args:[$],functionName:"aggregate3",data:v||"0x"})}}),[{returnData:f,success:h}]=await p({data:a,to:i});if(!h)throw new Ko({data:f});return f==="0x"?{data:void 0}:{data:f}}function ab(e){const{code:t,data:n}=e;return uu({abi:fl(["constructor(bytes, bytes)"]),bytecode:tb,args:[t,n]})}function lb(e){const{data:t,factory:n,factoryData:r,to:o}=e;return uu({abi:fl(["constructor(address, bytes, address, bytes)"]),bytecode:nb,args:[o,t,n,r]})}function ub(e){var n;if(!(e instanceof k))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 pu(e,t){const{abi:n,address:r,args:o,functionName:s,...a}=t,u=Vo({abi:n,args:o,functionName:s});try{const{data:i}=await dl(e,du,"call")({...a,data:u,to:r});return is({abi:n,args:o,functionName:s,data:i||"0x"})}catch(i){throw Xo(i,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function cb(e){return new Promise(t=>setTimeout(t,e))}function hu(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const a=async({count:u=0}={})=>{const i=async({error:l})=>{const c=typeof t=="function"?t({count:u,error:l}):t;c&&await cb(c),a({count:u+1})};try{const l=await e();o(l)}catch(l){if(u<n&&await r({count:u,error:l}))return i({error:l});s(l)}};a()})}const ds=256;let Sr=ds,Cr;function mu(e=11){if(!Cr||Sr+e>ds*2){Cr="",Sr=0;for(let t=0;t<ds;t++)Cr+=(256+Math.random()*256|0).toString(16).substring(1)}return Cr.substring(Sr,Sr+++e)}function gu(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:a="base"}=e,u=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),i=(n==null?void 0:n.blockTime)??12e3,l=Math.min(Math.max(Math.floor(i/2),500),4e3),c=e.pollingInterval??l,d=e.cacheTime??c,p=e.account?wr(e.account):void 0,{config:f,request:h,value:g}=e.transport({chain:n,pollingInterval:c}),b={...f,...g},$={account:p,batch:t,cacheTime:d,ccipRead:r,chain:n,key:o,name:s,pollingInterval:c,request:h,transport:b,type:a,uid:mu(),...u?{experimental_blockTag:u}:{}};function x(v){return E=>{const y=E(v);for(const S in $)delete y[S];const C={...v,...y};return Object.assign(C,{extend:x(C)})}}return Object.assign($,{extend:x($)})}const Pr=new Do(8192);function fb(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Pr.get(n))return Pr.get(n);const r=e().finally(()=>Pr.delete(n));return Pr.set(n,r),r}function db(e,t={}){return async(n,r={})=>{var d;const{dedupe:o=!1,methods:s,retryDelay:a=150,retryCount:u=3,uid:i}={...t,...r},{method:l}=n;if((d=s==null?void 0:s.exclude)!=null&&d.includes(l))throw new At(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new At(new Error("method not supported"),{method:l});const c=o?No(`${i}.${Ve(n)}`):void 0;return fb(()=>hu(async()=>{try{return await e(n)}catch(p){const f=p;switch(f.code){case xn.code:throw new xn(f);case En.code:throw new En(f);case $n.code:throw new $n(f,{method:n.method});case Sn.code:throw new Sn(f);case Ot.code:throw new Ot(f);case Cn.code:throw new Cn(f);case Pn.code:throw new Pn(f);case dt.code:throw new dt(f);case On.code:throw new On(f);case At.code:throw new At(f,{method:n.method});case Gt.code:throw new Gt(f);case An.code:throw new An(f);case ge.code:throw new ge(f);case Tn.code:throw new Tn(f);case In.code:throw new In(f);case Mn.code:throw new Mn(f);case jn.code:throw new jn(f);case Tt.code:throw new Tt(f);case kn.code:throw new kn(f);case Fn.code:throw new Fn(f);case Nn.code:throw new Nn(f);case Ln.code:throw new Ln(f);case Dn.code:throw new Dn(f);case _n.code:throw new _n(f);case Rn.code:throw new Rn(f);case 5e3:throw new ge(f);default:throw p instanceof k?p:new k0(f)}}},{delay:({count:p,error:f})=>{var h;if(f&&f instanceof Pt){const g=(h=f==null?void 0:f.headers)==null?void 0:h.get("Retry-After");if(g!=null&&g.match(/\d/))return Number.parseInt(g)*1e3}return~~(1<<p)*a},retryCount:u,shouldRetry:({error:p})=>pb(p)}),{enabled:o,id:c})}}function pb(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Gt.code||e.code===Ot.code:e instanceof Pt&&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 hb({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:a,type:u},i){const l=mu();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:a,type:u},request:db(r,{methods:t,retryCount:o,retryDelay:s,uid:l}),value:i}}class mb extends k{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 bu(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let a;try{const u=new AbortController;n>0&&(a=setTimeout(()=>{r?u.abort():s(t)},n)),o(await e({signal:(u==null?void 0:u.signal)||null}))}catch(u){(u==null?void 0:u.name)==="AbortError"&&s(t),s(u)}finally{clearTimeout(a)}})()})}function gb(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const yu=gb();function bb(e,t={}){return{async request(n){var d;const{body:r,onRequest:o=t.onRequest,onResponse:s=t.onResponse,timeout:a=t.timeout??1e4}=n,u={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:i,method:l,signal:c}=u;try{const p=await bu(async({signal:h})=>{const g={...u,body:Array.isArray(r)?Ve(r.map(v=>({jsonrpc:"2.0",id:v.id??yu.take(),...v}))):Ve({jsonrpc:"2.0",id:r.id??yu.take(),...r}),headers:{"Content-Type":"application/json",...i},method:l||"POST",signal:c||(a>0?h:null)},b=new Request(e,g),$=await(o==null?void 0:o(b,g))??{...g,url:e};return await fetch($.url??e,$)},{errorInstance:new nu({body:r,url:e}),timeout:a,signal:!0});s&&await s(p);let f;if((d=p.headers.get("Content-Type"))!=null&&d.startsWith("application/json"))f=await p.json();else{f=await p.text();try{f=JSON.parse(f||"{}")}catch(h){if(p.ok)throw h;f={error:f}}}if(!p.ok)throw new Pt({body:r,details:Ve(f.error)||p.statusText,headers:p.headers,status:p.status,url:e});return f}catch(p){throw p instanceof Pt||p instanceof nu?p:new Pt({body:r,cause:p,url:e})}}}}function yb(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:a="HTTP JSON-RPC",onFetchRequest:u,onFetchResponse:i,retryDelay:l,raw:c}=t;return({chain:d,retryCount:p,timeout:f})=>{const{batchSize:h=1e3,wait:g=0}=typeof n=="object"?n:{},b=t.retryCount??p,$=f??t.timeout??1e4,x=e||(d==null?void 0:d.rpcUrls.default.http[0]);if(!x)throw new mb;const v=bb(x,{fetchOptions:r,onRequest:u,onResponse:i,timeout:$});return hb({key:o,methods:s,name:a,async request({method:E,params:y}){const C={method:E,params:y},{schedule:S}=fu({id:x,wait:g,shouldSplitBatch(M){return M.length>h},fn:M=>v.request({body:M}),sort:(M,W)=>M.id-W.id}),A=async M=>n?S(M):[await v.request({body:M})],[{error:j,result:I}]=await A(C);if(c)return{error:j,result:I};if(j)throw new Yo({body:C,error:j,url:x});return I},retryCount:b,retryDelay:l,timeout:$,type:"http"},{fetchOptions:r,url:x})}}function vb(e){const{abi:t,data:n}=e,r=Wt(n,0,4),o=t.find(s=>s.type==="function"&&r===bn(ut(s)));if(!o)throw new Zm(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Go(o.inputs,Wt(n,4)):void 0}}const ps="/docs/contract/encodeErrorResult";function vu(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const i=yn({abi:t,args:r,name:n});if(!i)throw new gl(n,{docsPath:ps});o=i}if(o.type!=="error")throw new gl(void 0,{docsPath:ps});const s=ut(o),a=bn(s);let u="0x";if(r&&r.length>0){if(!o.inputs)throw new Qm(o.name,{docsPath:ps});u=gn(o.inputs,r)}return vr([a,u])}const hs="/docs/contract/encodeFunctionResult";function wb(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const a=yn({abi:t,name:n});if(!a)throw new zt(n,{docsPath:hs});o=a}if(o.type!=="function")throw new zt(void 0,{docsPath:hs});if(!o.outputs)throw new yl(o.name,{docsPath:hs});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new vl(r)})();return gn(o.outputs,s)}const wu="x-batch-gateway:true";async function xu(e){const{data:t,ccipRequest:n}=e,{args:[r]}=vb({abi:ls,data:t}),o=[],s=[];return await Promise.all(r.map(async(a,u)=>{try{s[u]=a.urls.includes(wu)?await xu({data:a.data,ccipRequest:n}):await n(a),o[u]=!1}catch(i){o[u]=!0,s[u]=xb(i)}})),wb({abi:ls,functionName:"query",result:[o,s]})}function xb(e){return e.name==="HttpRequestError"&&e.status?vu({abi:ls,errorName:"HttpError",args:[e.status,e.shortMessage]}):vu({abi:[Kl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}class Eb extends k{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:a}){var u;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(u=n.metaMessages)!=null&&u.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(i=>` ${wn(i)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class $b extends k{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${wn(n)}`,`Response: ${Ve(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Sb extends k{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 Cb="0x556f1830",Eu={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 Pb(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Ql({data:r,abi:[Eu]}),[a,u,i,l,c]=s,{ccipRead:d}=e,p=d&&typeof(d==null?void 0:d.request)=="function"?d.request:$u;try{if(!V0(o,a))throw new Sb({sender:a,to:o});const f=u.includes(wu)?await xu({data:i,ccipRequest:p}):await p({data:i,sender:a,urls:u}),{data:h}=await du(e,{blockNumber:t,blockTag:n,data:St([l,gn([{type:"bytes"},{type:"bytes"}],[f,c])]),to:o});return h}catch(f){throw new Eb({callbackSelector:l,cause:f,data:r,extraData:c,sender:a,urls:u})}}async function $u({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 a=n[s],u=a.includes("{data}")?"GET":"POST",i=u==="POST"?{data:e,sender:t}:void 0,l=u==="POST"?{"Content-Type":"application/json"}:{};try{const c=await fetch(a.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(i),headers:l,method:u});let d;if((o=c.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?d=(await c.json()).data:d=await c.text(),!c.ok){r=new Pt({body:i,details:d!=null&&d.error?Ve(d.error):c.statusText,headers:c.headers,status:c.status,url:a});continue}if(!Ut(d)){r=new $b({result:d,url:a});continue}return d}catch(c){r=new Pt({body:i,details:c.message,url:a})}}throw r}const Ob=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:$u,offchainLookup:Pb,offchainLookupAbiItem:Eu,offchainLookupSignature:Cb},Symbol.toStringTag,{value:"Module"}));async function Ab(e,t){var $;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:a,multicallAddress:u,stateOverride:i}=t,l=t.contracts,c=o??(typeof(($=e.batch)==null?void 0:$.multicall)=="object"&&e.batch.multicall.batchSize||1024);let d=u;if(!d){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");d=cu({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let f=0,h=0;for(let x=0;x<l.length;x++){const{abi:v,address:E,args:y,functionName:C}=l[x];try{const S=Vo({abi:v,args:y,functionName:C});h+=(S.length-2)/2,c>0&&h>c&&p[f].length>0&&(f++,h=(S.length-2)/2,p[f]=[]),p[f]=[...p[f],{allowFailure:!0,callData:S,target:E}]}catch(S){const A=Xo(S,{abi:v,address:E,args:y,docsPath:"/docs/contract/multicall",functionName:C,sender:n});if(!r)throw A;p[f]=[...p[f],{allowFailure:!0,callData:"0x",target:E}]}}const g=await Promise.allSettled(p.map(x=>dl(e,pu,"readContract")({abi:as,account:n,address:d,args:[x],blockNumber:s,blockTag:a,functionName:"aggregate3",stateOverride:i}))),b=[];for(let x=0;x<g.length;x++){const v=g[x];if(v.status==="rejected"){if(!r)throw v.reason;for(let y=0;y<p[x].length;y++)b.push({status:"failure",error:v.reason,result:void 0});continue}const E=v.value;for(let y=0;y<E.length;y++){const{returnData:C,success:S}=E[y],{callData:A}=p[x][y],{abi:j,address:I,functionName:M,args:W}=l[b.length];try{if(A==="0x")throw new mr;if(!S)throw new Ko({data:C});const D=is({abi:j,args:W,data:C,functionName:M});b.push(r?{result:D,status:"success"}:D)}catch(D){const L=Xo(D,{abi:j,address:I,args:W,docsPath:"/docs/contract/multicall",functionName:M});if(!r)throw L;b.push({error:L,result:void 0,status:"failure"})}}}if(b.length!==l.length)throw new k("multicall results mismatch");return b}function ms(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)}const Or="2.19.0",Tb=()=>`@wagmi/core@${Or}`;var Su=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},Ar,Cu;class Bn extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Tb()}constructor(t,n={}){var s;super(),Ar.add(this),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:"WagmiCoreError"});const r=n.cause instanceof Bn?n.cause.details:(s=n.cause)!=null&&s.message?n.cause.message:n.details,o=n.cause instanceof Bn&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: ${this.docsBaseUrl}${o}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join(`
|
|
139
|
+
`),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return Su(this,Ar,"m",Cu).call(this,this,t)}}Ar=new WeakSet,Cu=function e(t,n){return n!=null&&n(t)?t:t.cause?Su(this,Ar,"m",e).call(this,t.cause,n):t};class gs extends Bn{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}function Pu(e){return typeof e=="number"?e:e==="wei"?0:Math.abs(x0[e])}async function Ou(e,t){const{allowFailure:n=!0,chainId:r,contracts:o,...s}=t,a=e.getClient({chainId:r});return ms(a,Ab,"multicall")({allowFailure:n,contracts:o,...s})}function Ib(e,t){const{chainId:n,...r}=t,o=e.getClient({chainId:n});return ms(o,pu,"readContract")(r)}async function Mb(e,t){var u;const{allowFailure:n=!0,blockNumber:r,blockTag:o,...s}=t,a=t.contracts;try{const i={};for(const[p,f]of a.entries()){const h=f.chainId??e.state.chainId;i[h]||(i[h]=[]),(u=i[h])==null||u.push({contract:f,index:p})}const l=()=>Object.entries(i).map(([p,f])=>Ou(e,{...s,allowFailure:n,blockNumber:r,blockTag:o,chainId:Number.parseInt(p),contracts:f.map(({contract:h})=>h)})),c=(await Promise.all(l())).flat(),d=Object.values(i).flatMap(p=>p.map(({index:f})=>f));return c.reduce((p,f,h)=>(p&&(p[d[h]]=f),p),[])}catch(i){if(i instanceof tu)throw i;const l=()=>a.map(c=>Ib(e,{...c,blockNumber:r,blockTag:o}));return n?(await Promise.allSettled(l())).map(c=>c.status==="fulfilled"?{result:c.value,status:"success"}:{error:c.reason,result:void 0,status:"failure"}):await Promise.all(l())}}async function jb(e,t){const{address:n,blockNumber:r,blockTag:o,chainId:s,token:a,unit:u="ether"}=t;if(a)try{return await Au(e,{balanceAddress:n,chainId:s,symbolType:"string",tokenAddress:a})}catch(p){if(p.name==="ContractFunctionExecutionError"){const f=await Au(e,{balanceAddress:n,chainId:s,symbolType:"bytes32",tokenAddress:a}),h=ag(hn(f.symbol,{dir:"right"}));return{...f,symbol:h}}throw p}const i=e.getClient({chainId:s}),c=await ms(i,W0,"getBalance")(r?{address:n,blockNumber:r}:{address:n,blockTag:o}),d=e.chains.find(p=>p.id===s)??i.chain;return{decimals:d.nativeCurrency.decimals,formatted:xr(c,Pu(u)),symbol:d.nativeCurrency.symbol,value:c}}async function Au(e,t){const{balanceAddress:n,chainId:r,symbolType:o,tokenAddress:s,unit:a}=t,u={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:o}]}],address:s},[i,l,c]=await Mb(e,{allowFailure:!1,contracts:[{...u,functionName:"balanceOf",args:[n],chainId:r},{...u,functionName:"decimals",chainId:r},{...u,functionName:"symbol",chainId:r}]}),d=xr(i??"0",Pu(a??l));return{decimals:l,formatted:d,symbol:c,value:i}}class Kt extends Bn{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}function Fy(e){return e}bs.type="injected";function bs(e={}){const{shimDisconnect:t=!0,unstable_shimAsyncInject:n}=e;function r(){const i=e.target;if(typeof i=="function"){const l=i();if(l)return l}return typeof i=="object"?i:typeof i=="string"?{...kb[i]??{id:i,name:`${i[0].toUpperCase()}${i.slice(1)}`,provider:`is${i[0].toUpperCase()}${i.slice(1)}`}}:{id:"injected",name:"Injected",provider(l){return l==null?void 0:l.ethereum}}}let o,s,a,u;return i=>({get icon(){return r().icon},get id(){return r().id},get name(){return r().name},get supportsSimulation(){return!0},type:bs.type,async setup(){const l=await this.getProvider();l!=null&&l.on&&e.target&&(a||(a=this.onConnect.bind(this),l.on("connect",a)),o||(o=this.onAccountsChanged.bind(this),l.on("accountsChanged",o)))},async connect({chainId:l,isReconnecting:c}={}){var f,h,g,b,$,x;const d=await this.getProvider();if(!d)throw new Kt;let p=[];if(c)p=await this.getAccounts().catch(()=>[]);else if(t)try{p=(b=(g=(h=(f=(await d.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:f.caveats)==null?void 0:h[0])==null?void 0:g.value)==null?void 0:b.map(E=>ft(E)),p.length>0&&(p=await this.getAccounts())}catch(v){const E=v;if(E.code===ge.code)throw new ge(E);if(E.code===dt.code)throw E}try{!(p!=null&&p.length)&&!c&&(p=(await d.request({method:"eth_requestAccounts"})).map(y=>ft(y))),a&&(d.removeListener("connect",a),a=void 0),o||(o=this.onAccountsChanged.bind(this),d.on("accountsChanged",o)),s||(s=this.onChainChanged.bind(this),d.on("chainChanged",s)),u||(u=this.onDisconnect.bind(this),d.on("disconnect",u));let v=await this.getChainId();if(l&&v!==l){const E=await this.switchChain({chainId:l}).catch(y=>{if(y.code===ge.code)throw y;return{id:v}});v=(E==null?void 0:E.id)??v}return t&&await(($=i.storage)==null?void 0:$.removeItem(`${this.id}.disconnected`)),e.target||await((x=i.storage)==null?void 0:x.setItem("injected.connected",!0)),{accounts:p,chainId:v}}catch(v){const E=v;throw E.code===ge.code?new ge(E):E.code===dt.code?new dt(E):E}},async disconnect(){var c,d;const l=await this.getProvider();if(!l)throw new Kt;s&&(l.removeListener("chainChanged",s),s=void 0),u&&(l.removeListener("disconnect",u),u=void 0),a||(a=this.onConnect.bind(this),l.on("connect",a));try{await bu(()=>l.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}t&&await((c=i.storage)==null?void 0:c.setItem(`${this.id}.disconnected`,!0)),e.target||await((d=i.storage)==null?void 0:d.removeItem("injected.connected"))},async getAccounts(){const l=await this.getProvider();if(!l)throw new Kt;return(await l.request({method:"eth_accounts"})).map(d=>ft(d))},async getChainId(){const l=await this.getProvider();if(!l)throw new Kt;const c=await l.request({method:"eth_chainId"});return Number(c)},async getProvider(){if(typeof window>"u")return;let l;const c=r();return typeof c.provider=="function"?l=c.provider(window):typeof c.provider=="string"?l=Tr(window,c.provider):l=c.provider,l&&!l.removeListener&&("off"in l&&typeof l.off=="function"?l.removeListener=l.off:l.removeListener=()=>{}),l},async isAuthorized(){var l,c;try{if(t&&await((l=i.storage)==null?void 0:l.getItem(`${this.id}.disconnected`))||!e.target&&!await((c=i.storage)==null?void 0:c.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const h=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",h),!!await this.getProvider()),g=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise($=>window.addEventListener("ethereum#initialized",()=>$(h()),{once:!0}))]:[],new Promise($=>setTimeout(()=>$(h()),g))]))return!0}throw new Kt}return!!(await hu(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:l,chainId:c}){var h,g,b,$;const d=await this.getProvider();if(!d)throw new Kt;const p=i.chains.find(x=>x.id===c);if(!p)throw new Tt(new gs);const f=new Promise(x=>{const v=E=>{"chainId"in E&&E.chainId===c&&(i.emitter.off("change",v),x())};i.emitter.on("change",v)});try{return await Promise.all([d.request({method:"wallet_switchEthereumChain",params:[{chainId:Z(c)}]}).then(async()=>{await this.getChainId()===c&&i.emitter.emit("change",{chainId:c})}),f]),p}catch(x){const v=x;if(v.code===4902||((g=(h=v==null?void 0:v.data)==null?void 0:h.originalError)==null?void 0:g.code)===4902)try{const{default:E,...y}=p.blockExplorers??{};let C;l!=null&&l.blockExplorerUrls?C=l.blockExplorerUrls:E&&(C=[E.url,...Object.values(y).map(j=>j.url)]);let S;(b=l==null?void 0:l.rpcUrls)!=null&&b.length?S=l.rpcUrls:S=[(($=p.rpcUrls.default)==null?void 0:$.http[0])??""];const A={blockExplorerUrls:C,chainId:Z(c),chainName:(l==null?void 0:l.chainName)??p.name,iconUrls:l==null?void 0:l.iconUrls,nativeCurrency:(l==null?void 0:l.nativeCurrency)??p.nativeCurrency,rpcUrls:S};return await Promise.all([d.request({method:"wallet_addEthereumChain",params:[A]}).then(async()=>{if(await this.getChainId()===c)i.emitter.emit("change",{chainId:c});else throw new ge(new Error("User rejected switch after adding network."))}),f]),p}catch(E){throw new ge(E)}throw v.code===ge.code?new ge(v):new Tt(v)}},async onAccountsChanged(l){var c;if(l.length===0)this.onDisconnect();else if(i.emitter.listenerCount("connect")){const d=(await this.getChainId()).toString();this.onConnect({chainId:d}),t&&await((c=i.storage)==null?void 0:c.removeItem(`${this.id}.disconnected`))}else i.emitter.emit("change",{accounts:l.map(d=>ft(d))})},onChainChanged(l){const c=Number(l);i.emitter.emit("change",{chainId:c})},async onConnect(l){const c=await this.getAccounts();if(c.length===0)return;const d=Number(l.chainId);i.emitter.emit("connect",{accounts:c,chainId:d});const p=await this.getProvider();p&&(a&&(p.removeListener("connect",a),a=void 0),o||(o=this.onAccountsChanged.bind(this),p.on("accountsChanged",o)),s||(s=this.onChainChanged.bind(this),p.on("chainChanged",s)),u||(u=this.onDisconnect.bind(this),p.on("disconnect",u)))},async onDisconnect(l){const c=await this.getProvider();l&&l.code===1013&&c&&(await this.getAccounts()).length||(i.emitter.emit("disconnect"),c&&(s&&(c.removeListener("chainChanged",s),s=void 0),u&&(c.removeListener("disconnect",u),u=void 0),a||(a=this.onConnect.bind(this),c.on("connect",a))))}})}const kb={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(e){return e!=null&&e.coinbaseWalletExtension?e.coinbaseWalletExtension:Tr(e,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(e){return Tr(e,t=>{if(!t.isMetaMask||t.isBraveWallet&&!t._events&&!t._state)return!1;const n=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const r of n)if(t[r])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(e){var t,n;return(t=e==null?void 0:e.phantom)!=null&&t.ethereum?(n=e.phantom)==null?void 0:n.ethereum:Tr(e,"isPhantom")}}};function Tr(e,t){function n(o){return typeof t=="function"?t(o):typeof t=="string"?o[t]:!0}const r=e.ethereum;if(r!=null&&r.providers)return r.providers.find(o=>n(o));if(r&&n(r))return r}function Fb(e){if(typeof window>"u")return;const t=n=>e(n.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function Nb(){const e=new Set;let t=[];const n=()=>Fb(o=>{t.some(({info:s})=>s.uuid===o.info.uuid)||(t=[...t,o],e.forEach(s=>s(t,{added:[o]})))});let r=n();return{_listeners(){return e},clear(){e.forEach(o=>o([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),r==null||r()},findProvider({rdns:o}){return t.find(s=>s.info.rdns===o)},getProviders(){return t},reset(){this.clear(),r==null||r(),r=n()},subscribe(o,{emitImmediately:s}={}){return e.add(o),s&&o(t,{added:t}),()=>e.delete(o)}}}const Lb=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=(a,u,i)=>{let l=a;if(u){const c=(i==null?void 0:i.equalityFn)||Object.is;let d=a(r.getState());l=p=>{const f=a(p);if(!c(d,f)){const h=d;u(d=f,h)}},i!=null&&i.fireImmediately&&u(d,d)}return o(l)},e(t,n,r)};function Db(e,t){let n;try{n=e()}catch{return}return{getItem:o=>{var s;const a=i=>i===null?null:JSON.parse(i,void 0),u=(s=n.getItem(o))!=null?s:null;return u instanceof Promise?u.then(a):a(u)},setItem:(o,s)=>n.setItem(o,JSON.stringify(s,void 0)),removeItem:o=>n.removeItem(o)}}const ys=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return ys(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return ys(r)(n)}}}},_b=(e,t)=>(n,r,o)=>{let s={storage:Db(()=>localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...t},a=!1;const u=new Set,i=new Set;let l=s.storage;if(!l)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...g)},r,o);const c=()=>{const g=s.partialize({...r()});return l.setItem(s.name,{state:g,version:s.version})},d=o.setState;o.setState=(g,b)=>{d(g,b),c()};const p=e((...g)=>{n(...g),c()},r,o);o.getInitialState=()=>p;let f;const h=()=>{var g,b;if(!l)return;a=!1,u.forEach(x=>{var v;return x((v=r())!=null?v:p)});const $=((b=s.onRehydrateStorage)==null?void 0:b.call(s,(g=r())!=null?g:p))||void 0;return ys(l.getItem.bind(l))(s.name).then(x=>{if(x)if(typeof x.version=="number"&&x.version!==s.version){if(s.migrate)return[!0,s.migrate(x.state,x.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,x.state];return[!1,void 0]}).then(x=>{var v;const[E,y]=x;if(f=s.merge(y,(v=r())!=null?v:p),n(f,!0),E)return c()}).then(()=>{$==null||$(f,void 0),f=r(),a=!0,i.forEach(x=>x(f))}).catch(x=>{$==null||$(void 0,x)})};return o.persist={setOptions:g=>{s={...s,...g},g.storage&&(l=g.storage)},clearStorage:()=>{l==null||l.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>h(),hasHydrated:()=>a,onHydrate:g=>(u.add(g),()=>{u.delete(g)}),onFinishHydration:g=>(i.add(g),()=>{i.delete(g)})},s.skipHydration||h(),f||p},Tu=e=>{let t;const n=new Set,r=(l,c)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const p=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(f=>f(t,p))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>i,subscribe:l=>(n.add(l),()=>n.delete(l))},i=t=e(r,o,u);return u},vs=e=>e?Tu(e):Tu;var Iu={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function o(i,l,c){this.fn=i,this.context=l,this.once=c||!1}function s(i,l,c,d,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new o(c,d||i,p),h=n?n+l:l;return i._events[h]?i._events[h].fn?i._events[h]=[i._events[h],f]:i._events[h].push(f):(i._events[h]=f,i._eventsCount++),i}function a(i,l){--i._eventsCount===0?i._events=new r:delete i._events[l]}function u(){this._events=new r,this._eventsCount=0}u.prototype.eventNames=function(){var l=[],c,d;if(this._eventsCount===0)return l;for(d in c=this._events)t.call(c,d)&&l.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},u.prototype.listeners=function(l){var c=n?n+l:l,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,f=d.length,h=new Array(f);p<f;p++)h[p]=d[p].fn;return h},u.prototype.listenerCount=function(l){var c=n?n+l:l,d=this._events[c];return d?d.fn?1:d.length:0},u.prototype.emit=function(l,c,d,p,f,h){var g=n?n+l:l;if(!this._events[g])return!1;var b=this._events[g],$=arguments.length,x,v;if(b.fn){switch(b.once&&this.removeListener(l,b.fn,void 0,!0),$){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,c),!0;case 3:return b.fn.call(b.context,c,d),!0;case 4:return b.fn.call(b.context,c,d,p),!0;case 5:return b.fn.call(b.context,c,d,p,f),!0;case 6:return b.fn.call(b.context,c,d,p,f,h),!0}for(v=1,x=new Array($-1);v<$;v++)x[v-1]=arguments[v];b.fn.apply(b.context,x)}else{var E=b.length,y;for(v=0;v<E;v++)switch(b[v].once&&this.removeListener(l,b[v].fn,void 0,!0),$){case 1:b[v].fn.call(b[v].context);break;case 2:b[v].fn.call(b[v].context,c);break;case 3:b[v].fn.call(b[v].context,c,d);break;case 4:b[v].fn.call(b[v].context,c,d,p);break;default:if(!x)for(y=1,x=new Array($-1);y<$;y++)x[y-1]=arguments[y];b[v].fn.apply(b[v].context,x)}}return!0},u.prototype.on=function(l,c,d){return s(this,l,c,d,!1)},u.prototype.once=function(l,c,d){return s(this,l,c,d,!0)},u.prototype.removeListener=function(l,c,d,p){var f=n?n+l:l;if(!this._events[f])return this;if(!c)return a(this,f),this;var h=this._events[f];if(h.fn)h.fn===c&&(!p||h.once)&&(!d||h.context===d)&&a(this,f);else{for(var g=0,b=[],$=h.length;g<$;g++)(h[g].fn!==c||p&&!h[g].once||d&&h[g].context!==d)&&b.push(h[g]);b.length?this._events[f]=b.length===1?b[0]:b:a(this,f)}return this},u.prototype.removeAllListeners=function(l){var c;return l?(c=n?n+l:l,this._events[c]&&a(this,c)):(this._events=new r,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,e.exports=u})(Iu);var Rb=Iu.exports;const Bb=ec(Rb);class Ub{constructor(t){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new Bb})}on(t,n){this._emitter.on(t,n)}once(t,n){this._emitter.once(t,n)}off(t,n){this._emitter.off(t,n)}emit(t,...n){const r=n[0];this._emitter.emit(t,{uid:this.uid,...r})}listenerCount(t){return this._emitter.listenerCount(t)}}function zb(e){return new Ub(e)}function Hb(e,t){return JSON.parse(e,(n,r)=>{let o=r;return(o==null?void 0:o.__type)==="bigint"&&(o=BigInt(o.value)),(o==null?void 0:o.__type)==="Map"&&(o=new Map(o.value)),(t==null?void 0:t(n,o))??o})}function Mu(e,t){return e.slice(0,t).join(".")||"."}function ju(e,t){const{length:n}=e;for(let r=0;r<n;++r)if(e[r]===t)return r+1;return 0}function Wb(e,t){const n=typeof e=="function",r=typeof t=="function",o=[],s=[];return function(u,i){if(typeof i=="object")if(o.length){const l=ju(o,this);l===0?o[o.length]=this:(o.splice(l),s.splice(l)),s[s.length]=u;const c=ju(o,i);if(c!==0)return r?t.call(this,u,i,Mu(s,c)):`[ref=${Mu(s,c)}]`}else o[0]=i,s[0]=u;return n?e.call(this,u,i):i}}function Vb(e,t,n,r){return JSON.stringify(e,Wb((o,s)=>{let a=s;return typeof a=="bigint"&&(a={__type:"bigint",value:s.toString()}),a instanceof Map&&(a={__type:"Map",value:Array.from(s.entries())}),(t==null?void 0:t(o,a))??a},r),n??void 0)}function Gb(e){const{deserialize:t=Hb,key:n="wagmi",serialize:r=Vb,storage:o=ku}=e;function s(a){return a instanceof Promise?a.then(u=>u).catch(()=>null):a}return{...o,key:n,async getItem(a,u){const i=o.getItem(`${n}.${a}`),l=await s(i);return l?t(l)??null:u??null},async setItem(a,u){const i=`${n}.${a}`;u===null?await s(o.removeItem(i)):await s(o.setItem(i,r(u)))},async removeItem(a){await s(o.removeItem(`${n}.${a}`))}}}const ku={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function qb(){const e=typeof window<"u"&&window.localStorage?window.localStorage:ku;return{getItem(t){return e.getItem(t)},removeItem(t){e.removeItem(t)},setItem(t,n){try{e.setItem(t,n)}catch{}}}}const ws=256;let Ir=ws,Mr;function Kb(e=11){if(!Mr||Ir+e>ws*2){Mr="",Ir=0;for(let t=0;t<ws;t++)Mr+=(256+Math.random()*256|0).toString(16).substring(1)}return Mr.substring(Ir,Ir+++e)}function Yb(e){const{multiInjectedProviderDiscovery:t=!0,storage:n=Gb({storage:qb()}),syncConnectedChain:r=!0,ssr:o=!1,...s}=e,a=typeof window<"u"&&t?Nb():void 0,u=vs(()=>s.chains),i=vs(()=>{const y=[],C=new Set;for(const S of s.connectors??[]){const A=l(S);if(y.push(A),!o&&A.rdns){const j=typeof A.rdns=="string"?[A.rdns]:A.rdns;for(const I of j)C.add(I)}}if(!o&&a){const S=a.getProviders();for(const A of S)C.has(A.info.rdns)||y.push(l(c(A)))}return y});function l(y){var A;const C=zb(Kb()),S={...y({emitter:C,chains:u.getState(),storage:n,transports:s.transports}),emitter:C,uid:C.uid};return C.on("connect",v),(A=S.setup)==null||A.call(S),S}function c(y){const{info:C}=y,S=y.provider;return bs({target:{...C,id:C.rdns,provider:S}})}const d=new Map;function p(y={}){const C=y.chainId??b.getState().chainId,S=u.getState().find(j=>j.id===C);if(y.chainId&&!S)throw new gs;{const j=d.get(b.getState().chainId);if(j&&!S)return j;if(!S)throw new gs}{const j=d.get(C);if(j)return j}let A;if(s.client)A=s.client({chain:S});else{const j=S.id,I=u.getState().map(D=>D.id),M={},W=Object.entries(s);for(const[D,L]of W)if(!(D==="chains"||D==="client"||D==="connectors"||D==="transports"))if(typeof L=="object")if(j in L)M[D]=L[j];else{if(I.some(B=>B in L))continue;M[D]=L}else M[D]=L;A=gu({...M,chain:S,batch:M.batch??{multicall:!0},transport:D=>s.transports[j]({...D,connectors:i})})}return d.set(C,A),A}function f(){return{chainId:u.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let h;const g="0.0.0-canary-";Or.startsWith(g)?h=Number.parseInt(Or.replace(g,"")):h=Number.parseInt(Or.split(".")[0]??"0");const b=vs(Lb(n?_b(f,{migrate(y,C){if(C===h)return y;const S=f(),A=$(y,S.chainId);return{...S,chainId:A}},name:"store",partialize(y){return{connections:{__type:"Map",value:Array.from(y.connections.entries()).map(([C,S])=>{const{id:A,name:j,type:I,uid:M}=S.connector;return[C,{...S,connector:{id:A,name:j,type:I,uid:M}}]})},chainId:y.chainId,current:y.current}},merge(y,C){typeof y=="object"&&y&&"status"in y&&delete y.status;const S=$(y,C.chainId);return{...C,...y,chainId:S}},skipHydration:o,storage:n,version:h}):f));b.setState(f());function $(y,C){return y&&typeof y=="object"&&"chainId"in y&&typeof y.chainId=="number"&&u.getState().some(S=>S.id===y.chainId)?y.chainId:C}r&&b.subscribe(({connections:y,current:C})=>{var S;return C?(S=y.get(C))==null?void 0:S.chainId:void 0},y=>{if(u.getState().some(S=>S.id===y))return b.setState(S=>({...S,chainId:y??S.chainId}))}),a==null||a.subscribe(y=>{const C=new Set,S=new Set;for(const j of i.getState())if(C.add(j.id),j.rdns){const I=typeof j.rdns=="string"?[j.rdns]:j.rdns;for(const M of I)S.add(M)}const A=[];for(const j of y){if(S.has(j.info.rdns))continue;const I=l(c(j));C.has(I.id)||A.push(I)}n&&!b.persist.hasHydrated()||i.setState(j=>[...j,...A],!0)});function x(y){b.setState(C=>{const S=C.connections.get(y.uid);return S?{...C,connections:new Map(C.connections).set(y.uid,{accounts:y.accounts??S.accounts,chainId:y.chainId??S.chainId,connector:S.connector})}:C})}function v(y){b.getState().status==="connecting"||b.getState().status==="reconnecting"||b.setState(C=>{const S=i.getState().find(A=>A.uid===y.uid);return S?(S.emitter.listenerCount("connect")&&S.emitter.off("connect",x),S.emitter.listenerCount("change")||S.emitter.on("change",x),S.emitter.listenerCount("disconnect")||S.emitter.on("disconnect",E),{...C,connections:new Map(C.connections).set(y.uid,{accounts:y.accounts,chainId:y.chainId,connector:S}),current:y.uid,status:"connected"}):C})}function E(y){b.setState(C=>{const S=C.connections.get(y.uid);if(S){const j=S.connector;j.emitter.listenerCount("change")&&S.connector.emitter.off("change",x),j.emitter.listenerCount("disconnect")&&S.connector.emitter.off("disconnect",E),j.emitter.listenerCount("connect")||S.connector.emitter.on("connect",v)}if(C.connections.delete(y.uid),C.connections.size===0)return{...C,connections:new Map,current:null,status:"disconnected"};const A=C.connections.values().next().value;return{...C,connections:new Map(C.connections),current:A.connector.uid}})}return{get chains(){return u.getState()},get connectors(){return i.getState()},storage:n,getClient:p,get state(){return b.getState()},setState(y){let C;typeof y=="function"?C=y(b.getState()):C=y;const S=f();typeof C!="object"&&(C=S),Object.keys(S).some(j=>!(j in C))&&(C=S),b.setState(C,!0)},subscribe(y,C,S){return b.subscribe(y,C,S?{...S,fireImmediately:S.emitImmediately}:void 0)},_internal:{mipd:a,store:b,ssr:!!o,syncConnectedChain:r,transports:s.transports,chains:{setState(y){const C=typeof y=="function"?y(u.getState()):y;if(C.length!==0)return u.setState(C,!0)},subscribe(y){return u.subscribe(y)}},connectors:{providerDetailToConnector:c,setup:l,setState(y){return i.setState(typeof y=="function"?y(i.getState()):y,!0)},subscribe(y){return i.subscribe(y)}},events:{change:x,connect:v,disconnect:E}}}}const Xb=[{id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.llamarpc.com"]}}},{id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-sepolia-rpc.publicnode.com"]}}},{id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}}},{id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}}}],Qb=({account:e,chainId:t,contractAddress:n,tokens:r=[]}={})=>{const o=m.useCallback((l,c)=>{const d=Xb.find(f=>f.id===l);if(!d)throw new Error(`Unsupported chain: ${l}`);return Yb({chains:[d],client({chain:f}){return gu({chain:f,transport:yb(c||f.rpcUrls.default.http[0])})}})},[]),s=m.useMemo(()=>r.filter(l=>l.tokenAddress&&l.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),a=m.useCallback(()=>e?s.map(l=>({address:l.tokenAddress,abi:au,functionName:"balanceOf",args:[ft(e)]})):[],[e,s]),u=m.useCallback(()=>!e||!n?[]:s.map(l=>({address:l.tokenAddress,abi:au,functionName:"allowance",args:[ft(e),ft(n)]})),[e,n,s]);return{multicallRun:m.useCallback(async(l,c)=>{const d=l||t;if(console.log("🚀 multicallRun 开始:",{account:e,finalChainId:d,targetChainId:l,chainId:t,tokensCount:s.length}),!e||!d){const A=`Account and chainId are required. account: ${e}, finalChainId: ${d}`;throw console.error("❌ multicallRun 参数错误:",A),new Error(A)}const p=a(),f=u(),h=p.length,g=[...p,...f],b=o(d,c),[$,x]=await Promise.allSettled([jb(b,{address:e,chainId:d}),g.length>0?Ou(b,{contracts:g,chainId:d}):Promise.resolve([])]),v=$.status==="fulfilled"?$.value:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},E=x.status==="fulfilled"?x.value:[],y=E.slice(0,h).map((A,j)=>{const I=s[j],M=A.status==="success"?A.result:BigInt(0);return{address:I.tokenAddress,value:M,formatted:(M/BigInt(10)**BigInt(I.decimals)).toString(),decimals:I.decimals}}),C=E.slice(h).map((A,j)=>{const I=s[j],M=A.status==="success"?A.result:BigInt(0);return{address:I.tokenAddress,value:M,formatted:(M/BigInt(10)**BigInt(I.decimals)).toString(),decimals:I.decimals}}),S=y.reduce((A,j)=>{const I=C.find(M=>M.address===j.address);return{...A,[ft(j.address)]:{balance:j,allowance:I||{address:j.address,value:BigInt(0),formatted:"0",decimals:j.decimals}}}},{});return{balanceList:y,allowanceList:C,baseTokenBalance:v,combinedData:S}},[e,t,a,u,o]),validErcTokens:s}},Zb=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:a,approved:u,onApproved:i,onDeposit:l,onClose:c})=>{var L;const[d,p]=m.useState(()=>{var R;return!e||e.length===0?1:t||((R=e[0])==null?void 0:R.chainId)||1}),[f,h]=m.useState(()=>{var O;if(!e||e.length===0)return"";const R=t||((O=e[0])==null?void 0:O.chainId),B=e.find(_=>_.chainId===R);if(!B||!B.tokenList||B.tokenList.length===0)return"";const z=B.tokenList.find(_=>_.tokenAddress===n)||B.tokenList[0];return(z==null?void 0:z.token)||""}),[g,b]=m.useState(r),$=m.useRef(!0),x=m.useRef(f),v=m.useRef(d);m.useEffect(()=>{if($.current){$.current=!1,x.current=f,v.current=d;return}(x.current!==f||v.current!==d)&&(b(""),x.current=f,v.current=d)},[f,d]);const E=e&&e.length>0?e.find(R=>R.chainId===d)||e[0]:null,y=(L=E==null?void 0:E.tokenList)==null?void 0:L.find(R=>R.token===f),{multicallRun:C}=Qb({account:o==null?void 0:o.getDisplayAddress(),chainId:d,contractAddress:void 0,tokens:(E==null?void 0:E.tokenList)||[]}),[S,A]=m.useState(void 0),[j,I]=m.useState(!1);m.useEffect(()=>{(async()=>{var B,z;if(console.log("🔍 开始获取余额:",{selectedToken:y==null?void 0:y.token,tokenAddress:y==null?void 0:y.tokenAddress,chainId:E==null?void 0:E.chainId,account:o==null?void 0:o.getDisplayAddress()}),!y||!E){console.log("❌ 缺少必要参数,跳过余额查询"),A(void 0);return}I(!0);try{console.log("🏗️ 使用内置余额查询");const O=await C(E.chainId);if(console.log("📊 内置余额查询结果:",O),!y.tokenAddress||y.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")console.log("💰 基础代币余额:",O.baseTokenBalance.formatted),A(O.baseTokenBalance.formatted);else{const _=O.combinedData[y.tokenAddress];console.log("🪙 ERC20 代币余额:",(B=_==null?void 0:_.balance)==null?void 0:B.formatted),A(((z=_==null?void 0:_.balance)==null?void 0:z.formatted)||"0")}}catch(O){console.error("❌ 获取余额失败:",O),A("0")}finally{I(!1)}})()},[y,E,C,d,o]);const M=m.useMemo(()=>{var B;if(u!==void 0)return u;const R=(B=y==null?void 0:y.allowance)==null?void 0:B.formatted;return!R||!g?!1:parseFloat(R)>=parseFloat(g)},[u,y==null?void 0:y.allowance,g]),W=m.useMemo(()=>{const R=parseFloat(g||"0"),B=10,z=S||"0",O=Xh(g,z,M);return!g||R===0?{text:"Confirm Deposit",disabled:!0}:M?R>parseFloat(z)?{text:"Insufficient Balance",disabled:!0}:R<B?{text:`Min Deposit ${B} ${f}`,disabled:!0}:{text:"Confirm Deposit",disabled:!O}:{text:"Confirm Deposit",disabled:!0}},[g,f,S,M]),D=m.useCallback(async()=>{l&&l({amount:g,chainId:d,tokenAddress:(y==null?void 0:y.tokenAddress)||"",tokenSymbol:f}),c()},[l,c,g,d,y==null?void 0:y.tokenAddress,f]);return!e||e.length===0?P.jsx("div",{className:"text-center py-8",children:P.jsx("p",{className:"text-gray-400",children:"No chains available"})}):E?P.jsxs(P.Fragment,{children:[P.jsx(ka,{currentActiveChain:E,chainList:e,onChainChange:p,curSelectToken:f,onTokenChange:h,walletType:"evm"}),P.jsx(nm,{depositAmount:g,curSelectToken:f,curSelectTokenData:{balance:y==null?void 0:y.balance,allowance:y==null?void 0:y.allowance},approved:M,currentActiveChain:E,currentEquity:a||0,amount:g,decimals:(y==null?void 0:y.decimals)||6,tokenBalance:S,onDepositAmountChange:b,onApprove:async()=>{i&&await i()}}),P.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${W.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:D,disabled:W.disabled,children:W.text})]}):P.jsx("div",{className:"text-center py-8",children:P.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Fu=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=Ya,smartWallet:o=Xa,chains:s,defaultChainId:a,defaultTokenAddress:u,defaultAmount:i="",metadata:l=Qa,currentEquity:c=5e3,approved:d,onApproved:p,onDeposit:f})=>{const h=m.useMemo(()=>{var b;return r?gc(r,o,!1,(b=s[0])==null?void 0:b.chainId,"0","0"):null},[r,o,s]),g=(h==null?void 0:h.getWalletType())==="mpc";return e?ye.createPortal(P.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:P.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:P.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:b=>{b.stopPropagation()},children:[P.jsxs("div",{className:"flex items-center justify-between mb-4",children:[P.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),P.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:P.jsx(pc,{className:"h-4 w-4"})})]}),g?P.jsx(tm,{chains:s,defaultChainId:a,defaultTokenAddress:u,defaultAmount:i,walletAdapter:h,metadata:l,currentEquity:c,onDeposit:f,onClose:t}):P.jsx(Zb,{chains:s,defaultChainId:a,defaultTokenAddress:u,defaultAmount:i,walletAdapter:h,metadata:l,currentEquity:c,approved:d,onApproved:p,onDeposit:f,onClose:t})]})})}),document.body):null};let Ge=null;const Jb={symbol:"USDT"},Nu=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,s]=m.useState({chains:[]}),a=m.useCallback(c=>{s(c),r(!0)},[]),u=m.useCallback(c=>{s(d=>({...d,...c}))},[]),i=m.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=m.useCallback(()=>n,[n]);return m.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:i,updateDepositOptions:u,isOpen:l}),[a,i,u,l]),m.useEffect(()=>(Ge={openDeposit:a,closeDeposit:i,updateDepositOptions:u,isOpen:l},()=>{Ge=null}),[a,i,u,l]),P.jsx(Fu,{isOpen:n,onClose:i,config:o.config||Jb,currentActiveAccount:o.currentActiveAccount||Ya,smartWallet:o.smartWallet||Xa,chains:o.chains||Jh,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||Qa,currentEquity:o.currentEquity??5e3,approved:o.approved,onApproved:o.onApproved,onDeposit:o.onDeposit})});Nu.displayName="DepositManager";const Lu=e=>{if(!Ge){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ge.openDeposit(e||{chains:[]})},Du=()=>{if(!Ge){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ge.closeDeposit()},ey=e=>{if(!Ge){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ge.updateDepositOptions(e)},ty=()=>Ge?Ge.isOpen():!1,ny=()=>({openDeposit:Lu,closeDeposit:Du,updateDepositOptions:ey,isOpen:ty});m.createContext(null);const ry=({isOpen:e,onClose:t,config:n})=>e?P.jsx("div",{className:"withdraw-modal",children:P.jsx("div",{className:"modal-overlay",onClick:t,children:P.jsxs("div",{className:"modal-content",onClick:r=>r.stopPropagation(),children:[P.jsxs("h2",{children:["Withdraw ",n.symbol]}),P.jsxs("p",{children:["Symbol: ",n.symbol]}),P.jsx("button",{onClick:t,children:"Close"})]})})}):null;oe.ComponentProvider=oc,oe.Deposit=Fu,oe.DepositManager=Nu,oe.Withdraw=ry,oe.closeDeposit=Du,oe.openDeposit=Lu,oe.useDeposit=sc,oe.useDepositManager=ny,oe.useWithdraw=ic,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
|
|
123
140
|
//# sourceMappingURL=index.umd.js.map
|