@edgex-web/components 0.1.0-beta.8 → 0.1.0-beta.9
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/components/Deposit/index.d.ts +1 -1
- 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 +3 -0
- package/dist/components/Deposit/src/evm/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts +23 -1
- package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts.map +1 -1
- package/dist/components/Deposit/src/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/mpc/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/walletAdapters.d.ts.map +1 -1
- package/dist/components/Deposit/types/index.d.ts +4 -0
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2135 -2052
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +23 -23
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(ne,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],d):(ne=typeof globalThis<"u"?globalThis:ne||self,d(ne.EdgeXComponents={},ne.React,ne.ReactDOM))})(this,function(ne,d,
|
|
1
|
+
(function(ne,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],d):(ne=typeof globalThis<"u"?globalThis:ne||self,d(ne.EdgeXComponents={},ne.React,ne.ReactDOM))})(this,function(ne,d,pe){"use strict";var Nf=Object.defineProperty;var Mf=(ne,d,pe)=>d in ne?Nf(ne,d,{enumerable:!0,configurable:!0,writable:!0,value:pe}):ne[d]=pe;var Re=(ne,d,pe)=>Mf(ne,typeof d!="symbol"?d+"":d,pe);function sr(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 M=sr(d),Pt=sr(pe);var on={exports:{}},mt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -14,25 +14,25 @@
|
|
|
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 ar;function qi(){return ar||(ar=1,process.env.NODE_ENV!=="production"&&function(){var e=d,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"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),a=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),h=Symbol.iterator,
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var ar;function qi(){return ar||(ar=1,process.env.NODE_ENV!=="production"&&function(){var e=d,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"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),a=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),h=Symbol.iterator,v="@@iterator";function b(g){if(g===null||typeof g!="object")return null;var $=h&&g[h]||g[v];return typeof $=="function"?$:null}var x=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(g){{for(var $=arguments.length,N=new Array($>1?$-1:0),j=1;j<$;j++)N[j-1]=arguments[j];y("error",g,N)}}function y(g,$,N){{var j=x.ReactDebugCurrentFrame,q=j.getStackAddendum();q!==""&&($+="%s",N=N.concat([q]));var J=N.map(function(Y){return String(Y)});J.unshift("Warning: "+$),Function.prototype.apply.call(console[g],console,J)}}var C=!1,S=!1,A=!1,L=!1,R=!1,V;V=Symbol.for("react.module.reference");function P(g){return!!(typeof g=="string"||typeof g=="function"||g===r||g===s||R||g===o||g===l||g===a||L||g===f||C||S||A||typeof g=="object"&&g!==null&&(g.$$typeof===m||g.$$typeof===p||g.$$typeof===c||g.$$typeof===u||g.$$typeof===i||g.$$typeof===V||g.getModuleId!==void 0))}function T(g,$,N){var j=g.displayName;if(j)return j;var q=$.displayName||$.name||"";return q!==""?N+"("+q+")":N}function K(g){return g.displayName||"Context"}function I(g){if(g==null)return null;if(typeof g.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case a:return"SuspenseList"}if(typeof g=="object")switch(g.$$typeof){case u:var $=g;return K($)+".Consumer";case c:var N=g;return K(N._context)+".Provider";case i:return T(g,g.render,"ForwardRef");case p:var j=g.displayName||null;return j!==null?j:I(g.type)||"Memo";case m:{var q=g,J=q._payload,Y=q._init;try{return I(Y(J))}catch{return null}}}return null}var D=Object.assign,B=0,U,G,O,_,F,Z,Q;function X(){}X.__reactDisabledLog=!0;function Te(){{if(B===0){U=console.log,G=console.info,O=console.warn,_=console.error,F=console.group,Z=console.groupCollapsed,Q=console.groupEnd;var g={configurable:!0,enumerable:!0,value:X,writable:!0};Object.defineProperties(console,{info:g,log:g,warn:g,error:g,group:g,groupCollapsed:g,groupEnd:g})}B++}}function ke(){{if(B--,B===0){var g={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},g,{value:U}),info:D({},g,{value:G}),warn:D({},g,{value:O}),error:D({},g,{value:_}),group:D({},g,{value:F}),groupCollapsed:D({},g,{value:Z}),groupEnd:D({},g,{value:Q})})}B<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var tt=x.ReactCurrentDispatcher,k;function te(g,$,N){{if(k===void 0)try{throw Error()}catch(q){var j=q.stack.trim().match(/\n( *(at )?)/);k=j&&j[1]||""}return`
|
|
18
|
+
`+k+g}}var fe=!1,Ge;{var of=typeof WeakMap=="function"?WeakMap:Map;Ge=new of}function Di(g,$){if(!g||fe)return"";{var N=Ge.get(g);if(N!==void 0)return N}var j;fe=!0;var q=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var J;J=tt.current,tt.current=null,Te();try{if($){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(he){j=he}Reflect.construct(g,[],Y)}else{try{Y.call()}catch(he){j=he}g.call(Y.prototype)}}else{try{throw Error()}catch(he){j=he}g()}}catch(he){if(he&&j&&typeof he.stack=="string"){for(var H=he.stack.split(`
|
|
19
|
+
`),de=j.stack.split(`
|
|
20
|
+
`),ie=H.length-1,se=de.length-1;ie>=1&&se>=0&&H[ie]!==de[se];)se--;for(;ie>=1&&se>=0;ie--,se--)if(H[ie]!==de[se]){if(ie!==1||se!==1)do if(ie--,se--,se<0||H[ie]!==de[se]){var Ce=`
|
|
21
|
+
`+H[ie].replace(" at new "," at ");return g.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",g.displayName)),typeof g=="function"&&Ge.set(g,Ce),Ce}while(ie>=1&&se>=0);break}}}finally{fe=!1,tt.current=J,ke(),Error.prepareStackTrace=q}var pt=g?g.displayName||g.name:"",nt=pt?te(pt):"";return typeof g=="function"&&Ge.set(g,nt),nt}function sf(g,$,N){return Di(g,!1)}function lf(g){var $=g.prototype;return!!($&&$.isReactComponent)}function nn(g,$,N){if(g==null)return"";if(typeof g=="function")return Di(g,lf(g));if(typeof g=="string")return te(g);switch(g){case l:return te("Suspense");case a:return te("SuspenseList")}if(typeof g=="object")switch(g.$$typeof){case i:return sf(g.render);case p:return nn(g.type,$,N);case m:{var j=g,q=j._payload,J=j._init;try{return nn(J(q),$,N)}catch{}}}return""}var At=Object.prototype.hasOwnProperty,Ii={},ji=x.ReactDebugCurrentFrame;function rn(g){if(g){var $=g._owner,N=nn(g.type,g._source,$?$.type:null);ji.setExtraStackFrame(N)}else ji.setExtraStackFrame(null)}function af(g,$,N,j,q){{var J=Function.call.bind(At);for(var Y in g)if(J(g,Y)){var H=void 0;try{if(typeof g[Y]!="function"){var de=Error((j||"React class")+": "+N+" type `"+Y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof g[Y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw de.name="Invariant Violation",de}H=g[Y]($,Y,j,N,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ie){H=ie}H&&!(H instanceof Error)&&(rn(q),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",j||"React class",N,Y,typeof H),rn(null)),H instanceof Error&&!(H.message in Ii)&&(Ii[H.message]=!0,rn(q),E("Failed %s type: %s",N,H.message),rn(null))}}}var uf=Array.isArray;function tr(g){return uf(g)}function cf(g){{var $=typeof Symbol=="function"&&Symbol.toStringTag,N=$&&g[Symbol.toStringTag]||g.constructor.name||"Object";return N}}function ff(g){try{return _i(g),!1}catch{return!0}}function _i(g){return""+g}function ki(g){if(ff(g))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",cf(g)),_i(g)}var Ri=x.ReactCurrentOwner,df={key:!0,ref:!0,__self:!0,__source:!0},Bi,Wi;function pf(g){if(At.call(g,"ref")){var $=Object.getOwnPropertyDescriptor(g,"ref").get;if($&&$.isReactWarning)return!1}return g.ref!==void 0}function mf(g){if(At.call(g,"key")){var $=Object.getOwnPropertyDescriptor(g,"key").get;if($&&$.isReactWarning)return!1}return g.key!==void 0}function hf(g,$){typeof g.ref=="string"&&Ri.current}function vf(g,$){{var N=function(){Bi||(Bi=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",$))};N.isReactWarning=!0,Object.defineProperty(g,"key",{get:N,configurable:!0})}}function gf(g,$){{var N=function(){Wi||(Wi=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",$))};N.isReactWarning=!0,Object.defineProperty(g,"ref",{get:N,configurable:!0})}}var bf=function(g,$,N,j,q,J,Y){var H={$$typeof:t,type:g,key:$,ref:N,props:Y,_owner:J};return H._store={},Object.defineProperty(H._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(H,"_self",{configurable:!1,enumerable:!1,writable:!1,value:j}),Object.defineProperty(H,"_source",{configurable:!1,enumerable:!1,writable:!1,value:q}),Object.freeze&&(Object.freeze(H.props),Object.freeze(H)),H};function yf(g,$,N,j,q){{var J,Y={},H=null,de=null;N!==void 0&&(ki(N),H=""+N),mf($)&&(ki($.key),H=""+$.key),pf($)&&(de=$.ref,hf($,q));for(J in $)At.call($,J)&&!df.hasOwnProperty(J)&&(Y[J]=$[J]);if(g&&g.defaultProps){var ie=g.defaultProps;for(J in ie)Y[J]===void 0&&(Y[J]=ie[J])}if(H||de){var se=typeof g=="function"?g.displayName||g.name||"Unknown":g;H&&vf(Y,se),de&&gf(Y,se)}return bf(g,H,de,q,j,Ri.current,Y)}}var nr=x.ReactCurrentOwner,Vi=x.ReactDebugCurrentFrame;function dt(g){if(g){var $=g._owner,N=nn(g.type,g._source,$?$.type:null);Vi.setExtraStackFrame(N)}else Vi.setExtraStackFrame(null)}var rr;rr=!1;function or(g){return typeof g=="object"&&g!==null&&g.$$typeof===t}function Ui(){{if(nr.current){var g=I(nr.current.type);if(g)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+g+"`."}return""}}function xf(g){return""}var
|
|
23
|
+
Check the render method of \``+g+"`."}return""}}function xf(g){return""}var Hi={};function Ef(g){{var $=Ui();if(!$){var N=typeof g=="string"?g:g.displayName||g.name;N&&($=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+N+">.")}return $}}function zi(g,$){{if(!g._store||g._store.validated||g.key!=null)return;g._store.validated=!0;var N=Ef($);if(Hi[N])return;Hi[N]=!0;var j="";g&&g._owner&&g._owner!==nr.current&&(j=" It was passed a child from "+I(g._owner.type)+"."),dt(g),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',N,j),dt(null)}}function Gi(g,$){{if(typeof g!="object")return;if(tr(g))for(var N=0;N<g.length;N++){var j=g[N];or(j)&&zi(j,$)}else if(or(g))g._store&&(g._store.validated=!0);else if(g){var q=b(g);if(typeof q=="function"&&q!==g.entries)for(var J=q.call(g),Y;!(Y=J.next()).done;)or(Y.value)&&zi(Y.value,$)}}}function wf(g){{var $=g.type;if($==null||typeof $=="string")return;var N;if(typeof $=="function")N=$.propTypes;else if(typeof $=="object"&&($.$$typeof===i||$.$$typeof===p))N=$.propTypes;else return;if(N){var j=I($);af(N,g.props,"prop",j,g)}else if($.PropTypes!==void 0&&!rr){rr=!0;var q=I($);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",q||"Unknown")}typeof $.getDefaultProps=="function"&&!$.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Cf(g){{for(var $=Object.keys(g.props),N=0;N<$.length;N++){var j=$[N];if(j!=="children"&&j!=="key"){dt(g),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",j),dt(null);break}}g.ref!==null&&(dt(g),E("Invalid attribute `ref` supplied to `React.Fragment`."),dt(null))}}var Yi={};function Ki(g,$,N,j,q,J){{var Y=P(g);if(!Y){var H="";(g===void 0||typeof g=="object"&&g!==null&&Object.keys(g).length===0)&&(H+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var de=xf();de?H+=de:H+=Ui();var ie;g===null?ie="null":tr(g)?ie="array":g!==void 0&&g.$$typeof===t?(ie="<"+(I(g.type)||"Unknown")+" />",H=" Did you accidentally export a JSX literal instead of a component?"):ie=typeof g,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ie,H)}var se=yf(g,$,N,q,J);if(se==null)return se;if(Y){var Ce=$.children;if(Ce!==void 0)if(j)if(tr(Ce)){for(var pt=0;pt<Ce.length;pt++)Gi(Ce[pt],g);Object.freeze&&Object.freeze(Ce)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Gi(Ce,g)}if(At.call($,"key")){var nt=I(g),he=Object.keys($).filter(function(Pf){return Pf!=="key"}),ir=he.length>0?"{key: someKey, "+he.join(": ..., ")+": ...}":"{key: someKey}";if(!Yi[nt+ir]){var Af=he.length>0?"{"+he.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,ir,nt,Af,nt),Yi[nt+ir]=!0}}return g===r?Cf(
|
|
30
|
+
<%s key={someKey} {...props} />`,ir,nt,Af,nt),Yi[nt+ir]=!0}}return g===r?Cf(se):wf(se),se}}function Sf(g,$,N){return Ki(g,$,N,!0)}function $f(g,$,N){return Ki(g,$,N,!1)}var Of=$f,Tf=Sf;ht.Fragment=r,ht.jsx=Of,ht.jsxs=Tf}()),ht}process.env.NODE_ENV==="production"?on.exports=Xi():on.exports=qi();var w=on.exports;const Ji=d.createContext(null),Zi=({config:e,children:t})=>w.jsx(Ji.Provider,{value:e,children:t}),es=()=>({openDeposit:d.useCallback(t=>{},[])}),ts=()=>({openWithdraw:d.useCallback(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 ns=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),
|
|
35
|
+
*/const ns=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),ur=e=>{const t=rs(e);return t.charAt(0).toUpperCase()+t.slice(1)},cr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),os=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.
|
|
@@ -42,20 +42,20 @@ React keys must be passed directly to JSX without using spread:
|
|
|
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 ss=d.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...u},i)=>d.createElement("svg",{ref:i,...is,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:
|
|
45
|
+
*/const ss=d.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...u},i)=>d.createElement("svg",{ref:i,...is,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:cr("lucide",o),...!s&&!os(u)&&{"aria-hidden":"true"},...u},[...c.map(([l,a])=>d.createElement(l,a)),...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 ls=(e,t)=>{const n=d.forwardRef(({className:r,...o},s)=>d.createElement(ss,{ref:s,iconNode:t,className:
|
|
50
|
+
*/const ls=(e,t)=>{const n=d.forwardRef(({className:r,...o},s)=>d.createElement(ss,{ref:s,iconNode:t,className:cr(`lucide-${ns(ur(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ur(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 as=ls("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class dr{constructor(){ke(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 us extends dr{constructor(n,r){super();ke(this,"smartWallet");ke(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 cs extends dr{constructor(n,r,o,s="0",c="0"){super();ke(this,"currentActiveAccount");ke(this,"approved");ke(this,"chainId");ke(this,"balance");ke(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 fs(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new us(t,e);default:return new cs(e,!1,r||1,o,s)}}const pr=typeof document<"u"?d.useLayoutEffect:()=>{};var sn;const ds=(sn=d.useInsertionEffect)!==null&&sn!==void 0?sn:pr;function ps(e){const t=d.useRef(null);return ds(()=>{t.current=e},[e]),d.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Re=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Ge=e=>e&&"window"in e&&e.window===e?e:Re(e).defaultView||window;function ms(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function hs(e){return ms(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let gs=!1;function ln(){return gs}function mr(e,t){if(!ln())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:hs(n)?n=n.host:n=n.parentNode}return!1}const an=(e=document)=>{var t;if(!ln())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 hr(e){return ln()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Mt(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 un(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 De(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const cn=De(function(){return un(/^Mac/i)}),vs=De(function(){return un(/^iPhone/i)}),bs=De(function(){return un(/^iPad/i)||cn()&&navigator.maxTouchPoints>1}),ys=De(function(){return vs()||bs()});De(function(){return cn()||ys()}),De(function(){return Mt(/AppleWebKit/i)&&!xs()});const xs=De(function(){return Mt(/Chrome/i)}),ws=De(function(){return Mt(/Android/i)});De(function(){return Mt(/Firefox/i)});function gr(){let e=d.useRef(new Map),t=d.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=d.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=d.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return d.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Es(e){return e.mozInputSource===0&&e.isTrusted?!0:ws()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function vr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Cs(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function br(e){let t=d.useRef({isFocused:!1,observer:null});pr(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=ps(r=>{e==null||e(r)});return d.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=vr(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 Ss=!1,gt=null,fn=new Set,vt=new Map,Ye=!1,dn=!1;const $s={Tab:!0,Escape:!0};function pn(e,t){for(let n of fn)n(e,t)}function Os(e){return!(e.metaKey||!cn()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Nt(e){Ye=!0,Os(e)&&(gt="keyboard",pn("keyboard",e))}function be(e){gt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ye=!0,pn("pointer",e))}function yr(e){Es(e)&&(Ye=!0,gt="virtual")}function xr(e){e.target===window||e.target===document||Ss||!e.isTrusted||(!Ye&&!dn&&(gt="virtual",pn("virtual",e)),Ye=!1,dn=!1)}function wr(){Ye=!1,dn=!0}function mn(e){if(typeof window>"u"||typeof document>"u"||vt.get(Ge(e)))return;const t=Ge(e),n=Re(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ye=!0,r.apply(this,arguments)},n.addEventListener("keydown",Nt,!0),n.addEventListener("keyup",Nt,!0),n.addEventListener("click",yr,!0),t.addEventListener("focus",xr,!0),t.addEventListener("blur",wr,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",be,!0),n.addEventListener("pointermove",be,!0),n.addEventListener("pointerup",be,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",be,!0),n.addEventListener("mousemove",be,!0),n.addEventListener("mouseup",be,!0)),t.addEventListener("beforeunload",()=>{Er(e)},{once:!0}),vt.set(t,{focus:r})}const Er=(e,t)=>{const n=Ge(e),r=Re(e);t&&r.removeEventListener("DOMContentLoaded",t),vt.has(n)&&(n.HTMLElement.prototype.focus=vt.get(n).focus,r.removeEventListener("keydown",Nt,!0),r.removeEventListener("keyup",Nt,!0),r.removeEventListener("click",yr,!0),n.removeEventListener("focus",xr,!0),n.removeEventListener("blur",wr,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",be,!0),r.removeEventListener("pointermove",be,!0),r.removeEventListener("pointerup",be,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",be,!0),r.removeEventListener("mousemove",be,!0),r.removeEventListener("mouseup",be,!0)),vt.delete(n))};function Ts(e){const t=Re(e);let n;return t.readyState!=="loading"?mn(e):(n=()=>{mn(e)},t.addEventListener("DOMContentLoaded",n)),()=>Er(e,n)}typeof document<"u"&&Ts();function Cr(){return gt!=="pointer"}const As=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ps(e,t,n){let r=Re(n==null?void 0:n.target);const o=typeof window<"u"?Ge(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Ge(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?Ge(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?Ge(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!As.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof c&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!$s[n.key])}function Ms(e,t,n){mn(),d.useEffect(()=>{let r=(o,s)=>{Ps(!!(n!=null&&n.isTextInput),o,s)&&e(Cr())};return fn.add(r),()=>{fn.delete(r)}},t)}function Ns(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=d.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),c=br(s),u=d.useCallback(i=>{const l=Re(i.target),a=l?an(l):an();i.target===i.currentTarget&&a===hr(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 Ls(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=d.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:u}=gr(),i=d.useCallback(p=>{p.currentTarget.contains(p.target)&&s.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(s.current.isFocusWithin=!1,u(),n&&n(p),o&&o(!1))},[n,o,s,u]),l=br(i),a=d.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const m=Re(p.target),f=an(m);if(!s.current.isFocusWithin&&f===hr(p.nativeEvent)){r&&r(p),o&&o(!0),s.current.isFocusWithin=!0,l(p);let h=p.currentTarget;c(m,"focus",b=>{if(s.current.isFocusWithin&&!mr(h,b.target)){let v=new m.defaultView.FocusEvent("blur",{relatedTarget:b.target});Cs(v,h);let E=vr(v);i(E)}},{capture:!0})}},[r,o,l,c,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:a,onBlur:i}}}let Lt=!1,Ft=0;function hn(){Lt=!0,setTimeout(()=>{Lt=!1},50)}function Sr(e){e.pointerType==="touch"&&hn()}function Fs(){if(!(typeof document>"u"))return Ft===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Sr):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",hn)),Ft++,()=>{Ft--,!(Ft>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Sr):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",hn))}}function Ds(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,c]=d.useState(!1),u=d.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;d.useEffect(Fs,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=gr(),{hoverProps:a,triggerHoverEnd:p}=d.useMemo(()=>{let m=(b,v)=>{if(u.pointerType=v,o||v==="touch"||u.isHovered||!b.currentTarget.contains(b.target))return;u.isHovered=!0;let E=b.currentTarget;u.target=E,i(Re(b.target),"pointerover",x=>{u.isHovered&&u.target&&!mr(u.target,x.target)&&f(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:E,pointerType:v}),n&&n(!0),c(!0)},f=(b,v)=>{let E=u.target;u.pointerType="",u.target=null,!(v==="touch"||!u.isHovered||!E)&&(u.isHovered=!1,l(),r&&r({type:"hoverend",target:E,pointerType:v}),n&&n(!1),c(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=b=>{Lt&&b.pointerType==="mouse"||m(b,b.pointerType)},h.onPointerLeave=b=>{!o&&b.currentTarget.contains(b.target)&&f(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=b=>{!u.ignoreEmulatedMouseEvents&&!Lt&&m(b,"mouse"),u.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=b=>{!o&&b.currentTarget.contains(b.target)&&f(b,"mouse")}),{hoverProps:h,triggerHoverEnd:f}},[t,n,r,o,u,i,l]);return d.useEffect(()=>{o&&p({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:a,isHovered:s}}function Is(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=d.useRef({isFocused:!1,isFocusVisible:t||Cr()}),[s,c]=d.useState(!1),[u,i]=d.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=d.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),a=d.useCallback(f=>{o.current.isFocused=f,c(f),l()},[l]);Ms(f=>{o.current.isFocusVisible=f,l()},[],{isTextInput:n});let{focusProps:p}=Ns({isDisabled:r,onFocusChange:a}),{focusWithinProps:m}=Ls({isDisabled:!r,onFocusWithinChange:a});return{isFocused:s,isFocusVisible:u,focusProps:r?m:p}}var js=Object.defineProperty,_s=(e,t,n)=>t in e?js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gn=(e,t,n)=>(_s(e,typeof t!="symbol"?t+"":t,n),n);let ks=class{constructor(){gn(this,"current",this.detect()),gn(this,"handoffState","pending"),gn(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"}},Te=new ks;function bt(e){var t,n;return Te.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 $r(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Se(){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 $r(()=>{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=Se();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 rt(){let[e]=d.useState(Se);return d.useEffect(()=>()=>e.dispose(),[e]),e}let J=(e,t)=>{Te.isServer?d.useEffect(e,t):d.useLayoutEffect(e,t)};function Ke(e){let t=d.useRef(e);return J(()=>{t.current=e},[e]),t}let z=function(e){let t=Ke(e);return d.useCallback((...n)=>t.current(...n),[t])};function Rs(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 Bs(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ws({disabled:e=!1}={}){let t=d.useRef(null),[n,r]=d.useState(!1),o=rt(),s=z(()=>{t.current=null,r(!1),o.dispose()}),c=z(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let i=bt(u.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let a=Rs(l);r(Bs(a,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:c,onPointerUp:s,onClick:s}}}let Vs=d.createContext(void 0);function vn(){return d.useContext(Vs)}function bn(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ye(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,ye),r}var Dt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Dt||{}),Be=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Be||{});function ge(){let e=Us();return d.useCallback(t=>Hs({mergeRefs:e,...t}),[e])}function Hs({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:c,mergeRefs:u}){u=u??zs;let i=Or(t,e);if(s)return It(i,n,r,c,u);let l=o??0;if(l&2){let{static:a=!1,...p}=i;if(a)return It(p,n,r,c,u)}if(l&1){let{unmount:a=!0,...p}=i;return ye(a?0:1,{0(){return null},1(){return It({...p,hidden:!0,style:{display:"none"}},n,r,c,u)}})}return It(i,n,r,c,u)}function It(e,t={},n,r,o){let{as:s=n,children:c,refName:u="ref",...i}=yn(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 p={};if(t){let m=!1,f=[];for(let[h,b]of Object.entries(t))typeof b=="boolean"&&(m=!0),b===!0&&f.push(h.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(m){p["data-headlessui-state"]=f.join(" ");for(let h of f)p[`data-${h}`]=""}}if(s===d.Fragment&&(Object.keys(We(i)).length>0||Object.keys(We(p)).length>0))if(!d.isValidElement(a)||Array.isArray(a)&&a.length>1){if(Object.keys(We(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(We(i)).concat(Object.keys(We(p))).map(m=>` - ${m}`).join(`
|
|
55
|
+
*/const as=ls("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class fr{constructor(){Re(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 us extends fr{constructor(n,r){super();Re(this,"smartWallet");Re(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{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class cs extends fr{constructor(n,r,o,s="0",c="0"){super();Re(this,"currentActiveAccount");Re(this,"approved");Re(this,"chainId");Re(this,"balance");Re(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{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function fs(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new us(t,e);default:return new cs(e,!1,r||1,o,s)}}const dr=typeof document<"u"?d.useLayoutEffect:()=>{};var sn;const ds=(sn=d.useInsertionEffect)!==null&&sn!==void 0?sn:dr;function ps(e){const t=d.useRef(null);return ds(()=>{t.current=e},[e]),d.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Be=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Ye=e=>e&&"window"in e&&e.window===e?e:Be(e).defaultView||window;function ms(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function hs(e){return ms(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let vs=!1;function ln(){return vs}function pr(e,t){if(!ln())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:hs(n)?n=n.host:n=n.parentNode}return!1}const an=(e=document)=>{var t;if(!ln())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 mr(e){return ln()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Nt(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 un(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 Ie(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const cn=Ie(function(){return un(/^Mac/i)}),gs=Ie(function(){return un(/^iPhone/i)}),bs=Ie(function(){return un(/^iPad/i)||cn()&&navigator.maxTouchPoints>1}),ys=Ie(function(){return gs()||bs()});Ie(function(){return cn()||ys()}),Ie(function(){return Nt(/AppleWebKit/i)&&!xs()});const xs=Ie(function(){return Nt(/Chrome/i)}),Es=Ie(function(){return Nt(/Android/i)});Ie(function(){return Nt(/Firefox/i)});function hr(){let e=d.useRef(new Map),t=d.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=d.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=d.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return d.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ws(e){return e.mozInputSource===0&&e.isTrusted?!0:Es()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function vr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Cs(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function gr(e){let t=d.useRef({isFocused:!1,observer:null});dr(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=ps(r=>{e==null||e(r)});return d.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=vr(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 Ss=!1,vt=null,fn=new Set,gt=new Map,Ke=!1,dn=!1;const $s={Tab:!0,Escape:!0};function pn(e,t){for(let n of fn)n(e,t)}function Os(e){return!(e.metaKey||!cn()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Mt(e){Ke=!0,Os(e)&&(vt="keyboard",pn("keyboard",e))}function be(e){vt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ke=!0,pn("pointer",e))}function br(e){ws(e)&&(Ke=!0,vt="virtual")}function yr(e){e.target===window||e.target===document||Ss||!e.isTrusted||(!Ke&&!dn&&(vt="virtual",pn("virtual",e)),Ke=!1,dn=!1)}function xr(){Ke=!1,dn=!0}function mn(e){if(typeof window>"u"||typeof document>"u"||gt.get(Ye(e)))return;const t=Ye(e),n=Be(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ke=!0,r.apply(this,arguments)},n.addEventListener("keydown",Mt,!0),n.addEventListener("keyup",Mt,!0),n.addEventListener("click",br,!0),t.addEventListener("focus",yr,!0),t.addEventListener("blur",xr,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",be,!0),n.addEventListener("pointermove",be,!0),n.addEventListener("pointerup",be,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",be,!0),n.addEventListener("mousemove",be,!0),n.addEventListener("mouseup",be,!0)),t.addEventListener("beforeunload",()=>{Er(e)},{once:!0}),gt.set(t,{focus:r})}const Er=(e,t)=>{const n=Ye(e),r=Be(e);t&&r.removeEventListener("DOMContentLoaded",t),gt.has(n)&&(n.HTMLElement.prototype.focus=gt.get(n).focus,r.removeEventListener("keydown",Mt,!0),r.removeEventListener("keyup",Mt,!0),r.removeEventListener("click",br,!0),n.removeEventListener("focus",yr,!0),n.removeEventListener("blur",xr,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",be,!0),r.removeEventListener("pointermove",be,!0),r.removeEventListener("pointerup",be,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",be,!0),r.removeEventListener("mousemove",be,!0),r.removeEventListener("mouseup",be,!0)),gt.delete(n))};function Ts(e){const t=Be(e);let n;return t.readyState!=="loading"?mn(e):(n=()=>{mn(e)},t.addEventListener("DOMContentLoaded",n)),()=>Er(e,n)}typeof document<"u"&&Ts();function wr(){return vt!=="pointer"}const As=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ps(e,t,n){let r=Be(n==null?void 0:n.target);const o=typeof window<"u"?Ye(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Ye(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?Ye(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?Ye(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!As.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof c&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!$s[n.key])}function Ns(e,t,n){mn(),d.useEffect(()=>{let r=(o,s)=>{Ps(!!(n!=null&&n.isTextInput),o,s)&&e(wr())};return fn.add(r),()=>{fn.delete(r)}},t)}function Ms(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=d.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),c=gr(s),u=d.useCallback(i=>{const l=Be(i.target),a=l?an(l):an();i.target===i.currentTarget&&a===mr(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 Ls(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=d.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:u}=hr(),i=d.useCallback(p=>{p.currentTarget.contains(p.target)&&s.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(s.current.isFocusWithin=!1,u(),n&&n(p),o&&o(!1))},[n,o,s,u]),l=gr(i),a=d.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const m=Be(p.target),f=an(m);if(!s.current.isFocusWithin&&f===mr(p.nativeEvent)){r&&r(p),o&&o(!0),s.current.isFocusWithin=!0,l(p);let h=p.currentTarget;c(m,"focus",v=>{if(s.current.isFocusWithin&&!pr(h,v.target)){let b=new m.defaultView.FocusEvent("blur",{relatedTarget:v.target});Cs(b,h);let x=vr(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 Lt=!1,Ft=0;function hn(){Lt=!0,setTimeout(()=>{Lt=!1},50)}function Cr(e){e.pointerType==="touch"&&hn()}function Fs(){if(!(typeof document>"u"))return Ft===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Cr):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",hn)),Ft++,()=>{Ft--,!(Ft>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Cr):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",hn))}}function Ds(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,c]=d.useState(!1),u=d.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;d.useEffect(Fs,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=hr(),{hoverProps:a,triggerHoverEnd:p}=d.useMemo(()=>{let m=(v,b)=>{if(u.pointerType=b,o||b==="touch"||u.isHovered||!v.currentTarget.contains(v.target))return;u.isHovered=!0;let x=v.currentTarget;u.target=x,i(Be(v.target),"pointerover",E=>{u.isHovered&&u.target&&!pr(u.target,E.target)&&f(E,E.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:x,pointerType:b}),n&&n(!0),c(!0)},f=(v,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))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=v=>{Lt&&v.pointerType==="mouse"||m(v,v.pointerType)},h.onPointerLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,v.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=v=>{!u.ignoreEmulatedMouseEvents&&!Lt&&m(v,"mouse"),u.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,"mouse")}),{hoverProps:h,triggerHoverEnd:f}},[t,n,r,o,u,i,l]);return d.useEffect(()=>{o&&p({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:a,isHovered:s}}function Is(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=d.useRef({isFocused:!1,isFocusVisible:t||wr()}),[s,c]=d.useState(!1),[u,i]=d.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=d.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),a=d.useCallback(f=>{o.current.isFocused=f,c(f),l()},[l]);Ns(f=>{o.current.isFocusVisible=f,l()},[],{isTextInput:n});let{focusProps:p}=Ms({isDisabled:r,onFocusChange:a}),{focusWithinProps:m}=Ls({isDisabled:!r,onFocusWithinChange:a});return{isFocused:s,isFocusVisible:u,focusProps:r?m:p}}var js=Object.defineProperty,_s=(e,t,n)=>t in e?js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t,n)=>(_s(e,typeof t!="symbol"?t+"":t,n),n);let ks=class{constructor(){vn(this,"current",this.detect()),vn(this,"handoffState","pending"),vn(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"}},Ae=new ks;function bt(e){var t,n;return Ae.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 Sr(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Se(){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 Sr(()=>{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=Se();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 rt(){let[e]=d.useState(Se);return d.useEffect(()=>()=>e.dispose(),[e]),e}let ee=(e,t)=>{Ae.isServer?d.useEffect(e,t):d.useLayoutEffect(e,t)};function Qe(e){let t=d.useRef(e);return ee(()=>{t.current=e},[e]),t}let z=function(e){let t=Qe(e);return d.useCallback((...n)=>t.current(...n),[t])};function Rs(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 Bs(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ws({disabled:e=!1}={}){let t=d.useRef(null),[n,r]=d.useState(!1),o=rt(),s=z(()=>{t.current=null,r(!1),o.dispose()}),c=z(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let i=bt(u.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let a=Rs(l);r(Bs(a,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:c,onPointerUp:s,onClick:s}}}let Vs=d.createContext(void 0);function gn(){return d.useContext(Vs)}function bn(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ye(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,ye),r}var Dt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Dt||{}),We=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(We||{});function ve(){let e=Hs();return d.useCallback(t=>Us({mergeRefs:e,...t}),[e])}function Us({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:c,mergeRefs:u}){u=u??zs;let i=$r(t,e);if(s)return It(i,n,r,c,u);let l=o??0;if(l&2){let{static:a=!1,...p}=i;if(a)return It(p,n,r,c,u)}if(l&1){let{unmount:a=!0,...p}=i;return ye(a?0:1,{0(){return null},1(){return It({...p,hidden:!0,style:{display:"none"}},n,r,c,u)}})}return It(i,n,r,c,u)}function It(e,t={},n,r,o){let{as:s=n,children:c,refName:u="ref",...i}=yn(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 p={};if(t){let m=!1,f=[];for(let[h,v]of Object.entries(t))typeof v=="boolean"&&(m=!0),v===!0&&f.push(h.replace(/([A-Z])/g,b=>`-${b.toLowerCase()}`));if(m){p["data-headlessui-state"]=f.join(" ");for(let h of f)p[`data-${h}`]=""}}if(s===d.Fragment&&(Object.keys(Ve(i)).length>0||Object.keys(Ve(p)).length>0))if(!d.isValidElement(a)||Array.isArray(a)&&a.length>1){if(Object.keys(Ve(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(Ve(i)).concat(Object.keys(Ve(p))).map(m=>` - ${m}`).join(`
|
|
56
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(m=>` - ${m}`).join(`
|
|
57
57
|
`)].join(`
|
|
58
|
-
`))}else{let m=a.props,f=m==null?void 0:m.className,h=typeof f=="function"?(...E)=>bn(f(...E),i.className):bn(f,i.className),b=h?{className:h}:{},v=Or(a.props,We(yn(i,["ref"])));for(let E in p)E in v&&delete p[E];return d.cloneElement(a,Object.assign({},v,p,l,{ref:o(Gs(a),l.ref)},b))}return d.createElement(s,Object.assign({},yn(i,["ref"]),s!==d.Fragment&&l,s!==d.Fragment&&p),a)}function Us(){let e=d.useRef([]),t=d.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 zs(...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 Or(...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 Tr(...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 pe(e){var t;return Object.assign(d.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function We(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function yn(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Gs(e){return d.version.split(".")[0]>="19"?e.props.ref:e.ref}function Ys(e,t,n){let[r,o]=d.useState(n),s=e!==void 0,c=d.useRef(s),u=d.useRef(!1),i=d.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,z(l=>(s||o(l),t==null?void 0:t(l)))]}function Ks(e){let[t]=d.useState(e);return t}function Ar(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Mr(n,Pr(t,r),o);return n}function Pr(e,t){return e?e+"["+t+"]":t}function Mr(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Mr(e,Pr(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,""]):Ar(n,t,e)}function Qs(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 Xs="span";var xn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(xn||{});function qs(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 ge()({ourProps:s,theirProps:o,slot:{},defaultTag:Xs,name:"Hidden"})}let Nr=pe(qs),Js=d.createContext(null);function Zs({children:e}){let t=d.useContext(Js);if(!t)return d.createElement(d.Fragment,null,e);let{target:n}=t;return n?de.createPortal(d.createElement(d.Fragment,null,e),n):null}function el({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,c]=d.useState(null),u=rt();return d.useEffect(()=>{if(r&&s)return u.addEventListener(s,"reset",r)},[s,t,r]),d.createElement(Zs,null,d.createElement(tl,{setForm:c,formId:t}),Ar(e).map(([i,l])=>d.createElement(Nr,{features:xn.Hidden,...We({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function tl({setForm:e,formId:t}){return d.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:d.createElement(Nr,{features:xn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let nl=d.createContext(void 0);function Lr(){return d.useContext(nl)}function wn(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function jt(e){return wn(e)&&"tagName"in e}function Ie(e){return jt(e)&&"accessKey"in e}function ot(e){return jt(e)&&"tabIndex"in e}function rl(e){return jt(e)&&"style"in e}function ol(e){return Ie(e)&&e.nodeName==="IFRAME"}function Fr(e){return Ie(e)&&e.nodeName==="INPUT"}function Dr(e){return Ie(e)&&e.nodeName==="LABEL"}function il(e){return Ie(e)&&e.nodeName==="FIELDSET"}function Ir(e){return Ie(e)&&e.nodeName==="LEGEND"}function sl(e){return jt(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function ll(e){let t=e.parentElement,n=null;for(;t&&!il(t);)Ir(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&al(n)?!1:r}function al(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Ir(t))return!1;t=t.previousElementSibling}return!0}let jr=Symbol();function ul(e,t=!0){return Object.assign(e,{[jr]:t})}function xe(...e){let t=d.useRef(e);d.useEffect(()=>{t.current=e},[e]);let n=z(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[jr]))?void 0:n}let En=d.createContext(null);En.displayName="DescriptionContext";function _r(){let e=d.useContext(En);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,_r),t}return e}function cl(){var e,t;return(t=(e=d.useContext(En))==null?void 0:e.value)!=null?t:void 0}let fl="p";function dl(e,t){let n=d.useId(),r=vn(),{id:o=`headlessui-description-${n}`,...s}=e,c=_r(),u=xe(t);J(()=>c.register(o),[o,c.register]);let i=r||!1,l=d.useMemo(()=>({...c.slot,disabled:i}),[c.slot,i]),a={ref:u,...c.props,id:o};return ge()({ourProps:a,theirProps:s,slot:l,defaultTag:fl,name:c.name||"Description"})}let pl=pe(dl);Object.assign(pl,{});var se=(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))(se||{});let _t=d.createContext(null);_t.displayName="LabelContext";function kr(){let e=d.useContext(_t);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,kr),t}return e}function Rr(e){var t,n,r;let o=(n=(t=d.useContext(_t))==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 ml({inherit:e=!1}={}){let t=Rr(),[n,r]=d.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,d.useMemo(()=>function(s){let c=z(i=>(r(l=>[...l,i]),()=>r(l=>{let a=l.slice(),p=a.indexOf(i);return p!==-1&&a.splice(p,1),a}))),u=d.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 d.createElement(_t.Provider,{value:u},s.children)},[r])]}let hl="label";function gl(e,t){var n;let r=d.useId(),o=kr(),s=Lr(),c=vn(),{id:u=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...a}=e,p=xe(t);J(()=>o.register(u),[u,o.register]);let m=z(v=>{let E=v.currentTarget;if(!(v.target!==v.currentTarget&&sl(v.target))&&(Dr(E)&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),Dr(E))){let x=document.getElementById(E.htmlFor);if(x){let y=x.getAttribute("disabled");if(y==="true"||y==="")return;let S=x.getAttribute("aria-disabled");if(S==="true"||S==="")return;(Fr(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=c||!1,h=d.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),b={ref:p,...o.props,id:u,htmlFor:i,onClick:m};return l&&("onClick"in b&&(delete b.htmlFor,delete b.onClick),"onClick"in a&&delete a.onClick),ge()({ourProps:b,theirProps:a,slot:h,defaultTag:i?hl:"div",name:o.name||"Label"})}let vl=pe(gl),bl=Object.assign(vl,{});function yl(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 xl(e=yl){return d.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 wl(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function El(e,t=!1){let[n,r]=d.useReducer(()=>({}),{}),o=d.useMemo(()=>wl(e),[e,n]);return J(()=>{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 Br=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 Cl=Object.defineProperty,Sl=(e,t,n)=>t in e?Cl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$l=(e,t,n)=>(Sl(e,t+"",n),n),Wr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},we=(e,t,n)=>(Wr(e,t,"read from private field"),n?n.call(e):t.get(e)),Cn=(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)},Vr=(e,t,n,r)=>(Wr(e,t,"write to private field"),t.set(e,n),n),Ae,yt,xt;let Hr=class{constructor(t){Cn(this,Ae,{}),Cn(this,yt,new Br(()=>new Set)),Cn(this,xt,new Set),$l(this,"disposables",Se()),Vr(this,Ae,t),Te.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return we(this,Ae)}subscribe(t,n){if(Te.isServer)return()=>{};let r={selector:t,callback:n,current:t(we(this,Ae))};return we(this,xt).add(r),this.disposables.add(()=>{we(this,xt).delete(r)})}on(t,n){return Te.isServer?()=>{}:(we(this,yt).get(t).add(n),this.disposables.add(()=>{we(this,yt).get(t).delete(n)}))}send(t){let n=this.reduce(we(this,Ae),t);if(n!==we(this,Ae)){Vr(this,Ae,n);for(let r of we(this,xt)){let o=r.selector(we(this,Ae));Ur(r.current,o)||(r.current=o,r.callback(o))}for(let r of we(this,yt).get(t.type))r(we(this,Ae),t)}}};Ae=new WeakMap,yt=new WeakMap,xt=new WeakMap;function Ur(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:Sn(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Sn(e.entries(),t.entries()):zr(e)&&zr(t)?Sn(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Sn(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 zr(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=Se();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Ol=Object.defineProperty,Tl=(e,t,n)=>t in e?Ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gr=(e,t,n)=>(Tl(e,typeof t!="symbol"?t+"":t,n),n),Yr=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Yr||{});let Al={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}}},Pl=class Qi extends Hr{constructor(){super(...arguments),Gr(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Gr(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Qi({stack:[]})}reduce(t,n){return ye(n.type,Al,t,n)}};const On=new Br(()=>Pl.new());var Tn={exports:{}},An={};/**
|
|
58
|
+
`))}else{let m=a.props,f=m==null?void 0:m.className,h=typeof f=="function"?(...x)=>bn(f(...x),i.className):bn(f,i.className),v=h?{className:h}:{},b=$r(a.props,Ve(yn(i,["ref"])));for(let x in p)x in b&&delete p[x];return d.cloneElement(a,Object.assign({},b,p,l,{ref:o(Gs(a),l.ref)},v))}return d.createElement(s,Object.assign({},yn(i,["ref"]),s!==d.Fragment&&l,s!==d.Fragment&&p),a)}function Hs(){let e=d.useRef([]),t=d.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 zs(...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 $r(...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 Or(...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 me(e){var t;return Object.assign(d.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Ve(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function yn(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Gs(e){return d.version.split(".")[0]>="19"?e.props.ref:e.ref}function Ys(e,t,n){let[r,o]=d.useState(n),s=e!==void 0,c=d.useRef(s),u=d.useRef(!1),i=d.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,z(l=>(s||o(l),t==null?void 0:t(l)))]}function Ks(e){let[t]=d.useState(e);return t}function Tr(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Pr(n,Ar(t,r),o);return n}function Ar(e,t){return e?e+"["+t+"]":t}function Pr(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Pr(e,Ar(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,""]):Tr(n,t,e)}function Qs(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 Xs="span";var xn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(xn||{});function qs(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 ve()({ourProps:s,theirProps:o,slot:{},defaultTag:Xs,name:"Hidden"})}let Nr=me(qs),Js=d.createContext(null);function Zs({children:e}){let t=d.useContext(Js);if(!t)return d.createElement(d.Fragment,null,e);let{target:n}=t;return n?pe.createPortal(d.createElement(d.Fragment,null,e),n):null}function el({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,c]=d.useState(null),u=rt();return d.useEffect(()=>{if(r&&s)return u.addEventListener(s,"reset",r)},[s,t,r]),d.createElement(Zs,null,d.createElement(tl,{setForm:c,formId:t}),Tr(e).map(([i,l])=>d.createElement(Nr,{features:xn.Hidden,...Ve({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function tl({setForm:e,formId:t}){return d.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:d.createElement(Nr,{features:xn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let nl=d.createContext(void 0);function Mr(){return d.useContext(nl)}function En(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function jt(e){return En(e)&&"tagName"in e}function je(e){return jt(e)&&"accessKey"in e}function ot(e){return jt(e)&&"tabIndex"in e}function rl(e){return jt(e)&&"style"in e}function ol(e){return je(e)&&e.nodeName==="IFRAME"}function Lr(e){return je(e)&&e.nodeName==="INPUT"}function Fr(e){return je(e)&&e.nodeName==="LABEL"}function il(e){return je(e)&&e.nodeName==="FIELDSET"}function Dr(e){return je(e)&&e.nodeName==="LEGEND"}function sl(e){return jt(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function ll(e){let t=e.parentElement,n=null;for(;t&&!il(t);)Dr(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&al(n)?!1:r}function al(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Dr(t))return!1;t=t.previousElementSibling}return!0}let Ir=Symbol();function ul(e,t=!0){return Object.assign(e,{[Ir]:t})}function xe(...e){let t=d.useRef(e);d.useEffect(()=>{t.current=e},[e]);let n=z(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[Ir]))?void 0:n}let wn=d.createContext(null);wn.displayName="DescriptionContext";function jr(){let e=d.useContext(wn);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,jr),t}return e}function cl(){var e,t;return(t=(e=d.useContext(wn))==null?void 0:e.value)!=null?t:void 0}let fl="p";function dl(e,t){let n=d.useId(),r=gn(),{id:o=`headlessui-description-${n}`,...s}=e,c=jr(),u=xe(t);ee(()=>c.register(o),[o,c.register]);let i=r||!1,l=d.useMemo(()=>({...c.slot,disabled:i}),[c.slot,i]),a={ref:u,...c.props,id:o};return ve()({ourProps:a,theirProps:s,slot:l,defaultTag:fl,name:c.name||"Description"})}let pl=me(dl);Object.assign(pl,{});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 _t=d.createContext(null);_t.displayName="LabelContext";function _r(){let e=d.useContext(_t);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,_r),t}return e}function kr(e){var t,n,r;let o=(n=(t=d.useContext(_t))==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 ml({inherit:e=!1}={}){let t=kr(),[n,r]=d.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,d.useMemo(()=>function(s){let c=z(i=>(r(l=>[...l,i]),()=>r(l=>{let a=l.slice(),p=a.indexOf(i);return p!==-1&&a.splice(p,1),a}))),u=d.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 d.createElement(_t.Provider,{value:u},s.children)},[r])]}let hl="label";function vl(e,t){var n;let r=d.useId(),o=_r(),s=Mr(),c=gn(),{id:u=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...a}=e,p=xe(t);ee(()=>o.register(u),[u,o.register]);let m=z(b=>{let x=b.currentTarget;if(!(b.target!==b.currentTarget&&sl(b.target))&&(Fr(x)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),Fr(x))){let E=document.getElementById(x.htmlFor);if(E){let y=E.getAttribute("disabled");if(y==="true"||y==="")return;let C=E.getAttribute("aria-disabled");if(C==="true"||C==="")return;(Lr(E)&&(E.type==="file"||E.type==="radio"||E.type==="checkbox")||E.role==="radio"||E.role==="checkbox"||E.role==="switch")&&E.click(),E.focus({preventScroll:!0})}}}),f=c||!1,h=d.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),v={ref:p,...o.props,id:u,htmlFor:i,onClick:m};return l&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in a&&delete a.onClick),ve()({ourProps:v,theirProps:a,slot:h,defaultTag:i?hl:"div",name:o.name||"Label"})}let gl=me(vl),bl=Object.assign(gl,{});function yl(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 xl(e=yl){return d.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 El(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function wl(e,t=!1){let[n,r]=d.useReducer(()=>({}),{}),o=d.useMemo(()=>El(e),[e,n]);return ee(()=>{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 Rr=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 Cl=Object.defineProperty,Sl=(e,t,n)=>t in e?Cl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$l=(e,t,n)=>(Sl(e,t+"",n),n),Br=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ee=(e,t,n)=>(Br(e,t,"read from private field"),n?n.call(e):t.get(e)),Cn=(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)},Wr=(e,t,n,r)=>(Br(e,t,"write to private field"),t.set(e,n),n),Pe,yt,xt;let Vr=class{constructor(t){Cn(this,Pe,{}),Cn(this,yt,new Rr(()=>new Set)),Cn(this,xt,new Set),$l(this,"disposables",Se()),Wr(this,Pe,t),Ae.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Ee(this,Pe)}subscribe(t,n){if(Ae.isServer)return()=>{};let r={selector:t,callback:n,current:t(Ee(this,Pe))};return Ee(this,xt).add(r),this.disposables.add(()=>{Ee(this,xt).delete(r)})}on(t,n){return Ae.isServer?()=>{}:(Ee(this,yt).get(t).add(n),this.disposables.add(()=>{Ee(this,yt).get(t).delete(n)}))}send(t){let n=this.reduce(Ee(this,Pe),t);if(n!==Ee(this,Pe)){Wr(this,Pe,n);for(let r of Ee(this,xt)){let o=r.selector(Ee(this,Pe));Ur(r.current,o)||(r.current=o,r.callback(o))}for(let r of Ee(this,yt).get(t.type))r(Ee(this,Pe),t)}}};Pe=new WeakMap,yt=new WeakMap,xt=new WeakMap;function Ur(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:Sn(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Sn(e.entries(),t.entries()):Hr(e)&&Hr(t)?Sn(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Sn(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 Hr(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=Se();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Ol=Object.defineProperty,Tl=(e,t,n)=>t in e?Ol(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zr=(e,t,n)=>(Tl(e,typeof t!="symbol"?t+"":t,n),n),Gr=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Gr||{});let Al={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}}},Pl=class Qi extends Vr{constructor(){super(...arguments),zr(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),zr(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Qi({stack:[]})}reduce(t,n){return ye(n.type,Al,t,n)}};const On=new Rr(()=>Pl.new());var Tn={exports:{}},An={};/**
|
|
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 Yr;function Nl(){if(Yr)return An;Yr=1;var e=d;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,c=e.useMemo,u=e.useDebugValue;return An.useSyncExternalStoreWithSelector=function(i,l,a,p,m){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=c(function(){function b(S){if(!x){if(x=!0,E=S,S=p(S),m!==void 0&&h.hasValue){var A=h.value;if(m(A,S))return y=A}return y=S}if(A=y,n(E,S))return A;var L=p(S);return m!==void 0&&m(A,L)?(E=S,A):(E=S,y=L)}var x=!1,E,y,C=a===void 0?null:a;return[function(){return b(l())},C===null?void 0:function(){return b(C())}]},[l,a,p,m]);var v=r(i,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=v},[v]),u(v),v},An}var Pn={};/**
|
|
67
67
|
* @license React
|
|
68
68
|
* use-sync-external-store-with-selector.development.js
|
|
69
69
|
*
|
|
@@ -71,34 +71,34 @@ 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 Qr;function Nl(){return Qr||(Qr=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=d,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,u=t.useDebugValue;Pn.useSyncExternalStoreWithSelector=function(i,l,a,p,m){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=c(function(){function v(C){if(!E){if(E=!0,x=C,C=p(C),m!==void 0&&h.hasValue){var O=h.value;if(m(O,C))return y=O}return y=C}if(O=y,n(x,C))return O;var F=p(C);return m!==void 0&&m(O,F)?(x=C,O):(x=C,y=F)}var E=!1,x,y,S=a===void 0?null:a;return[function(){return v(l())},S===null?void 0:function(){return v(S())}]},[l,a,p,m]);var b=r(i,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),u(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Pn}process.env.NODE_ENV==="production"?Tn.exports=Ml():Tn.exports=Nl();var Ll=Tn.exports;function Ee(e,t,n=Ur){return Ll.useSyncExternalStoreWithSelector(z(r=>e.subscribe(Fl,r)),z(()=>e.state),z(()=>e.state),z(t),n)}function Fl(e){return e}function Xr(e,t){let n=d.useId(),r=On.get(t),[o,s]=Ee(r,d.useCallback(c=>[r.selectors.isTop(c,n),r.selectors.inStack(c,n)],[r,n]));return J(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Mn=new Map,wt=new Map;function qr(e){var t;let n=(t=wt.get(e))!=null?t:0;return wt.set(e,n+1),n!==0?()=>Jr(e):(Mn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Jr(e))}function Jr(e){var t;let n=(t=wt.get(e))!=null?t:1;if(n===1?wt.delete(e):wt.set(e,n-1),n!==1)return;let r=Mn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Mn.delete(e))}function Dl(e,{allowed:t,disallowed:n}={}){let r=Xr(e,"inert-others");J(()=>{var o,s;if(!r)return;let c=Se();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&c.add(qr(i));let u=(s=t==null?void 0:t())!=null?s:[];for(let i of u){if(!i)continue;let l=bt(i);if(!l)continue;let a=i.parentElement;for(;a&&a!==l.body;){for(let p of a.children)u.some(m=>p.contains(m))||c.add(qr(p));a=a.parentElement}}return c.dispose},[r,t,n])}function Il(e,t,n){let r=Ke(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});d.useEffect(()=>{if(!e)return;let o=t===null?null:Ie(t)?t:t.current;if(!o)return;let s=Se();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(","),jl=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ln=(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))(Ln||{}),_l=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(_l||{}),kl=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(kl||{});function Zr(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 Rl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(jl)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Fn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Fn||{});function eo(e,t=0){var n;return e===((n=bt(e))==null?void 0:n.body)?!1:ye(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 Bl=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Bl||{});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 Wl=["textarea","input"].join(",");function Vl(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Wl))!=null?n:!1}function to(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 Hl(e,t){return Ul(Zr(),t,{relativeTo:e})}function Ul(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?to(e):e:t&64?Rl(e):Zr(e);o.length>0&&c.length>1&&(c=c.filter(f=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===f:h===f))),r=r??s.activeElement;let u=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,c.indexOf(r))-1;if(t&4)return Math.max(0,c.indexOf(r))+1;if(t&8)return c.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},a=0,p=c.length,m;do{if(a>=p||a+p<=0)return 0;let f=i+a;if(t&16)f=(f+p)%p;else{if(f<0)return 3;if(f>=p)return 1}m=c[f],m==null||m.focus(l),a+=u}while(m!==s.activeElement);return t&6&&Vl(m)&&m.select(),2}function no(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function zl(){return/Android/gi.test(window.navigator.userAgent)}function ro(){return no()||zl()}function it(e,t,n,r){let o=Ke(n);d.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 Gl(e,t,n,r){let o=Ke(n);d.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 oo=30;function Yl(e,t,n){let r=Ke(n),o=d.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 p(m){return typeof m=="function"?p(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let p of a)if(p!==null&&(p.contains(l)||u.composed&&u.composedPath().includes(p)))return;return!eo(l,Fn.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),s=d.useRef(null);it(e,"pointerdown",u=>{var i,l;ro()||(s.current=((l=(i=u.composedPath)==null?void 0:i.call(u))==null?void 0:l[0])||u.target)},!0),it(e,"pointerup",u=>{if(ro()||!s.current)return;let i=s.current;return s.current=null,o(u,()=>i)},!0);let c=d.useRef({x:0,y:0});it(e,"touchstart",u=>{c.current.x=u.touches[0].clientX,c.current.y=u.touches[0].clientY},!0),it(e,"touchend",u=>{let i={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(i.x-c.current.x)>=oo||Math.abs(i.y-c.current.y)>=oo))return o(u,()=>ot(u.target)?u.target:null)},!0),Gl(e,"blur",u=>o(u,()=>ol(window.document.activeElement)?window.document.activeElement:null),!0)}function Dn(...e){return d.useMemo(()=>bt(...e),[...e])}var Kl=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(Kl||{});const kt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},Ql=200,io=5;function Xl(e,{trigger:t,action:n,close:r,select:o}){let s=d.useRef(null),c=d.useRef(null),u=d.useRef(null);it(e&&t!==null,"pointerdown",i=>{wn(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(c.current=i.x,u.current=i.y,s.current=i.timeStamp)}),it(e&&t!==null,"pointerup",i=>{var l,a;let p=s.current;if(p===null||(s.current=null,!ot(i.target))||Math.abs(i.x-((l=c.current)!=null?l:i.x))<io&&Math.abs(i.y-((a=u.current)!=null?a:i.y))<io)return;let m=n(i);switch(m.kind){case 0:return;case 1:{i.timeStamp-p>Ql&&(o(m.target),r());break}case 2:{r();break}}},{capture:!0})}function ql(e,t){return d.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 Jl(e){return d.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Zl(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 ea(){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 ta(){return no()?{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=Se();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(ot(u.target))try{let i=u.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),a=e.querySelector(l);ot(a)&&!r(a)&&(c=a)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(ot(u.target)&&rl(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(ot(u.target)){if(Fr(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 na(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function ra(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Qe=Zl(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Se(),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:ra(n)},o=[ta(),ea(),na()];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)}});Qe.subscribe(()=>{let e=Qe.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)&&Qe.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Qe.dispatch("TEARDOWN",n)}});function oa(e,t,n=()=>({containers:[]})){let r=Jl(Qe),o=t?r.get(t):void 0,s=o?o.count>0:!1;return J(()=>{if(!(!t||!e))return Qe.dispatch("PUSH",t,n),()=>Qe.dispatch("POP",t,n)},[e,t]),s}function ia(e,t,n=()=>[document.body]){let r=Xr(e,"scroll-lock");oa(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function so(e){return[e.screenX,e.screenY]}function sa(){let e=d.useRef([-1,-1]);return{wasMoved(t){let n=so(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=so(t)}}}function la(e=0){let[t,n]=d.useState(e),r=d.useCallback(i=>n(i),[t]),o=d.useCallback(i=>n(l=>l|i),[t]),s=d.useCallback(i=>(t&i)===i,[t]),c=d.useCallback(i=>n(l=>l&~i),[n]),u=d.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:c,toggleFlag:u}}var lo,ao;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((lo=process==null?void 0:process.env)==null?void 0:lo.NODE_ENV)==="test"&&typeof((ao=Element==null?void 0:Element.prototype)==null?void 0:ao.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 aa=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(aa||{});function uo(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function co(e,t,n,r){let[o,s]=d.useState(n),{hasFlag:c,addFlag:u,removeFlag:i}=la(e&&o?3:0),l=d.useRef(!1),a=d.useRef(!1),p=rt();return J(()=>{var m;if(e){if(n&&s(!0),!t){n&&u(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),ua(t,{inFlight:l,prepare(){a.current?a.current=!1:a.current=l.current,l.current=!0,!a.current&&(n?(u(3),i(4)):(u(4),i(2)))},run(){a.current?n?(i(3),u(4)):(i(4),u(3)):n?i(1):u(1)},done(){var f;a.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,p]),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 ua(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Se();return fa(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(ca(e,r))})}),s.dispose}function ca(e,t){var n,r;let o=Se();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 fa(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 Rt(){return typeof window<"u"}function st(e){return fo(e)?(e.nodeName||"").toLowerCase():"#document"}function ve(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pe(e){var t;return(t=(fo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fo(e){return Rt()?e instanceof Node||e instanceof ve(e).Node:!1}function ae(e){return Rt()?e instanceof Element||e instanceof ve(e).Element:!1}function Me(e){return Rt()?e instanceof HTMLElement||e instanceof ve(e).HTMLElement:!1}function po(e){return!Rt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ve(e).ShadowRoot}const da=new Set(["inline","contents"]);function Et(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$e(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!da.has(o)}const pa=new Set(["table","td","th"]);function ma(e){return pa.has(st(e))}const ha=[":popover-open",":modal"];function Bt(e){return ha.some(t=>{try{return e.matches(t)}catch{return!1}})}const ga=["transform","translate","scale","rotate","perspective"],va=["transform","translate","scale","rotate","perspective","filter"],ba=["paint","layout","strict","content"];function In(e){const t=jn(),n=ae(e)?$e(e):e;return ga.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)||va.some(r=>(n.willChange||"").includes(r))||ba.some(r=>(n.contain||"").includes(r))}function ya(e){let t=Ve(e);for(;Me(t)&&!lt(t);){if(In(t))return t;if(Bt(t))return null;t=Ve(t)}return null}function jn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xa=new Set(["html","body","#document"]);function lt(e){return xa.has(st(e))}function $e(e){return ve(e).getComputedStyle(e)}function Wt(e){return ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ve(e){if(st(e)==="html")return e;const t=e.assignedSlot||e.parentNode||po(e)&&e.host||Pe(e);return po(t)?t.host:t}function mo(e){const t=Ve(e);return lt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Me(t)&&Et(t)?t:mo(t)}function Ct(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=mo(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=ve(o);if(s){const u=_n(c);return t.concat(c,c.visualViewport||[],Et(o)?o:[],u&&n?Ct(u):[])}return t.concat(o,Ct(o,[],n))}function _n(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wa(){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 Xe=Math.min,ue=Math.max,St=Math.round,Vt=Math.floor,Ne=e=>({x:e,y:e}),Ea={left:"right",right:"left",bottom:"top",top:"bottom"},Ca={start:"end",end:"start"};function ho(e,t,n){return ue(e,Xe(t,n))}function at(e,t){return typeof e=="function"?e(t):e}function He(e){return e.split("-")[0]}function $t(e){return e.split("-")[1]}function go(e){return e==="x"?"y":"x"}function vo(e){return e==="y"?"height":"width"}const Sa=new Set(["top","bottom"]);function je(e){return Sa.has(He(e))?"y":"x"}function bo(e){return go(je(e))}function $a(e,t,n){n===void 0&&(n=!1);const r=$t(e),o=bo(e),s=vo(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=Ht(c)),[c,Ht(c)]}function Oa(e){const t=Ht(e);return[kn(e),t,kn(t)]}function kn(e){return e.replace(/start|end/g,t=>Ca[t])}const yo=["left","right"],xo=["right","left"],Ta=["top","bottom"],Aa=["bottom","top"];function Pa(e,t,n){switch(e){case"top":case"bottom":return n?t?xo:yo:t?yo:xo;case"left":case"right":return t?Ta:Aa;default:return[]}}function Ma(e,t,n,r){const o=$t(e);let s=Pa(He(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(kn)))),s}function Ht(e){return e.replace(/left|right|bottom|top/g,t=>Ea[t])}function Na(e){return{top:0,right:0,bottom:0,left:0,...e}}function La(e){return typeof e!="number"?Na(e):{top:e,right:e,bottom:e,left:e}}function Ut(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 wo(e,t,n){let{reference:r,floating:o}=e;const s=je(t),c=bo(t),u=vo(c),i=He(t),l=s==="y",a=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[u]/2-o[u]/2;let f;switch(i){case"top":f={x:a,y:r.y-o.height};break;case"bottom":f={x:a,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-o.width,y:p};break;default:f={x:r.x,y:r.y}}switch($t(t)){case"start":f[c]-=m*(n&&l?-1:1);break;case"end":f[c]+=m*(n&&l?-1:1);break}return f}const Fa=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:p}=wo(l,r,i),m=r,f={},h=0;for(let b=0;b<u.length;b++){const{name:v,fn:E}=u[b],{x,y,data:S,reset:C}=await E({x:a,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:l,platform:c,elements:{reference:e,floating:t}});a=x??a,p=y??p,f={...f,[v]:{...f[v],...S}},C&&h<=50&&(h++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(l=C.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:a,y:p}=wo(l,m,i)),b=-1)}return{x:a,y:p,placement:m,strategy:o,middlewareData:f}};async function zt(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:p="floating",altBoundary:m=!1,padding:f=0}=at(t,e),h=La(f),v=u[m?p==="floating"?"reference":"floating":p],E=Ut(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:l,rootBoundary:a,strategy:i})),x=p==="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},C=Ut(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:x,offsetParent:y,strategy:i}):x);return{top:(E.top-C.top+h.top)/S.y,bottom:(C.bottom-E.bottom+h.bottom)/S.y,left:(E.left-C.left+h.left)/S.x,right:(C.right-E.right+h.right)/S.x}}const Da=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:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...v}=at(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const E=He(o),x=je(u),y=He(u)===u,S=await(i.isRTL==null?void 0:i.isRTL(l.floating)),C=m||(y||!b?[Ht(u)]:Oa(u)),O=h!=="none";!m&&O&&C.push(...Ma(u,b,h,S));const F=[u,...C],R=await zt(t,v),V=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&V.push(R[E]),p){const A=$a(o,c,S);V.push(R[A[0]],R[A[1]])}if(M=[...M,{placement:o,overflows:V}],!V.every(A=>A<=0)){var L,Y;const A=(((L=s.flip)==null?void 0:L.index)||0)+1,D=F[A];if(D&&(!(p==="alignment"?x!==je(D):!1)||M.every(T=>je(T.placement)===x?T.overflows[0]>0:!0)))return{data:{index:A,overflows:M},reset:{placement:D}};let B=(Y=M.filter(H=>H.overflows[0]<=0).sort((H,T)=>H.overflows[1]-T.overflows[1])[0])==null?void 0:Y.placement;if(!B)switch(f){case"bestFit":{var j;const H=(j=M.filter(T=>{if(O){const k=je(T.placement);return k===x||k==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(k=>k>0).reduce((k,Q)=>k+Q,0)]).sort((T,k)=>T[1]-k[1])[0])==null?void 0:j[0];H&&(B=H);break}case"initialPlacement":B=u;break}if(o!==B)return{reset:{placement:B}}}return{}}}},Ia=new Set(["left","top"]);async function ja(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=He(n),u=$t(n),i=je(n)==="y",l=Ia.has(c)?-1:1,a=s&&i?-1:1,p=at(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof h=="number"&&(f=u==="end"?h*-1:h),i?{x:f*a,y:m*l}:{x:m*l,y:f*a}}const _a=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 ja(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}}}}},ka=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:v=>{let{x:E,y:x}=v;return{x:E,y:x}}},...i}=at(e,t),l={x:n,y:r},a=await zt(t,i),p=je(He(o)),m=go(p);let f=l[m],h=l[p];if(s){const v=m==="y"?"top":"left",E=m==="y"?"bottom":"right",x=f+a[v],y=f-a[E];f=ho(x,f,y)}if(c){const v=p==="y"?"top":"left",E=p==="y"?"bottom":"right",x=h+a[v],y=h-a[E];h=ho(x,h,y)}const b=u.fn({...t,[m]:f,[p]:h});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[m]:s,[p]:c}}}}}},Ra=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}=at(e,t),a=await zt(t,l),p=He(o),m=$t(o),f=je(o)==="y",{width:h,height:b}=s.floating;let v,E;p==="top"||p==="bottom"?(v=p,E=m===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(E=p,v=m==="end"?"top":"bottom");const x=b-a.top-a.bottom,y=h-a.left-a.right,S=Xe(b-a[v],x),C=Xe(h-a[E],y),O=!t.middlewareData.shift;let F=S,R=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=x),O&&!m){const M=ue(a.left,0),L=ue(a.right,0),Y=ue(a.top,0),j=ue(a.bottom,0);f?R=h-2*(M!==0||L!==0?M+L:ue(a.left,a.right)):F=b-2*(Y!==0||j!==0?Y+j:ue(a.top,a.bottom))}await i({...t,availableWidth:R,availableHeight:F});const V=await c.getDimensions(u.floating);return h!==V.width||b!==V.height?{reset:{rects:!0}}:{}}}};function Eo(e){const t=$e(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Me(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,u=St(n)!==s||St(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}function Rn(e){return ae(e)?e:e.contextElement}function ut(e){const t=Rn(e);if(!Me(t))return Ne(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Eo(t);let c=(s?St(n.width):n.width)/r,u=(s?St(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const Ba=Ne(0);function Co(e){const t=ve(e);return!jn()||!t.visualViewport?Ba:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Wa(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ve(e)?!1:t}function qe(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Rn(e);let c=Ne(1);t&&(r?ae(r)&&(c=ut(r)):c=ut(e));const u=Wa(s,n,r)?Co(s):Ne(0);let i=(o.left+u.x)/c.x,l=(o.top+u.y)/c.y,a=o.width/c.x,p=o.height/c.y;if(s){const m=ve(s),f=r&&ae(r)?ve(r):r;let h=m,b=_n(h);for(;b&&r&&f!==h;){const v=ut(b),E=b.getBoundingClientRect(),x=$e(b),y=E.left+(b.clientLeft+parseFloat(x.paddingLeft))*v.x,S=E.top+(b.clientTop+parseFloat(x.paddingTop))*v.y;i*=v.x,l*=v.y,a*=v.x,p*=v.y,i+=y,l+=S,h=ve(b),b=_n(h)}}return Ut({width:a,height:p,x:i,y:l})}function Gt(e,t){const n=Wt(e).scrollLeft;return t?t.left+n:qe(Pe(e)).left+n}function So(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Gt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Va(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=Pe(r),u=t?Bt(t.floating):!1;if(r===c||u&&s)return n;let i={scrollLeft:0,scrollTop:0},l=Ne(1);const a=Ne(0),p=Me(r);if((p||!p&&!s)&&((st(r)!=="body"||Et(c))&&(i=Wt(r)),Me(r))){const f=qe(r);l=ut(r),a.x=f.x+r.clientLeft,a.y=f.y+r.clientTop}const m=c&&!p&&!s?So(c,i):Ne(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+a.x+m.x,y:n.y*l.y-i.scrollTop*l.y+a.y+m.y}}function Ha(e){return Array.from(e.getClientRects())}function Ua(e){const t=Pe(e),n=Wt(e),r=e.ownerDocument.body,o=ue(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ue(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Gt(e);const u=-n.scrollTop;return $e(r).direction==="rtl"&&(c+=ue(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:u}}const $o=25;function za(e,t){const n=ve(e),r=Pe(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=jn();(!a||a&&t==="fixed")&&(u=o.offsetLeft,i=o.offsetTop)}const l=Gt(r);if(l<=0){const a=r.ownerDocument,p=a.body,m=getComputedStyle(p),f=a.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(r.clientWidth-p.clientWidth-f);h<=$o&&(s-=h)}else l<=$o&&(s+=l);return{width:s,height:c,x:u,y:i}}const Ga=new Set(["absolute","fixed"]);function Ya(e,t){const n=qe(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Me(e)?ut(e):Ne(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 Oo(e,t,n){let r;if(t==="viewport")r=za(e,n);else if(t==="document")r=Ua(Pe(e));else if(ae(t))r=Ya(t,n);else{const o=Co(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ut(r)}function To(e,t){const n=Ve(e);return n===t||!ae(n)||lt(n)?!1:$e(n).position==="fixed"||To(n,t)}function Ka(e,t){const n=t.get(e);if(n)return n;let r=Ct(e,[],!1).filter(u=>ae(u)&&st(u)!=="body"),o=null;const s=$e(e).position==="fixed";let c=s?Ve(e):e;for(;ae(c)&&!lt(c);){const u=$e(c),i=In(c);!i&&u.position==="fixed"&&(o=null),(s?!i&&!o:!i&&u.position==="static"&&!!o&&Ga.has(o.position)||Et(c)&&!i&&To(e,c))?r=r.filter(a=>a!==c):o=u,c=Ve(c)}return t.set(e,r),r}function Qa(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Bt(t)?[]:Ka(t,this._c):[].concat(n),r],u=c[0],i=c.reduce((l,a)=>{const p=Oo(t,a,o);return l.top=ue(p.top,l.top),l.right=Xe(p.right,l.right),l.bottom=Xe(p.bottom,l.bottom),l.left=ue(p.left,l.left),l},Oo(t,u,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function Xa(e){const{width:t,height:n}=Eo(e);return{width:t,height:n}}function qa(e,t,n){const r=Me(t),o=Pe(t),s=n==="fixed",c=qe(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const i=Ne(0);function l(){i.x=Gt(o)}if(r||!r&&!s)if((st(t)!=="body"||Et(o))&&(u=Wt(t)),r){const f=qe(t,!0,s,t);i.x=f.x+t.clientLeft,i.y=f.y+t.clientTop}else o&&l();s&&!r&&o&&l();const a=o&&!r&&!s?So(o,u):Ne(0),p=c.left+u.scrollLeft-i.x-a.x,m=c.top+u.scrollTop-i.y-a.y;return{x:p,y:m,width:c.width,height:c.height}}function Bn(e){return $e(e).position==="static"}function Ao(e,t){if(!Me(e)||$e(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Pe(e)===n&&(n=n.ownerDocument.body),n}function Po(e,t){const n=ve(e);if(Bt(e))return n;if(!Me(e)){let o=Ve(e);for(;o&&!lt(o);){if(ae(o)&&!Bn(o))return o;o=Ve(o)}return n}let r=Ao(e,t);for(;r&&ma(r)&&Bn(r);)r=Ao(r,t);return r&<(r)&&Bn(r)&&!In(r)?n:r||ya(e)||n}const Ja=async function(e){const t=this.getOffsetParent||Po,n=this.getDimensions,r=await n(e.floating);return{reference:qa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Za(e){return $e(e).direction==="rtl"}const eu={convertOffsetParentRelativeRectToViewportRelativeRect:Va,getDocumentElement:Pe,getClippingRect:Qa,getOffsetParent:Po,getElementRects:Ja,getClientRects:Ha,getDimensions:Xa,getScale:ut,isElement:ae,isRTL:Za};function Mo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tu(e,t){let n=null,r;const o=Pe(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:p,width:m,height:f}=l;if(u||t(),!m||!f)return;const h=Vt(p),b=Vt(o.clientWidth-(a+m)),v=Vt(o.clientHeight-(p+f)),E=Vt(a),y={rootMargin:-h+"px "+-b+"px "+-v+"px "+-E+"px",threshold:ue(0,Xe(1,i))||1};let S=!0;function C(O){const F=O[0].intersectionRatio;if(F!==i){if(!S)return c();F?c(!1,F):r=setTimeout(()=>{c(!1,1e-7)},1e3)}F===1&&!Mo(l,e.getBoundingClientRect())&&c(),S=!1}try{n=new IntersectionObserver(C,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,y)}n.observe(e)}return c(!0),s}function nu(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=Rn(e),a=o||s?[...l?Ct(l):[],...Ct(t)]:[];a.forEach(E=>{o&&E.addEventListener("scroll",n,{passive:!0}),s&&E.addEventListener("resize",n)});const p=l&&u?tu(l,n):null;let m=-1,f=null;c&&(f=new ResizeObserver(E=>{let[x]=E;x&&x.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(t)})),n()}),l&&!i&&f.observe(l),f.observe(t));let h,b=i?qe(e):null;i&&v();function v(){const E=qe(e);b&&!Mo(b,E)&&n(),b=E,h=requestAnimationFrame(v)}return n(),()=>{var E;a.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),p==null||p(),(E=f)==null||E.disconnect(),f=null,i&&cancelAnimationFrame(h)}}const Wn=zt,ru=_a,ou=ka,iu=Da,su=Ra,lu=(e,t,n)=>{const r=new Map,o={platform:eu,...n},s={...o.platform,_c:r};return Fa(e,t,{...o,platform:s})};var au=typeof document<"u",uu=function(){},Yt=au?d.useLayoutEffect:uu;function Kt(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(!Kt(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)&&!Kt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function No(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lo(e,t){const n=No(e);return Math.round(t*n)/n}function Vn(e){const t=N.useRef(e);return Yt(()=>{t.current=e}),t}function cu(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,p]=N.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=N.useState(r);Kt(m,r)||f(r);const[h,b]=N.useState(null),[v,E]=N.useState(null),x=N.useCallback(T=>{T!==O.current&&(O.current=T,b(T))},[]),y=N.useCallback(T=>{T!==F.current&&(F.current=T,E(T))},[]),S=s||h,C=c||v,O=N.useRef(null),F=N.useRef(null),R=N.useRef(a),V=i!=null,M=Vn(i),L=Vn(o),Y=Vn(l),j=N.useCallback(()=>{if(!O.current||!F.current)return;const T={placement:t,strategy:n,middleware:m};L.current&&(T.platform=L.current),lu(O.current,F.current,T).then(k=>{const Q={...k,isPositioned:Y.current!==!1};A.current&&!Kt(R.current,Q)&&(R.current=Q,Pt.flushSync(()=>{p(Q)}))})},[m,t,n,L,Y]);Yt(()=>{l===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(T=>({...T,isPositioned:!1})))},[l]);const A=N.useRef(!1);Yt(()=>(A.current=!0,()=>{A.current=!1}),[]),Yt(()=>{if(S&&(O.current=S),C&&(F.current=C),S&&C){if(M.current)return M.current(S,C,j);j()}},[S,C,j,M,V]);const D=N.useMemo(()=>({reference:O,floating:F,setReference:x,setFloating:y}),[x,y]),B=N.useMemo(()=>({reference:S,floating:C}),[S,C]),H=N.useMemo(()=>{const T={position:n,left:0,top:0};if(!B.floating)return T;const k=Lo(B.floating,a.x),Q=Lo(B.floating,a.y);return u?{...T,transform:"translate("+k+"px, "+Q+"px)",...No(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:Q}},[n,u,B.floating,a.x,a.y]);return N.useMemo(()=>({...a,update:j,refs:D,elements:B,floatingStyles:H}),[a,j,D,B,H])}const Fo=(e,t)=>({...ru(e),options:[e,t]}),fu=(e,t)=>({...ou(e),options:[e,t]}),du=(e,t)=>({...iu(e),options:[e,t]}),pu=(e,t)=>({...su(e),options:[e,t]}),Do={...N},mu=Do.useInsertionEffect||(e=>e());function Io(e){const t=N.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return mu(()=>{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 Hn=typeof document<"u"?d.useLayoutEffect:d.useEffect;let jo=!1,hu=0;const _o=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+hu++;function gu(){const[e,t]=N.useState(()=>jo?_o():void 0);return Hn(()=>{e==null&&t(_o())},[]),N.useEffect(()=>{jo=!0},[]),e}const vu=Do.useId||gu;let Ot;process.env.NODE_ENV!=="production"&&(Ot=new Set);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=Ot)!=null&&e.has(o))){var s;(s=Ot)==null||s.add(o),console.warn(o)}}function yu(){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=Ot)!=null&&e.has(o))){var s;(s=Ot)==null||s.add(o),console.error(o)}}function xu(){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 wu=N.createContext(null),Eu=N.createContext(null),Cu=()=>{var e;return((e=N.useContext(wu))==null?void 0:e.id)||null},Su=()=>N.useContext(Eu),$u="data-floating-ui-focusable";function Ou(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=vu(),s=N.useRef({}),[c]=N.useState(()=>xu()),u=Cu()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!ae(f)&&yu("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[i,l]=N.useState(r.reference),a=Io((f,h,b)=>{s.current.openEvent=f?h:void 0,c.emit("openchange",{open:f,event:h,reason:b,nested:u}),n==null||n(f,h,b)}),p=N.useMemo(()=>({setPositionReference:l}),[]),m=N.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return N.useMemo(()=>({dataRef:s,open:t,onOpenChange:a,elements:m,events:c,floatingId:o,refs:p}),[t,a,m,c,o,p])}function Tu(e){e===void 0&&(e={});const{nodeId:t}=e,n=Ou({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=N.useState(null),[u,i]=N.useState(null),a=(o==null?void 0:o.domReference)||s,p=N.useRef(null),m=Su();Hn(()=>{a&&(p.current=a)},[a]);const f=cu({...e,elements:{...o,...u&&{reference:u}}}),h=N.useCallback(y=>{const S=ae(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;i(S),f.refs.setReference(S)},[f.refs]),b=N.useCallback(y=>{(ae(y)||y===null)&&(p.current=y,c(y)),(ae(f.refs.reference.current)||f.refs.reference.current===null||y!==null&&!ae(y))&&f.refs.setReference(y)},[f.refs]),v=N.useMemo(()=>({...f.refs,setReference:b,setPositionReference:h,domReference:p}),[f.refs,b,h]),E=N.useMemo(()=>({...f.elements,domReference:a}),[f.elements,a]),x=N.useMemo(()=>({...f,...r,refs:v,elements:E,nodeId:t}),[f,v,E,t,r]);return Hn(()=>{r.dataRef.current.floatingContext=x;const y=m==null?void 0:m.nodesRef.current.find(S=>S.id===t);y&&(y.context=x)}),N.useMemo(()=>({...f,context:x,refs:v,elements:E}),[f,v,E,x])}const ko="active",Ro="selected";function Un(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[ko]:c,[Ro]:u,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[$u]:""},...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&&[ko,Ro].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof a=="function"){var p;(p=r.get(l))==null||p.push(a),c[l]=function(){for(var m,f=arguments.length,h=new Array(f),b=0;b<f;b++)h[b]=arguments[b];return(m=r.get(l))==null?void 0:m.map(v=>v(...h)).find(v=>v!==void 0)}}}else c[l]=a}),c),{})}}function Au(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=>Un(u,e,"reference"),t),s=N.useCallback(u=>Un(u,e,"floating"),n),c=N.useCallback(u=>Un(u,e,"item"),r);return N.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}function Bo(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Pu=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}=at(e,t),{rects:p,elements:{floating:m}}=t,f=n.current[c],h=(l==null?void 0:l.current)||m,b=m.clientTop||h.clientTop,v=m.clientTop!==0,E=h.clientTop!==0,x=m===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||bu('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const y={...t,...await Fo(-f.offsetTop-m.clientTop-p.reference.height/2-f.offsetHeight/2-s).fn(t)},S=await Wn(Bo(y,h.scrollHeight+b+m.clientTop),a),C=await Wn(y,{...a,elementContext:"reference"}),O=ue(0,S.top),F=y.y+O,M=(h.scrollHeight>h.clientHeight?L=>L:St)(ue(0,h.scrollHeight+(v&&x||E?b*2:0)-O-ue(0,S.bottom)));if(h.style.maxHeight=M+"px",h.scrollTop=O,o){const L=h.offsetHeight<f.offsetHeight*Xe(u,n.current.length)-1||C.top>=-i||C.bottom>=-i;Pt.flushSync(()=>o(L))}return r&&(r.current=await Wn(Bo({...y,y:F},h.offsetHeight+b+m.clientTop),a)),{y:F}}});function Mu(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:c,onChange:u}=t,i=Io(u),l=N.useRef(!1),a=N.useRef(null),p=N.useRef(null);N.useEffect(()=>{if(!o)return;function f(b){if(b.ctrlKey||!h||s.current==null)return;const v=b.deltaY,E=s.current.top>=-.5,x=s.current.bottom>=-.5,y=h.scrollHeight-h.clientHeight,S=v<0?-1:1,C=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!E&&v>0||!x&&v<0?(b.preventDefault(),Pt.flushSync(()=>{i(O=>O+Math[C](v,y*S))})):/firefox/i.test(wa())&&(h.scrollTop+=v))}const h=(c==null?void 0:c.current)||r.floating;if(n&&h)return h.addEventListener("wheel",f),requestAnimationFrame(()=>{a.current=h.scrollTop,s.current!=null&&(p.current={...s.current})}),()=>{a.current=null,p.current=null,h.removeEventListener("wheel",f)}},[o,n,r.floating,s,c,i]);const m=N.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const f=(c==null?void 0:c.current)||r.floating;if(!(!s.current||!f||!l.current)){if(a.current!==null){const h=f.scrollTop-a.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Pt.flushSync(()=>i(b=>b+h))}requestAnimationFrame(()=>{a.current=f.scrollTop})}}}),[r.floating,i,s,c]);return N.useMemo(()=>o?{floating:m}:{},[o,m])}let ct=d.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});ct.displayName="FloatingContext";let zn=d.createContext(null);zn.displayName="PlacementContext";function Nu(e){return d.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Lu(){return d.useContext(ct).setReference}function Fu(){return d.useContext(ct).getReferenceProps}function Du(){let{getFloatingProps:e,slot:t}=d.useContext(ct);return d.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Iu(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=d.useContext(zn),n=d.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var c;return(c=s==null?void 0:s.outerHTML)!=null?c:s})]);J(()=>{t==null||t(n??null)},[t,n]);let r=d.useContext(ct);return d.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Wo=4;function ju({children:e,enabled:t=!0}){let[n,r]=d.useState(null),[o,s]=d.useState(0),c=d.useRef(null),[u,i]=d.useState(null);_u(u);let l=t&&n!==null&&u!==null,{to:a="bottom",gap:p=0,offset:m=0,padding:f=0,inner:h}=ku(n,u),[b,v="center"]=a.split(" ");J(()=>{l&&s(0)},[l]);let{refs:E,floatingStyles:x,context:y}=Tu({open:l,placement:b==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${b}`:`${b}-${v}`,strategy:"absolute",transform:!1,middleware:[Fo({mainAxis:b==="selection"?0:p,crossAxis:m}),fu({padding:f}),b!=="selection"&&du({padding:f}),b==="selection"&&h?Pu({...h,padding:f,overflowRef:c,offset:o,minItemsVisible:Wo,referenceOverflowThreshold:f,onFallbackChange(L){var Y,j;if(!L)return;let A=y.elements.floating;if(!A)return;let D=parseFloat(getComputedStyle(A).scrollPaddingBottom)||0,B=Math.min(Wo,A.childElementCount),H=0,T=0;for(let k of(j=(Y=y.elements.floating)==null?void 0:Y.childNodes)!=null?j:[])if(Ie(k)){let Q=k.offsetTop,me=Q+k.clientHeight+D,Z=A.scrollTop,q=Z+A.clientHeight;if(Q>=Z&&me<=q)B--;else{T=Math.max(0,Math.min(me,q)-Math.max(Q,Z)),H=k.clientHeight;break}}B>=1&&s(k=>{let Q=H*B-T+D;return k>=Q?k:Q})}}):null,pu({padding:f,apply({availableWidth:L,availableHeight:Y,elements:j}){Object.assign(j.floating.style,{overflow:"auto",maxWidth:`${L}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${Y}px)`})}})].filter(Boolean),whileElementsMounted:nu}),[S=b,C=v]=y.placement.split("-");b==="selection"&&(S="selection");let O=d.useMemo(()=>({anchor:[S,C].filter(Boolean).join(" ")}),[S,C]),F=Mu(y,{overflowRef:c,onChange:s}),{getReferenceProps:R,getFloatingProps:V}=Au([F]),M=z(L=>{i(L),E.setFloating(L)});return N.createElement(zn.Provider,{value:r},N.createElement(ct.Provider,{value:{setFloating:M,setReference:E.setReference,styles:x,getReferenceProps:R,getFloatingProps:V,slot:O}},e))}function _u(e){J(()=>{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 ku(e,t){var n,r,o;let s=Gn((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),c=Gn((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Gn((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:c,padding:u}}function Gn(e,t,n=void 0){let r=rt(),o=z((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=Ho(i,l);return[a,p=>{let m=Vo(i);{let f=m.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let b=!1;for(let[E,x]of m.entries()){let y=window.getComputedStyle(l).getPropertyValue(x);if(f[E]!==y){f[E]=y,b=!0;break}}if(!b)return;let v=Ho(i,l);a!==v&&(p(v),a=v)})}return r.dispose}]}return[n,null]}),s=d.useMemo(()=>o(e,t)[0],[e,t]),[c=s,u]=d.useState();return J(()=>{let[i,l]=o(e,t);if(u(i),!!l)return l(u)},[e,t]),c}function Vo(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,...Vo(o)]:[r]}return[]}function Ho(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 Ru(e,t){let[n,r]=d.useState(t);return!e&&n!==t&&r(t),e?n:t}let Yn=d.createContext(null);Yn.displayName="OpenClosedContext";var Oe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Oe||{});function Kn(){return d.useContext(Yn)}function Uo({value:e,children:t}){return d.createElement(Yn.Provider,{value:e},t)}function Bu(e){throw new Error("Unexpected object: "+e)}var te=(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))(te||{});function Qt(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:Bu(e)}}var zo=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(zo||{});function Go(e){let t=z(e),n=d.useRef(!1);d.useEffect(()=>(n.current=!1,()=>{n.current=!0,$r(()=>{n.current&&t()})}),[t])}function Wu(){let e=typeof document>"u";return"useSyncExternalStore"in N?(t=>t.useSyncExternalStore)(N)(()=>()=>{},()=>!1,()=>!e):!1}function Qn(){let e=Wu(),[t,n]=N.useState(Te.isHandoffComplete);return t&&Te.isHandoffComplete===!1&&n(!1),N.useEffect(()=>{t!==!0&&n(!0)},[t]),N.useEffect(()=>Te.handoff(),[]),e?!1:t}let Vu=d.createContext(!1);function Hu(){return d.useContext(Vu)}function Uu(e){let t=Hu(),n=d.useContext(Ko),[r,o]=d.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Te.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 d.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),d.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Yo=d.Fragment,zu=pe(function(e,t){let{ownerDocument:n=null,...r}=e,o=d.useRef(null),s=xe(ul(f=>{o.current=f}),t),c=Dn(o),u=n??c,i=Uu(u),[l]=d.useState(()=>{var f;return Te.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),a=d.useContext(Qu),p=Qn();J(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),J(()=>{if(l&&a)return a.register(l)},[a,l]),Go(()=>{var f;!i||!l||(wn(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let m=ge();return p?!i||!l?null:de.createPortal(m({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Yo,name:"Portal"}),l):null});function Gu(e,t){let n=xe(t),{enabled:r=!0,ownerDocument:o,...s}=e,c=ge();return r?d.createElement(zu,{...s,ownerDocument:o,ref:n}):c({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Yo,name:"Portal"})}let Yu=d.Fragment,Ko=d.createContext(null);function Ku(e,t){let{target:n,...r}=e,o={ref:xe(t)},s=ge();return d.createElement(Ko.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:Yu,name:"Popover.Group"}))}let Qu=d.createContext(null),Xu=pe(Gu),qu=pe(Ku),Ju=Object.assign(Xu,{Group:qu});function Zu(){let e=d.useRef(!1);return J(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Qo(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:qo)!==d.Fragment||d.Children.count(e.children)===1}let Xt=d.createContext(null);Xt.displayName="TransitionContext";var ec=(e=>(e.Visible="visible",e.Hidden="hidden",e))(ec||{});function tc(){let e=d.useContext(Xt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function nc(){let e=d.useContext(qt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let qt=d.createContext(null);qt.displayName="NestingContext";function Jt(e){return"children"in e?Jt(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Xo(e,t){let n=Ke(e),r=d.useRef([]),o=Zu(),s=rt(),c=z((f,h=Be.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===f);b!==-1&&(ye(h,{[Be.Unmount](){r.current.splice(b,1)},[Be.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var v;!Jt(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),u=z(f=>{let h=r.current.find(({el:b})=>b===f);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:f,state:"visible"}),()=>c(f,Be.Unmount)}),i=d.useRef([]),l=d.useRef(Promise.resolve()),a=d.useRef({enter:[],leave:[]}),p=z((f,h,b)=>{i.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([v])=>v!==f)),t==null||t.chains.current[h].push([f,new Promise(v=>{i.current.push(v)})]),t==null||t.chains.current[h].push([f,new Promise(v=>{Promise.all(a.current[h].map(([E,x])=>x)).then(()=>v())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(h)):b(h)}),m=z((f,h,b)=>{Promise.all(a.current[h].splice(0).map(([v,E])=>E)).then(()=>{var v;(v=i.current.shift())==null||v()}).then(()=>b(h))});return d.useMemo(()=>({children:r,register:u,unregister:c,onStart:p,onStop:m,wait:l,chains:a}),[u,c,r,p,m,a,l])}let qo=d.Fragment,Jo=Dt.RenderStrategy;function rc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:u,afterLeave:i,enter:l,enterFrom:a,enterTo:p,entered:m,leave:f,leaveFrom:h,leaveTo:b,...v}=e,[E,x]=d.useState(null),y=d.useRef(null),S=Qo(e),C=xe(...S?[y,t,x]:t===null?[]:[t]),O=(n=v.unmount)==null||n?Be.Unmount:Be.Hidden,{show:F,appear:R,initial:V}=tc(),[M,L]=d.useState(F?"visible":"hidden"),Y=nc(),{register:j,unregister:A}=Y;J(()=>j(y),[j,y]),J(()=>{if(O===Be.Hidden&&y.current){if(F&&M!=="visible"){L("visible");return}return ye(M,{hidden:()=>A(y),visible:()=>j(y)})}},[M,y,j,A,F,O]);let D=Qn();J(()=>{if(S&&D&&M==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,M,D,S]);let B=V&&!R,H=R&&F&&V,T=d.useRef(!1),k=Xo(()=>{T.current||(L("hidden"),A(y))},Y),Q=z(_=>{T.current=!0;let ee=_?"enter":"leave";k.onStart(y,ee,ce=>{ce==="enter"?s==null||s():ce==="leave"&&(u==null||u())})}),me=z(_=>{let ee=_?"enter":"leave";T.current=!1,k.onStop(y,ee,ce=>{ce==="enter"?c==null||c():ce==="leave"&&(i==null||i())}),ee==="leave"&&!Jt(k)&&(L("hidden"),A(y))});d.useEffect(()=>{S&&o||(Q(F),me(F))},[F,S,o]);let Z=!(!o||!S||!D||B),[,q]=co(Z,E,F,{start:Q,end:me}),et=We({ref:C,className:((r=bn(v.className,H&&l,H&&a,q.enter&&l,q.enter&&q.closed&&a,q.enter&&!q.closed&&p,q.leave&&f,q.leave&&!q.closed&&h,q.leave&&q.closed&&b,!q.transition&&F&&m))==null?void 0:r.trim())||void 0,...uo(q)}),_e=0;M==="visible"&&(_e|=Oe.Open),M==="hidden"&&(_e|=Oe.Closed),F&&M==="hidden"&&(_e|=Oe.Opening),!F&&M==="visible"&&(_e|=Oe.Closing);let tt=ge();return d.createElement(qt.Provider,{value:k},d.createElement(Uo,{value:_e},tt({ourProps:et,theirProps:v,defaultTag:qo,features:Jo,visible:M==="visible",name:"Transition.Child"})))}function oc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,c=d.useRef(null),u=Qo(e),i=xe(...u?[c,t]:t===null?[]:[t]);Qn();let l=Kn();if(n===void 0&&l!==null&&(n=(l&Oe.Open)===Oe.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,p]=d.useState(n?"visible":"hidden"),m=Xo(()=>{n||p("hidden")}),[f,h]=d.useState(!0),b=d.useRef([n]);J(()=>{f!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),h(!1))},[b,n]);let v=d.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);J(()=>{n?p("visible"):!Jt(m)&&c.current!==null&&p("hidden")},[n,m]);let E={unmount:o},x=z(()=>{var C;f&&h(!1),(C=e.beforeEnter)==null||C.call(e)}),y=z(()=>{var C;f&&h(!1),(C=e.beforeLeave)==null||C.call(e)}),S=ge();return d.createElement(qt.Provider,{value:m},d.createElement(Xt.Provider,{value:v},S({ourProps:{...E,as:d.Fragment,children:d.createElement(Zo,{ref:i,...E,...s,beforeEnter:x,beforeLeave:y})},theirProps:{},defaultTag:d.Fragment,features:Jo,visible:a==="visible",name:"Transition"})))}function ic(e,t){let n=d.useContext(Xt)!==null,r=Kn()!==null;return d.createElement(d.Fragment,null,!n&&r?d.createElement(Xn,{ref:t,...e}):d.createElement(Zo,{ref:t,...e}))}let Xn=pe(oc),Zo=pe(rc),sc=pe(ic),ei=Object.assign(Xn,{Child:sc,Root:Xn});function lc(e,t){let n=d.useRef({left:0,top:0});if(J(()=>{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 ti=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ni(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Ie(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 ti.test(c)&&(c=c.replace(ti,"")),c}function ac(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():ni(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ni(e).trim()}function uc(e){let t=d.useRef(""),n=d.useRef("");return z(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=ac(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var cc=Object.defineProperty,fc=(e,t,n)=>t in e?cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ri=(e,t,n)=>(fc(e,typeof t!="symbol"?t+"":t,n),n),le=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(le||{}),Le=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Le||{}),Zt=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Zt||{}),oi=(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))(oi||{});function ii(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=to(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 dc={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:te.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===te.Nothing)return{...u,activeOptionIndex:null};if(t.focus===te.Specific)return{...u,activeOptionIndex:e.options.findIndex(a=>a.id===t.id)};if(t.focus===te.Previous){let a=e.activeOptionIndex;if(a!==null){let p=e.options[a].dataRef.current.domRef,m=Qt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((r=p.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...u,activeOptionIndex:m}}}}else if(t.focus===te.Next){let a=e.activeOptionIndex;if(a!==null){let p=e.options[a].dataRef.current.domRef,m=Qt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((s=p.current)==null?void 0:s.nextElementSibling)===f.current||((c=f.current)==null?void 0:c.nextElementSibling)===null)return{...u,activeOptionIndex:m}}}}let i=ii(e),l=Qt(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!==te.Nothing&&(r=Qt(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:te.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,...ii(e),pendingShouldSort:!1}:e};class qn extends Hr{constructor(t){super(t),ri(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:c}=this.state.dataRef.current;return ye(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:te.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})}}),ri(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=On.get(null);this.disposables.add(r.on(Yr.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 qn({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:te.Nothing},__demoMode:n})}reduce(t,n){return ye(n.type,dc,t,n)}}const si=d.createContext(null);function Jn(e){let t=d.useContext(si);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,li),n}return t}function li({id:e,__demoMode:t=!1}){let n=d.useMemo(()=>qn.new({id:e,__demoMode:t}),[]);return Go(()=>n.dispose()),n}let en=d.createContext(null);en.displayName="ListboxDataContext";function Tt(e){let t=d.useContext(en);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Tt),n}return t}let pc=d.Fragment;function mc(e,t){let n=d.useId(),r=vn(),{value:o,defaultValue:s,form:c,name:u,onChange:i,by:l,invalid:a=!1,disabled:p=r||!1,horizontal:m=!1,multiple:f=!1,__demoMode:h=!1,...b}=e;const v=m?"horizontal":"vertical";let E=xe(t),x=Ks(s),[y=f?[]:void 0,S]=Ys(o,i,x),C=li({id:n,__demoMode:h}),O=d.useRef({static:!1,hold:!1}),F=d.useRef(new Map),R=xl(l),V=d.useCallback(Z=>ye(M.mode,{[Le.Multi]:()=>y.some(q=>R(q,Z)),[Le.Single]:()=>R(y,Z)}),[y]),M=d.useMemo(()=>({value:y,disabled:p,invalid:a,mode:f?Le.Multi:Le.Single,orientation:v,onChange:S,compare:R,isSelected:V,optionsPropsRef:O,listRef:F}),[y,p,a,f,v,S,R,V,O,F]);J(()=>{C.state.dataRef.current=M},[M]);let L=Ee(C,Z=>Z.listboxState),Y=On.get(null),j=Ee(Y,d.useCallback(Z=>Y.selectors.isTop(Z,n),[Y,n])),[A,D]=Ee(C,Z=>[Z.buttonElement,Z.optionsElement]);Yl(j,[A,D],(Z,q)=>{C.send({type:oi.CloseListbox}),eo(q,Fn.Loose)||(Z.preventDefault(),A==null||A.focus())});let B=d.useMemo(()=>({open:L===le.Open,disabled:p,invalid:a,value:y}),[L,p,a,y]),[H,T]=ml({inherit:!0}),k={ref:E},Q=d.useCallback(()=>{if(x!==void 0)return S==null?void 0:S(x)},[S,x]),me=ge();return d.createElement(T,{value:H,props:{htmlFor:A==null?void 0:A.id},slot:{open:L===le.Open,disabled:p}},d.createElement(ju,null,d.createElement(si.Provider,{value:C},d.createElement(en.Provider,{value:M},d.createElement(Uo,{value:ye(L,{[le.Open]:Oe.Open,[le.Closed]:Oe.Closed})},u!=null&&y!=null&&d.createElement(el,{disabled:p,data:{[u]:y},form:c,onReset:Q}),me({ourProps:k,theirProps:b,slot:B,defaultTag:pc,name:"Listbox"}))))))}let hc="button";function gc(e,t){let n=d.useId(),r=Lr(),o=Tt("Listbox.Button"),s=Jn("Listbox.Button"),{id:c=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:i=!1,...l}=e,a=xe(t,Lu(),s.actions.setButtonElement),p=Fu(),[m,f,h]=Ee(s,T=>[T.listboxState,T.buttonElement,T.optionsElement]),b=m===le.Open;Xl(b,{trigger:f,action:d.useCallback(T=>{if(f!=null&&f.contains(T.target))return kt.Ignore;let k=T.target.closest('[role="option"]:not([data-disabled])');return Ie(k)?kt.Select(k):h!=null&&h.contains(T.target)?kt.Ignore:kt.Close},[f,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=z(T=>{switch(T.key){case se.Enter:Qs(T.currentTarget);break;case se.Space:case se.ArrowDown:T.preventDefault(),s.actions.openListbox({focus:o.value?te.Nothing:te.First});break;case se.ArrowUp:T.preventDefault(),s.actions.openListbox({focus:o.value?te.Nothing:te.Last});break}}),E=z(T=>{switch(T.key){case se.Space:T.preventDefault();break}}),x=z(T=>{var k;if(T.button===zo.Left){if(ll(T.currentTarget))return T.preventDefault();s.state.listboxState===le.Open?(de.flushSync(()=>s.actions.closeListbox()),(k=s.state.buttonElement)==null||k.focus({preventScroll:!0})):(T.preventDefault(),s.actions.openListbox({focus:te.Nothing}))}}),y=d.useRef(null),S=z(T=>{y.current=T.pointerType,T.pointerType==="mouse"&&x(T)}),C=z(T=>{y.current!=="mouse"&&x(T)}),O=z(T=>T.preventDefault()),F=Rr([c]),R=cl(),{isFocusVisible:V,focusProps:M}=Is({autoFocus:i}),{isHovered:L,hoverProps:Y}=Ds({isDisabled:u}),{pressed:j,pressProps:A}=Ws({disabled:u}),D=d.useMemo(()=>({open:m===le.Open,active:j||m===le.Open,disabled:u,invalid:o.invalid,value:o.value,hover:L,focus:V,autofocus:i}),[m,o.value,u,L,V,j,o.invalid,i]),B=Ee(s,T=>T.listboxState===le.Open),H=Tr(p(),{ref:a,id:c,type:ql(e,f),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":B,"aria-labelledby":F,"aria-describedby":R,disabled:u||void 0,autoFocus:i,onKeyDown:v,onKeyUp:E,onKeyPress:O,onPointerDown:S,onClick:C},M,Y,A);return ge()({ourProps:H,theirProps:l,slot:D,defaultTag:hc,name:"Listbox.Button"})}let ai=d.createContext(!1),vc="div",bc=Dt.RenderStrategy|Dt.Static;function yc(e,t){let n=d.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:c=!0,transition:u=!1,...i}=e,l=Nu(o),[a,p]=d.useState(null);l&&(s=!0);let m=Tt("Listbox.Options"),f=Jn("Listbox.Options"),[h,b,v,E]=Ee(f,_=>[_.listboxState,_.buttonElement,_.optionsElement,_.__demoMode]),x=Dn(b),y=Dn(v),S=Kn(),[C,O]=co(u,a,S!==null?(S&Oe.Open)===Oe.Open:h===le.Open);Il(C,b,f.actions.closeListbox);let F=E?!1:c&&h===le.Open;ia(F,y);let R=E?!1:c&&h===le.Open;Dl(R,{allowed:d.useCallback(()=>[b,v],[b,v])});let V=h!==le.Open,M=lc(V,b)?!1:C,L=C&&h===le.Closed,Y=Ru(L,m.value),j=z(_=>m.compare(Y,_)),A=Ee(f,_=>{var ee;if(l==null||!((ee=l==null?void 0:l.to)!=null&&ee.includes("selection")))return null;let ce=_.options.findIndex(ze=>j(ze.dataRef.current.value));return ce===-1&&(ce=0),ce}),D=(()=>{if(l==null)return;if(A===null)return{...l,inner:void 0};let _=Array.from(m.listRef.current.values());return{...l,inner:{listRef:{current:_},index:A}}})(),[B,H]=Iu(D),T=Du(),k=xe(t,l?B:null,f.actions.setOptionsElement,p),Q=rt();d.useEffect(()=>{var _;let ee=v;ee&&h===le.Open&&ee!==((_=bt(ee))==null?void 0:_.activeElement)&&(ee==null||ee.focus({preventScroll:!0}))},[h,v]);let me=z(_=>{var ee,ce;switch(Q.dispose(),_.key){case se.Space:if(f.state.searchQuery!=="")return _.preventDefault(),_.stopPropagation(),f.actions.search(_.key);case se.Enter:if(_.preventDefault(),_.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:ze}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(ze.current.value)}m.mode===Le.Single&&(de.flushSync(()=>f.actions.closeListbox()),(ee=f.state.buttonElement)==null||ee.focus({preventScroll:!0}));break;case ye(m.orientation,{vertical:se.ArrowDown,horizontal:se.ArrowRight}):return _.preventDefault(),_.stopPropagation(),f.actions.goToOption({focus:te.Next});case ye(m.orientation,{vertical:se.ArrowUp,horizontal:se.ArrowLeft}):return _.preventDefault(),_.stopPropagation(),f.actions.goToOption({focus:te.Previous});case se.Home:case se.PageUp:return _.preventDefault(),_.stopPropagation(),f.actions.goToOption({focus:te.First});case se.End:case se.PageDown:return _.preventDefault(),_.stopPropagation(),f.actions.goToOption({focus:te.Last});case se.Escape:_.preventDefault(),_.stopPropagation(),de.flushSync(()=>f.actions.closeListbox()),(ce=f.state.buttonElement)==null||ce.focus({preventScroll:!0});return;case se.Tab:_.preventDefault(),_.stopPropagation(),de.flushSync(()=>f.actions.closeListbox()),Hl(f.state.buttonElement,_.shiftKey?Ln.Previous:Ln.Next);break;default:_.key.length===1&&(f.actions.search(_.key),Q.setTimeout(()=>f.actions.clearSearch(),350));break}}),Z=Ee(f,_=>{var ee;return(ee=_.buttonElement)==null?void 0:ee.id}),q=d.useMemo(()=>({open:h===le.Open}),[h]),et=Tr(l?T():{},{id:r,ref:k,"aria-activedescendant":Ee(f,f.selectors.activeDescendantId),"aria-multiselectable":m.mode===Le.Multi?!0:void 0,"aria-labelledby":Z,"aria-orientation":m.orientation,onKeyDown:me,role:"listbox",tabIndex:h===le.Open?0:void 0,style:{...i.style,...H,"--button-width":El(b,!0).width},...uo(O)}),_e=ge(),tt=d.useMemo(()=>m.mode===Le.Multi?m:{...m,isSelected:j},[m,j]);return d.createElement(Ju,{enabled:s?e.static||C:!1,ownerDocument:x},d.createElement(en.Provider,{value:tt},_e({ourProps:et,theirProps:i,slot:q,defaultTag:vc,features:bc,visible:M,name:"Listbox.Options"})))}let xc="div";function wc(e,t){let n=d.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...c}=e,u=d.useContext(ai)===!0,i=Tt("Listbox.Option"),l=Jn("Listbox.Option"),a=Ee(l,M=>l.selectors.isActive(M,r)),p=i.isSelected(s),m=d.useRef(null),f=uc(m),h=Ke({disabled:o,value:s,domRef:m,get textValue(){return f()}}),b=xe(t,m,M=>{M?i.listRef.current.set(r,M):i.listRef.current.delete(r)}),v=Ee(l,M=>l.selectors.shouldScrollIntoView(M,r));J(()=>{if(v)return Se().requestAnimationFrame(()=>{var M,L;(L=(M=m.current)==null?void 0:M.scrollIntoView)==null||L.call(M,{block:"nearest"})})},[v,m]),J(()=>{if(!u)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,u]);let E=z(M=>{var L;if(o)return M.preventDefault();l.actions.onChange(s),i.mode===Le.Single&&(de.flushSync(()=>l.actions.closeListbox()),(L=l.state.buttonElement)==null||L.focus({preventScroll:!0}))}),x=z(()=>{if(o)return l.actions.goToOption({focus:te.Nothing});l.actions.goToOption({focus:te.Specific,id:r})}),y=sa(),S=z(M=>y.update(M)),C=z(M=>{y.wasMoved(M)&&(o||a&&l.state.activationTrigger===Zt.Pointer||l.actions.goToOption({focus:te.Specific,id:r},Zt.Pointer))}),O=z(M=>{y.wasMoved(M)&&(o||a&&l.state.activationTrigger===Zt.Pointer&&l.actions.goToOption({focus:te.Nothing}))}),F=d.useMemo(()=>({active:a,focus:a,selected:p,disabled:o,selectedOption:p&&u}),[a,p,o,u]),R=u?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:E,onFocus:x,onPointerEnter:S,onMouseEnter:S,onPointerMove:C,onMouseMove:C,onPointerLeave:O,onMouseLeave:O},V=ge();return!p&&u?null:V({ourProps:R,theirProps:c,slot:F,defaultTag:xc,name:"Listbox.Option"})}let Ec=d.Fragment;function Cc(e,t){let{options:n,placeholder:r,...o}=e,s={ref:xe(t)},c=Tt("ListboxSelectedOption"),u=d.useMemo(()=>({}),[]),i=c.value===void 0||c.value===null||c.mode===Le.Multi&&Array.isArray(c.value)&&c.value.length===0,l=ge();return d.createElement(ai.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:d.createElement(d.Fragment,null,r&&i?r:n)},slot:u,defaultTag:Ec,name:"ListboxSelectedOption"}))}let Sc=pe(mc),$c=pe(gc),Oc=bl,Tc=pe(yc),Ac=pe(wc),Pc=pe(Cc),Ue=Object.assign(Sc,{Button:$c,Label:Oc,Options:Tc,Option:Ac,SelectedOption:Pc});function Mc({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 ui=N.forwardRef(Mc);function Nc({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 ci=N.forwardRef(Nc),Lc=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>w.jsx("div",{className:`relative ${o}`,children:w.jsx(Ue,{value:t,onChange:n,disabled:r,children:({open:c})=>w.jsxs(w.Fragment,{children:[w.jsxs(Ue.Button,{className:`
|
|
74
|
+
*/var Kr;function Ml(){return Kr||(Kr=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=d,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,u=t.useDebugValue;Pn.useSyncExternalStoreWithSelector=function(i,l,a,p,m){var f=o(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=c(function(){function b(S){if(!x){if(x=!0,E=S,S=p(S),m!==void 0&&h.hasValue){var A=h.value;if(m(A,S))return y=A}return y=S}if(A=y,n(E,S))return A;var L=p(S);return m!==void 0&&m(A,L)?(E=S,A):(E=S,y=L)}var x=!1,E,y,C=a===void 0?null:a;return[function(){return b(l())},C===null?void 0:function(){return b(C())}]},[l,a,p,m]);var v=r(i,f[0],f[1]);return s(function(){h.hasValue=!0,h.value=v},[v]),u(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Pn}process.env.NODE_ENV==="production"?Tn.exports=Nl():Tn.exports=Ml();var Ll=Tn.exports;function we(e,t,n=Ur){return Ll.useSyncExternalStoreWithSelector(z(r=>e.subscribe(Fl,r)),z(()=>e.state),z(()=>e.state),z(t),n)}function Fl(e){return e}function Qr(e,t){let n=d.useId(),r=On.get(t),[o,s]=we(r,d.useCallback(c=>[r.selectors.isTop(c,n),r.selectors.inStack(c,n)],[r,n]));return ee(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Nn=new Map,Et=new Map;function Xr(e){var t;let n=(t=Et.get(e))!=null?t:0;return Et.set(e,n+1),n!==0?()=>qr(e):(Nn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>qr(e))}function qr(e){var t;let n=(t=Et.get(e))!=null?t:1;if(n===1?Et.delete(e):Et.set(e,n-1),n!==1)return;let r=Nn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Nn.delete(e))}function Dl(e,{allowed:t,disallowed:n}={}){let r=Qr(e,"inert-others");ee(()=>{var o,s;if(!r)return;let c=Se();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&c.add(Xr(i));let u=(s=t==null?void 0:t())!=null?s:[];for(let i of u){if(!i)continue;let l=bt(i);if(!l)continue;let a=i.parentElement;for(;a&&a!==l.body;){for(let p of a.children)u.some(m=>p.contains(m))||c.add(Xr(p));a=a.parentElement}}return c.dispose},[r,t,n])}function Il(e,t,n){let r=Qe(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});d.useEffect(()=>{if(!e)return;let o=t===null?null:je(t)?t:t.current;if(!o)return;let s=Se();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 Mn=["[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(","),jl=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ln=(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))(Ln||{}),_l=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(_l||{}),kl=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(kl||{});function Jr(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Mn)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Rl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(jl)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Fn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Fn||{});function Zr(e,t=0){var n;return e===((n=bt(e))==null?void 0:n.body)?!1:ye(t,{0(){return e.matches(Mn)},1(){let r=e;for(;r!==null;){if(r.matches(Mn))return!0;r=r.parentElement}return!1}})}var Bl=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Bl||{});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 Wl=["textarea","input"].join(",");function Vl(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Wl))!=null?n:!1}function eo(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 Ul(e,t){return Hl(Jr(),t,{relativeTo:e})}function Hl(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?eo(e):e:t&64?Rl(e):Jr(e);o.length>0&&c.length>1&&(c=c.filter(f=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===f:h===f))),r=r??s.activeElement;let u=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,c.indexOf(r))-1;if(t&4)return Math.max(0,c.indexOf(r))+1;if(t&8)return c.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},a=0,p=c.length,m;do{if(a>=p||a+p<=0)return 0;let f=i+a;if(t&16)f=(f+p)%p;else{if(f<0)return 3;if(f>=p)return 1}m=c[f],m==null||m.focus(l),a+=u}while(m!==s.activeElement);return t&6&&Vl(m)&&m.select(),2}function to(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function zl(){return/Android/gi.test(window.navigator.userAgent)}function no(){return to()||zl()}function it(e,t,n,r){let o=Qe(n);d.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 Gl(e,t,n,r){let o=Qe(n);d.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 ro=30;function Yl(e,t,n){let r=Qe(n),o=d.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 p(m){return typeof m=="function"?p(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let p of a)if(p!==null&&(p.contains(l)||u.composed&&u.composedPath().includes(p)))return;return!Zr(l,Fn.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),s=d.useRef(null);it(e,"pointerdown",u=>{var i,l;no()||(s.current=((l=(i=u.composedPath)==null?void 0:i.call(u))==null?void 0:l[0])||u.target)},!0),it(e,"pointerup",u=>{if(no()||!s.current)return;let i=s.current;return s.current=null,o(u,()=>i)},!0);let c=d.useRef({x:0,y:0});it(e,"touchstart",u=>{c.current.x=u.touches[0].clientX,c.current.y=u.touches[0].clientY},!0),it(e,"touchend",u=>{let i={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(i.x-c.current.x)>=ro||Math.abs(i.y-c.current.y)>=ro))return o(u,()=>ot(u.target)?u.target:null)},!0),Gl(e,"blur",u=>o(u,()=>ol(window.document.activeElement)?window.document.activeElement:null),!0)}function Dn(...e){return d.useMemo(()=>bt(...e),[...e])}var Kl=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(Kl||{});const kt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},Ql=200,oo=5;function Xl(e,{trigger:t,action:n,close:r,select:o}){let s=d.useRef(null),c=d.useRef(null),u=d.useRef(null);it(e&&t!==null,"pointerdown",i=>{En(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(c.current=i.x,u.current=i.y,s.current=i.timeStamp)}),it(e&&t!==null,"pointerup",i=>{var l,a;let p=s.current;if(p===null||(s.current=null,!ot(i.target))||Math.abs(i.x-((l=c.current)!=null?l:i.x))<oo&&Math.abs(i.y-((a=u.current)!=null?a:i.y))<oo)return;let m=n(i);switch(m.kind){case 0:return;case 1:{i.timeStamp-p>Ql&&(o(m.target),r());break}case 2:{r();break}}},{capture:!0})}function ql(e,t){return d.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 Jl(e){return d.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Zl(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 ea(){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 ta(){return to()?{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=Se();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(ot(u.target))try{let i=u.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),a=e.querySelector(l);ot(a)&&!r(a)&&(c=a)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(ot(u.target)&&rl(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(ot(u.target)){if(Lr(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 na(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function ra(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Xe=Zl(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Se(),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:ra(n)},o=[ta(),ea(),na()];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)}});Xe.subscribe(()=>{let e=Xe.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)&&Xe.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Xe.dispatch("TEARDOWN",n)}});function oa(e,t,n=()=>({containers:[]})){let r=Jl(Xe),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ee(()=>{if(!(!t||!e))return Xe.dispatch("PUSH",t,n),()=>Xe.dispatch("POP",t,n)},[e,t]),s}function ia(e,t,n=()=>[document.body]){let r=Qr(e,"scroll-lock");oa(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function io(e){return[e.screenX,e.screenY]}function sa(){let e=d.useRef([-1,-1]);return{wasMoved(t){let n=io(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=io(t)}}}function la(e=0){let[t,n]=d.useState(e),r=d.useCallback(i=>n(i),[t]),o=d.useCallback(i=>n(l=>l|i),[t]),s=d.useCallback(i=>(t&i)===i,[t]),c=d.useCallback(i=>n(l=>l&~i),[n]),u=d.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:c,toggleFlag:u}}var so,lo;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((so=process==null?void 0:process.env)==null?void 0:so.NODE_ENV)==="test"&&typeof((lo=Element==null?void 0:Element.prototype)==null?void 0:lo.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 aa=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(aa||{});function ao(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function uo(e,t,n,r){let[o,s]=d.useState(n),{hasFlag:c,addFlag:u,removeFlag:i}=la(e&&o?3:0),l=d.useRef(!1),a=d.useRef(!1),p=rt();return ee(()=>{var m;if(e){if(n&&s(!0),!t){n&&u(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),ua(t,{inFlight:l,prepare(){a.current?a.current=!1:a.current=l.current,l.current=!0,!a.current&&(n?(u(3),i(4)):(u(4),i(2)))},run(){a.current?n?(i(3),u(4)):(i(4),u(3)):n?i(1):u(1)},done(){var f;a.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,p]),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 ua(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Se();return fa(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(ca(e,r))})}),s.dispose}function ca(e,t){var n,r;let o=Se();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 fa(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 Rt(){return typeof window<"u"}function st(e){return co(e)?(e.nodeName||"").toLowerCase():"#document"}function ge(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ne(e){var t;return(t=(co(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function co(e){return Rt()?e instanceof Node||e instanceof ge(e).Node:!1}function ue(e){return Rt()?e instanceof Element||e instanceof ge(e).Element:!1}function Me(e){return Rt()?e instanceof HTMLElement||e instanceof ge(e).HTMLElement:!1}function fo(e){return!Rt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ge(e).ShadowRoot}const da=new Set(["inline","contents"]);function wt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$e(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!da.has(o)}const pa=new Set(["table","td","th"]);function ma(e){return pa.has(st(e))}const ha=[":popover-open",":modal"];function Bt(e){return ha.some(t=>{try{return e.matches(t)}catch{return!1}})}const va=["transform","translate","scale","rotate","perspective"],ga=["transform","translate","scale","rotate","perspective","filter"],ba=["paint","layout","strict","content"];function In(e){const t=jn(),n=ue(e)?$e(e):e;return va.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)||ga.some(r=>(n.willChange||"").includes(r))||ba.some(r=>(n.contain||"").includes(r))}function ya(e){let t=Ue(e);for(;Me(t)&&!lt(t);){if(In(t))return t;if(Bt(t))return null;t=Ue(t)}return null}function jn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xa=new Set(["html","body","#document"]);function lt(e){return xa.has(st(e))}function $e(e){return ge(e).getComputedStyle(e)}function Wt(e){return ue(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ue(e){if(st(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fo(e)&&e.host||Ne(e);return fo(t)?t.host:t}function po(e){const t=Ue(e);return lt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Me(t)&&wt(t)?t:po(t)}function Ct(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=ge(o);if(s){const u=_n(c);return t.concat(c,c.visualViewport||[],wt(o)?o:[],u&&n?Ct(u):[])}return t.concat(o,Ct(o,[],n))}function _n(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ea(){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 qe=Math.min,ce=Math.max,St=Math.round,Vt=Math.floor,Le=e=>({x:e,y:e}),wa={left:"right",right:"left",bottom:"top",top:"bottom"},Ca={start:"end",end:"start"};function mo(e,t,n){return ce(e,qe(t,n))}function at(e,t){return typeof e=="function"?e(t):e}function He(e){return e.split("-")[0]}function $t(e){return e.split("-")[1]}function ho(e){return e==="x"?"y":"x"}function vo(e){return e==="y"?"height":"width"}const Sa=new Set(["top","bottom"]);function _e(e){return Sa.has(He(e))?"y":"x"}function go(e){return ho(_e(e))}function $a(e,t,n){n===void 0&&(n=!1);const r=$t(e),o=go(e),s=vo(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=Ut(c)),[c,Ut(c)]}function Oa(e){const t=Ut(e);return[kn(e),t,kn(t)]}function kn(e){return e.replace(/start|end/g,t=>Ca[t])}const bo=["left","right"],yo=["right","left"],Ta=["top","bottom"],Aa=["bottom","top"];function Pa(e,t,n){switch(e){case"top":case"bottom":return n?t?yo:bo:t?bo:yo;case"left":case"right":return t?Ta:Aa;default:return[]}}function Na(e,t,n,r){const o=$t(e);let s=Pa(He(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(kn)))),s}function Ut(e){return e.replace(/left|right|bottom|top/g,t=>wa[t])}function Ma(e){return{top:0,right:0,bottom:0,left:0,...e}}function La(e){return typeof e!="number"?Ma(e):{top:e,right:e,bottom:e,left:e}}function Ht(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 xo(e,t,n){let{reference:r,floating:o}=e;const s=_e(t),c=go(t),u=vo(c),i=He(t),l=s==="y",a=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[u]/2-o[u]/2;let f;switch(i){case"top":f={x:a,y:r.y-o.height};break;case"bottom":f={x:a,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-o.width,y:p};break;default:f={x:r.x,y:r.y}}switch($t(t)){case"start":f[c]-=m*(n&&l?-1:1);break;case"end":f[c]+=m*(n&&l?-1:1);break}return f}const Fa=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:p}=xo(l,r,i),m=r,f={},h=0;for(let v=0;v<u.length;v++){const{name:b,fn:x}=u[v],{x:E,y,data:C,reset:S}=await x({x:a,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:l,platform:c,elements:{reference:e,floating:t}});a=E??a,p=y??p,f={...f,[b]:{...f[b],...C}},S&&h<=50&&(h++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(l=S.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:a,y:p}=xo(l,m,i)),v=-1)}return{x:a,y:p,placement:m,strategy:o,middlewareData:f}};async function zt(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:p="floating",altBoundary:m=!1,padding:f=0}=at(t,e),h=La(f),b=u[m?p==="floating"?"reference":"floating":p],x=Ht(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:l,rootBoundary:a,strategy:i})),E=p==="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)),C=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},S=Ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:y,strategy:i}):E);return{top:(x.top-S.top+h.top)/C.y,bottom:(S.bottom-x.bottom+h.bottom)/C.y,left:(x.left-S.left+h.left)/C.x,right:(S.right-x.right+h.right)/C.x}}const Da=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:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...b}=at(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=He(o),E=_e(u),y=He(u)===u,C=await(i.isRTL==null?void 0:i.isRTL(l.floating)),S=m||(y||!v?[Ut(u)]:Oa(u)),A=h!=="none";!m&&A&&S.push(...Na(u,v,h,C));const L=[u,...S],R=await zt(t,b),V=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&V.push(R[x]),p){const D=$a(o,c,C);V.push(R[D[0]],R[D[1]])}if(P=[...P,{placement:o,overflows:V}],!V.every(D=>D<=0)){var T,K;const D=(((T=s.flip)==null?void 0:T.index)||0)+1,B=L[D];if(B&&(!(p==="alignment"?E!==_e(B):!1)||P.every(O=>_e(O.placement)===E?O.overflows[0]>0:!0)))return{data:{index:D,overflows:P},reset:{placement:B}};let U=(K=P.filter(G=>G.overflows[0]<=0).sort((G,O)=>G.overflows[1]-O.overflows[1])[0])==null?void 0:K.placement;if(!U)switch(f){case"bestFit":{var I;const G=(I=P.filter(O=>{if(A){const _=_e(O.placement);return _===E||_==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(_=>_>0).reduce((_,F)=>_+F,0)]).sort((O,_)=>O[1]-_[1])[0])==null?void 0:I[0];G&&(U=G);break}case"initialPlacement":U=u;break}if(o!==U)return{reset:{placement:U}}}return{}}}},Ia=new Set(["left","top"]);async function ja(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=He(n),u=$t(n),i=_e(n)==="y",l=Ia.has(c)?-1:1,a=s&&i?-1:1,p=at(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof h=="number"&&(f=u==="end"?h*-1:h),i?{x:f*a,y:m*l}:{x:m*l,y:f*a}}const _a=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 ja(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}}}}},ka=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:E}=b;return{x,y:E}}},...i}=at(e,t),l={x:n,y:r},a=await zt(t,i),p=_e(He(o)),m=ho(p);let f=l[m],h=l[p];if(s){const b=m==="y"?"top":"left",x=m==="y"?"bottom":"right",E=f+a[b],y=f-a[x];f=mo(E,f,y)}if(c){const b=p==="y"?"top":"left",x=p==="y"?"bottom":"right",E=h+a[b],y=h-a[x];h=mo(E,h,y)}const v=u.fn({...t,[m]:f,[p]:h});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:s,[p]:c}}}}}},Ra=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}=at(e,t),a=await zt(t,l),p=He(o),m=$t(o),f=_e(o)==="y",{width:h,height:v}=s.floating;let b,x;p==="top"||p==="bottom"?(b=p,x=m===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(x=p,b=m==="end"?"top":"bottom");const E=v-a.top-a.bottom,y=h-a.left-a.right,C=qe(v-a[b],E),S=qe(h-a[x],y),A=!t.middlewareData.shift;let L=C,R=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=E),A&&!m){const P=ce(a.left,0),T=ce(a.right,0),K=ce(a.top,0),I=ce(a.bottom,0);f?R=h-2*(P!==0||T!==0?P+T:ce(a.left,a.right)):L=v-2*(K!==0||I!==0?K+I:ce(a.top,a.bottom))}await i({...t,availableWidth:R,availableHeight:L});const V=await c.getDimensions(u.floating);return h!==V.width||v!==V.height?{reset:{rects:!0}}:{}}}};function Eo(e){const t=$e(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Me(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,u=St(n)!==s||St(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}function Rn(e){return ue(e)?e:e.contextElement}function ut(e){const t=Rn(e);if(!Me(t))return Le(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Eo(t);let c=(s?St(n.width):n.width)/r,u=(s?St(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const Ba=Le(0);function wo(e){const t=ge(e);return!jn()||!t.visualViewport?Ba:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Wa(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ge(e)?!1:t}function Je(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Rn(e);let c=Le(1);t&&(r?ue(r)&&(c=ut(r)):c=ut(e));const u=Wa(s,n,r)?wo(s):Le(0);let i=(o.left+u.x)/c.x,l=(o.top+u.y)/c.y,a=o.width/c.x,p=o.height/c.y;if(s){const m=ge(s),f=r&&ue(r)?ge(r):r;let h=m,v=_n(h);for(;v&&r&&f!==h;){const b=ut(v),x=v.getBoundingClientRect(),E=$e(v),y=x.left+(v.clientLeft+parseFloat(E.paddingLeft))*b.x,C=x.top+(v.clientTop+parseFloat(E.paddingTop))*b.y;i*=b.x,l*=b.y,a*=b.x,p*=b.y,i+=y,l+=C,h=ge(v),v=_n(h)}}return Ht({width:a,height:p,x:i,y:l})}function Gt(e,t){const n=Wt(e).scrollLeft;return t?t.left+n:Je(Ne(e)).left+n}function Co(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Gt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Va(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=Ne(r),u=t?Bt(t.floating):!1;if(r===c||u&&s)return n;let i={scrollLeft:0,scrollTop:0},l=Le(1);const a=Le(0),p=Me(r);if((p||!p&&!s)&&((st(r)!=="body"||wt(c))&&(i=Wt(r)),Me(r))){const f=Je(r);l=ut(r),a.x=f.x+r.clientLeft,a.y=f.y+r.clientTop}const m=c&&!p&&!s?Co(c,i):Le(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+a.x+m.x,y:n.y*l.y-i.scrollTop*l.y+a.y+m.y}}function Ua(e){return Array.from(e.getClientRects())}function Ha(e){const t=Ne(e),n=Wt(e),r=e.ownerDocument.body,o=ce(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ce(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Gt(e);const u=-n.scrollTop;return $e(r).direction==="rtl"&&(c+=ce(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:u}}const So=25;function za(e,t){const n=ge(e),r=Ne(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=jn();(!a||a&&t==="fixed")&&(u=o.offsetLeft,i=o.offsetTop)}const l=Gt(r);if(l<=0){const a=r.ownerDocument,p=a.body,m=getComputedStyle(p),f=a.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(r.clientWidth-p.clientWidth-f);h<=So&&(s-=h)}else l<=So&&(s+=l);return{width:s,height:c,x:u,y:i}}const Ga=new Set(["absolute","fixed"]);function Ya(e,t){const n=Je(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Me(e)?ut(e):Le(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 $o(e,t,n){let r;if(t==="viewport")r=za(e,n);else if(t==="document")r=Ha(Ne(e));else if(ue(t))r=Ya(t,n);else{const o=wo(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ht(r)}function Oo(e,t){const n=Ue(e);return n===t||!ue(n)||lt(n)?!1:$e(n).position==="fixed"||Oo(n,t)}function Ka(e,t){const n=t.get(e);if(n)return n;let r=Ct(e,[],!1).filter(u=>ue(u)&&st(u)!=="body"),o=null;const s=$e(e).position==="fixed";let c=s?Ue(e):e;for(;ue(c)&&!lt(c);){const u=$e(c),i=In(c);!i&&u.position==="fixed"&&(o=null),(s?!i&&!o:!i&&u.position==="static"&&!!o&&Ga.has(o.position)||wt(c)&&!i&&Oo(e,c))?r=r.filter(a=>a!==c):o=u,c=Ue(c)}return t.set(e,r),r}function Qa(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Bt(t)?[]:Ka(t,this._c):[].concat(n),r],u=c[0],i=c.reduce((l,a)=>{const p=$o(t,a,o);return l.top=ce(p.top,l.top),l.right=qe(p.right,l.right),l.bottom=qe(p.bottom,l.bottom),l.left=ce(p.left,l.left),l},$o(t,u,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function Xa(e){const{width:t,height:n}=Eo(e);return{width:t,height:n}}function qa(e,t,n){const r=Me(t),o=Ne(t),s=n==="fixed",c=Je(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const i=Le(0);function l(){i.x=Gt(o)}if(r||!r&&!s)if((st(t)!=="body"||wt(o))&&(u=Wt(t)),r){const f=Je(t,!0,s,t);i.x=f.x+t.clientLeft,i.y=f.y+t.clientTop}else o&&l();s&&!r&&o&&l();const a=o&&!r&&!s?Co(o,u):Le(0),p=c.left+u.scrollLeft-i.x-a.x,m=c.top+u.scrollTop-i.y-a.y;return{x:p,y:m,width:c.width,height:c.height}}function Bn(e){return $e(e).position==="static"}function To(e,t){if(!Me(e)||$e(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ne(e)===n&&(n=n.ownerDocument.body),n}function Ao(e,t){const n=ge(e);if(Bt(e))return n;if(!Me(e)){let o=Ue(e);for(;o&&!lt(o);){if(ue(o)&&!Bn(o))return o;o=Ue(o)}return n}let r=To(e,t);for(;r&&ma(r)&&Bn(r);)r=To(r,t);return r&<(r)&&Bn(r)&&!In(r)?n:r||ya(e)||n}const Ja=async function(e){const t=this.getOffsetParent||Ao,n=this.getDimensions,r=await n(e.floating);return{reference:qa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Za(e){return $e(e).direction==="rtl"}const eu={convertOffsetParentRelativeRectToViewportRelativeRect:Va,getDocumentElement:Ne,getClippingRect:Qa,getOffsetParent:Ao,getElementRects:Ja,getClientRects:Ua,getDimensions:Xa,getScale:ut,isElement:ue,isRTL:Za};function Po(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tu(e,t){let n=null,r;const o=Ne(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:p,width:m,height:f}=l;if(u||t(),!m||!f)return;const h=Vt(p),v=Vt(o.clientWidth-(a+m)),b=Vt(o.clientHeight-(p+f)),x=Vt(a),y={rootMargin:-h+"px "+-v+"px "+-b+"px "+-x+"px",threshold:ce(0,qe(1,i))||1};let C=!0;function S(A){const L=A[0].intersectionRatio;if(L!==i){if(!C)return c();L?c(!1,L):r=setTimeout(()=>{c(!1,1e-7)},1e3)}L===1&&!Po(l,e.getBoundingClientRect())&&c(),C=!1}try{n=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return c(!0),s}function nu(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=Rn(e),a=o||s?[...l?Ct(l):[],...Ct(t)]:[];a.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const p=l&&u?tu(l,n):null;let m=-1,f=null;c&&(f=new ResizeObserver(x=>{let[E]=x;E&&E.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(t)})),n()}),l&&!i&&f.observe(l),f.observe(t));let h,v=i?Je(e):null;i&&b();function b(){const x=Je(e);v&&!Po(v,x)&&n(),v=x,h=requestAnimationFrame(b)}return n(),()=>{var x;a.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),p==null||p(),(x=f)==null||x.disconnect(),f=null,i&&cancelAnimationFrame(h)}}const Wn=zt,ru=_a,ou=ka,iu=Da,su=Ra,lu=(e,t,n)=>{const r=new Map,o={platform:eu,...n},s={...o.platform,_c:r};return Fa(e,t,{...o,platform:s})};var au=typeof document<"u",uu=function(){},Yt=au?d.useLayoutEffect:uu;function Kt(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(!Kt(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)&&!Kt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function No(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mo(e,t){const n=No(e);return Math.round(t*n)/n}function Vn(e){const t=M.useRef(e);return Yt(()=>{t.current=e}),t}function cu(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,p]=M.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=M.useState(r);Kt(m,r)||f(r);const[h,v]=M.useState(null),[b,x]=M.useState(null),E=M.useCallback(O=>{O!==A.current&&(A.current=O,v(O))},[]),y=M.useCallback(O=>{O!==L.current&&(L.current=O,x(O))},[]),C=s||h,S=c||b,A=M.useRef(null),L=M.useRef(null),R=M.useRef(a),V=i!=null,P=Vn(i),T=Vn(o),K=Vn(l),I=M.useCallback(()=>{if(!A.current||!L.current)return;const O={placement:t,strategy:n,middleware:m};T.current&&(O.platform=T.current),lu(A.current,L.current,O).then(_=>{const F={..._,isPositioned:K.current!==!1};D.current&&!Kt(R.current,F)&&(R.current=F,Pt.flushSync(()=>{p(F)}))})},[m,t,n,T,K]);Yt(()=>{l===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(O=>({...O,isPositioned:!1})))},[l]);const D=M.useRef(!1);Yt(()=>(D.current=!0,()=>{D.current=!1}),[]),Yt(()=>{if(C&&(A.current=C),S&&(L.current=S),C&&S){if(P.current)return P.current(C,S,I);I()}},[C,S,I,P,V]);const B=M.useMemo(()=>({reference:A,floating:L,setReference:E,setFloating:y}),[E,y]),U=M.useMemo(()=>({reference:C,floating:S}),[C,S]),G=M.useMemo(()=>{const O={position:n,left:0,top:0};if(!U.floating)return O;const _=Mo(U.floating,a.x),F=Mo(U.floating,a.y);return u?{...O,transform:"translate("+_+"px, "+F+"px)",...No(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:F}},[n,u,U.floating,a.x,a.y]);return M.useMemo(()=>({...a,update:I,refs:B,elements:U,floatingStyles:G}),[a,I,B,U,G])}const Lo=(e,t)=>({...ru(e),options:[e,t]}),fu=(e,t)=>({...ou(e),options:[e,t]}),du=(e,t)=>({...iu(e),options:[e,t]}),pu=(e,t)=>({...su(e),options:[e,t]}),Fo={...M},mu=Fo.useInsertionEffect||(e=>e());function Do(e){const t=M.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return mu(()=>{t.current=e}),M.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 Un=typeof document<"u"?d.useLayoutEffect:d.useEffect;let Io=!1,hu=0;const jo=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+hu++;function vu(){const[e,t]=M.useState(()=>Io?jo():void 0);return Un(()=>{e==null&&t(jo())},[]),M.useEffect(()=>{Io=!0},[]),e}const gu=Fo.useId||vu;let Ot;process.env.NODE_ENV!=="production"&&(Ot=new Set);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=Ot)!=null&&e.has(o))){var s;(s=Ot)==null||s.add(o),console.warn(o)}}function yu(){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=Ot)!=null&&e.has(o))){var s;(s=Ot)==null||s.add(o),console.error(o)}}function xu(){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 Eu=M.createContext(null),wu=M.createContext(null),Cu=()=>{var e;return((e=M.useContext(Eu))==null?void 0:e.id)||null},Su=()=>M.useContext(wu),$u="data-floating-ui-focusable";function Ou(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=gu(),s=M.useRef({}),[c]=M.useState(()=>xu()),u=Cu()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!ue(f)&&yu("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]=M.useState(r.reference),a=Do((f,h,v)=>{s.current.openEvent=f?h:void 0,c.emit("openchange",{open:f,event:h,reason:v,nested:u}),n==null||n(f,h,v)}),p=M.useMemo(()=>({setPositionReference:l}),[]),m=M.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return M.useMemo(()=>({dataRef:s,open:t,onOpenChange:a,elements:m,events:c,floatingId:o,refs:p}),[t,a,m,c,o,p])}function Tu(e){e===void 0&&(e={});const{nodeId:t}=e,n=Ou({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=M.useState(null),[u,i]=M.useState(null),a=(o==null?void 0:o.domReference)||s,p=M.useRef(null),m=Su();Un(()=>{a&&(p.current=a)},[a]);const f=cu({...e,elements:{...o,...u&&{reference:u}}}),h=M.useCallback(y=>{const C=ue(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;i(C),f.refs.setReference(C)},[f.refs]),v=M.useCallback(y=>{(ue(y)||y===null)&&(p.current=y,c(y)),(ue(f.refs.reference.current)||f.refs.reference.current===null||y!==null&&!ue(y))&&f.refs.setReference(y)},[f.refs]),b=M.useMemo(()=>({...f.refs,setReference:v,setPositionReference:h,domReference:p}),[f.refs,v,h]),x=M.useMemo(()=>({...f.elements,domReference:a}),[f.elements,a]),E=M.useMemo(()=>({...f,...r,refs:b,elements:x,nodeId:t}),[f,b,x,t,r]);return Un(()=>{r.dataRef.current.floatingContext=E;const y=m==null?void 0:m.nodesRef.current.find(C=>C.id===t);y&&(y.context=E)}),M.useMemo(()=>({...f,context:E,refs:b,elements:x}),[f,b,x,E])}const _o="active",ko="selected";function Hn(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[_o]:c,[ko]:u,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[$u]:""},...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&&[_o,ko].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof a=="function"){var p;(p=r.get(l))==null||p.push(a),c[l]=function(){for(var m,f=arguments.length,h=new Array(f),v=0;v<f;v++)h[v]=arguments[v];return(m=r.get(l))==null?void 0:m.map(b=>b(...h)).find(b=>b!==void 0)}}}else c[l]=a}),c),{})}}function Au(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=M.useCallback(u=>Hn(u,e,"reference"),t),s=M.useCallback(u=>Hn(u,e,"floating"),n),c=M.useCallback(u=>Hn(u,e,"item"),r);return M.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}function Ro(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Pu=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}=at(e,t),{rects:p,elements:{floating:m}}=t,f=n.current[c],h=(l==null?void 0:l.current)||m,v=m.clientTop||h.clientTop,b=m.clientTop!==0,x=h.clientTop!==0,E=m===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||bu('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const y={...t,...await Lo(-f.offsetTop-m.clientTop-p.reference.height/2-f.offsetHeight/2-s).fn(t)},C=await Wn(Ro(y,h.scrollHeight+v+m.clientTop),a),S=await Wn(y,{...a,elementContext:"reference"}),A=ce(0,C.top),L=y.y+A,P=(h.scrollHeight>h.clientHeight?T=>T:St)(ce(0,h.scrollHeight+(b&&E||x?v*2:0)-A-ce(0,C.bottom)));if(h.style.maxHeight=P+"px",h.scrollTop=A,o){const T=h.offsetHeight<f.offsetHeight*qe(u,n.current.length)-1||S.top>=-i||S.bottom>=-i;Pt.flushSync(()=>o(T))}return r&&(r.current=await Wn(Ro({...y,y:L},h.offsetHeight+v+m.clientTop),a)),{y:L}}});function Nu(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:c,onChange:u}=t,i=Do(u),l=M.useRef(!1),a=M.useRef(null),p=M.useRef(null);M.useEffect(()=>{if(!o)return;function f(v){if(v.ctrlKey||!h||s.current==null)return;const b=v.deltaY,x=s.current.top>=-.5,E=s.current.bottom>=-.5,y=h.scrollHeight-h.clientHeight,C=b<0?-1:1,S=b<0?"max":"min";h.scrollHeight<=h.clientHeight||(!x&&b>0||!E&&b<0?(v.preventDefault(),Pt.flushSync(()=>{i(A=>A+Math[S](b,y*C))})):/firefox/i.test(Ea())&&(h.scrollTop+=b))}const h=(c==null?void 0:c.current)||r.floating;if(n&&h)return h.addEventListener("wheel",f),requestAnimationFrame(()=>{a.current=h.scrollTop,s.current!=null&&(p.current={...s.current})}),()=>{a.current=null,p.current=null,h.removeEventListener("wheel",f)}},[o,n,r.floating,s,c,i]);const m=M.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const f=(c==null?void 0:c.current)||r.floating;if(!(!s.current||!f||!l.current)){if(a.current!==null){const h=f.scrollTop-a.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Pt.flushSync(()=>i(v=>v+h))}requestAnimationFrame(()=>{a.current=f.scrollTop})}}}),[r.floating,i,s,c]);return M.useMemo(()=>o?{floating:m}:{},[o,m])}let ct=d.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});ct.displayName="FloatingContext";let zn=d.createContext(null);zn.displayName="PlacementContext";function Mu(e){return d.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Lu(){return d.useContext(ct).setReference}function Fu(){return d.useContext(ct).getReferenceProps}function Du(){let{getFloatingProps:e,slot:t}=d.useContext(ct);return d.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Iu(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=d.useContext(zn),n=d.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var c;return(c=s==null?void 0:s.outerHTML)!=null?c:s})]);ee(()=>{t==null||t(n??null)},[t,n]);let r=d.useContext(ct);return d.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Bo=4;function ju({children:e,enabled:t=!0}){let[n,r]=d.useState(null),[o,s]=d.useState(0),c=d.useRef(null),[u,i]=d.useState(null);_u(u);let l=t&&n!==null&&u!==null,{to:a="bottom",gap:p=0,offset:m=0,padding:f=0,inner:h}=ku(n,u),[v,b="center"]=a.split(" ");ee(()=>{l&&s(0)},[l]);let{refs:x,floatingStyles:E,context:y}=Tu({open:l,placement:v==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${v}`:`${v}-${b}`,strategy:"absolute",transform:!1,middleware:[Lo({mainAxis:v==="selection"?0:p,crossAxis:m}),fu({padding:f}),v!=="selection"&&du({padding:f}),v==="selection"&&h?Pu({...h,padding:f,overflowRef:c,offset:o,minItemsVisible:Bo,referenceOverflowThreshold:f,onFallbackChange(T){var K,I;if(!T)return;let D=y.elements.floating;if(!D)return;let B=parseFloat(getComputedStyle(D).scrollPaddingBottom)||0,U=Math.min(Bo,D.childElementCount),G=0,O=0;for(let _ of(I=(K=y.elements.floating)==null?void 0:K.childNodes)!=null?I:[])if(je(_)){let F=_.offsetTop,Z=F+_.clientHeight+B,Q=D.scrollTop,X=Q+D.clientHeight;if(F>=Q&&Z<=X)U--;else{O=Math.max(0,Math.min(Z,X)-Math.max(F,Q)),G=_.clientHeight;break}}U>=1&&s(_=>{let F=G*U-O+B;return _>=F?_:F})}}):null,pu({padding:f,apply({availableWidth:T,availableHeight:K,elements:I}){Object.assign(I.floating.style,{overflow:"auto",maxWidth:`${T}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${K}px)`})}})].filter(Boolean),whileElementsMounted:nu}),[C=v,S=b]=y.placement.split("-");v==="selection"&&(C="selection");let A=d.useMemo(()=>({anchor:[C,S].filter(Boolean).join(" ")}),[C,S]),L=Nu(y,{overflowRef:c,onChange:s}),{getReferenceProps:R,getFloatingProps:V}=Au([L]),P=z(T=>{i(T),x.setFloating(T)});return M.createElement(zn.Provider,{value:r},M.createElement(ct.Provider,{value:{setFloating:P,setReference:x.setReference,styles:E,getReferenceProps:R,getFloatingProps:V,slot:A}},e))}function _u(e){ee(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function ku(e,t){var n,r,o;let s=Gn((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),c=Gn((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Gn((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:c,padding:u}}function Gn(e,t,n=void 0){let r=rt(),o=z((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=Vo(i,l);return[a,p=>{let m=Wo(i);{let f=m.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let v=!1;for(let[x,E]of m.entries()){let y=window.getComputedStyle(l).getPropertyValue(E);if(f[x]!==y){f[x]=y,v=!0;break}}if(!v)return;let b=Vo(i,l);a!==b&&(p(b),a=b)})}return r.dispose}]}return[n,null]}),s=d.useMemo(()=>o(e,t)[0],[e,t]),[c=s,u]=d.useState();return ee(()=>{let[i,l]=o(e,t);if(u(i),!!l)return l(u)},[e,t]),c}function Wo(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,...Wo(o)]:[r]}return[]}function Vo(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 Ru(e,t){let[n,r]=d.useState(t);return!e&&n!==t&&r(t),e?n:t}let Yn=d.createContext(null);Yn.displayName="OpenClosedContext";var Oe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Oe||{});function Kn(){return d.useContext(Yn)}function Uo({value:e,children:t}){return d.createElement(Yn.Provider,{value:e},t)}function Bu(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 Qt(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:Bu(e)}}var Ho=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Ho||{});function zo(e){let t=z(e),n=d.useRef(!1);d.useEffect(()=>(n.current=!1,()=>{n.current=!0,Sr(()=>{n.current&&t()})}),[t])}function Wu(){let e=typeof document>"u";return"useSyncExternalStore"in M?(t=>t.useSyncExternalStore)(M)(()=>()=>{},()=>!1,()=>!e):!1}function Qn(){let e=Wu(),[t,n]=M.useState(Ae.isHandoffComplete);return t&&Ae.isHandoffComplete===!1&&n(!1),M.useEffect(()=>{t!==!0&&n(!0)},[t]),M.useEffect(()=>Ae.handoff(),[]),e?!1:t}let Vu=d.createContext(!1);function Uu(){return d.useContext(Vu)}function Hu(e){let t=Uu(),n=d.useContext(Yo),[r,o]=d.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Ae.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 d.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),d.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Go=d.Fragment,zu=me(function(e,t){let{ownerDocument:n=null,...r}=e,o=d.useRef(null),s=xe(ul(f=>{o.current=f}),t),c=Dn(o),u=n??c,i=Hu(u),[l]=d.useState(()=>{var f;return Ae.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),a=d.useContext(Qu),p=Qn();ee(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),ee(()=>{if(l&&a)return a.register(l)},[a,l]),zo(()=>{var f;!i||!l||(En(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let m=ve();return p?!i||!l?null:pe.createPortal(m({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Go,name:"Portal"}),l):null});function Gu(e,t){let n=xe(t),{enabled:r=!0,ownerDocument:o,...s}=e,c=ve();return r?d.createElement(zu,{...s,ownerDocument:o,ref:n}):c({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Go,name:"Portal"})}let Yu=d.Fragment,Yo=d.createContext(null);function Ku(e,t){let{target:n,...r}=e,o={ref:xe(t)},s=ve();return d.createElement(Yo.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:Yu,name:"Popover.Group"}))}let Qu=d.createContext(null),Xu=me(Gu),qu=me(Ku),Ju=Object.assign(Xu,{Group:qu});function Zu(){let e=d.useRef(!1);return ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ko(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Xo)!==d.Fragment||d.Children.count(e.children)===1}let Xt=d.createContext(null);Xt.displayName="TransitionContext";var ec=(e=>(e.Visible="visible",e.Hidden="hidden",e))(ec||{});function tc(){let e=d.useContext(Xt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function nc(){let e=d.useContext(qt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let qt=d.createContext(null);qt.displayName="NestingContext";function Jt(e){return"children"in e?Jt(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Qo(e,t){let n=Qe(e),r=d.useRef([]),o=Zu(),s=rt(),c=z((f,h=We.Hidden)=>{let v=r.current.findIndex(({el:b})=>b===f);v!==-1&&(ye(h,{[We.Unmount](){r.current.splice(v,1)},[We.Hidden](){r.current[v].state="hidden"}}),s.microTask(()=>{var b;!Jt(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),u=z(f=>{let h=r.current.find(({el:v})=>v===f);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:f,state:"visible"}),()=>c(f,We.Unmount)}),i=d.useRef([]),l=d.useRef(Promise.resolve()),a=d.useRef({enter:[],leave:[]}),p=z((f,h,v)=>{i.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([b])=>b!==f)),t==null||t.chains.current[h].push([f,new Promise(b=>{i.current.push(b)})]),t==null||t.chains.current[h].push([f,new Promise(b=>{Promise.all(a.current[h].map(([x,E])=>E)).then(()=>b())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(h)):v(h)}),m=z((f,h,v)=>{Promise.all(a.current[h].splice(0).map(([b,x])=>x)).then(()=>{var b;(b=i.current.shift())==null||b()}).then(()=>v(h))});return d.useMemo(()=>({children:r,register:u,unregister:c,onStart:p,onStop:m,wait:l,chains:a}),[u,c,r,p,m,a,l])}let Xo=d.Fragment,qo=Dt.RenderStrategy;function rc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:u,afterLeave:i,enter:l,enterFrom:a,enterTo:p,entered:m,leave:f,leaveFrom:h,leaveTo:v,...b}=e,[x,E]=d.useState(null),y=d.useRef(null),C=Ko(e),S=xe(...C?[y,t,E]:t===null?[]:[t]),A=(n=b.unmount)==null||n?We.Unmount:We.Hidden,{show:L,appear:R,initial:V}=tc(),[P,T]=d.useState(L?"visible":"hidden"),K=nc(),{register:I,unregister:D}=K;ee(()=>I(y),[I,y]),ee(()=>{if(A===We.Hidden&&y.current){if(L&&P!=="visible"){T("visible");return}return ye(P,{hidden:()=>D(y),visible:()=>I(y)})}},[P,y,I,D,L,A]);let B=Qn();ee(()=>{if(C&&B&&P==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,P,B,C]);let U=V&&!R,G=R&&L&&V,O=d.useRef(!1),_=Qo(()=>{O.current||(T("hidden"),D(y))},K),F=z(k=>{O.current=!0;let te=k?"enter":"leave";_.onStart(y,te,fe=>{fe==="enter"?s==null||s():fe==="leave"&&(u==null||u())})}),Z=z(k=>{let te=k?"enter":"leave";O.current=!1,_.onStop(y,te,fe=>{fe==="enter"?c==null||c():fe==="leave"&&(i==null||i())}),te==="leave"&&!Jt(_)&&(T("hidden"),D(y))});d.useEffect(()=>{C&&o||(F(L),Z(L))},[L,C,o]);let Q=!(!o||!C||!B||U),[,X]=uo(Q,x,L,{start:F,end:Z}),Te=Ve({ref:S,className:((r=bn(b.className,G&&l,G&&a,X.enter&&l,X.enter&&X.closed&&a,X.enter&&!X.closed&&p,X.leave&&f,X.leave&&!X.closed&&h,X.leave&&X.closed&&v,!X.transition&&L&&m))==null?void 0:r.trim())||void 0,...ao(X)}),ke=0;P==="visible"&&(ke|=Oe.Open),P==="hidden"&&(ke|=Oe.Closed),L&&P==="hidden"&&(ke|=Oe.Opening),!L&&P==="visible"&&(ke|=Oe.Closing);let tt=ve();return d.createElement(qt.Provider,{value:_},d.createElement(Uo,{value:ke},tt({ourProps:Te,theirProps:b,defaultTag:Xo,features:qo,visible:P==="visible",name:"Transition.Child"})))}function oc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,c=d.useRef(null),u=Ko(e),i=xe(...u?[c,t]:t===null?[]:[t]);Qn();let l=Kn();if(n===void 0&&l!==null&&(n=(l&Oe.Open)===Oe.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,p]=d.useState(n?"visible":"hidden"),m=Qo(()=>{n||p("hidden")}),[f,h]=d.useState(!0),v=d.useRef([n]);ee(()=>{f!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),h(!1))},[v,n]);let b=d.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);ee(()=>{n?p("visible"):!Jt(m)&&c.current!==null&&p("hidden")},[n,m]);let x={unmount:o},E=z(()=>{var S;f&&h(!1),(S=e.beforeEnter)==null||S.call(e)}),y=z(()=>{var S;f&&h(!1),(S=e.beforeLeave)==null||S.call(e)}),C=ve();return d.createElement(qt.Provider,{value:m},d.createElement(Xt.Provider,{value:b},C({ourProps:{...x,as:d.Fragment,children:d.createElement(Jo,{ref:i,...x,...s,beforeEnter:E,beforeLeave:y})},theirProps:{},defaultTag:d.Fragment,features:qo,visible:a==="visible",name:"Transition"})))}function ic(e,t){let n=d.useContext(Xt)!==null,r=Kn()!==null;return d.createElement(d.Fragment,null,!n&&r?d.createElement(Xn,{ref:t,...e}):d.createElement(Jo,{ref:t,...e}))}let Xn=me(oc),Jo=me(rc),sc=me(ic),Zo=Object.assign(Xn,{Child:sc,Root:Xn});function lc(e,t){let n=d.useRef({left:0,top:0});if(ee(()=>{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 ei=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ti(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!je(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 ei.test(c)&&(c=c.replace(ei,"")),c}function ac(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():ti(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ti(e).trim()}function uc(e){let t=d.useRef(""),n=d.useRef("");return z(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=ac(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var cc=Object.defineProperty,fc=(e,t,n)=>t in e?cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ni=(e,t,n)=>(fc(e,typeof t!="symbol"?t+"":t,n),n),ae=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ae||{}),Fe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Fe||{}),Zt=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Zt||{}),ri=(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))(ri||{});function oi(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=eo(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 dc={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,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===re.Nothing)return{...u,activeOptionIndex:null};if(t.focus===re.Specific)return{...u,activeOptionIndex:e.options.findIndex(a=>a.id===t.id)};if(t.focus===re.Previous){let a=e.activeOptionIndex;if(a!==null){let p=e.options[a].dataRef.current.domRef,m=Qt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((r=p.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...u,activeOptionIndex:m}}}}else if(t.focus===re.Next){let a=e.activeOptionIndex;if(a!==null){let p=e.options[a].dataRef.current.domRef,m=Qt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((s=p.current)==null?void 0:s.nextElementSibling)===f.current||((c=f.current)==null?void 0:c.nextElementSibling)===null)return{...u,activeOptionIndex:m}}}}let i=oi(e),l=Qt(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!==re.Nothing&&(r=Qt(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:re.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,...oi(e),pendingShouldSort:!1}:e};class qn extends Vr{constructor(t){super(t),ni(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:c}=this.state.dataRef.current;return ye(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: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})}}),ni(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=On.get(null);this.disposables.add(r.on(Gr.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 qn({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 ye(n.type,dc,t,n)}}const ii=d.createContext(null);function Jn(e){let t=d.useContext(ii);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,si),n}return t}function si({id:e,__demoMode:t=!1}){let n=d.useMemo(()=>qn.new({id:e,__demoMode:t}),[]);return zo(()=>n.dispose()),n}let en=d.createContext(null);en.displayName="ListboxDataContext";function Tt(e){let t=d.useContext(en);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Tt),n}return t}let pc=d.Fragment;function mc(e,t){let n=d.useId(),r=gn(),{value:o,defaultValue:s,form:c,name:u,onChange:i,by:l,invalid:a=!1,disabled:p=r||!1,horizontal:m=!1,multiple:f=!1,__demoMode:h=!1,...v}=e;const b=m?"horizontal":"vertical";let x=xe(t),E=Ks(s),[y=f?[]:void 0,C]=Ys(o,i,E),S=si({id:n,__demoMode:h}),A=d.useRef({static:!1,hold:!1}),L=d.useRef(new Map),R=xl(l),V=d.useCallback(Q=>ye(P.mode,{[Fe.Multi]:()=>y.some(X=>R(X,Q)),[Fe.Single]:()=>R(y,Q)}),[y]),P=d.useMemo(()=>({value:y,disabled:p,invalid:a,mode:f?Fe.Multi:Fe.Single,orientation:b,onChange:C,compare:R,isSelected:V,optionsPropsRef:A,listRef:L}),[y,p,a,f,b,C,R,V,A,L]);ee(()=>{S.state.dataRef.current=P},[P]);let T=we(S,Q=>Q.listboxState),K=On.get(null),I=we(K,d.useCallback(Q=>K.selectors.isTop(Q,n),[K,n])),[D,B]=we(S,Q=>[Q.buttonElement,Q.optionsElement]);Yl(I,[D,B],(Q,X)=>{S.send({type:ri.CloseListbox}),Zr(X,Fn.Loose)||(Q.preventDefault(),D==null||D.focus())});let U=d.useMemo(()=>({open:T===ae.Open,disabled:p,invalid:a,value:y}),[T,p,a,y]),[G,O]=ml({inherit:!0}),_={ref:x},F=d.useCallback(()=>{if(E!==void 0)return C==null?void 0:C(E)},[C,E]),Z=ve();return d.createElement(O,{value:G,props:{htmlFor:D==null?void 0:D.id},slot:{open:T===ae.Open,disabled:p}},d.createElement(ju,null,d.createElement(ii.Provider,{value:S},d.createElement(en.Provider,{value:P},d.createElement(Uo,{value:ye(T,{[ae.Open]:Oe.Open,[ae.Closed]:Oe.Closed})},u!=null&&y!=null&&d.createElement(el,{disabled:p,data:{[u]:y},form:c,onReset:F}),Z({ourProps:_,theirProps:v,slot:U,defaultTag:pc,name:"Listbox"}))))))}let hc="button";function vc(e,t){let n=d.useId(),r=Mr(),o=Tt("Listbox.Button"),s=Jn("Listbox.Button"),{id:c=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:i=!1,...l}=e,a=xe(t,Lu(),s.actions.setButtonElement),p=Fu(),[m,f,h]=we(s,O=>[O.listboxState,O.buttonElement,O.optionsElement]),v=m===ae.Open;Xl(v,{trigger:f,action:d.useCallback(O=>{if(f!=null&&f.contains(O.target))return kt.Ignore;let _=O.target.closest('[role="option"]:not([data-disabled])');return je(_)?kt.Select(_):h!=null&&h.contains(O.target)?kt.Ignore:kt.Close},[f,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let b=z(O=>{switch(O.key){case le.Enter:Qs(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}}),x=z(O=>{switch(O.key){case le.Space:O.preventDefault();break}}),E=z(O=>{var _;if(O.button===Ho.Left){if(ll(O.currentTarget))return O.preventDefault();s.state.listboxState===ae.Open?(pe.flushSync(()=>s.actions.closeListbox()),(_=s.state.buttonElement)==null||_.focus({preventScroll:!0})):(O.preventDefault(),s.actions.openListbox({focus:re.Nothing}))}}),y=d.useRef(null),C=z(O=>{y.current=O.pointerType,O.pointerType==="mouse"&&E(O)}),S=z(O=>{y.current!=="mouse"&&E(O)}),A=z(O=>O.preventDefault()),L=kr([c]),R=cl(),{isFocusVisible:V,focusProps:P}=Is({autoFocus:i}),{isHovered:T,hoverProps:K}=Ds({isDisabled:u}),{pressed:I,pressProps:D}=Ws({disabled:u}),B=d.useMemo(()=>({open:m===ae.Open,active:I||m===ae.Open,disabled:u,invalid:o.invalid,value:o.value,hover:T,focus:V,autofocus:i}),[m,o.value,u,T,V,I,o.invalid,i]),U=we(s,O=>O.listboxState===ae.Open),G=Or(p(),{ref:a,id:c,type:ql(e,f),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":U,"aria-labelledby":L,"aria-describedby":R,disabled:u||void 0,autoFocus:i,onKeyDown:b,onKeyUp:x,onKeyPress:A,onPointerDown:C,onClick:S},P,K,D);return ve()({ourProps:G,theirProps:l,slot:B,defaultTag:hc,name:"Listbox.Button"})}let li=d.createContext(!1),gc="div",bc=Dt.RenderStrategy|Dt.Static;function yc(e,t){let n=d.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:c=!0,transition:u=!1,...i}=e,l=Mu(o),[a,p]=d.useState(null);l&&(s=!0);let m=Tt("Listbox.Options"),f=Jn("Listbox.Options"),[h,v,b,x]=we(f,k=>[k.listboxState,k.buttonElement,k.optionsElement,k.__demoMode]),E=Dn(v),y=Dn(b),C=Kn(),[S,A]=uo(u,a,C!==null?(C&Oe.Open)===Oe.Open:h===ae.Open);Il(S,v,f.actions.closeListbox);let L=x?!1:c&&h===ae.Open;ia(L,y);let R=x?!1:c&&h===ae.Open;Dl(R,{allowed:d.useCallback(()=>[v,b],[v,b])});let V=h!==ae.Open,P=lc(V,v)?!1:S,T=S&&h===ae.Closed,K=Ru(T,m.value),I=z(k=>m.compare(K,k)),D=we(f,k=>{var te;if(l==null||!((te=l==null?void 0:l.to)!=null&&te.includes("selection")))return null;let fe=k.options.findIndex(Ge=>I(Ge.dataRef.current.value));return fe===-1&&(fe=0),fe}),B=(()=>{if(l==null)return;if(D===null)return{...l,inner:void 0};let k=Array.from(m.listRef.current.values());return{...l,inner:{listRef:{current:k},index:D}}})(),[U,G]=Iu(B),O=Du(),_=xe(t,l?U:null,f.actions.setOptionsElement,p),F=rt();d.useEffect(()=>{var k;let te=b;te&&h===ae.Open&&te!==((k=bt(te))==null?void 0:k.activeElement)&&(te==null||te.focus({preventScroll:!0}))},[h,b]);let Z=z(k=>{var te,fe;switch(F.dispose(),k.key){case le.Space:if(f.state.searchQuery!=="")return k.preventDefault(),k.stopPropagation(),f.actions.search(k.key);case le.Enter:if(k.preventDefault(),k.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:Ge}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(Ge.current.value)}m.mode===Fe.Single&&(pe.flushSync(()=>f.actions.closeListbox()),(te=f.state.buttonElement)==null||te.focus({preventScroll:!0}));break;case ye(m.orientation,{vertical:le.ArrowDown,horizontal:le.ArrowRight}):return k.preventDefault(),k.stopPropagation(),f.actions.goToOption({focus:re.Next});case ye(m.orientation,{vertical:le.ArrowUp,horizontal:le.ArrowLeft}):return k.preventDefault(),k.stopPropagation(),f.actions.goToOption({focus:re.Previous});case le.Home:case le.PageUp:return k.preventDefault(),k.stopPropagation(),f.actions.goToOption({focus:re.First});case le.End:case le.PageDown:return k.preventDefault(),k.stopPropagation(),f.actions.goToOption({focus:re.Last});case le.Escape:k.preventDefault(),k.stopPropagation(),pe.flushSync(()=>f.actions.closeListbox()),(fe=f.state.buttonElement)==null||fe.focus({preventScroll:!0});return;case le.Tab:k.preventDefault(),k.stopPropagation(),pe.flushSync(()=>f.actions.closeListbox()),Ul(f.state.buttonElement,k.shiftKey?Ln.Previous:Ln.Next);break;default:k.key.length===1&&(f.actions.search(k.key),F.setTimeout(()=>f.actions.clearSearch(),350));break}}),Q=we(f,k=>{var te;return(te=k.buttonElement)==null?void 0:te.id}),X=d.useMemo(()=>({open:h===ae.Open}),[h]),Te=Or(l?O():{},{id:r,ref:_,"aria-activedescendant":we(f,f.selectors.activeDescendantId),"aria-multiselectable":m.mode===Fe.Multi?!0:void 0,"aria-labelledby":Q,"aria-orientation":m.orientation,onKeyDown:Z,role:"listbox",tabIndex:h===ae.Open?0:void 0,style:{...i.style,...G,"--button-width":wl(v,!0).width},...ao(A)}),ke=ve(),tt=d.useMemo(()=>m.mode===Fe.Multi?m:{...m,isSelected:I},[m,I]);return d.createElement(Ju,{enabled:s?e.static||S:!1,ownerDocument:E},d.createElement(en.Provider,{value:tt},ke({ourProps:Te,theirProps:i,slot:X,defaultTag:gc,features:bc,visible:P,name:"Listbox.Options"})))}let xc="div";function Ec(e,t){let n=d.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...c}=e,u=d.useContext(li)===!0,i=Tt("Listbox.Option"),l=Jn("Listbox.Option"),a=we(l,P=>l.selectors.isActive(P,r)),p=i.isSelected(s),m=d.useRef(null),f=uc(m),h=Qe({disabled:o,value:s,domRef:m,get textValue(){return f()}}),v=xe(t,m,P=>{P?i.listRef.current.set(r,P):i.listRef.current.delete(r)}),b=we(l,P=>l.selectors.shouldScrollIntoView(P,r));ee(()=>{if(b)return Se().requestAnimationFrame(()=>{var P,T;(T=(P=m.current)==null?void 0:P.scrollIntoView)==null||T.call(P,{block:"nearest"})})},[b,m]),ee(()=>{if(!u)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,u]);let x=z(P=>{var T;if(o)return P.preventDefault();l.actions.onChange(s),i.mode===Fe.Single&&(pe.flushSync(()=>l.actions.closeListbox()),(T=l.state.buttonElement)==null||T.focus({preventScroll:!0}))}),E=z(()=>{if(o)return l.actions.goToOption({focus:re.Nothing});l.actions.goToOption({focus:re.Specific,id:r})}),y=sa(),C=z(P=>y.update(P)),S=z(P=>{y.wasMoved(P)&&(o||a&&l.state.activationTrigger===Zt.Pointer||l.actions.goToOption({focus:re.Specific,id:r},Zt.Pointer))}),A=z(P=>{y.wasMoved(P)&&(o||a&&l.state.activationTrigger===Zt.Pointer&&l.actions.goToOption({focus:re.Nothing}))}),L=d.useMemo(()=>({active:a,focus:a,selected:p,disabled:o,selectedOption:p&&u}),[a,p,o,u]),R=u?{}:{id:r,ref:v,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:x,onFocus:E,onPointerEnter:C,onMouseEnter:C,onPointerMove:S,onMouseMove:S,onPointerLeave:A,onMouseLeave:A},V=ve();return!p&&u?null:V({ourProps:R,theirProps:c,slot:L,defaultTag:xc,name:"Listbox.Option"})}let wc=d.Fragment;function Cc(e,t){let{options:n,placeholder:r,...o}=e,s={ref:xe(t)},c=Tt("ListboxSelectedOption"),u=d.useMemo(()=>({}),[]),i=c.value===void 0||c.value===null||c.mode===Fe.Multi&&Array.isArray(c.value)&&c.value.length===0,l=ve();return d.createElement(li.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:d.createElement(d.Fragment,null,r&&i?r:n)},slot:u,defaultTag:wc,name:"ListboxSelectedOption"}))}let Sc=me(mc),$c=me(vc),Oc=bl,Tc=me(yc),Ac=me(Ec),Pc=me(Cc),ze=Object.assign(Sc,{Button:$c,Label:Oc,Options:Tc,Option:Ac,SelectedOption:Pc});function Nc({title:e,titleId:t,...n},r){return M.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?M.createElement("title",{id:t},e):null,M.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 ai=M.forwardRef(Nc);function Mc({title:e,titleId:t,...n},r){return M.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?M.createElement("title",{id:t},e):null,M.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 ui=M.forwardRef(Mc),Lc=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>w.jsx("div",{className:`relative ${o}`,children:w.jsx(ze,{value:t,onChange:n,disabled:r,children:({open:c})=>w.jsxs(w.Fragment,{children:[w.jsxs(ze.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
80
|
${c?"ring-2 ring-blue-500":""}
|
|
81
|
-
`,children:[w.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Asset"}),w.jsxs("div",{className:"flex items-center",children:[t.iconUrl?w.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):w.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:w.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),w.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),w.jsx(
|
|
81
|
+
`,children:[w.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Asset"}),w.jsxs("div",{className:"flex items-center",children:[t.iconUrl?w.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):w.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:w.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),w.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),w.jsx(ui,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${c?"rotate-180":""}`})]})]}),w.jsx(Zo,{as:d.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:w.jsx(ze.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(u=>w.jsx(
|
|
85
|
+
`,children:e.map(u=>w.jsx(ze.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})=>w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center space-x-3",children:[u.iconUrl?w.jsx("img",{src:u.iconUrl,alt:u.token,className:"w-5 h-5 rounded-full"}):w.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:w.jsx("span",{className:"text-xs text-white font-bold",children:u.token.charAt(0)})}),w.jsx("div",{className:"flex flex-col",children:w.jsx("span",{className:`text-sm font-medium ${i||l?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),i&&w.jsx(ai,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})}),Fc=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>w.jsx("div",{className:`relative ${o}`,children:w.jsx(ze,{value:t,onChange:n,disabled:r,children:({open:c})=>w.jsxs(w.Fragment,{children:[w.jsxs(ze.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
90
|
${c?"ring-2 ring-blue-500":""}
|
|
91
|
-
`,children:[w.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Chain"}),w.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?w.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):w.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:w.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),w.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),w.jsx(
|
|
91
|
+
`,children:[w.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Chain"}),w.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?w.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):w.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:w.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),w.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),w.jsx(ui,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${c?"rotate-180":""}`})]})]}),w.jsx(Zo,{as:d.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:w.jsx(ze.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(u=>u[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(u=>w.jsx(
|
|
95
|
+
`,children:e.filter(u=>u[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(u=>w.jsx(ze.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})=>w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center space-x-3",children:[u.chainIconUrl?w.jsx("img",{src:u.chainIconUrl,alt:u.chain,className:"w-5 h-5 rounded-full"}):w.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:w.jsx("span",{className:"text-xs text-white font-bold",children:u.chain.charAt(0)})}),w.jsx("div",{className:"flex flex-col",children:w.jsx("span",{className:`text-sm font-medium ${i||l?"text-text-primary":"text-text-tertiary"}`,children:u.chain})})]}),i&&w.jsx(ai,{className:"w-4 h-4 text-blue-400"})]})},u.chainId))})})]})})}),ci=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const c=d.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),u=f=>{if(n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(v=>v.token===r||v.symbol===r)){const v=f.tokenList[0];o(v.symbol||v.token)}},i=f=>{o(f.symbol||f.token)},l=d.useMemo(()=>t.map(f=>f),[t]),a=d.useMemo(()=>l.find(f=>f.chainId===e.chainId)||l[0],[l,e.chainId]),p=d.useMemo(()=>c.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[c]),m=d.useMemo(()=>{if(p.length!==0)return p.find(f=>f.token===r||f.symbol===r)||p[0]},[p,r]);return w.jsxs("div",{className:"space-y-4",children:[w.jsx(Fc,{chains:l,selectedChain:a,onChainChange:f=>{const h=t.find(v=>v.chainId===f.chainId);h&&u(h)},walletType:s,className:"w-full"}),p.length>0?m&&w.jsx(Lc,{tokens:p,selectedToken:m,onTokenChange:i,walletType:s,className:"w-full"}):w.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:w.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})};var Dc=Object.defineProperty,tn=Object.getOwnPropertySymbols,fi=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable,pi=(e,t,n)=>t in e?Dc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zn=(e,t)=>{for(var n in t||(t={}))fi.call(t,n)&&pi(e,n,t[n]);if(tn)for(var n of tn(t))di.call(t,n)&&pi(e,n,t[n]);return e},er=(e,t)=>{var n={};for(var r in e)fi.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&tn)for(var r of tn(e))t.indexOf(r)<0&&di.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 Je;(e=>{const t=class W{constructor(i,l,a,p){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<W.MIN_VERSION||i>W.MAX_VERSION)throw new RangeError("Version value out of range");if(p<-1||p>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let m=[];for(let h=0;h<this.size;h++)m.push(!1);for(let h=0;h<this.size;h++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(a);if(this.drawCodewords(f),p==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const v=this.getPenaltyScore();v<h&&(p=b,h=v),this.applyMask(b)}}o(0<=p&&p<=7),this.mask=p,this.applyMask(p),this.drawFormatBits(p),this.isFunction=[]}static encodeText(i,l){const a=e.QrSegment.makeSegments(i);return W.encodeSegments(a,l)}static encodeBinary(i,l){const a=e.QrSegment.makeBytes(i);return W.encodeSegments([a],l)}static encodeSegments(i,l,a=1,p=40,m=-1,f=!0){if(!(W.MIN_VERSION<=a&&a<=p&&p<=W.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,b;for(h=a;;h++){const y=W.getNumDataCodewords(h,l)*8,S=c.getTotalBits(i,h);if(S<=y){b=S;break}if(h>=p)throw new RangeError("Data too long")}for(const y of[W.Ecc.MEDIUM,W.Ecc.QUARTILE,W.Ecc.HIGH])f&&b<=W.getNumDataCodewords(h,y)*8&&(l=y);let v=[];for(const y of i){n(y.mode.modeBits,4,v),n(y.numChars,y.mode.numCharCountBits(h),v);for(const S of y.getData())v.push(S)}o(v.length==b);const E=W.getNumDataCodewords(h,l)*8;o(v.length<=E),n(0,Math.min(4,E-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let y=236;v.length<E;y^=253)n(y,8,v);let x=[];for(;x.length*8<v.length;)x.push(0);return v.forEach((y,S)=>x[S>>>3]|=y<<7-(S&7)),new W(h,l,x,m)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let a=0;a<l;a++)for(let p=0;p<l;p++)a==0&&p==0||a==0&&p==l-1||a==l-1&&p==0||this.drawAlignmentPattern(i[a],i[p]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let a=l;for(let m=0;m<10;m++)a=a<<1^(a>>>9)*1335;const p=(l<<10|a)^21522;o(p>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(p,m));this.setFunctionModule(8,7,r(p,6)),this.setFunctionModule(8,8,r(p,7)),this.setFunctionModule(7,8,r(p,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(p,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(p,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(p,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let a=0;a<12;a++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let a=0;a<18;a++){const p=r(l,a),m=this.size-11+a%3,f=Math.floor(a/3);this.setFunctionModule(m,f,p),this.setFunctionModule(f,m,p)}}drawFinderPattern(i,l){for(let a=-4;a<=4;a++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(a)),f=i+p,h=l+a;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,m!=2&&m!=4)}}drawAlignmentPattern(i,l){for(let a=-2;a<=2;a++)for(let p=-2;p<=2;p++)this.setFunctionModule(i+p,l+a,Math.max(Math.abs(p),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!=W.getNumDataCodewords(l,a))throw new RangeError("Invalid argument");const p=W.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][l],m=W.ECC_CODEWORDS_PER_BLOCK[a.ordinal][l],f=Math.floor(W.getNumRawDataModules(l)/8),h=p-f%p,b=Math.floor(f/p);let v=[];const E=W.reedSolomonComputeDivisor(m);for(let y=0,S=0;y<p;y++){let C=i.slice(S,S+b-m+(y<h?0:1));S+=C.length;const O=W.reedSolomonComputeRemainder(C,E);y<h&&C.push(0),v.push(C.concat(O))}let x=[];for(let y=0;y<v[0].length;y++)v.forEach((S,C)=>{(y!=b-m||C>=h)&&x.push(S[y])});return o(x.length==f),x}drawCodewords(i){if(i.length!=Math.floor(W.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 p=0;p<this.size;p++)for(let m=0;m<2;m++){const f=a-m,b=(a+1&2)==0?this.size-1-p:p;!this.isFunction[b][f]&&l<i.length*8&&(this.modules[b][f]=r(i[l>>>3],7-(l&7)),l++)}}o(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let a=0;a<this.size;a++){let p;switch(i){case 0:p=(a+l)%2==0;break;case 1:p=l%2==0;break;case 2:p=a%3==0;break;case 3:p=(a+l)%3==0;break;case 4:p=(Math.floor(a/3)+Math.floor(l/2))%2==0;break;case 5:p=a*l%2+a*l%3==0;break;case 6:p=(a*l%2+a*l%3)%2==0;break;case 7:p=((a+l)%2+a*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][a]&&p&&(this.modules[l][a]=!this.modules[l][a])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let f=!1,h=0,b=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[m][v]==f?(h++,h==5?i+=W.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),f||(i+=this.finderPenaltyCountPatterns(b)*W.PENALTY_N3),f=this.modules[m][v],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,b)*W.PENALTY_N3}for(let m=0;m<this.size;m++){let f=!1,h=0,b=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][m]==f?(h++,h==5?i+=W.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),f||(i+=this.finderPenaltyCountPatterns(b)*W.PENALTY_N3),f=this.modules[v][m],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,b)*W.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let f=0;f<this.size-1;f++){const h=this.modules[m][f];h==this.modules[m][f+1]&&h==this.modules[m+1][f]&&h==this.modules[m+1][f+1]&&(i+=W.PENALTY_N2)}let l=0;for(const m of this.modules)l=m.reduce((f,h)=>f+(h?1:0),l);const a=this.size*this.size,p=Math.ceil(Math.abs(l*20-a*10)/a)-1;return o(0<=p&&p<=9),i+=p*W.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 p=this.size-7;a.length<i;p-=l)a.splice(1,0,p);return a}}static getNumRawDataModules(i){if(i<W.MIN_VERSION||i>W.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(W.getNumRawDataModules(i)/8)-W.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*W.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 p=0;p<i-1;p++)l.push(0);l.push(1);let a=1;for(let p=0;p<i;p++){for(let m=0;m<l.length;m++)l[m]=W.reedSolomonMultiply(l[m],a),m+1<l.length&&(l[m]^=l[m+1]);a=W.reedSolomonMultiply(a,2)}return l}static reedSolomonComputeRemainder(i,l){let a=l.map(p=>0);for(const p of i){const m=p^a.shift();a.push(0),l.forEach((f,h)=>a[h]^=W.reedSolomonMultiply(f,m))}return a}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let a=0;for(let p=7;p>=0;p--)a=a<<1^(a>>>7)*285,a^=(l>>>p&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 re{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 re(re.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!re.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let a=0;a<i.length;){const p=Math.min(i.length-a,3);n(parseInt(i.substring(a,a+p),10),p*3+1,l),a+=p}return new re(re.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!re.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 p=re.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a))*45;p+=re.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a+1)),n(p,11,l)}return a<i.length&&n(re.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a)),6,l),new re(re.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:re.isNumeric(i)?[re.makeNumeric(i)]:re.isAlphanumeric(i)?[re.makeAlphanumeric(i)]:[re.makeBytes(re.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 re(re.Mode.ECI,0,l)}static isNumeric(i){return re.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return re.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let a=0;for(const p of i){const m=p.mode.numCharCountBits(l);if(p.numChars>=1<<m)return 1/0;a+=4+m+p.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})(Je||(Je={})),(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={}))})(Je||(Je={})),(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={}))})(Je||(Je={}));var ft=Je;/**
|
|
99
|
+
*/var Ze;(e=>{const t=class W{constructor(i,l,a,p){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<W.MIN_VERSION||i>W.MAX_VERSION)throw new RangeError("Version value out of range");if(p<-1||p>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let m=[];for(let h=0;h<this.size;h++)m.push(!1);for(let h=0;h<this.size;h++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(a);if(this.drawCodewords(f),p==-1){let h=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const b=this.getPenaltyScore();b<h&&(p=v,h=b),this.applyMask(v)}}o(0<=p&&p<=7),this.mask=p,this.applyMask(p),this.drawFormatBits(p),this.isFunction=[]}static encodeText(i,l){const a=e.QrSegment.makeSegments(i);return W.encodeSegments(a,l)}static encodeBinary(i,l){const a=e.QrSegment.makeBytes(i);return W.encodeSegments([a],l)}static encodeSegments(i,l,a=1,p=40,m=-1,f=!0){if(!(W.MIN_VERSION<=a&&a<=p&&p<=W.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,v;for(h=a;;h++){const y=W.getNumDataCodewords(h,l)*8,C=c.getTotalBits(i,h);if(C<=y){v=C;break}if(h>=p)throw new RangeError("Data too long")}for(const y of[W.Ecc.MEDIUM,W.Ecc.QUARTILE,W.Ecc.HIGH])f&&v<=W.getNumDataCodewords(h,y)*8&&(l=y);let b=[];for(const y of i){n(y.mode.modeBits,4,b),n(y.numChars,y.mode.numCharCountBits(h),b);for(const C of y.getData())b.push(C)}o(b.length==v);const x=W.getNumDataCodewords(h,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 E=[];for(;E.length*8<b.length;)E.push(0);return b.forEach((y,C)=>E[C>>>3]|=y<<7-(C&7)),new W(h,l,E,m)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let a=0;a<l;a++)for(let p=0;p<l;p++)a==0&&p==0||a==0&&p==l-1||a==l-1&&p==0||this.drawAlignmentPattern(i[a],i[p]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let a=l;for(let m=0;m<10;m++)a=a<<1^(a>>>9)*1335;const p=(l<<10|a)^21522;o(p>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(p,m));this.setFunctionModule(8,7,r(p,6)),this.setFunctionModule(8,8,r(p,7)),this.setFunctionModule(7,8,r(p,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(p,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(p,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(p,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let a=0;a<12;a++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let a=0;a<18;a++){const p=r(l,a),m=this.size-11+a%3,f=Math.floor(a/3);this.setFunctionModule(m,f,p),this.setFunctionModule(f,m,p)}}drawFinderPattern(i,l){for(let a=-4;a<=4;a++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(a)),f=i+p,h=l+a;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,m!=2&&m!=4)}}drawAlignmentPattern(i,l){for(let a=-2;a<=2;a++)for(let p=-2;p<=2;p++)this.setFunctionModule(i+p,l+a,Math.max(Math.abs(p),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!=W.getNumDataCodewords(l,a))throw new RangeError("Invalid argument");const p=W.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][l],m=W.ECC_CODEWORDS_PER_BLOCK[a.ordinal][l],f=Math.floor(W.getNumRawDataModules(l)/8),h=p-f%p,v=Math.floor(f/p);let b=[];const x=W.reedSolomonComputeDivisor(m);for(let y=0,C=0;y<p;y++){let S=i.slice(C,C+v-m+(y<h?0:1));C+=S.length;const A=W.reedSolomonComputeRemainder(S,x);y<h&&S.push(0),b.push(S.concat(A))}let E=[];for(let y=0;y<b[0].length;y++)b.forEach((C,S)=>{(y!=v-m||S>=h)&&E.push(C[y])});return o(E.length==f),E}drawCodewords(i){if(i.length!=Math.floor(W.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 p=0;p<this.size;p++)for(let m=0;m<2;m++){const f=a-m,v=(a+1&2)==0?this.size-1-p:p;!this.isFunction[v][f]&&l<i.length*8&&(this.modules[v][f]=r(i[l>>>3],7-(l&7)),l++)}}o(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let a=0;a<this.size;a++){let p;switch(i){case 0:p=(a+l)%2==0;break;case 1:p=l%2==0;break;case 2:p=a%3==0;break;case 3:p=(a+l)%3==0;break;case 4:p=(Math.floor(a/3)+Math.floor(l/2))%2==0;break;case 5:p=a*l%2+a*l%3==0;break;case 6:p=(a*l%2+a*l%3)%2==0;break;case 7:p=((a+l)%2+a*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][a]&&p&&(this.modules[l][a]=!this.modules[l][a])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[m][b]==f?(h++,h==5?i+=W.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,v),f||(i+=this.finderPenaltyCountPatterns(v)*W.PENALTY_N3),f=this.modules[m][b],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,v)*W.PENALTY_N3}for(let m=0;m<this.size;m++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[b][m]==f?(h++,h==5?i+=W.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,v),f||(i+=this.finderPenaltyCountPatterns(v)*W.PENALTY_N3),f=this.modules[b][m],h=1);i+=this.finderPenaltyTerminateAndCount(f,h,v)*W.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let f=0;f<this.size-1;f++){const h=this.modules[m][f];h==this.modules[m][f+1]&&h==this.modules[m+1][f]&&h==this.modules[m+1][f+1]&&(i+=W.PENALTY_N2)}let l=0;for(const m of this.modules)l=m.reduce((f,h)=>f+(h?1:0),l);const a=this.size*this.size,p=Math.ceil(Math.abs(l*20-a*10)/a)-1;return o(0<=p&&p<=9),i+=p*W.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 p=this.size-7;a.length<i;p-=l)a.splice(1,0,p);return a}}static getNumRawDataModules(i){if(i<W.MIN_VERSION||i>W.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(W.getNumRawDataModules(i)/8)-W.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*W.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 p=0;p<i-1;p++)l.push(0);l.push(1);let a=1;for(let p=0;p<i;p++){for(let m=0;m<l.length;m++)l[m]=W.reedSolomonMultiply(l[m],a),m+1<l.length&&(l[m]^=l[m+1]);a=W.reedSolomonMultiply(a,2)}return l}static reedSolomonComputeRemainder(i,l){let a=l.map(p=>0);for(const p of i){const m=p^a.shift();a.push(0),l.forEach((f,h)=>a[h]^=W.reedSolomonMultiply(f,m))}return a}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let a=0;for(let p=7;p>=0;p--)a=a<<1^(a>>>7)*285,a^=(l>>>p&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 oe{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 oe(oe.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!oe.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let a=0;a<i.length;){const p=Math.min(i.length-a,3);n(parseInt(i.substring(a,a+p),10),p*3+1,l),a+=p}return new oe(oe.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!oe.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 p=oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a))*45;p+=oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a+1)),n(p,11,l)}return a<i.length&&n(oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a)),6,l),new oe(oe.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:oe.isNumeric(i)?[oe.makeNumeric(i)]:oe.isAlphanumeric(i)?[oe.makeAlphanumeric(i)]:[oe.makeBytes(oe.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 oe(oe.Mode.ECI,0,l)}static isNumeric(i){return oe.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return oe.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let a=0;for(const p of i){const m=p.mode.numCharCountBits(l);if(p.numChars>=1<<m)return 1/0;a+=4+m+p.bitData.length}return a}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let a=0;a<i.length;a++)i.charAt(a)!="%"?l.push(i.charCodeAt(a)):(l.push(parseInt(i.substring(a+1,a+3),16)),a+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let c=s;e.QrSegment=s})(Ze||(Ze={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Ze||(Ze={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Ze||(Ze={}));var ft=Ze;/**
|
|
100
100
|
* @license qrcode.react
|
|
101
101
|
* Copyright (c) Paul O'Shannessy
|
|
102
102
|
* SPDX-License-Identifier: ISC
|
|
103
|
-
*/var Ic={L:ft.QrCode.Ecc.LOW,M:ft.QrCode.Ecc.MEDIUM,Q:ft.QrCode.Ecc.QUARTILE,H:ft.QrCode.Ecc.HIGH},hi=128,gi="L",vi="#FFFFFF",bi="#000000",yi=!1,xi=1,jc=4,_c=0,kc=.1;function wi(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 Ei(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 Rc(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*kc),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,p=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let h=Math.floor(l),b=Math.floor(a),v=Math.ceil(u+l-h),E=Math.ceil(i+a-b);m={x:h,y:b,w:v,h:E}}const f=r.crossOrigin;return{x:l,y:a,h:i,w:u,excavation:m,opacity:p,crossOrigin:f}}function Bc(e,t){return t!=null?Math.max(Math.floor(t),0):e?jc:_c}function Ci({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:c,boostLevel:u}){let i=d.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((b,v)=>(b.push(...ft.QrSegment.makeSegments(v)),b),[]);return ft.QrCode.encodeSegments(h,Ic[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:a,numCells:p,calculatedImageSettings:m}=d.useMemo(()=>{let f=i.getModules();const h=Bc(r,o),b=f.length+h*2,v=Rc(f,c,h,s);return{cells:f,margin:h,numCells:b,calculatedImageSettings:v}},[i,c,s,r,o]);return{qrcode:i,margin:a,cells:l,numCells:p,calculatedImageSettings:m}}var Wc=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Vc=d.forwardRef(function(t,n){const r=t,{value:o,size:s=hi,level:c=gi,bgColor:u=vi,fgColor:i=bi,includeMargin:l=yi,minVersion:a=xi,boostLevel:p,marginSize:m,imageSettings:f}=r,b=er(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=b,E=er(b,["style"]),x=f==null?void 0:f.src,y=d.useRef(null),S=d.useRef(null),C=d.useCallback(A=>{y.current=A,typeof n=="function"?n(A):n&&(n.current=A)},[n]),[O,F]=d.useState(!1),{margin:R,cells:V,numCells:M,calculatedImageSettings:L}=Ci({value:o,level:c,minVersion:a,boostLevel:p,includeMargin:l,marginSize:m,imageSettings:f,size:s});d.useEffect(()=>{if(y.current!=null){const A=y.current,D=A.getContext("2d");if(!D)return;let B=V;const H=S.current,T=L!=null&&H!==null&&H.complete&&H.naturalHeight!==0&&H.naturalWidth!==0;T&&L.excavation!=null&&(B=Ei(V,L.excavation));const k=window.devicePixelRatio||1;A.height=A.width=s*k;const Q=s/M*k;D.scale(Q,Q),D.fillStyle=u,D.fillRect(0,0,M,M),D.fillStyle=i,Wc?D.fill(new Path2D(wi(B,R))):V.forEach(function(me,Z){me.forEach(function(q,et){q&&D.fillRect(et+R,Z+R,1,1)})}),L&&(D.globalAlpha=L.opacity),T&&D.drawImage(H,L.x+R,L.y+R,L.w,L.h)}}),d.useEffect(()=>{F(!1)},[x]);const Y=Zn({height:s,width:s},v);let j=null;return x!=null&&(j=d.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{F(!0)},ref:S,crossOrigin:L==null?void 0:L.crossOrigin})),d.createElement(d.Fragment,null,d.createElement("canvas",Zn({style:Y,height:s,width:s,ref:C,role:"img"},E)),j)});Vc.displayName="QRCodeCanvas";var Si=d.forwardRef(function(t,n){const r=t,{value:o,size:s=hi,level:c=gi,bgColor:u=vi,fgColor:i=bi,includeMargin:l=yi,minVersion:a=xi,boostLevel:p,title:m,marginSize:f,imageSettings:h}=r,b=er(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:E,numCells:x,calculatedImageSettings:y}=Ci({value:o,level:c,minVersion:a,boostLevel:p,includeMargin:l,marginSize:f,imageSettings:h,size:s});let S=E,C=null;h!=null&&y!=null&&(y.excavation!=null&&(S=Ei(E,y.excavation)),C=d.createElement("image",{href:h.src,height:y.h,width:y.w,x:y.x+v,y:y.y+v,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const O=wi(S,v);return d.createElement("svg",Zn({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},b),!!m&&d.createElement("title",null,m),d.createElement("path",{fill:u,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),d.createElement("path",{fill:i,d:O,shapeRendering:"crispEdges"}),C)});Si.displayName="QRCodeSVG";const Hc=(e,t)=>Number(e)>Number(t),Ze=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"},$i=(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 $i(i,t)}const s=parseFloat(e),c=parseFloat(t);if(!isNaN(s)&&!isNaN(c)&&s>c)return{isValid:!0,formattedValue:Ze(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}},Uc=(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)},Oi={ETHEREUM:1,SEPOLIA:11155111},zc=[Oi.ETHEREUM,Oi.SEPOLIA],Gc=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!zc.includes(t)}return!0},Yc=[{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}],Ti={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Ai={address:"0x1234567890123456789012345678901234567890"},Pi={multiChain:{minDeposit:10}},Kc=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r})=>{var s;const o=d.useMemo(()=>Gc(n||{}),[n]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"flex justify-center mt-4 mb-3",children:w.jsx("div",{className:"bg-white rounded-lg",children:w.jsx(Si,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),w.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[w.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),w.jsx("div",{onClick:()=>{navigator.clipboard.writeText((e==null?void 0:e.getDisplayAddress())||"")},style:{cursor:"pointer"},children:w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[w.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),w.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),w.jsxs("div",{className:"flex items-start",children:[w.jsx("div",{className:"w-5",children:w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.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"})})}),w.jsxs("div",{className:"flex-1",children:[w.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."]}),w.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),o&&w.jsxs(w.Fragment,{children:[w.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."}),w.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),w.jsxs("div",{className:"text-sm",children:[w.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[w.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),w.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"]})]}),w.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[w.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),w.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]})]}),w.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[w.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),w.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},Qc=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onClose:c})=>{var b;const[u,i]=d.useState(()=>{var v;return!e||e.length===0?1:t||((v=e[0])==null?void 0:v.chainId)||1}),[l,a]=d.useState(()=>{var y;if(!e||e.length===0)return"";const v=t||((y=e[0])==null?void 0:y.chainId),E=e.find(S=>S.chainId===v);if(!E||!E.tokenList||E.tokenList.length===0)return"";const x=E.tokenList.find(S=>S.tokenAddress===n)||E.tokenList[0];return(x==null?void 0:x.token)||""}),[p,m]=d.useState(""),f=e&&e.length>0?e.find(v=>v.chainId===u)||e[0]:null,h=(b=f==null?void 0:f.tokenList)==null?void 0:b.find(v=>v.token===l);return!e||e.length===0?w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"No chains available"})}):f?w.jsxs(w.Fragment,{children:[w.jsx(fi,{currentActiveChain:f,chainList:e,onChainChange:i,curSelectToken:l,onTokenChange:a,walletType:"mpc"}),w.jsx(Kc,{walletAdapter:r,curSelectToken:l,currentActiveChain:f,metadata:o}),w.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:p,chainId:u,tokenAddress:(h==null?void 0:h.tokenAddress)||"",tokenSymbol:l}),c()},children:"Deposit"})]}):w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Xc=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:c,decimals:u,tokenBalance:i,onDepositAmountChange:l,onApprove:a})=>{const p=f=>{const h=f.target.value,v=$i(h,i||"0");if(v.isValid)l(v.formattedValue),v.errorType;else return v.errorType==="exceed_balance",void 0},m=()=>{const f=parseFloat(i||"0"),h=parseFloat(e||"0");if(h>0){const b=f-h,v=Ze(Math.max(0,b).toString());return`${Ze(i||"0")} → ${v} ${t}`}return`${Ze(i||"0")} ${t}`};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-[10px] my-4",children:[w.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[w.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:p,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),w.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"})]}),w.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),w.jsxs("div",{className:"flex justify-between items-center",children:[w.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),w.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:m()})]})]}),!r&&Hc(e||"0",0)&&w.jsxs("div",{className:"flex justify-center flex-col items-center",children:[w.jsxs("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:["Enable ",t," on ",o==null?void 0:o.chain]}),w.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,"."]}),w.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:a,children:["Enable ",t]})]}),w.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:w.jsxs("div",{className:"flex justify-between items-center",children:[w.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:"总资产"}),w.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?`${Ze("0")} → ${Ze(e)} ${t}`:`${Ze("0")} ${t}`})]})})]})},qc=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var p;const s=d.useMemo(()=>r.filter(m=>m.tokenAddress&&m.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),c=(p=o==null?void 0:o.useBalance)==null?void 0:p.call(o,{address:e,chainId:t}),u=s.map(m=>{var f;return(f=o==null?void 0:o.useBalance)==null?void 0:f.call(o,{address:e,token:m.tokenAddress,chainId:t})}),i=s.map(m=>{var f;return(f=o==null?void 0:o.useReadContract)==null?void 0:f.call(o,{address:m.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[e,n],chainId:t})}),l=d.useMemo(()=>{const m=c!=null&&c.data?{value:c.data.value,formatted:c.data.formatted,decimals:c.data.decimals,symbol:c.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},f=u.map((v,E)=>{const x=s[E],y=v==null?void 0:v.data;return{address:x.tokenAddress,value:(y==null?void 0:y.value)||BigInt(0),formatted:(y==null?void 0:y.formatted)||"0",decimals:(y==null?void 0:y.decimals)||x.decimals}}),h=i.map((v,E)=>{const x=s[E],y=v!=null&&v.data?BigInt(v.data.toString()):BigInt(0);return{address:x.tokenAddress,value:y,formatted:(y/BigInt(10)**BigInt(x.decimals)).toString(),decimals:x.decimals}}),b=f.reduce((v,E)=>{const x=h.find(y=>y.address===E.address);return{...v,[E.address]:{balance:E,allowance:x||{address:E.address,value:BigInt(0),formatted:"0",decimals:E.decimals}}}},{});return{balanceList:f,allowanceList:h,baseTokenBalance:m,combinedData:b}},[c==null?void 0:c.data,u,i,s]);return{multicallRun:d.useCallback(async()=>l,[l]),multicallResult:l,validErcTokens:s,isLoading:(c==null?void 0:c.isLoading)||u.some(m=>m==null?void 0:m.isLoading)||i.some(m=>m==null?void 0:m.isLoading)}},Jc=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:c,wagmiHooks:u,approved:i,onApproved:l,onDeposit:a,onClose:p})=>{var j;const[m,f]=d.useState(()=>{var A;return!e||e.length===0?1:t||((A=e[0])==null?void 0:A.chainId)||1}),[h,b]=d.useState(()=>{var H;if(!e||e.length===0)return"";const A=t||((H=e[0])==null?void 0:H.chainId),D=e.find(T=>T.chainId===A);if(!D||!D.tokenList||D.tokenList.length===0)return"";const B=D.tokenList.find(T=>T.tokenAddress===n)||D.tokenList[0];return(B==null?void 0:B.token)||""}),[v,E]=d.useState(r),x=d.useRef(!0),y=d.useRef(h),S=d.useRef(m);d.useEffect(()=>{if(x.current){x.current=!1,y.current=h,S.current=m;return}(y.current!==h||S.current!==m)&&(E(""),y.current=h,S.current=m)},[h,m]);const C=e&&e.length>0?e.find(A=>A.chainId===m)||e[0]:null,O=(j=C==null?void 0:C.tokenList)==null?void 0:j.find(A=>A.token===h),F=o==null?void 0:o.getDisplayAddress(),{multicallResult:R}=qc({account:F,chainId:m,contractAddress:void 0,tokens:(C==null?void 0:C.tokenList)||[],wagmiHooks:u}),V=d.useMemo(()=>{var D;if(!O)return;if(!O.tokenAddress||O.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return R.baseTokenBalance.formatted;const A=R.combinedData[O.tokenAddress];return((D=A==null?void 0:A.balance)==null?void 0:D.formatted)||"0"},[O,R]),M=d.useMemo(()=>{var D;if(i!==void 0)return i;const A=(D=O==null?void 0:O.allowance)==null?void 0:D.formatted;return!A||!v?!1:parseFloat(A)>=parseFloat(v)},[i,O==null?void 0:O.allowance,v]),L=d.useMemo(()=>{const A=parseFloat(v||"0"),D=10,B=V||"0",H=Uc(v,B,M);return!v||A===0?{text:"Confirm Deposit",disabled:!0}:M?A>parseFloat(B)?{text:"Insufficient Balance",disabled:!0}:A<D?{text:`Min Deposit ${D} ${h}`,disabled:!0}:{text:"Confirm Deposit",disabled:!H}:{text:"Confirm Deposit",disabled:!0}},[v,h,V,M]),Y=d.useCallback(async()=>{a&&a({amount:v,chainId:m,tokenAddress:(O==null?void 0:O.tokenAddress)||"",tokenSymbol:h}),p()},[a,p,v,m,O==null?void 0:O.tokenAddress,h]);return!e||e.length===0?w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"No chains available"})}):C?w.jsxs(w.Fragment,{children:[w.jsx(fi,{currentActiveChain:C,chainList:e,onChainChange:f,curSelectToken:h,onTokenChange:b,walletType:"evm"}),w.jsx(Xc,{depositAmount:v,curSelectToken:h,curSelectTokenData:{balance:O==null?void 0:O.balance,allowance:O==null?void 0:O.allowance},approved:M,currentActiveChain:C,currentEquity:c||0,amount:v,decimals:(O==null?void 0:O.decimals)||6,tokenBalance:V,onDepositAmountChange:E,onApprove:async()=>{l&&await l()}}),w.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${L.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Y,disabled:L.disabled,children:L.text})]}):w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Mi=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=Ti,smartWallet:o=Ai,chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i="",metadata:l=Pi,currentEquity:a=5e3,approved:p,onApproved:m,onDeposit:f})=>{const h=d.useMemo(()=>{var v;return r?fs(r,o,!1,(v=s[0])==null?void 0:v.chainId,"0","0"):null},[r,o,s]),b=(h==null?void 0:h.getWalletType())==="mpc";return e?de.createPortal(w.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:w.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:w.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:v=>{v.stopPropagation()},children:[w.jsxs("div",{className:"flex items-center justify-between mb-4",children:[w.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),w.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:w.jsx(as,{className:"h-4 w-4"})})]}),b?w.jsx(Qc,{chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i,walletAdapter:h,metadata:l,currentEquity:a,onDeposit:f,onClose:t}):w.jsx(Jc,{chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i,walletAdapter:h,metadata:l,currentEquity:a,approved:p,onApproved:m,onDeposit:f,onClose:t})]})})}),document.body):null};let Fe=null;const Zc={symbol:"USDT"},Ni=d.forwardRef((e,t)=>{const[n,r]=d.useState(!1),[o,s]=d.useState({chains:[]}),c=d.useCallback(a=>{s(a),r(!0)},[]),u=d.useCallback(a=>{s(p=>({...p,...a}))},[]),i=d.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=d.useCallback(()=>n,[n]);return d.useImperativeHandle(t,()=>({openDeposit:c,closeDeposit:i,updateDepositOptions:u,isOpen:l}),[c,i,u,l]),d.useEffect(()=>(Fe={openDeposit:c,closeDeposit:i,updateDepositOptions:u,isOpen:l},()=>{Fe=null}),[c,i,u,l]),w.jsx(Mi,{isOpen:n,onClose:i,config:o.config||Zc,currentActiveAccount:o.currentActiveAccount||Ti,smartWallet:o.smartWallet||Ai,chains:o.chains||Yc,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||Pi,currentEquity:o.currentEquity??5e3,wagmiHooks:o.wagmiHooks,approved:o.approved,onApproved:o.onApproved,onDeposit:o.onDeposit})});Ni.displayName="DepositManager";const Li=e=>{if(!Fe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Fe.openDeposit(e||{chains:[]})},Fi=()=>{if(!Fe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Fe.closeDeposit()},ef=e=>{if(!Fe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Fe.updateDepositOptions(e)},tf=()=>Fe?Fe.isOpen():!1,nf=()=>({openDeposit:Li,closeDeposit:Fi,updateDepositOptions:ef,isOpen:tf});d.createContext(null);const rf=({isOpen:e,onClose:t,config:n})=>e?w.jsx("div",{className:"withdraw-modal",children:w.jsx("div",{className:"modal-overlay",onClick:t,children:w.jsxs("div",{className:"modal-content",onClick:r=>r.stopPropagation(),children:[w.jsxs("h2",{children:["Withdraw ",n.symbol]}),w.jsxs("p",{children:["Symbol: ",n.symbol]}),w.jsx("button",{onClick:t,children:"Close"})]})})}):null;ne.ComponentProvider=Zi,ne.Deposit=Mi,ne.DepositManager=Ni,ne.Withdraw=rf,ne.closeDeposit=Fi,ne.openDeposit=Li,ne.useDeposit=es,ne.useDepositManager=nf,ne.useWithdraw=ts,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})});
|
|
103
|
+
*/var Ic={L:ft.QrCode.Ecc.LOW,M:ft.QrCode.Ecc.MEDIUM,Q:ft.QrCode.Ecc.QUARTILE,H:ft.QrCode.Ecc.HIGH},mi=128,hi="L",vi="#FFFFFF",gi="#000000",bi=!1,yi=1,jc=4,_c=0,kc=.1;function xi(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 Ei(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 Rc(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*kc),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,p=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let h=Math.floor(l),v=Math.floor(a),b=Math.ceil(u+l-h),x=Math.ceil(i+a-v);m={x:h,y:v,w:b,h:x}}const f=r.crossOrigin;return{x:l,y:a,h:i,w:u,excavation:m,opacity:p,crossOrigin:f}}function Bc(e,t){return t!=null?Math.max(Math.floor(t),0):e?jc:_c}function wi({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:c,boostLevel:u}){let i=d.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((v,b)=>(v.push(...ft.QrSegment.makeSegments(b)),v),[]);return ft.QrCode.encodeSegments(h,Ic[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:a,numCells:p,calculatedImageSettings:m}=d.useMemo(()=>{let f=i.getModules();const h=Bc(r,o),v=f.length+h*2,b=Rc(f,c,h,s);return{cells:f,margin:h,numCells:v,calculatedImageSettings:b}},[i,c,s,r,o]);return{qrcode:i,margin:a,cells:l,numCells:p,calculatedImageSettings:m}}var Wc=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Vc=d.forwardRef(function(t,n){const r=t,{value:o,size:s=mi,level:c=hi,bgColor:u=vi,fgColor:i=gi,includeMargin:l=bi,minVersion:a=yi,boostLevel:p,marginSize:m,imageSettings:f}=r,v=er(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=v,x=er(v,["style"]),E=f==null?void 0:f.src,y=d.useRef(null),C=d.useRef(null),S=d.useCallback(D=>{y.current=D,typeof n=="function"?n(D):n&&(n.current=D)},[n]),[A,L]=d.useState(!1),{margin:R,cells:V,numCells:P,calculatedImageSettings:T}=wi({value:o,level:c,minVersion:a,boostLevel:p,includeMargin:l,marginSize:m,imageSettings:f,size:s});d.useEffect(()=>{if(y.current!=null){const D=y.current,B=D.getContext("2d");if(!B)return;let U=V;const G=C.current,O=T!=null&&G!==null&&G.complete&&G.naturalHeight!==0&&G.naturalWidth!==0;O&&T.excavation!=null&&(U=Ei(V,T.excavation));const _=window.devicePixelRatio||1;D.height=D.width=s*_;const F=s/P*_;B.scale(F,F),B.fillStyle=u,B.fillRect(0,0,P,P),B.fillStyle=i,Wc?B.fill(new Path2D(xi(U,R))):V.forEach(function(Z,Q){Z.forEach(function(X,Te){X&&B.fillRect(Te+R,Q+R,1,1)})}),T&&(B.globalAlpha=T.opacity),O&&B.drawImage(G,T.x+R,T.y+R,T.w,T.h)}}),d.useEffect(()=>{L(!1)},[E]);const K=Zn({height:s,width:s},b);let I=null;return E!=null&&(I=d.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{L(!0)},ref:C,crossOrigin:T==null?void 0:T.crossOrigin})),d.createElement(d.Fragment,null,d.createElement("canvas",Zn({style:K,height:s,width:s,ref:S,role:"img"},x)),I)});Vc.displayName="QRCodeCanvas";var Ci=d.forwardRef(function(t,n){const r=t,{value:o,size:s=mi,level:c=hi,bgColor:u=vi,fgColor:i=gi,includeMargin:l=bi,minVersion:a=yi,boostLevel:p,title:m,marginSize:f,imageSettings:h}=r,v=er(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:x,numCells:E,calculatedImageSettings:y}=wi({value:o,level:c,minVersion:a,boostLevel:p,includeMargin:l,marginSize:f,imageSettings:h,size:s});let C=x,S=null;h!=null&&y!=null&&(y.excavation!=null&&(C=Ei(x,y.excavation)),S=d.createElement("image",{href:h.src,height:y.h,width:y.w,x:y.x+b,y:y.y+b,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const A=xi(C,b);return d.createElement("svg",Zn({height:s,width:s,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},v),!!m&&d.createElement("title",null,m),d.createElement("path",{fill:u,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),d.createElement("path",{fill:i,d:A,shapeRendering:"crispEdges"}),S)});Ci.displayName="QRCodeSVG";const Uc=(e,t)=>Number(e)>Number(t),et=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"},Si=(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 Si(i,t)}const s=parseFloat(e),c=parseFloat(t);if(!isNaN(s)&&!isNaN(c)&&s>c)return{isValid:!0,formattedValue:et(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}},Hc=(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)},$i={ETHEREUM:1,SEPOLIA:11155111},zc=[$i.ETHEREUM,$i.SEPOLIA],Gc=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!zc.includes(t)}return!0},Yc=[{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}],Oi={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Ti={address:"0x1234567890123456789012345678901234567890"},Ai={multiChain:{minDeposit:10}},Kc=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r})=>{var s;const o=d.useMemo(()=>Gc(n||{}),[n]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"flex justify-center mt-4 mb-3",children:w.jsx("div",{className:"bg-white rounded-lg",children:w.jsx(Ci,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),w.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[w.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),w.jsx("div",{onClick:()=>{navigator.clipboard.writeText((e==null?void 0:e.getDisplayAddress())||"")},style:{cursor:"pointer"},children:w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[w.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),w.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),w.jsxs("div",{className:"flex items-start",children:[w.jsx("div",{className:"w-5",children:w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.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"})})}),w.jsxs("div",{className:"flex-1",children:[w.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."]}),w.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),o&&w.jsxs(w.Fragment,{children:[w.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."}),w.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),w.jsxs("div",{className:"text-sm",children:[w.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[w.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),w.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"]})]}),w.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[w.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),w.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]})]}),w.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[w.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),w.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},Qc=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onClose:c})=>{var f;const[u,i]=d.useState(()=>{var h;return!e||e.length===0?1:t||((h=e[0])==null?void 0:h.chainId)||1}),[l,a]=d.useState(()=>{var x;if(!e||e.length===0)return"";const h=t||((x=e[0])==null?void 0:x.chainId),v=e.find(E=>E.chainId===h);if(!v||!v.tokenList||v.tokenList.length===0)return"";const b=v.tokenList.find(E=>E.tokenAddress===n)||v.tokenList[0];return(b==null?void 0:b.token)||""}),p=e&&e.length>0?e.find(h=>h.chainId===u)||e[0]:null,m=(f=p==null?void 0:p.tokenList)==null?void 0:f.find(h=>h.token===l);return!e||e.length===0?w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"No chains available"})}):p?w.jsxs(w.Fragment,{children:[w.jsx(ci,{currentActiveChain:p,chainList:e,onChainChange:i,curSelectToken:l,onTokenChange:a,walletType:"mpc"}),w.jsx(Kc,{walletAdapter:r,curSelectToken:l,currentActiveChain:p,metadata:o}),w.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{s&&s({amount:"",chainId:u,tokenAddress:(m==null?void 0:m.tokenAddress)||"",tokenSymbol:l}),c()},children:"Deposit"})]}):w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Xc=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:c,decimals:u,tokenBalance:i,platformBalance:l="0",onDepositAmountChange:a,onApprove:p})=>{const m=h=>{const v=h.target.value,x=Si(v,i||"0");if(x.isValid)a(x.formattedValue),x.errorType;else return x.errorType==="exceed_balance",void 0},f=()=>{const h=parseFloat(i||"0"),v=parseFloat(e||"0");if(v>0){const b=h-v,x=et(Math.max(0,b).toString());return`${et(i||"0")} → ${x} ${t}`}return`${et(i||"0")} ${t}`};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[w.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[w.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:m,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"}),w.jsx("button",{onClick:()=>{a(i||"0")},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),w.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),w.jsxs("div",{className:"flex justify-between items-center",children:[w.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),w.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:f()})]})]}),!r&&Uc(e||"0",0)&&w.jsxs("div",{className:"flex justify-center flex-col items-center",children:[w.jsxs("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:["Enable ",t," on ",o==null?void 0:o.chain]}),w.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,"."]}),w.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:p,children:["Enable ",t]})]}),w.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:w.jsxs("div",{className:"flex justify-between items-center",children:[w.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:"总资产"}),w.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?`${et(l)} → ${et((parseFloat(l)+parseFloat(e)).toString())} ${t}`:`${et(l)} ${t}`})]})})]})},qc=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var i,l;const c=(i=o==null?void 0:o.useBalance)==null?void 0:i.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),u=(l=o==null?void 0:o.useReadContract)==null?void 0:l.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return d.useEffect(()=>{s(e.tokenAddress,{balance:c,allowance:u})},[c,u,e.tokenAddress,s]),null},Jc=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var h;const s=d.useMemo(()=>r.filter(v=>v.tokenAddress&&v.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[c,u]=d.useState({}),i=d.useCallback((v,b)=>{u(x=>({...x,[v]:b}))},[]),l=(h=o==null?void 0:o.useBalance)==null?void 0:h.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),a=d.useMemo(()=>s.map(v=>d.createElement(qc,{key:v.tokenAddress,token:v,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:i})),[s,e,t,n,o,i]),p=d.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const v=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},b=s.map(y=>{const C=c[y.tokenAddress],S=C==null?void 0:C.balance,A=S==null?void 0:S.data;return{address:y.tokenAddress,value:(A==null?void 0:A.value)||BigInt(0),formatted:(A==null?void 0:A.formatted)||"0",decimals:(A==null?void 0:A.decimals)||y.decimals}}).filter(y=>y.address),x=s.map(y=>{const C=c[y.tokenAddress],S=C==null?void 0:C.allowance,A=S==null?void 0:S.data,L=BigInt(A?A.toString():0);return{address:y.tokenAddress,value:L,formatted:(L/BigInt(10)**BigInt(y.decimals)).toString(),decimals:y.decimals}}).filter(y=>y.address),E=b.reduce((y,C)=>{const S=x.find(A=>A.address===C.address);return{...y,[C.address]:{balance:C,allowance:S||{address:C.address,value:BigInt(0),formatted:"0",decimals:C.decimals}}}},{});return{balanceList:b,allowanceList:x,baseTokenBalance:v,combinedData:E}},[l,c,s,o==null?void 0:o.useBalance]),m=d.useCallback(async()=>p,[p]),f=d.useMemo(()=>{const v=(l==null?void 0:l.isLoading)||!1,b=Object.values(c).some(x=>{var E,y;return((E=x.balance)==null?void 0:E.isLoading)||((y=x.allowance)==null?void 0:y.isLoading)});return v||b},[l==null?void 0:l.isLoading,c]);return{multicallRun:m,multicallResult:p,validErcTokens:s,isLoading:f,queryComponents:a}},Zc=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:c,platformBalance:u="0",wagmiHooks:i,approved:l,onApproved:a,onDeposit:p,onClose:m,onChainChange:f,onTokenChange:h})=>{var _;const[v,b]=d.useState(()=>{var F;return!e||e.length===0?1:t||((F=e[0])==null?void 0:F.chainId)||1}),[x,E]=d.useState(()=>{var X;if(!e||e.length===0)return"";const F=t||((X=e[0])==null?void 0:X.chainId),Z=e.find(Te=>Te.chainId===F);if(!Z||!Z.tokenList||Z.tokenList.length===0)return"";const Q=Z.tokenList.find(Te=>Te.tokenAddress===n)||Z.tokenList[0];return(Q==null?void 0:Q.token)||""}),[y,C]=d.useState(r),S=d.useCallback(F=>{b(F),f==null||f(F)},[f]),A=d.useCallback(F=>{E(F),h==null||h(F)},[h]),L=d.useRef(!0),R=d.useRef(x),V=d.useRef(v);d.useEffect(()=>{if(L.current){L.current=!1,R.current=x,V.current=v;return}(R.current!==x||V.current!==v)&&(C(""),R.current=x,V.current=v)},[x,v]);const P=e&&e.length>0?e.find(F=>F.chainId===v)||e[0]:null,T=(_=P==null?void 0:P.tokenList)==null?void 0:_.find(F=>F.token===x),K=o==null?void 0:o.getDisplayAddress(),{multicallResult:I,queryComponents:D}=Jc({account:K,chainId:v,contractAddress:void 0,tokens:(P==null?void 0:P.tokenList)||[],wagmiHooks:i}),B=d.useMemo(()=>{var Z;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return I.baseTokenBalance.formatted;const F=I.combinedData[T.tokenAddress];return((Z=F==null?void 0:F.balance)==null?void 0:Z.formatted)||"0"},[T,I]),U=l??!1,G=d.useMemo(()=>{const F=parseFloat(y||"0"),Z=10,Q=B||"0",X=Hc(y,Q,U);return!y||F===0?{text:"Confirm Deposit",disabled:!0}:U?F>parseFloat(Q)?{text:"Insufficient Balance",disabled:!0}:F<Z?{text:`Min Deposit ${Z} ${x}`,disabled:!0}:{text:"Confirm Deposit",disabled:!X}:{text:"Confirm Deposit",disabled:!0}},[y,x,B,U]),O=d.useCallback(async()=>{p&&p({amount:y,chainId:v,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:x})},[p,y,v,T==null?void 0:T.tokenAddress,x]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?w.jsxs("div",{className:"p-6 text-center",children:[w.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),w.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"No chains available"})}):P?w.jsxs(w.Fragment,{children:[D,w.jsx(ci,{currentActiveChain:P,chainList:e,onChainChange:S,curSelectToken:x,onTokenChange:A,walletType:"evm"}),w.jsx(Xc,{depositAmount:y,curSelectToken:x,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},approved:U,currentActiveChain:P,currentEquity:c||0,amount:y,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:B,platformBalance:u,onDepositAmountChange:C,onApprove:async()=>{a&&await a()}}),w.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${G.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:O,disabled:G.disabled,children:G.text})]}):w.jsx("div",{className:"text-center py-8",children:w.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Pi=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=Oi,smartWallet:o=Ti,chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i="",metadata:l=Ai,currentEquity:a=5e3,platformBalance:p="0",wagmiHooks:m,approved:f,onApproved:h,onDeposit:v,onChainChange:b,onTokenChange:x})=>{const E=d.useMemo(()=>{var C;return r?fs(r,o,!1,(C=s[0])==null?void 0:C.chainId,"0","0"):null},[r,o,s]),y=(E==null?void 0:E.getWalletType())==="mpc";return e?pe.createPortal(w.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:w.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:w.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:C=>{C.stopPropagation()},children:[w.jsxs("div",{className:"flex items-center justify-between mb-4",children:[w.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),w.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:w.jsx(as,{className:"h-4 w-4"})})]}),y?w.jsx(Qc,{chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i,walletAdapter:E,metadata:l,currentEquity:a,onDeposit:v,onClose:t}):w.jsx(Zc,{chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i,walletAdapter:E,metadata:l,currentEquity:a,platformBalance:p,wagmiHooks:m,approved:f,onApproved:h,onDeposit:v,onClose:t,onChainChange:b,onTokenChange:x})]})})}),document.body):null};let De=null;const ef={symbol:"USDT"},Ni=d.forwardRef((e,t)=>{const[n,r]=d.useState(!1),[o,s]=d.useState({chains:[]}),c=d.useCallback(a=>{s(a),r(!0)},[]),u=d.useCallback(a=>{s(p=>({...p,...a}))},[]),i=d.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=d.useCallback(()=>n,[n]);return d.useImperativeHandle(t,()=>({openDeposit:c,closeDeposit:i,updateDepositOptions:u,isOpen:l}),[c,i,u,l]),d.useEffect(()=>(De={openDeposit:c,closeDeposit:i,updateDepositOptions:u,isOpen:l},()=>{De=null}),[c,i,u,l]),w.jsx(Pi,{isOpen:n,onClose:i,config:o.config||ef,currentActiveAccount:o.currentActiveAccount||Oi,smartWallet:o.smartWallet||Ti,chains:o.chains||Yc,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||Ai,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,approved:o.approved,onApproved:o.onApproved,onDeposit:o.onDeposit,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});Ni.displayName="DepositManager";const Mi=e=>{if(!De){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}De.openDeposit(e||{chains:[]})},Li=()=>{if(!De){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}De.closeDeposit()},Fi=e=>{if(!De){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}De.updateDepositOptions(e)},tf=()=>De?De.isOpen():!1,nf=()=>({openDeposit:Mi,closeDeposit:Li,updateDepositOptions:Fi,isOpen:tf});d.createContext(null);const rf=({isOpen:e,onClose:t,config:n})=>e?w.jsx("div",{className:"withdraw-modal",children:w.jsx("div",{className:"modal-overlay",onClick:t,children:w.jsxs("div",{className:"modal-content",onClick:r=>r.stopPropagation(),children:[w.jsxs("h2",{children:["Withdraw ",n.symbol]}),w.jsxs("p",{children:["Symbol: ",n.symbol]}),w.jsx("button",{onClick:t,children:"Close"})]})})}):null;ne.ComponentProvider=Zi,ne.Deposit=Pi,ne.DepositManager=Ni,ne.Withdraw=rf,ne.closeDeposit=Li,ne.openDeposit=Mi,ne.updateDepositOptions=Fi,ne.useDeposit=es,ne.useDepositManager=nf,ne.useWithdraw=ts,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})});
|
|
104
104
|
//# sourceMappingURL=index.umd.js.map
|