@edgex-web/components 0.1.0-beta.17 → 0.1.0-beta.18

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.
Files changed (52) hide show
  1. package/dist/components/Deposit/src/evm/WalletView.d.ts.map +1 -1
  2. package/dist/components/Deposit/src/evm/index.d.ts.map +1 -1
  3. package/dist/components/Deposit/src/index.d.ts.map +1 -1
  4. package/dist/components/Deposit/src/mpc/WalletView.d.ts.map +1 -1
  5. package/dist/components/Deposit/src/selector/Asset.d.ts.map +1 -1
  6. package/dist/components/Deposit/src/selector/Chain.d.ts.map +1 -1
  7. package/dist/components/Provider/index.d.ts +6 -1
  8. package/dist/components/Provider/index.d.ts.map +1 -1
  9. package/dist/components/Tooltip/index.d.ts +3 -0
  10. package/dist/components/Tooltip/index.d.ts.map +1 -0
  11. package/dist/components/Tooltip/src/Tooltip.d.ts +5 -0
  12. package/dist/components/Tooltip/src/Tooltip.d.ts.map +1 -0
  13. package/dist/components/Tooltip/src/TooltipArrow.d.ts +5 -0
  14. package/dist/components/Tooltip/src/TooltipArrow.d.ts.map +1 -0
  15. package/dist/components/Tooltip/src/index.d.ts +3 -0
  16. package/dist/components/Tooltip/src/index.d.ts.map +1 -0
  17. package/dist/components/Tooltip/types/index.d.ts +52 -0
  18. package/dist/components/Tooltip/types/index.d.ts.map +1 -0
  19. package/dist/components/Withdraw/constants/index.d.ts +7 -0
  20. package/dist/components/Withdraw/constants/index.d.ts.map +1 -0
  21. package/dist/components/Withdraw/index.d.ts +1 -0
  22. package/dist/components/Withdraw/index.d.ts.map +1 -1
  23. package/dist/components/Withdraw/src/Speed.d.ts +10 -0
  24. package/dist/components/Withdraw/src/Speed.d.ts.map +1 -0
  25. package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -1
  26. package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
  27. package/dist/components/Withdraw/src/index.d.ts.map +1 -1
  28. package/dist/hooks/index.d.ts +1 -0
  29. package/dist/hooks/index.d.ts.map +1 -1
  30. package/dist/hooks/useTranslation.d.ts +113 -0
  31. package/dist/hooks/useTranslation.d.ts.map +1 -0
  32. package/dist/index.d.ts +5 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.esm.js +5953 -4155
  35. package/dist/index.esm.js.map +1 -1
  36. package/dist/index.umd.js +43 -27
  37. package/dist/index.umd.js.map +1 -1
  38. package/dist/locales/en-US.d.ts +39 -0
  39. package/dist/locales/en-US.d.ts.map +1 -0
  40. package/dist/locales/index.d.ts +16 -0
  41. package/dist/locales/index.d.ts.map +1 -0
  42. package/dist/locales/ja-JP.d.ts +39 -0
  43. package/dist/locales/ja-JP.d.ts.map +1 -0
  44. package/dist/locales/ru-RU.d.ts +39 -0
  45. package/dist/locales/ru-RU.d.ts.map +1 -0
  46. package/dist/locales/zh-CN.d.ts +40 -0
  47. package/dist/locales/zh-CN.d.ts.map +1 -0
  48. package/dist/locales/zh-TW.d.ts +39 -0
  49. package/dist/locales/zh-TW.d.ts.map +1 -0
  50. package/dist/types/index.d.ts +3 -1
  51. package/dist/types/index.d.ts.map +1 -1
  52. package/package.json +2 -1
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(oe,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):(oe=typeof globalThis<"u"?globalThis:oe||self,d(oe.EdgeXComponents={},oe.React,oe.ReactDOM))})(this,function(oe,d,xe){"use strict";var Ud=Object.defineProperty;var Vd=(oe,d,xe)=>d in oe?Ud(oe,d,{enumerable:!0,configurable:!0,writable:!0,value:xe}):oe[d]=xe;var nt=(oe,d,xe)=>Vd(oe,typeof d!="symbol"?d+"":d,xe);function Br(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 H=Br(d),Gt=Br(xe);function Ws(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nn={exports:{}},Mt={};/**
1
+ (function(te,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],m):(te=typeof globalThis<"u"?globalThis:te||self,m(te.EdgeXComponents={},te.React,te.ReactDOM))})(this,function(te,m,we){"use strict";var ch=Object.defineProperty;var fh=(te,m,we)=>m in te?ch(te,m,{enumerable:!0,configurable:!0,writable:!0,value:we}):te[m]=we;var Le=(te,m,we)=>fh(te,typeof m!="symbol"?m+"":m,we);function Co(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 j=Co(m),Ut=Co(we);function Zl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gn={exports:{}},Vt={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Wr;function Us(){if(Wr)return Mt;Wr=1;var e=d,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(a,i,l){var c,p={},m=null,f=null;l!==void 0&&(m=""+l),i.key!==void 0&&(m=""+i.key),i.ref!==void 0&&(f=i.ref);for(c in i)r.call(i,c)&&!s.hasOwnProperty(c)&&(p[c]=i[c]);if(a&&a.defaultProps)for(c in i=a.defaultProps,i)p[c]===void 0&&(p[c]=i[c]);return{$$typeof:t,type:a,key:m,ref:f,props:p,_owner:o.current}}return Mt.Fragment=n,Mt.jsx=u,Mt.jsxs=u,Mt}var Lt={};/**
9
+ */var Oo;function ea(){if(Oo)return Vt;Oo=1;var e=m,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(u,s,l){var c,d={},p=null,f=null;l!==void 0&&(p=""+l),s.key!==void 0&&(p=""+s.key),s.ref!==void 0&&(f=s.ref);for(c in s)r.call(s,c)&&!i.hasOwnProperty(c)&&(d[c]=s[c]);if(u&&u.defaultProps)for(c in s=u.defaultProps,s)d[c]===void 0&&(d[c]=s[c]);return{$$typeof:t,type:u,key:p,ref:f,props:d,_owner:o.current}}return Vt.Fragment=n,Vt.jsx=a,Vt.jsxs=a,Vt}var Ht={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,48 +14,53 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ur;function Vs(){return Ur||(Ur=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"),u=Symbol.for("react.provider"),a=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),b=Symbol.iterator,y="@@iterator";function N(O){if(O===null||typeof O!="object")return null;var k=b&&O[b]||O[y];return typeof k=="function"?k:null}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(O){{for(var k=arguments.length,V=new Array(k>1?k-1:0),Y=1;Y<k;Y++)V[Y-1]=arguments[Y];T("error",O,V)}}function T(O,k,V){{var Y=I.ReactDebugCurrentFrame,ne=Y.getStackAddendum();ne!==""&&(k+="%s",V=V.concat([ne]));var se=V.map(function(te){return String(te)});se.unshift("Warning: "+k),Function.prototype.apply.call(console[O],console,se)}}var j=!1,_=!1,B=!1,W=!1,h=!1,v;v=Symbol.for("react.module.reference");function g(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===s||h||O===o||O===l||O===c||W||O===f||j||_||B||typeof O=="object"&&O!==null&&(O.$$typeof===m||O.$$typeof===p||O.$$typeof===u||O.$$typeof===a||O.$$typeof===i||O.$$typeof===v||O.getModuleId!==void 0))}function x(O,k,V){var Y=O.displayName;if(Y)return Y;var ne=k.displayName||k.name||"";return ne!==""?V+"("+ne+")":V}function C(O){return O.displayName||"Context"}function A(O){if(O==null)return null;if(typeof O.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case a:var k=O;return C(k)+".Consumer";case u:var V=O;return C(V._context)+".Provider";case i:return x(O,O.render,"ForwardRef");case p:var Y=O.displayName||null;return Y!==null?Y:A(O.type)||"Memo";case m:{var ne=O,se=ne._payload,te=ne._init;try{return A(te(se))}catch{return null}}}return null}var P=Object.assign,S=0,$,L,E,D,F,R,U;function G(){}G.__reactDisabledLog=!0;function ee(){{if(S===0){$=console.log,L=console.info,E=console.warn,D=console.error,F=console.group,R=console.groupCollapsed,U=console.groupEnd;var O={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}S++}}function q(){{if(S--,S===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},O,{value:$}),info:P({},O,{value:L}),warn:P({},O,{value:E}),error:P({},O,{value:D}),group:P({},O,{value:F}),groupCollapsed:P({},O,{value:R}),groupEnd:P({},O,{value:U})})}S<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=I.ReactCurrentDispatcher,z;function re(O,k,V){{if(z===void 0)try{throw Error()}catch(ne){var Y=ne.stack.trim().match(/\n( *(at )?)/);z=Y&&Y[1]||""}return`
18
- `+z+O}}var de=!1,_e;{var je=typeof WeakMap=="function"?WeakMap:Map;_e=new je}function ct(O,k){if(!O||de)return"";{var V=_e.get(O);if(V!==void 0)return V}var Y;de=!0;var ne=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var se;se=X.current,X.current=null,ee();try{if(k){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(Oe){Y=Oe}Reflect.construct(O,[],te)}else{try{te.call()}catch(Oe){Y=Oe}O.call(te.prototype)}}else{try{throw Error()}catch(Oe){Y=Oe}O()}}catch(Oe){if(Oe&&Y&&typeof Oe.stack=="string"){for(var J=Oe.stack.split(`
19
- `),we=Y.stack.split(`
20
- `),fe=J.length-1,pe=we.length-1;fe>=1&&pe>=0&&J[fe]!==we[pe];)pe--;for(;fe>=1&&pe>=0;fe--,pe--)if(J[fe]!==we[pe]){if(fe!==1||pe!==1)do if(fe--,pe--,pe<0||J[fe]!==we[pe]){var ke=`
21
- `+J[fe].replace(" at new "," at ");return O.displayName&&ke.includes("<anonymous>")&&(ke=ke.replace("<anonymous>",O.displayName)),typeof O=="function"&&_e.set(O,ke),ke}while(fe>=1&&pe>=0);break}}}finally{de=!1,X.current=se,q(),Error.prepareStackTrace=ne}var Pt=O?O.displayName||O.name:"",yt=Pt?re(Pt):"";return typeof O=="function"&&_e.set(O,yt),yt}function Se(O,k,V){return ct(O,!1)}function ve(O){var k=O.prototype;return!!(k&&k.isReactComponent)}function ie(O,k,V){if(O==null)return"";if(typeof O=="function")return ct(O,ve(O));if(typeof O=="string")return re(O);switch(O){case l:return re("Suspense");case c:return re("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case i:return Se(O.render);case p:return ie(O.type,k,V);case m:{var Y=O,ne=Y._payload,se=Y._init;try{return ie(se(ne),k,V)}catch{}}}return""}var Ht=Object.prototype.hasOwnProperty,As={},Ns=I.ReactDebugCurrentFrame;function An(O){if(O){var k=O._owner,V=ie(O.type,O._source,k?k.type:null);Ns.setExtraStackFrame(V)}else Ns.setExtraStackFrame(null)}function xd(O,k,V,Y,ne){{var se=Function.call.bind(Ht);for(var te in O)if(se(O,te)){var J=void 0;try{if(typeof O[te]!="function"){var we=Error((Y||"React class")+": "+V+" type `"+te+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[te]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw we.name="Invariant Violation",we}J=O[te](k,te,Y,V,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(fe){J=fe}J&&!(J instanceof Error)&&(An(ne),w("%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).",Y||"React class",V,te,typeof J),An(null)),J instanceof Error&&!(J.message in As)&&(As[J.message]=!0,An(ne),w("Failed %s type: %s",V,J.message),An(null))}}}var wd=Array.isArray;function Fr(O){return wd(O)}function Ed(O){{var k=typeof Symbol=="function"&&Symbol.toStringTag,V=k&&O[Symbol.toStringTag]||O.constructor.name||"Object";return V}}function Cd(O){try{return $s(O),!1}catch{return!0}}function $s(O){return""+O}function Ts(O){if(Cd(O))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ed(O)),$s(O)}var Ps=I.ReactCurrentOwner,Sd={key:!0,ref:!0,__self:!0,__source:!0},Ms,Ls;function Od(O){if(Ht.call(O,"ref")){var k=Object.getOwnPropertyDescriptor(O,"ref").get;if(k&&k.isReactWarning)return!1}return O.ref!==void 0}function Ad(O){if(Ht.call(O,"key")){var k=Object.getOwnPropertyDescriptor(O,"key").get;if(k&&k.isReactWarning)return!1}return O.key!==void 0}function Nd(O,k){typeof O.ref=="string"&&Ps.current}function $d(O,k){{var V=function(){Ms||(Ms=!0,w("%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)",k))};V.isReactWarning=!0,Object.defineProperty(O,"key",{get:V,configurable:!0})}}function Td(O,k){{var V=function(){Ls||(Ls=!0,w("%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)",k))};V.isReactWarning=!0,Object.defineProperty(O,"ref",{get:V,configurable:!0})}}var Pd=function(O,k,V,Y,ne,se,te){var J={$$typeof:t,type:O,key:k,ref:V,props:te,_owner:se};return J._store={},Object.defineProperty(J._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(J,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(J,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ne}),Object.freeze&&(Object.freeze(J.props),Object.freeze(J)),J};function Md(O,k,V,Y,ne){{var se,te={},J=null,we=null;V!==void 0&&(Ts(V),J=""+V),Ad(k)&&(Ts(k.key),J=""+k.key),Od(k)&&(we=k.ref,Nd(k,ne));for(se in k)Ht.call(k,se)&&!Sd.hasOwnProperty(se)&&(te[se]=k[se]);if(O&&O.defaultProps){var fe=O.defaultProps;for(se in fe)te[se]===void 0&&(te[se]=fe[se])}if(J||we){var pe=typeof O=="function"?O.displayName||O.name||"Unknown":O;J&&$d(te,pe),we&&Td(te,pe)}return Pd(O,J,we,ne,Y,Ps.current,te)}}var _r=I.ReactCurrentOwner,Is=I.ReactDebugCurrentFrame;function Tt(O){if(O){var k=O._owner,V=ie(O.type,O._source,k?k.type:null);Is.setExtraStackFrame(V)}else Is.setExtraStackFrame(null)}var jr;jr=!1;function kr(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Ds(){{if(_r.current){var O=A(_r.current.type);if(O)return`
17
+ */var To;function ta(){return To||(To=1,process.env.NODE_ENV!=="production"&&function(){var e=m,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),g=Symbol.iterator,v="@@iterator";function E(M){if(M===null||typeof M!="object")return null;var U=g&&M[g]||M[v];return typeof U=="function"?U:null}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(M){{for(var U=arguments.length,Y=new Array(U>1?U-1:0),q=1;q<U;q++)Y[q-1]=arguments[q];P("error",M,Y)}}function P(M,U,Y){{var q=I.ReactDebugCurrentFrame,ie=q.getStackAddendum();ie!==""&&(U+="%s",Y=Y.concat([ie]));var le=Y.map(function(ne){return String(ne)});le.unshift("Warning: "+U),Function.prototype.apply.call(console[M],console,le)}}var F=!1,R=!1,B=!1,V=!1,h=!1,x;x=Symbol.for("react.module.reference");function b(M){return!!(typeof M=="string"||typeof M=="function"||M===r||M===i||h||M===o||M===l||M===c||V||M===f||F||R||B||typeof M=="object"&&M!==null&&(M.$$typeof===p||M.$$typeof===d||M.$$typeof===a||M.$$typeof===u||M.$$typeof===s||M.$$typeof===x||M.getModuleId!==void 0))}function A(M,U,Y){var q=M.displayName;if(q)return q;var ie=U.displayName||U.name||"";return ie!==""?Y+"("+ie+")":Y}function C(M){return M.displayName||"Context"}function N(M){if(M==null)return null;if(typeof M.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof M=="function")return M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case c:return"SuspenseList"}if(typeof M=="object")switch(M.$$typeof){case u:var U=M;return C(U)+".Consumer";case a:var Y=M;return C(Y._context)+".Provider";case s:return A(M,M.render,"ForwardRef");case d:var q=M.displayName||null;return q!==null?q:N(M.type)||"Memo";case p:{var ie=M,le=ie._payload,ne=ie._init;try{return N(ne(le))}catch{return null}}}return null}var T=Object.assign,S=0,L,$,y,D,_,k,W;function H(){}H.__reactDisabledLog=!0;function Q(){{if(S===0){L=console.log,$=console.info,y=console.warn,D=console.error,_=console.group,k=console.groupCollapsed,W=console.groupEnd;var M={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:M,log:M,warn:M,error:M,group:M,groupCollapsed:M,groupEnd:M})}S++}}function z(){{if(S--,S===0){var M={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:T({},M,{value:L}),info:T({},M,{value:$}),warn:T({},M,{value:y}),error:T({},M,{value:D}),group:T({},M,{value:_}),groupCollapsed:T({},M,{value:k}),groupEnd:T({},M,{value:W})})}S<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=I.ReactCurrentDispatcher,G;function oe(M,U,Y){{if(G===void 0)try{throw Error()}catch(ie){var q=ie.stack.trim().match(/\n( *(at )?)/);G=q&&q[1]||""}return`
18
+ `+G+M}}var fe=!1,Ne;{var Ae=typeof WeakMap=="function"?WeakMap:Map;Ne=new Ae}function ot(M,U){if(!M||fe)return"";{var Y=Ne.get(M);if(Y!==void 0)return Y}var q;fe=!0;var ie=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var le;le=K.current,K.current=null,Q();try{if(U){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch($e){q=$e}Reflect.construct(M,[],ne)}else{try{ne.call()}catch($e){q=$e}M.call(ne.prototype)}}else{try{throw Error()}catch($e){q=$e}M()}}catch($e){if($e&&q&&typeof $e.stack=="string"){for(var Z=$e.stack.split(`
19
+ `),Se=q.stack.split(`
20
+ `),pe=Z.length-1,me=Se.length-1;pe>=1&&me>=0&&Z[pe]!==Se[me];)me--;for(;pe>=1&&me>=0;pe--,me--)if(Z[pe]!==Se[me]){if(pe!==1||me!==1)do if(pe--,me--,me<0||Z[pe]!==Se[me]){var Ue=`
21
+ `+Z[pe].replace(" at new "," at ");return M.displayName&&Ue.includes("<anonymous>")&&(Ue=Ue.replace("<anonymous>",M.displayName)),typeof M=="function"&&Ne.set(M,Ue),Ue}while(pe>=1&&me>=0);break}}}finally{fe=!1,K.current=le,z(),Error.prepareStackTrace=ie}var Wt=M?M.displayName||M.name:"",At=Wt?oe(Wt):"";return typeof M=="function"&&Ne.set(M,At),At}function ye(M,U,Y){return ot(M,!1)}function he(M){var U=M.prototype;return!!(U&&U.isReactComponent)}function se(M,U,Y){if(M==null)return"";if(typeof M=="function")return ot(M,he(M));if(typeof M=="string")return oe(M);switch(M){case l:return oe("Suspense");case c:return oe("SuspenseList")}if(typeof M=="object")switch(M.$$typeof){case s:return ye(M.render);case d:return se(M.type,U,Y);case p:{var q=M,ie=q._payload,le=q._init;try{return se(le(ie),U,Y)}catch{}}}return""}var sn=Object.prototype.hasOwnProperty,kl={},_l=I.ReactDebugCurrentFrame;function zn(M){if(M){var U=M._owner,Y=se(M.type,M._source,U?U.type:null);_l.setExtraStackFrame(Y)}else _l.setExtraStackFrame(null)}function Um(M,U,Y,q,ie){{var le=Function.call.bind(sn);for(var ne in M)if(le(M,ne)){var Z=void 0;try{if(typeof M[ne]!="function"){var Se=Error((q||"React class")+": "+Y+" type `"+ne+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof M[ne]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Se.name="Invariant Violation",Se}Z=M[ne](U,ne,q,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(pe){Z=pe}Z&&!(Z instanceof Error)&&(zn(ie),w("%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).",q||"React class",Y,ne,typeof Z),zn(null)),Z instanceof Error&&!(Z.message in kl)&&(kl[Z.message]=!0,zn(ie),w("Failed %s type: %s",Y,Z.message),zn(null))}}}var Vm=Array.isArray;function xo(M){return Vm(M)}function Hm(M){{var U=typeof Symbol=="function"&&Symbol.toStringTag,Y=U&&M[Symbol.toStringTag]||M.constructor.name||"Object";return Y}}function zm(M){try{return Bl(M),!1}catch{return!0}}function Bl(M){return""+M}function Wl(M){if(zm(M))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Hm(M)),Bl(M)}var Ul=I.ReactCurrentOwner,Gm={key:!0,ref:!0,__self:!0,__source:!0},Vl,Hl;function Ym(M){if(sn.call(M,"ref")){var U=Object.getOwnPropertyDescriptor(M,"ref").get;if(U&&U.isReactWarning)return!1}return M.ref!==void 0}function Km(M){if(sn.call(M,"key")){var U=Object.getOwnPropertyDescriptor(M,"key").get;if(U&&U.isReactWarning)return!1}return M.key!==void 0}function qm(M,U){typeof M.ref=="string"&&Ul.current}function Xm(M,U){{var Y=function(){Vl||(Vl=!0,w("%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)",U))};Y.isReactWarning=!0,Object.defineProperty(M,"key",{get:Y,configurable:!0})}}function Qm(M,U){{var Y=function(){Hl||(Hl=!0,w("%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)",U))};Y.isReactWarning=!0,Object.defineProperty(M,"ref",{get:Y,configurable:!0})}}var Jm=function(M,U,Y,q,ie,le,ne){var Z={$$typeof:t,type:M,key:U,ref:Y,props:ne,_owner:le};return Z._store={},Object.defineProperty(Z._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Z,"_self",{configurable:!1,enumerable:!1,writable:!1,value:q}),Object.defineProperty(Z,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.freeze&&(Object.freeze(Z.props),Object.freeze(Z)),Z};function Zm(M,U,Y,q,ie){{var le,ne={},Z=null,Se=null;Y!==void 0&&(Wl(Y),Z=""+Y),Km(U)&&(Wl(U.key),Z=""+U.key),Ym(U)&&(Se=U.ref,qm(U,ie));for(le in U)sn.call(U,le)&&!Gm.hasOwnProperty(le)&&(ne[le]=U[le]);if(M&&M.defaultProps){var pe=M.defaultProps;for(le in pe)ne[le]===void 0&&(ne[le]=pe[le])}if(Z||Se){var me=typeof M=="function"?M.displayName||M.name||"Unknown":M;Z&&Xm(ne,me),Se&&Qm(ne,me)}return Jm(M,Z,Se,ie,q,Ul.current,ne)}}var yo=I.ReactCurrentOwner,zl=I.ReactDebugCurrentFrame;function Bt(M){if(M){var U=M._owner,Y=se(M.type,M._source,U?U.type:null);zl.setExtraStackFrame(Y)}else zl.setExtraStackFrame(null)}var wo;wo=!1;function Eo(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function Gl(){{if(yo.current){var M=N(yo.current.type);if(M)return`
22
22
 
23
- Check the render method of \``+O+"`."}return""}}function Ld(O){return""}var Fs={};function Id(O){{var k=Ds();if(!k){var V=typeof O=="string"?O:O.displayName||O.name;V&&(k=`
23
+ Check the render method of \``+M+"`."}return""}}function eh(M){return""}var Yl={};function th(M){{var U=Gl();if(!U){var Y=typeof M=="string"?M:M.displayName||M.name;Y&&(U=`
24
24
 
25
- Check the top-level render call using <`+V+">.")}return k}}function _s(O,k){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var V=Id(k);if(Fs[V])return;Fs[V]=!0;var Y="";O&&O._owner&&O._owner!==_r.current&&(Y=" It was passed a child from "+A(O._owner.type)+"."),Tt(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',V,Y),Tt(null)}}function js(O,k){{if(typeof O!="object")return;if(Fr(O))for(var V=0;V<O.length;V++){var Y=O[V];kr(Y)&&_s(Y,k)}else if(kr(O))O._store&&(O._store.validated=!0);else if(O){var ne=N(O);if(typeof ne=="function"&&ne!==O.entries)for(var se=ne.call(O),te;!(te=se.next()).done;)kr(te.value)&&_s(te.value,k)}}}function Dd(O){{var k=O.type;if(k==null||typeof k=="string")return;var V;if(typeof k=="function")V=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===i||k.$$typeof===p))V=k.propTypes;else return;if(V){var Y=A(k);xd(V,O.props,"prop",Y,O)}else if(k.PropTypes!==void 0&&!jr){jr=!0;var ne=A(k);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ne||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Fd(O){{for(var k=Object.keys(O.props),V=0;V<k.length;V++){var Y=k[V];if(Y!=="children"&&Y!=="key"){Tt(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),Tt(null);break}}O.ref!==null&&(Tt(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),Tt(null))}}var ks={};function Rs(O,k,V,Y,ne,se){{var te=g(O);if(!te){var J="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(J+=" 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 we=Ld();we?J+=we:J+=Ds();var fe;O===null?fe="null":Fr(O)?fe="array":O!==void 0&&O.$$typeof===t?(fe="<"+(A(O.type)||"Unknown")+" />",J=" Did you accidentally export a JSX literal instead of a component?"):fe=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",fe,J)}var pe=Md(O,k,V,ne,se);if(pe==null)return pe;if(te){var ke=k.children;if(ke!==void 0)if(Y)if(Fr(ke)){for(var Pt=0;Pt<ke.length;Pt++)js(ke[Pt],O);Object.freeze&&Object.freeze(ke)}else w("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 js(ke,O)}if(Ht.call(k,"key")){var yt=A(O),Oe=Object.keys(k).filter(function(Wd){return Wd!=="key"}),Rr=Oe.length>0?"{key: someKey, "+Oe.join(": ..., ")+": ...}":"{key: someKey}";if(!ks[yt+Rr]){var Bd=Oe.length>0?"{"+Oe.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+Y+">.")}return U}}function Kl(M,U){{if(!M._store||M._store.validated||M.key!=null)return;M._store.validated=!0;var Y=th(U);if(Yl[Y])return;Yl[Y]=!0;var q="";M&&M._owner&&M._owner!==yo.current&&(q=" It was passed a child from "+N(M._owner.type)+"."),Bt(M),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,q),Bt(null)}}function ql(M,U){{if(typeof M!="object")return;if(xo(M))for(var Y=0;Y<M.length;Y++){var q=M[Y];Eo(q)&&Kl(q,U)}else if(Eo(M))M._store&&(M._store.validated=!0);else if(M){var ie=E(M);if(typeof ie=="function"&&ie!==M.entries)for(var le=ie.call(M),ne;!(ne=le.next()).done;)Eo(ne.value)&&Kl(ne.value,U)}}}function nh(M){{var U=M.type;if(U==null||typeof U=="string")return;var Y;if(typeof U=="function")Y=U.propTypes;else if(typeof U=="object"&&(U.$$typeof===s||U.$$typeof===d))Y=U.propTypes;else return;if(Y){var q=N(U);Um(Y,M.props,"prop",q,M)}else if(U.PropTypes!==void 0&&!wo){wo=!0;var ie=N(U);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ie||"Unknown")}typeof U.getDefaultProps=="function"&&!U.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function rh(M){{for(var U=Object.keys(M.props),Y=0;Y<U.length;Y++){var q=U[Y];if(q!=="children"&&q!=="key"){Bt(M),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",q),Bt(null);break}}M.ref!==null&&(Bt(M),w("Invalid attribute `ref` supplied to `React.Fragment`."),Bt(null))}}var Xl={};function Ql(M,U,Y,q,ie,le){{var ne=b(M);if(!ne){var Z="";(M===void 0||typeof M=="object"&&M!==null&&Object.keys(M).length===0)&&(Z+=" 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 Se=eh();Se?Z+=Se:Z+=Gl();var pe;M===null?pe="null":xo(M)?pe="array":M!==void 0&&M.$$typeof===t?(pe="<"+(N(M.type)||"Unknown")+" />",Z=" Did you accidentally export a JSX literal instead of a component?"):pe=typeof M,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",pe,Z)}var me=Zm(M,U,Y,ie,le);if(me==null)return me;if(ne){var Ue=U.children;if(Ue!==void 0)if(q)if(xo(Ue)){for(var Wt=0;Wt<Ue.length;Wt++)ql(Ue[Wt],M);Object.freeze&&Object.freeze(Ue)}else w("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 ql(Ue,M)}if(sn.call(U,"key")){var At=N(M),$e=Object.keys(U).filter(function(uh){return uh!=="key"}),So=$e.length>0?"{key: someKey, "+$e.join(": ..., ")+": ...}":"{key: someKey}";if(!Xl[At+So]){var ah=$e.length>0?"{"+$e.join(": ..., ")+": ...}":"{}";w(`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} />`,Rr,yt,Bd,yt),ks[yt+Rr]=!0}}return O===r?Fd(pe):Dd(pe),pe}}function _d(O,k,V){return Rs(O,k,V,!0)}function jd(O,k,V){return Rs(O,k,V,!1)}var kd=jd,Rd=_d;Lt.Fragment=r,Lt.jsx=kd,Lt.jsxs=Rd}()),Lt}process.env.NODE_ENV==="production"?Nn.exports=Us():Nn.exports=Vs();var M=Nn.exports;const zs=d.createContext(null),Hs=({config:e,children:t})=>M.jsx(zs.Provider,{value:e,children:t}),Gs=()=>({openDeposit:d.useCallback(t=>{},[])}),Ys=()=>({openWithdraw:d.useCallback(t=>{},[])});/**
30
+ <%s key={someKey} {...props} />`,So,At,ah,At),Xl[At+So]=!0}}return M===r?rh(me):nh(me),me}}function oh(M,U,Y){return Ql(M,U,Y,!0)}function ih(M,U,Y){return Ql(M,U,Y,!1)}var sh=ih,lh=oh;Ht.Fragment=r,Ht.jsx=sh,Ht.jsxs=lh}()),Ht}process.env.NODE_ENV==="production"?Gn.exports=ea():Gn.exports=ta();var O=Gn.exports;const na={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 250,000。若充值金额大于250,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
+ 充值金额大于 250,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"您可以在约 {{v}} 分钟 (达到 {{v1}} 个区块确认后) 提走已到账的资金",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"预计约{{v}}分钟",availableDesc:"您可以提取的最大金额。当 available 为0或负数时,不允许提现。"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址"}},ra={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",max:"Max",arrivalTime:"Arrival Time",minDeposit:"Minimum Deposit Amount",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 250,000. If your deposit exceeds 250,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
32
+ If the deposit amount exceeds 250,000, there may be a delay in the arrival time. Please be patient.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"You can withdraw the arrived funds in approximately {{v}} minutes (after reaching {{v1}} block confirmations)",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"Estimated approximately {{v}} minutes",availableDesc:"Max. amount you can withdraw. When the available amount shown is 0 or negative, you are not allowed to make withdrawals."},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address"}},oa={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は250,000です。250,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
+ 入金金額が 250,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"{{v1}} ブロック確認後、おおよそ {{v}} 分以内に引き出し可能となります",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"推定 {{v}} 分以内",availableDesc:"出金可能な最大金額です。 available が0またはマイナスの場合、出金は行えません。"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス"}},ia={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 250 000. Если сумма превышает 250 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
+ Если сумма депозита превышает 250 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Вы сможете вывести поступившие средства примерно через {{v}} минут (после {{v1}} подтверждений в блокчейне)",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"Ожидается примерно через {{v}} минут",availableDesc:"Максимальная сумма для вывода. Если доступная сумма равна 0 или меньше, вывод невозможен."},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя"}},sa={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 250,000。若充值金額大於 250,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
+ 充值金額大於 250,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"您可以在約 {{v}} 分鐘 (達到 {{v1}} 個區塊確認後) 提走已到帳的資金",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"預計約{{v}}分鐘",availableDesc:"您可以提取的最大金額。當 available 爲0或負數時,不允許提現。"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址"}},Yn=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],No={"en-US":ra,"ja-JP":oa,"ru-RU":ia,"zh-CN":na,"zh-TW":sa},ln="en-US",la={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},aa=e=>Yn.includes(e)?No[e]:No[ln],ua=e=>Yn.includes(e),Ao=m.createContext(null),ca=({config:e,children:t})=>{const n=m.useMemo(()=>{const r=e.locale||ln,o=ua(r)?r:ln,i=aa(o);return{...e,currentLocale:o,translations:i}},[e]);return O.jsx(Ao.Provider,{value:n,children:t})},$o=()=>{const e=m.useContext(Ao);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e},Ye=()=>{const{translations:e,currentLocale:t}=$o();return{t:(i,a)=>{try{const u=i.split(".");let s=e;for(const c of u)if(s&&typeof s=="object"&&c in s)s=s[c];else return i;let l=typeof s=="string"?s:i;return a&&typeof l=="string"&&Object.keys(a).forEach(c=>{const d=`{{${c}}}`;l=l.replace(new RegExp(d,"g"),String(a[c]))}),l}catch(u){return console.warn(`Translation error for key "${i}":`,u),i}},translations:e,locale:t,getTranslationObject:i=>{try{const a=i.split(".");let u=e;for(const s of a)if(u&&typeof u=="object"&&s in u)u=u[s];else return{};return typeof u=="object"?u:{}}catch(a){return console.warn(`Translation object error for key "${i}":`,a),{}}},hasTranslation:i=>{try{const a=i.split(".");let u=e;for(const s of a)if(u&&typeof u=="object"&&s in u)u=u[s];else return!1;return typeof u=="string"}catch{return!1}}}},fa=()=>({openDeposit:m.useCallback(t=>{},[])}),da=()=>({openWithdraw:m.useCallback(t=>{},[])});/**
31
36
  * @license lucide-react v0.540.0 - ISC
32
37
  *
33
38
  * This source code is licensed under the ISC license.
34
39
  * See the LICENSE file in the root directory of this source tree.
35
- */const Ks=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Vr=e=>{const t=qs(e);return t.charAt(0).toUpperCase()+t.slice(1)},zr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Qs=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
40
+ */const pa=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ma=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Po=e=>{const t=ma(e);return t.charAt(0).toUpperCase()+t.slice(1)},Lo=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ha=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
36
41
  * @license lucide-react v0.540.0 - ISC
37
42
  *
38
43
  * This source code is licensed under the ISC license.
39
44
  * See the LICENSE file in the root directory of this source tree.
40
- */var Xs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
45
+ */var ga={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
41
46
  * @license lucide-react v0.540.0 - ISC
42
47
  *
43
48
  * This source code is licensed under the ISC license.
44
49
  * See the LICENSE file in the root directory of this source tree.
45
- */const Js=d.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:u,...a},i)=>d.createElement("svg",{ref:i,...Xs,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:zr("lucide",o),...!s&&!Qs(a)&&{"aria-hidden":"true"},...a},[...u.map(([l,c])=>d.createElement(l,c)),...Array.isArray(s)?s:[s]]));/**
50
+ */const va=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...u},s)=>m.createElement("svg",{ref:s,...ga,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Lo("lucide",o),...!i&&!ha(u)&&{"aria-hidden":"true"},...u},[...a.map(([l,c])=>m.createElement(l,c)),...Array.isArray(i)?i:[i]]));/**
46
51
  * @license lucide-react v0.540.0 - ISC
47
52
  *
48
53
  * This source code is licensed under the ISC license.
49
54
  * See the LICENSE file in the root directory of this source tree.
50
- */const Zs=(e,t)=>{const n=d.forwardRef(({className:r,...o},s)=>d.createElement(Js,{ref:s,iconNode:t,className:zr(`lucide-${Ks(Vr(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Vr(e),n};/**
55
+ */const ba=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(va,{ref:i,iconNode:t,className:Lo(`lucide-${pa(Po(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Po(e),n};/**
51
56
  * @license lucide-react v0.540.0 - ISC
52
57
  *
53
58
  * This source code is licensed under the ISC license.
54
59
  * See the LICENSE file in the root directory of this source tree.
55
- */const Hr=Zs("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Gr{constructor(){nt(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class el extends Gr{constructor(n,r){super();nt(this,"smartWallet");nt(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{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 tl extends Gr{constructor(n,r,o,s="0",u="0"){super();nt(this,"currentActiveAccount");nt(this,"approved");nt(this,"chainId");nt(this,"balance");nt(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=u}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 Yr(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new el(t,e);default:return new tl(e,!1,r||1,o,s)}}const Kr=typeof document<"u"?d.useLayoutEffect:()=>{};var $n;const nl=($n=d.useInsertionEffect)!==null&&$n!==void 0?$n:Kr;function rl(e){const t=d.useRef(null);return nl(()=>{t.current=e},[e]),d.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const rt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},ft=e=>e&&"window"in e&&e.window===e?e:rt(e).defaultView||window;function ol(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function il(e){return ol(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let sl=!1;function Tn(){return sl}function qr(e,t){if(!Tn())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:il(n)?n=n.host:n=n.parentNode}return!1}const Pn=(e=document)=>{var t;if(!Tn())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 Qr(e){return Tn()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Yt(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Mn(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Je(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ln=Je(function(){return Mn(/^Mac/i)}),ll=Je(function(){return Mn(/^iPhone/i)}),al=Je(function(){return Mn(/^iPad/i)||Ln()&&navigator.maxTouchPoints>1}),ul=Je(function(){return ll()||al()});Je(function(){return Ln()||ul()}),Je(function(){return Yt(/AppleWebKit/i)&&!cl()});const cl=Je(function(){return Yt(/Chrome/i)}),fl=Je(function(){return Yt(/Android/i)});Je(function(){return Yt(/Firefox/i)});function Xr(){let e=d.useRef(new Map),t=d.useCallback((o,s,u,a)=>{let i=a!=null&&a.once?(...l)=>{e.current.delete(u),u(...l)}:u;e.current.set(u,{type:s,eventTarget:o,fn:i,options:a}),o.addEventListener(s,i,a)},[]),n=d.useCallback((o,s,u,a)=>{var i;let l=((i=e.current.get(u))===null||i===void 0?void 0:i.fn)||u;o.removeEventListener(s,l,a),e.current.delete(u)},[]),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 dl(e){return e.mozInputSource===0&&e.isTrusted?!0:fl()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Jr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function pl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Zr(e){let t=d.useRef({isFocused:!1,observer:null});Kr(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=rl(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=u=>{if(t.current.isFocused=!1,o.disabled){let a=Jr(u);n(a)}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 u;(u=t.current.observer)===null||u===void 0||u.disconnect();let a=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let hl=!1,It=null,In=new Set,Dt=new Map,dt=!1,Dn=!1;const ml={Tab:!0,Escape:!0};function Fn(e,t){for(let n of In)n(e,t)}function gl(e){return!(e.metaKey||!Ln()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Kt(e){dt=!0,gl(e)&&(It="keyboard",Fn("keyboard",e))}function $e(e){It="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(dt=!0,Fn("pointer",e))}function eo(e){dl(e)&&(dt=!0,It="virtual")}function to(e){e.target===window||e.target===document||hl||!e.isTrusted||(!dt&&!Dn&&(It="virtual",Fn("virtual",e)),dt=!1,Dn=!1)}function no(){dt=!1,Dn=!0}function _n(e){if(typeof window>"u"||typeof document>"u"||Dt.get(ft(e)))return;const t=ft(e),n=rt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){dt=!0,r.apply(this,arguments)},n.addEventListener("keydown",Kt,!0),n.addEventListener("keyup",Kt,!0),n.addEventListener("click",eo,!0),t.addEventListener("focus",to,!0),t.addEventListener("blur",no,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",$e,!0),n.addEventListener("pointermove",$e,!0),n.addEventListener("pointerup",$e,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",$e,!0),n.addEventListener("mousemove",$e,!0),n.addEventListener("mouseup",$e,!0)),t.addEventListener("beforeunload",()=>{ro(e)},{once:!0}),Dt.set(t,{focus:r})}const ro=(e,t)=>{const n=ft(e),r=rt(e);t&&r.removeEventListener("DOMContentLoaded",t),Dt.has(n)&&(n.HTMLElement.prototype.focus=Dt.get(n).focus,r.removeEventListener("keydown",Kt,!0),r.removeEventListener("keyup",Kt,!0),r.removeEventListener("click",eo,!0),n.removeEventListener("focus",to,!0),n.removeEventListener("blur",no,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",$e,!0),r.removeEventListener("pointermove",$e,!0),r.removeEventListener("pointerup",$e,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",$e,!0),r.removeEventListener("mousemove",$e,!0),r.removeEventListener("mouseup",$e,!0)),Dt.delete(n))};function vl(e){const t=rt(e);let n;return t.readyState!=="loading"?_n(e):(n=()=>{_n(e)},t.addEventListener("DOMContentLoaded",n)),()=>ro(e,n)}typeof document<"u"&&vl();function oo(){return It!=="pointer"}const bl=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function yl(e,t,n){let r=rt(n==null?void 0:n.target);const o=typeof window<"u"?ft(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?ft(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,u=typeof window<"u"?ft(n==null?void 0:n.target).HTMLElement:HTMLElement,a=typeof window<"u"?ft(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!bl.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof u&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!ml[n.key])}function xl(e,t,n){_n(),d.useEffect(()=>{let r=(o,s)=>{yl(!!(n!=null&&n.isTextInput),o,s)&&e(oo())};return In.add(r),()=>{In.delete(r)}},t)}function wl(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]),u=Zr(s),a=d.useCallback(i=>{const l=rt(i.target),c=l?Pn(l):Pn();i.target===i.currentTarget&&c===Qr(i.nativeEvent)&&(n&&n(i),o&&o(!0),u(i))},[o,n,u]);return{focusProps:{onFocus:!t&&(n||o||r)?a:void 0,onBlur:!t&&(r||o)?s:void 0}}}function El(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=d.useRef({isFocusWithin:!1}),{addGlobalListener:u,removeAllGlobalListeners:a}=Xr(),i=d.useCallback(p=>{p.currentTarget.contains(p.target)&&s.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(s.current.isFocusWithin=!1,a(),n&&n(p),o&&o(!1))},[n,o,s,a]),l=Zr(i),c=d.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const m=rt(p.target),f=Pn(m);if(!s.current.isFocusWithin&&f===Qr(p.nativeEvent)){r&&r(p),o&&o(!0),s.current.isFocusWithin=!0,l(p);let b=p.currentTarget;u(m,"focus",y=>{if(s.current.isFocusWithin&&!qr(b,y.target)){let N=new m.defaultView.FocusEvent("blur",{relatedTarget:y.target});pl(N,b);let I=Jr(N);i(I)}},{capture:!0})}},[r,o,l,u,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:i}}}let qt=!1,Qt=0;function jn(){qt=!0,setTimeout(()=>{qt=!1},50)}function io(e){e.pointerType==="touch"&&jn()}function Cl(){if(!(typeof document>"u"))return Qt===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",io):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",jn)),Qt++,()=>{Qt--,!(Qt>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",io):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",jn))}}function Sl(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,u]=d.useState(!1),a=d.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;d.useEffect(Cl,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Xr(),{hoverProps:c,triggerHoverEnd:p}=d.useMemo(()=>{let m=(y,N)=>{if(a.pointerType=N,o||N==="touch"||a.isHovered||!y.currentTarget.contains(y.target))return;a.isHovered=!0;let I=y.currentTarget;a.target=I,i(rt(y.target),"pointerover",w=>{a.isHovered&&a.target&&!qr(a.target,w.target)&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:I,pointerType:N}),n&&n(!0),u(!0)},f=(y,N)=>{let I=a.target;a.pointerType="",a.target=null,!(N==="touch"||!a.isHovered||!I)&&(a.isHovered=!1,l(),r&&r({type:"hoverend",target:I,pointerType:N}),n&&n(!1),u(!1))},b={};return typeof PointerEvent<"u"?(b.onPointerEnter=y=>{qt&&y.pointerType==="mouse"||m(y,y.pointerType)},b.onPointerLeave=y=>{!o&&y.currentTarget.contains(y.target)&&f(y,y.pointerType)}):process.env.NODE_ENV==="test"&&(b.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},b.onMouseEnter=y=>{!a.ignoreEmulatedMouseEvents&&!qt&&m(y,"mouse"),a.ignoreEmulatedMouseEvents=!1},b.onMouseLeave=y=>{!o&&y.currentTarget.contains(y.target)&&f(y,"mouse")}),{hoverProps:b,triggerHoverEnd:f}},[t,n,r,o,a,i,l]);return d.useEffect(()=>{o&&p({currentTarget:a.target},a.pointerType)},[o]),{hoverProps:c,isHovered:s}}function Ol(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=d.useRef({isFocused:!1,isFocusVisible:t||oo()}),[s,u]=d.useState(!1),[a,i]=d.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=d.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),c=d.useCallback(f=>{o.current.isFocused=f,u(f),l()},[l]);xl(f=>{o.current.isFocusVisible=f,l()},[],{isTextInput:n});let{focusProps:p}=wl({isDisabled:r,onFocusChange:c}),{focusWithinProps:m}=El({isDisabled:!r,onFocusWithinChange:c});return{isFocused:s,isFocusVisible:a,focusProps:r?m:p}}var Al=Object.defineProperty,Nl=(e,t,n)=>t in e?Al(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kn=(e,t,n)=>(Nl(e,typeof t!="symbol"?t+"":t,n),n);let $l=class{constructor(){kn(this,"current",this.detect()),kn(this,"handoffState","pending"),kn(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"}},ze=new $l;function Ft(e){var t,n;return ze.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 so(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Re(){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 so(()=>{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=Re();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 xt(){let[e]=d.useState(Re);return d.useEffect(()=>()=>e.dispose(),[e]),e}let le=(e,t)=>{ze.isServer?d.useEffect(e,t):d.useLayoutEffect(e,t)};function pt(e){let t=d.useRef(e);return le(()=>{t.current=e},[e]),t}let Z=function(e){let t=pt(e);return d.useCallback((...n)=>t.current(...n),[t])};function Tl(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 Pl(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ml({disabled:e=!1}={}){let t=d.useRef(null),[n,r]=d.useState(!1),o=xt(),s=Z(()=>{t.current=null,r(!1),o.dispose()}),u=Z(a=>{if(o.dispose(),t.current===null){t.current=a.currentTarget,r(!0);{let i=Ft(a.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let c=Tl(l);r(Pl(c,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:u,onPointerUp:s,onClick:s}}}let Ll=d.createContext(void 0);function Rn(){return d.useContext(Ll)}function Bn(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Te(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,Te),r}var Xt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Xt||{}),ot=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ot||{});function Ae(){let e=Dl();return d.useCallback(t=>Il({mergeRefs:e,...t}),[e])}function Il({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:u,mergeRefs:a}){a=a??Fl;let i=lo(t,e);if(s)return Jt(i,n,r,u,a);let l=o??0;if(l&2){let{static:c=!1,...p}=i;if(c)return Jt(p,n,r,u,a)}if(l&1){let{unmount:c=!0,...p}=i;return Te(c?0:1,{0(){return null},1(){return Jt({...p,hidden:!0,style:{display:"none"}},n,r,u,a)}})}return Jt(i,n,r,u,a)}function Jt(e,t={},n,r,o){let{as:s=n,children:u,refName:a="ref",...i}=Wn(e,["unmount","static"]),l=e.ref!==void 0?{[a]:e.ref}:{},c=typeof u=="function"?u(t):u;"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[b,y]of Object.entries(t))typeof y=="boolean"&&(m=!0),y===!0&&f.push(b.replace(/([A-Z])/g,N=>`-${N.toLowerCase()}`));if(m){p["data-headlessui-state"]=f.join(" ");for(let b of f)p[`data-${b}`]=""}}if(s===d.Fragment&&(Object.keys(it(i)).length>0||Object.keys(it(p)).length>0))if(!d.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(it(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(it(i)).concat(Object.keys(it(p))).map(m=>` - ${m}`).join(`
56
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(m=>` - ${m}`).join(`
60
+ */const Mo=ba("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Do{constructor(){Le(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 xa extends Do{constructor(n,r){super();Le(this,"smartWallet");Le(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 ya extends Do{constructor(n,r,o,i="0",a="0"){super();Le(this,"currentActiveAccount");Le(this,"approved");Le(this,"chainId");Le(this,"balance");Le(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=i,this.allowance=a}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{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 Io(e,t,n,r,o,i){switch(e==null?void 0:e.wallet){case"mpc":return new xa(t,e);default:return new ya(e,!1,r||1,o,i)}}const Fo=typeof document<"u"?m.useLayoutEffect:()=>{};var Kn;const wa=(Kn=m.useInsertionEffect)!==null&&Kn!==void 0?Kn:Fo;function Ea(e){const t=m.useRef(null);return wa(()=>{t.current=e},[e]),m.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const pt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},yt=e=>e&&"window"in e&&e.window===e?e:pt(e).defaultView||window;function Sa(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Ca(e){return Sa(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Oa=!1;function qn(){return Oa}function jo(e,t){if(!qn())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:Ca(n)?n=n.host:n=n.parentNode}return!1}const Xn=(e=document)=>{var t;if(!qn())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 Ro(e){return qn()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function an(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 Qn(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 it(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Jn=it(function(){return Qn(/^Mac/i)}),Ta=it(function(){return Qn(/^iPhone/i)}),Na=it(function(){return Qn(/^iPad/i)||Jn()&&navigator.maxTouchPoints>1}),Aa=it(function(){return Ta()||Na()});it(function(){return Jn()||Aa()}),it(function(){return an(/AppleWebKit/i)&&!$a()});const $a=it(function(){return an(/Chrome/i)}),Pa=it(function(){return an(/Android/i)});it(function(){return an(/Firefox/i)});function ko(){let e=m.useRef(new Map),t=m.useCallback((o,i,a,u)=>{let s=u!=null&&u.once?(...l)=>{e.current.delete(a),a(...l)}:a;e.current.set(a,{type:i,eventTarget:o,fn:s,options:u}),o.addEventListener(i,s,u)},[]),n=m.useCallback((o,i,a,u)=>{var s;let l=((s=e.current.get(a))===null||s===void 0?void 0:s.fn)||a;o.removeEventListener(i,l,u),e.current.delete(a)},[]),r=m.useCallback(()=>{e.current.forEach((o,i)=>{n(o.eventTarget,o.type,i,o.options)})},[n]);return m.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function La(e){return e.mozInputSource===0&&e.isTrusted?!0:Pa()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function _o(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Ma(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Bo(e){let t=m.useRef({isFocused:!1,observer:null});Fo(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Ea(r=>{e==null||e(r)});return m.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,i=a=>{if(t.current.isFocused=!1,o.disabled){let u=_o(a);n(u)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var a;(a=t.current.observer)===null||a===void 0||a.disconnect();let u=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:u})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:u}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let Da=!1,zt=null,Zn=new Set,Gt=new Map,wt=!1,er=!1;const Ia={Tab:!0,Escape:!0};function tr(e,t){for(let n of Zn)n(e,t)}function Fa(e){return!(e.metaKey||!Jn()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function un(e){wt=!0,Fa(e)&&(zt="keyboard",tr("keyboard",e))}function Me(e){zt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(wt=!0,tr("pointer",e))}function Wo(e){La(e)&&(wt=!0,zt="virtual")}function Uo(e){e.target===window||e.target===document||Da||!e.isTrusted||(!wt&&!er&&(zt="virtual",tr("virtual",e)),wt=!1,er=!1)}function Vo(){wt=!1,er=!0}function nr(e){if(typeof window>"u"||typeof document>"u"||Gt.get(yt(e)))return;const t=yt(e),n=pt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){wt=!0,r.apply(this,arguments)},n.addEventListener("keydown",un,!0),n.addEventListener("keyup",un,!0),n.addEventListener("click",Wo,!0),t.addEventListener("focus",Uo,!0),t.addEventListener("blur",Vo,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Me,!0),n.addEventListener("pointermove",Me,!0),n.addEventListener("pointerup",Me,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Me,!0),n.addEventListener("mousemove",Me,!0),n.addEventListener("mouseup",Me,!0)),t.addEventListener("beforeunload",()=>{Ho(e)},{once:!0}),Gt.set(t,{focus:r})}const Ho=(e,t)=>{const n=yt(e),r=pt(e);t&&r.removeEventListener("DOMContentLoaded",t),Gt.has(n)&&(n.HTMLElement.prototype.focus=Gt.get(n).focus,r.removeEventListener("keydown",un,!0),r.removeEventListener("keyup",un,!0),r.removeEventListener("click",Wo,!0),n.removeEventListener("focus",Uo,!0),n.removeEventListener("blur",Vo,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Me,!0),r.removeEventListener("pointermove",Me,!0),r.removeEventListener("pointerup",Me,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Me,!0),r.removeEventListener("mousemove",Me,!0),r.removeEventListener("mouseup",Me,!0)),Gt.delete(n))};function ja(e){const t=pt(e);let n;return t.readyState!=="loading"?nr(e):(n=()=>{nr(e)},t.addEventListener("DOMContentLoaded",n)),()=>Ho(e,n)}typeof document<"u"&&ja();function zo(){return zt!=="pointer"}const Ra=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function ka(e,t,n){let r=pt(n==null?void 0:n.target);const o=typeof window<"u"?yt(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?yt(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,a=typeof window<"u"?yt(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?yt(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Ra.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof a&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Ia[n.key])}function _a(e,t,n){nr(),m.useEffect(()=>{let r=(o,i)=>{ka(!!(n!=null&&n.isTextInput),o,i)&&e(zo())};return Zn.add(r),()=>{Zn.delete(r)}},t)}function Ba(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const i=m.useCallback(s=>{if(s.target===s.currentTarget)return r&&r(s),o&&o(!1),!0},[r,o]),a=Bo(i),u=m.useCallback(s=>{const l=pt(s.target),c=l?Xn(l):Xn();s.target===s.currentTarget&&c===Ro(s.nativeEvent)&&(n&&n(s),o&&o(!0),a(s))},[o,n,a]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?i:void 0}}}function Wa(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=m.useRef({isFocusWithin:!1}),{addGlobalListener:a,removeAllGlobalListeners:u}=ko(),s=m.useCallback(d=>{d.currentTarget.contains(d.target)&&i.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(i.current.isFocusWithin=!1,u(),n&&n(d),o&&o(!1))},[n,o,i,u]),l=Bo(s),c=m.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const p=pt(d.target),f=Xn(p);if(!i.current.isFocusWithin&&f===Ro(d.nativeEvent)){r&&r(d),o&&o(!0),i.current.isFocusWithin=!0,l(d);let g=d.currentTarget;a(p,"focus",v=>{if(i.current.isFocusWithin&&!jo(g,v.target)){let E=new p.defaultView.FocusEvent("blur",{relatedTarget:v.target});Ma(E,g);let I=_o(E);s(I)}},{capture:!0})}},[r,o,l,a,s]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:s}}}let cn=!1,fn=0;function rr(){cn=!0,setTimeout(()=>{cn=!1},50)}function Go(e){e.pointerType==="touch"&&rr()}function Ua(){if(!(typeof document>"u"))return fn===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Go):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",rr)),fn++,()=>{fn--,!(fn>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Go):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",rr))}}function Va(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[i,a]=m.useState(!1),u=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(Ua,[]);let{addGlobalListener:s,removeAllGlobalListeners:l}=ko(),{hoverProps:c,triggerHoverEnd:d}=m.useMemo(()=>{let p=(v,E)=>{if(u.pointerType=E,o||E==="touch"||u.isHovered||!v.currentTarget.contains(v.target))return;u.isHovered=!0;let I=v.currentTarget;u.target=I,s(pt(v.target),"pointerover",w=>{u.isHovered&&u.target&&!jo(u.target,w.target)&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:I,pointerType:E}),n&&n(!0),a(!0)},f=(v,E)=>{let I=u.target;u.pointerType="",u.target=null,!(E==="touch"||!u.isHovered||!I)&&(u.isHovered=!1,l(),r&&r({type:"hoverend",target:I,pointerType:E}),n&&n(!1),a(!1))},g={};return typeof PointerEvent<"u"?(g.onPointerEnter=v=>{cn&&v.pointerType==="mouse"||p(v,v.pointerType)},g.onPointerLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,v.pointerType)}):process.env.NODE_ENV==="test"&&(g.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},g.onMouseEnter=v=>{!u.ignoreEmulatedMouseEvents&&!cn&&p(v,"mouse"),u.ignoreEmulatedMouseEvents=!1},g.onMouseLeave=v=>{!o&&v.currentTarget.contains(v.target)&&f(v,"mouse")}),{hoverProps:g,triggerHoverEnd:f}},[t,n,r,o,u,s,l]);return m.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:c,isHovered:i}}function Ha(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=m.useRef({isFocused:!1,isFocusVisible:t||zo()}),[i,a]=m.useState(!1),[u,s]=m.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=m.useCallback(()=>s(o.current.isFocused&&o.current.isFocusVisible),[]),c=m.useCallback(f=>{o.current.isFocused=f,a(f),l()},[l]);_a(f=>{o.current.isFocusVisible=f,l()},[],{isTextInput:n});let{focusProps:d}=Ba({isDisabled:r,onFocusChange:c}),{focusWithinProps:p}=Wa({isDisabled:!r,onFocusWithinChange:c});return{isFocused:i,isFocusVisible:u,focusProps:r?p:d}}var za=Object.defineProperty,Ga=(e,t,n)=>t in e?za(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,or=(e,t,n)=>(Ga(e,typeof t!="symbol"?t+"":t,n),n);let Ya=class{constructor(){or(this,"current",this.detect()),or(this,"handoffState","pending"),or(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Ke=new Ya;function Yt(e){var t,n;return Ke.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Yo(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Ve(){let e=[],t={addEventListener(n,r,o,i){return n.addEventListener(r,o,i),t.add(()=>n.removeEventListener(r,o,i))},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 Yo(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=Ve();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 $t(){let[e]=m.useState(Ve);return m.useEffect(()=>()=>e.dispose(),[e]),e}let ae=(e,t)=>{Ke.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function Et(e){let t=m.useRef(e);return ae(()=>{t.current=e},[e]),t}let ee=function(e){let t=Et(e);return m.useCallback((...n)=>t.current(...n),[t])};function Ka(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 qa(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Xa({disabled:e=!1}={}){let t=m.useRef(null),[n,r]=m.useState(!1),o=$t(),i=ee(()=>{t.current=null,r(!1),o.dispose()}),a=ee(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let s=Yt(u.currentTarget);o.addEventListener(s,"pointerup",i,!1),o.addEventListener(s,"pointermove",l=>{if(t.current){let c=Ka(l);r(qa(c,t.current.getBoundingClientRect()))}},!1),o.addEventListener(s,"pointercancel",i,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:a,onPointerUp:i,onClick:i}}}let Qa=m.createContext(void 0);function ir(){return m.useContext(Qa)}function sr(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function De(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,De),r}var dn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(dn||{}),mt=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(mt||{});function Pe(){let e=Za();return m.useCallback(t=>Ja({mergeRefs:e,...t}),[e])}function Ja({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:a,mergeRefs:u}){u=u??eu;let s=Ko(t,e);if(i)return pn(s,n,r,a,u);let l=o??0;if(l&2){let{static:c=!1,...d}=s;if(c)return pn(d,n,r,a,u)}if(l&1){let{unmount:c=!0,...d}=s;return De(c?0:1,{0(){return null},1(){return pn({...d,hidden:!0,style:{display:"none"}},n,r,a,u)}})}return pn(s,n,r,a,u)}function pn(e,t={},n,r,o){let{as:i=n,children:a,refName:u="ref",...s}=lr(e,["unmount","static"]),l=e.ref!==void 0?{[u]:e.ref}:{},c=typeof a=="function"?a(t):a;"className"in s&&s.className&&typeof s.className=="function"&&(s.className=s.className(t)),s["aria-labelledby"]&&s["aria-labelledby"]===s.id&&(s["aria-labelledby"]=void 0);let d={};if(t){let p=!1,f=[];for(let[g,v]of Object.entries(t))typeof v=="boolean"&&(p=!0),v===!0&&f.push(g.replace(/([A-Z])/g,E=>`-${E.toLowerCase()}`));if(p){d["data-headlessui-state"]=f.join(" ");for(let g of f)d[`data-${g}`]=""}}if(i===m.Fragment&&(Object.keys(ht(s)).length>0||Object.keys(ht(d)).length>0))if(!m.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(ht(s)).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(ht(s)).concat(Object.keys(ht(d))).map(p=>` - ${p}`).join(`
61
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
57
62
  `)].join(`
58
- `))}else{let m=c.props,f=m==null?void 0:m.className,b=typeof f=="function"?(...I)=>Bn(f(...I),i.className):Bn(f,i.className),y=b?{className:b}:{},N=lo(c.props,it(Wn(i,["ref"])));for(let I in p)I in N&&delete p[I];return d.cloneElement(c,Object.assign({},N,p,l,{ref:o(_l(c),l.ref)},y))}return d.createElement(s,Object.assign({},Wn(i,["ref"]),s!==d.Fragment&&l,s!==d.Fragment&&p),c)}function Dl(){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 Fl(...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 lo(...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 u=n[r];for(let a of u){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...s)}}});return t}function ao(...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 u of s)u==null||u(...o)}});return t}function Ee(e){var t;return Object.assign(d.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function it(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Wn(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function _l(e){return d.version.split(".")[0]>="19"?e.props.ref:e.ref}function jl(e,t,n){let[r,o]=d.useState(n),s=e!==void 0,u=d.useRef(s),a=d.useRef(!1),i=d.useRef(!1);return s&&!u.current&&!a.current?(a.current=!0,u.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&&u.current&&!i.current&&(i.current=!0,u.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 kl(e){let[t]=d.useState(e);return t}function uo(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))fo(n,co(t,r),o);return n}function co(e,t){return e?e+"["+t+"]":t}function fo(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())fo(e,co(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,""]):uo(n,t,e)}function Rl(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Bl="span";var Un=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Un||{});function Wl(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 Ae()({ourProps:s,theirProps:o,slot:{},defaultTag:Bl,name:"Hidden"})}let po=Ee(Wl),Ul=d.createContext(null);function Vl({children:e}){let t=d.useContext(Ul);if(!t)return d.createElement(d.Fragment,null,e);let{target:n}=t;return n?xe.createPortal(d.createElement(d.Fragment,null,e),n):null}function zl({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,u]=d.useState(null),a=xt();return d.useEffect(()=>{if(r&&s)return a.addEventListener(s,"reset",r)},[s,t,r]),d.createElement(Vl,null,d.createElement(Hl,{setForm:u,formId:t}),uo(e).map(([i,l])=>d.createElement(po,{features:Un.Hidden,...it({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function Hl({setForm:e,formId:t}){return d.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:d.createElement(po,{features:Un.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Gl=d.createContext(void 0);function ho(){return d.useContext(Gl)}function Vn(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Zt(e){return Vn(e)&&"tagName"in e}function Ze(e){return Zt(e)&&"accessKey"in e}function wt(e){return Zt(e)&&"tabIndex"in e}function Yl(e){return Zt(e)&&"style"in e}function Kl(e){return Ze(e)&&e.nodeName==="IFRAME"}function mo(e){return Ze(e)&&e.nodeName==="INPUT"}function go(e){return Ze(e)&&e.nodeName==="LABEL"}function ql(e){return Ze(e)&&e.nodeName==="FIELDSET"}function vo(e){return Ze(e)&&e.nodeName==="LEGEND"}function Ql(e){return Zt(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Xl(e){let t=e.parentElement,n=null;for(;t&&!ql(t);)vo(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Jl(n)?!1:r}function Jl(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(vo(t))return!1;t=t.previousElementSibling}return!0}let bo=Symbol();function Zl(e,t=!0){return Object.assign(e,{[bo]:t})}function Pe(...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[bo]))?void 0:n}let zn=d.createContext(null);zn.displayName="DescriptionContext";function yo(){let e=d.useContext(zn);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,yo),t}return e}function ea(){var e,t;return(t=(e=d.useContext(zn))==null?void 0:e.value)!=null?t:void 0}let ta="p";function na(e,t){let n=d.useId(),r=Rn(),{id:o=`headlessui-description-${n}`,...s}=e,u=yo(),a=Pe(t);le(()=>u.register(o),[o,u.register]);let i=r||!1,l=d.useMemo(()=>({...u.slot,disabled:i}),[u.slot,i]),c={ref:a,...u.props,id:o};return Ae()({ourProps:c,theirProps:s,slot:l,defaultTag:ta,name:u.name||"Description"})}let ra=Ee(na);Object.assign(ra,{});var he=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(he||{});let en=d.createContext(null);en.displayName="LabelContext";function xo(){let e=d.useContext(en);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,xo),t}return e}function wo(e){var t,n,r;let o=(n=(t=d.useContext(en))==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 oa({inherit:e=!1}={}){let t=wo(),[n,r]=d.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,d.useMemo(()=>function(s){let u=Z(i=>(r(l=>[...l,i]),()=>r(l=>{let c=l.slice(),p=c.indexOf(i);return p!==-1&&c.splice(p,1),c}))),a=d.useMemo(()=>({register:u,slot:s.slot,name:s.name,props:s.props,value:s.value}),[u,s.slot,s.name,s.props,s.value]);return d.createElement(en.Provider,{value:a},s.children)},[r])]}let ia="label";function sa(e,t){var n;let r=d.useId(),o=xo(),s=ho(),u=Rn(),{id:a=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...c}=e,p=Pe(t);le(()=>o.register(a),[a,o.register]);let m=Z(N=>{let I=N.currentTarget;if(!(N.target!==N.currentTarget&&Ql(N.target))&&(go(I)&&N.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(N),go(I))){let w=document.getElementById(I.htmlFor);if(w){let T=w.getAttribute("disabled");if(T==="true"||T==="")return;let j=w.getAttribute("aria-disabled");if(j==="true"||j==="")return;(mo(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),f=u||!1,b=d.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),y={ref:p,...o.props,id:a,htmlFor:i,onClick:m};return l&&("onClick"in y&&(delete y.htmlFor,delete y.onClick),"onClick"in c&&delete c.onClick),Ae()({ourProps:y,theirProps:c,slot:b,defaultTag:i?ia:"div",name:o.name||"Label"})}let la=Ee(sa),aa=Object.assign(la,{});function ua(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 ca(e=ua){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 fa(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function da(e,t=!1){let[n,r]=d.useReducer(()=>({}),{}),o=d.useMemo(()=>fa(e),[e,n]);return le(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let Eo=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var pa=Object.defineProperty,ha=(e,t,n)=>t in e?pa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ma=(e,t,n)=>(ha(e,t+"",n),n),Co=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Me=(e,t,n)=>(Co(e,t,"read from private field"),n?n.call(e):t.get(e)),Hn=(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)},So=(e,t,n,r)=>(Co(e,t,"write to private field"),t.set(e,n),n),He,_t,jt;let Oo=class{constructor(t){Hn(this,He,{}),Hn(this,_t,new Eo(()=>new Set)),Hn(this,jt,new Set),ma(this,"disposables",Re()),So(this,He,t),ze.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Me(this,He)}subscribe(t,n){if(ze.isServer)return()=>{};let r={selector:t,callback:n,current:t(Me(this,He))};return Me(this,jt).add(r),this.disposables.add(()=>{Me(this,jt).delete(r)})}on(t,n){return ze.isServer?()=>{}:(Me(this,_t).get(t).add(n),this.disposables.add(()=>{Me(this,_t).get(t).delete(n)}))}send(t){let n=this.reduce(Me(this,He),t);if(n!==Me(this,He)){So(this,He,n);for(let r of Me(this,jt)){let o=r.selector(Me(this,He));Ao(r.current,o)||(r.current=o,r.callback(o))}for(let r of Me(this,_t).get(t.type))r(Me(this,He),t)}}};He=new WeakMap,_t=new WeakMap,jt=new WeakMap;function Ao(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:Gn(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Gn(e.entries(),t.entries()):No(e)&&No(t)?Gn(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Gn(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 No(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Yn(e){let[t,n]=e(),r=Re();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var ga=Object.defineProperty,va=(e,t,n)=>t in e?ga(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t,n)=>(va(e,typeof t!="symbol"?t+"":t,n),n),To=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(To||{});let ba={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}}},ya=class Bs extends Oo{constructor(){super(...arguments),$o(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),$o(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Bs({stack:[]})}reduce(t,n){return Te(n.type,ba,t,n)}};const Kn=new Eo(()=>ya.new());var qn={exports:{}},Qn={};/**
63
+ `))}else{let p=c.props,f=p==null?void 0:p.className,g=typeof f=="function"?(...I)=>sr(f(...I),s.className):sr(f,s.className),v=g?{className:g}:{},E=Ko(c.props,ht(lr(s,["ref"])));for(let I in d)I in E&&delete d[I];return m.cloneElement(c,Object.assign({},E,d,l,{ref:o(tu(c),l.ref)},v))}return m.createElement(i,Object.assign({},lr(s,["ref"]),i!==m.Fragment&&l,i!==m.Fragment&&d),c)}function Za(){let e=m.useRef([]),t=m.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function eu(...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 Ko(...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 i;return(i=o==null?void 0:o.preventDefault)==null?void 0:i.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...i){let a=n[r];for(let u of a){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...i)}}});return t}function qo(...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 i=n[r];for(let a of i)a==null||a(...o)}});return t}function Ce(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ht(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function lr(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function tu(e){return m.version.split(".")[0]>="19"?e.props.ref:e.ref}function nu(e,t,n){let[r,o]=m.useState(n),i=e!==void 0,a=m.useRef(i),u=m.useRef(!1),s=m.useRef(!1);return i&&!a.current&&!u.current?(u.current=!0,a.current=i,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.")):!i&&a.current&&!s.current&&(s.current=!0,a.current=i,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.")),[i?e:r,ee(l=>(i||o(l),t==null?void 0:t(l)))]}function ru(e){let[t]=m.useState(e);return t}function Xo(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Jo(n,Qo(t,r),o);return n}function Qo(e,t){return e?e+"["+t+"]":t}function Jo(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Jo(e,Qo(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,""]):Xo(n,t,e)}function ou(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 iu="span";var ar=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(ar||{});function su(e,t){var n;let{features:r=1,...o}=e,i={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 Pe()({ourProps:i,theirProps:o,slot:{},defaultTag:iu,name:"Hidden"})}let Zo=Ce(su),lu=m.createContext(null);function au({children:e}){let t=m.useContext(lu);if(!t)return m.createElement(m.Fragment,null,e);let{target:n}=t;return n?we.createPortal(m.createElement(m.Fragment,null,e),n):null}function uu({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[i,a]=m.useState(null),u=$t();return m.useEffect(()=>{if(r&&i)return u.addEventListener(i,"reset",r)},[i,t,r]),m.createElement(au,null,m.createElement(cu,{setForm:a,formId:t}),Xo(e).map(([s,l])=>m.createElement(Zo,{features:ar.Hidden,...ht({key:s,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:s,value:l,...o})})))}function cu({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:m.createElement(Zo,{features:ar.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let fu=m.createContext(void 0);function ei(){return m.useContext(fu)}function ur(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function mn(e){return ur(e)&&"tagName"in e}function st(e){return mn(e)&&"accessKey"in e}function Pt(e){return mn(e)&&"tabIndex"in e}function du(e){return mn(e)&&"style"in e}function pu(e){return st(e)&&e.nodeName==="IFRAME"}function ti(e){return st(e)&&e.nodeName==="INPUT"}function ni(e){return st(e)&&e.nodeName==="LABEL"}function mu(e){return st(e)&&e.nodeName==="FIELDSET"}function ri(e){return st(e)&&e.nodeName==="LEGEND"}function hu(e){return mn(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function gu(e){let t=e.parentElement,n=null;for(;t&&!mu(t);)ri(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&vu(n)?!1:r}function vu(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(ri(t))return!1;t=t.previousElementSibling}return!0}let oi=Symbol();function bu(e,t=!0){return Object.assign(e,{[oi]:t})}function Ie(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=ee(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[oi]))?void 0:n}let cr=m.createContext(null);cr.displayName="DescriptionContext";function ii(){let e=m.useContext(cr);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ii),t}return e}function xu(){var e,t;return(t=(e=m.useContext(cr))==null?void 0:e.value)!=null?t:void 0}let yu="p";function wu(e,t){let n=m.useId(),r=ir(),{id:o=`headlessui-description-${n}`,...i}=e,a=ii(),u=Ie(t);ae(()=>a.register(o),[o,a.register]);let s=r||!1,l=m.useMemo(()=>({...a.slot,disabled:s}),[a.slot,s]),c={ref:u,...a.props,id:o};return Pe()({ourProps:c,theirProps:i,slot:l,defaultTag:yu,name:a.name||"Description"})}let Eu=Ce(wu);Object.assign(Eu,{});var ge=(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))(ge||{});let hn=m.createContext(null);hn.displayName="LabelContext";function si(){let e=m.useContext(hn);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,si),t}return e}function li(e){var t,n,r;let o=(n=(t=m.useContext(hn))==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 Su({inherit:e=!1}={}){let t=li(),[n,r]=m.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,m.useMemo(()=>function(i){let a=ee(s=>(r(l=>[...l,s]),()=>r(l=>{let c=l.slice(),d=c.indexOf(s);return d!==-1&&c.splice(d,1),c}))),u=m.useMemo(()=>({register:a,slot:i.slot,name:i.name,props:i.props,value:i.value}),[a,i.slot,i.name,i.props,i.value]);return m.createElement(hn.Provider,{value:u},i.children)},[r])]}let Cu="label";function Ou(e,t){var n;let r=m.useId(),o=si(),i=ei(),a=ir(),{id:u=`headlessui-label-${r}`,htmlFor:s=i??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...c}=e,d=Ie(t);ae(()=>o.register(u),[u,o.register]);let p=ee(E=>{let I=E.currentTarget;if(!(E.target!==E.currentTarget&&hu(E.target))&&(ni(I)&&E.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(E),ni(I))){let w=document.getElementById(I.htmlFor);if(w){let P=w.getAttribute("disabled");if(P==="true"||P==="")return;let F=w.getAttribute("aria-disabled");if(F==="true"||F==="")return;(ti(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),f=a||!1,g=m.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),v={ref:d,...o.props,id:u,htmlFor:s,onClick:p};return l&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in c&&delete c.onClick),Pe()({ourProps:v,theirProps:c,slot:g,defaultTag:s?Cu:"div",name:o.name||"Label"})}let Tu=Ce(Ou),Nu=Object.assign(Tu,{});function Au(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 $u(e=Au){return m.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function Pu(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Lu(e,t=!1){let[n,r]=m.useReducer(()=>({}),{}),o=m.useMemo(()=>Pu(e),[e,n]);return ae(()=>{if(!e)return;let i=new ResizeObserver(r);return i.observe(e),()=>{i.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let ai=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 Mu=Object.defineProperty,Du=(e,t,n)=>t in e?Mu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Iu=(e,t,n)=>(Du(e,t+"",n),n),ui=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Fe=(e,t,n)=>(ui(e,t,"read from private field"),n?n.call(e):t.get(e)),fr=(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)},ci=(e,t,n,r)=>(ui(e,t,"write to private field"),t.set(e,n),n),qe,Kt,qt;let fi=class{constructor(t){fr(this,qe,{}),fr(this,Kt,new ai(()=>new Set)),fr(this,qt,new Set),Iu(this,"disposables",Ve()),ci(this,qe,t),Ke.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Fe(this,qe)}subscribe(t,n){if(Ke.isServer)return()=>{};let r={selector:t,callback:n,current:t(Fe(this,qe))};return Fe(this,qt).add(r),this.disposables.add(()=>{Fe(this,qt).delete(r)})}on(t,n){return Ke.isServer?()=>{}:(Fe(this,Kt).get(t).add(n),this.disposables.add(()=>{Fe(this,Kt).get(t).delete(n)}))}send(t){let n=this.reduce(Fe(this,qe),t);if(n!==Fe(this,qe)){ci(this,qe,n);for(let r of Fe(this,qt)){let o=r.selector(Fe(this,qe));di(r.current,o)||(r.current=o,r.callback(o))}for(let r of Fe(this,Kt).get(t.type))r(Fe(this,qe),t)}}};qe=new WeakMap,Kt=new WeakMap,qt=new WeakMap;function di(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:dr(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:dr(e.entries(),t.entries()):pi(e)&&pi(t)?dr(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function dr(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 pi(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function pr(e){let[t,n]=e(),r=Ve();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Fu=Object.defineProperty,ju=(e,t,n)=>t in e?Fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t,n)=>(ju(e,typeof t!="symbol"?t+"":t,n),n),hi=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(hi||{});let Ru={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let i=e.stack.slice();return i.splice(o,1),i.push(n),r=i,{...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}}},ku=class Jl extends fi{constructor(){super(...arguments),mi(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),mi(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Jl({stack:[]})}reduce(t,n){return De(n.type,Ru,t,n)}};const mr=new ai(()=>ku.new());var hr={exports:{}},gr={};/**
59
64
  * @license React
60
65
  * use-sync-external-store-with-selector.production.js
61
66
  *
@@ -63,7 +68,7 @@ React keys must be passed directly to JSX without using spread:
63
68
  *
64
69
  * This source code is licensed under the MIT license found in the
65
70
  * LICENSE file in the root directory of this source tree.
66
- */var Po;function xa(){if(Po)return Qn;Po=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,u=e.useMemo,a=e.useDebugValue;return Qn.useSyncExternalStoreWithSelector=function(i,l,c,p,m){var f=o(null);if(f.current===null){var b={hasValue:!1,value:null};f.current=b}else b=f.current;f=u(function(){function N(_){if(!I){if(I=!0,w=_,_=p(_),m!==void 0&&b.hasValue){var B=b.value;if(m(B,_))return T=B}return T=_}if(B=T,n(w,_))return B;var W=p(_);return m!==void 0&&m(B,W)?(w=_,B):(w=_,T=W)}var I=!1,w,T,j=c===void 0?null:c;return[function(){return N(l())},j===null?void 0:function(){return N(j())}]},[l,c,p,m]);var y=r(i,f[0],f[1]);return s(function(){b.hasValue=!0,b.value=y},[y]),a(y),y},Qn}var Xn={};/**
71
+ */var gi;function _u(){if(gi)return gr;gi=1;var e=m;function t(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,u=e.useDebugValue;return gr.useSyncExternalStoreWithSelector=function(s,l,c,d,p){var f=o(null);if(f.current===null){var g={hasValue:!1,value:null};f.current=g}else g=f.current;f=a(function(){function E(R){if(!I){if(I=!0,w=R,R=d(R),p!==void 0&&g.hasValue){var B=g.value;if(p(B,R))return P=B}return P=R}if(B=P,n(w,R))return B;var V=d(R);return p!==void 0&&p(B,V)?(w=R,B):(w=R,P=V)}var I=!1,w,P,F=c===void 0?null:c;return[function(){return E(l())},F===null?void 0:function(){return E(F())}]},[l,c,d,p]);var v=r(s,f[0],f[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),u(v),v},gr}var vr={};/**
67
72
  * @license React
68
73
  * use-sync-external-store-with-selector.development.js
69
74
  *
@@ -71,34 +76,45 @@ React keys must be passed directly to JSX without using spread:
71
76
  *
72
77
  * This source code is licensed under the MIT license found in the
73
78
  * LICENSE file in the root directory of this source tree.
74
- */var Mo;function wa(){return Mo||(Mo=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,u=t.useMemo,a=t.useDebugValue;Xn.useSyncExternalStoreWithSelector=function(i,l,c,p,m){var f=o(null);if(f.current===null){var b={hasValue:!1,value:null};f.current=b}else b=f.current;f=u(function(){function N(_){if(!I){if(I=!0,w=_,_=p(_),m!==void 0&&b.hasValue){var B=b.value;if(m(B,_))return T=B}return T=_}if(B=T,n(w,_))return B;var W=p(_);return m!==void 0&&m(B,W)?(w=_,B):(w=_,T=W)}var I=!1,w,T,j=c===void 0?null:c;return[function(){return N(l())},j===null?void 0:function(){return N(j())}]},[l,c,p,m]);var y=r(i,f[0],f[1]);return s(function(){b.hasValue=!0,b.value=y},[y]),a(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Xn}process.env.NODE_ENV==="production"?qn.exports=xa():qn.exports=wa();var Ea=qn.exports;function Le(e,t,n=Ao){return Ea.useSyncExternalStoreWithSelector(Z(r=>e.subscribe(Ca,r)),Z(()=>e.state),Z(()=>e.state),Z(t),n)}function Ca(e){return e}function Lo(e,t){let n=d.useId(),r=Kn.get(t),[o,s]=Le(r,d.useCallback(u=>[r.selectors.isTop(u,n),r.selectors.inStack(u,n)],[r,n]));return le(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Jn=new Map,kt=new Map;function Io(e){var t;let n=(t=kt.get(e))!=null?t:0;return kt.set(e,n+1),n!==0?()=>Do(e):(Jn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Do(e))}function Do(e){var t;let n=(t=kt.get(e))!=null?t:1;if(n===1?kt.delete(e):kt.set(e,n-1),n!==1)return;let r=Jn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Jn.delete(e))}function Sa(e,{allowed:t,disallowed:n}={}){let r=Lo(e,"inert-others");le(()=>{var o,s;if(!r)return;let u=Re();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&u.add(Io(i));let a=(s=t==null?void 0:t())!=null?s:[];for(let i of a){if(!i)continue;let l=Ft(i);if(!l)continue;let c=i.parentElement;for(;c&&c!==l.body;){for(let p of c.children)a.some(m=>p.contains(m))||u.add(Io(p));c=c.parentElement}}return u.dispose},[r,t,n])}function Oa(e,t,n){let r=pt(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:Ze(t)?t:t.current;if(!o)return;let s=Re();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>r.current(o));u.observe(o),s.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>r.current(o));u.observe(o),s.add(()=>u.disconnect())}return()=>s.dispose()},[t,r,e])}let Zn=["[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(","),Aa=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var er=(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))(er||{}),Na=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Na||{}),$a=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))($a||{});function Fo(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Zn)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Ta(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Aa)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var tr=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(tr||{});function _o(e,t=0){var n;return e===((n=Ft(e))==null?void 0:n.body)?!1:Te(t,{0(){return e.matches(Zn)},1(){let r=e;for(;r!==null;){if(r.matches(Zn))return!0;r=r.parentElement}return!1}})}var Pa=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Pa||{});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 Ma=["textarea","input"].join(",");function La(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Ma))!=null?n:!1}function jo(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 u=o.compareDocumentPosition(s);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ia(e,t){return Da(Fo(),t,{relativeTo:e})}function Da(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,u=Array.isArray(e)?n?jo(e):e:t&64?Ta(e):Fo(e);o.length>0&&u.length>1&&(u=u.filter(f=>!o.some(b=>b!=null&&"current"in b?(b==null?void 0:b.current)===f:b===f))),r=r??s.activeElement;let a=(()=>{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,u.indexOf(r))-1;if(t&4)return Math.max(0,u.indexOf(r))+1;if(t&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},c=0,p=u.length,m;do{if(c>=p||c+p<=0)return 0;let f=i+c;if(t&16)f=(f+p)%p;else{if(f<0)return 3;if(f>=p)return 1}m=u[f],m==null||m.focus(l),c+=a}while(m!==s.activeElement);return t&6&&La(m)&&m.select(),2}function ko(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Fa(){return/Android/gi.test(window.navigator.userAgent)}function Ro(){return ko()||Fa()}function Et(e,t,n,r){let o=pt(n);d.useEffect(()=>{if(!e)return;function s(u){o.current(u)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function _a(e,t,n,r){let o=pt(n);d.useEffect(()=>{if(!e)return;function s(u){o.current(u)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Bo=30;function ja(e,t,n){let r=pt(n),o=d.useCallback(function(a,i){if(a.defaultPrevented)return;let l=i(a);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function p(m){return typeof m=="function"?p(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let p of c)if(p!==null&&(p.contains(l)||a.composed&&a.composedPath().includes(p)))return;return!_o(l,tr.Loose)&&l.tabIndex!==-1&&a.preventDefault(),r.current(a,l)},[r,t]),s=d.useRef(null);Et(e,"pointerdown",a=>{var i,l;Ro()||(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),Et(e,"pointerup",a=>{if(Ro()||!s.current)return;let i=s.current;return s.current=null,o(a,()=>i)},!0);let u=d.useRef({x:0,y:0});Et(e,"touchstart",a=>{u.current.x=a.touches[0].clientX,u.current.y=a.touches[0].clientY},!0),Et(e,"touchend",a=>{let i={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(i.x-u.current.x)>=Bo||Math.abs(i.y-u.current.y)>=Bo))return o(a,()=>wt(a.target)?a.target:null)},!0),_a(e,"blur",a=>o(a,()=>Kl(window.document.activeElement)?window.document.activeElement:null),!0)}function nr(...e){return d.useMemo(()=>Ft(...e),[...e])}var ka=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(ka||{});const tn={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},Ra=200,Wo=5;function Ba(e,{trigger:t,action:n,close:r,select:o}){let s=d.useRef(null),u=d.useRef(null),a=d.useRef(null);Et(e&&t!==null,"pointerdown",i=>{Vn(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(u.current=i.x,a.current=i.y,s.current=i.timeStamp)}),Et(e&&t!==null,"pointerup",i=>{var l,c;let p=s.current;if(p===null||(s.current=null,!wt(i.target))||Math.abs(i.x-((l=u.current)!=null?l:i.x))<Wo&&Math.abs(i.y-((c=a.current)!=null?c:i.y))<Wo)return;let m=n(i);switch(m.kind){case 0:return;case 1:{i.timeStamp-p>Ra&&(o(m.target),r());break}case 2:{r();break}}},{capture:!0})}function Wa(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 Ua(e){return d.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Va(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 u=t[o].call(n,...s);u&&(n=u,r.forEach(a=>a()))}}}function za(){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 Ha(){return ko()?{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 a=Re();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,u=null;t.addEventListener(e,"click",a=>{if(wt(a.target))try{let i=a.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),c=e.querySelector(l);wt(c)&&!r(c)&&(u=c)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(wt(a.target)&&Yl(a.target))if(r(a.target)){let i=a.target;for(;i.parentElement&&r(i.parentElement);)i=i.parentElement;t.style(i,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(wt(a.target)){if(mo(a.target))return;if(r(a.target)){let i=a.target;for(;i.parentElement&&i.dataset.headlessuiPortal!==""&&!(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);)i=i.parentElement;i.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let i=(a=window.scrollY)!=null?a:window.pageYOffset;s!==i&&window.scrollTo(0,s),u&&u.isConnected&&(u.scrollIntoView({block:"nearest"}),u=null)})})}}:{}}function Ga(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Ya(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let ht=Va(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Re(),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:Ya(n)},o=[Ha(),za(),Ga()];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)}});ht.subscribe(()=>{let e=ht.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)&&ht.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ht.dispatch("TEARDOWN",n)}});function Ka(e,t,n=()=>({containers:[]})){let r=Ua(ht),o=t?r.get(t):void 0,s=o?o.count>0:!1;return le(()=>{if(!(!t||!e))return ht.dispatch("PUSH",t,n),()=>ht.dispatch("POP",t,n)},[e,t]),s}function qa(e,t,n=()=>[document.body]){let r=Lo(e,"scroll-lock");Ka(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Uo(e){return[e.screenX,e.screenY]}function Qa(){let e=d.useRef([-1,-1]);return{wasMoved(t){let n=Uo(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Uo(t)}}}function Xa(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]),u=d.useCallback(i=>n(l=>l&~i),[n]),a=d.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:u,toggleFlag:a}}var Vo,zo;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Vo=process==null?void 0:process.env)==null?void 0:Vo.NODE_ENV)==="test"&&typeof((zo=Element==null?void 0:Element.prototype)==null?void 0:zo.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 Ja=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Ja||{});function Ho(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Go(e,t,n,r){let[o,s]=d.useState(n),{hasFlag:u,addFlag:a,removeFlag:i}=Xa(e&&o?3:0),l=d.useRef(!1),c=d.useRef(!1),p=xt();return le(()=>{var m;if(e){if(n&&s(!0),!t){n&&a(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),Za(t,{inFlight:l,prepare(){c.current?c.current=!1:c.current=l.current,l.current=!0,!c.current&&(n?(a(3),i(4)):(a(4),i(2)))},run(){c.current?n?(i(3),a(4)):(i(4),a(3)):n?i(1):a(1)},done(){var f;c.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,p]),e?[o,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Za(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Re();return tu(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(eu(e,r))})}),s.dispose}function eu(e,t){var n,r;let o=Re();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let u=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return u.length===0?(t(),o.dispose):(Promise.allSettled(u.map(a=>a.finished)).then(()=>{s||t()}),o.dispose)}function tu(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 nn(){return typeof window<"u"}function Ct(e){return Yo(e)?(e.nodeName||"").toLowerCase():"#document"}function Ne(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ge(e){var t;return(t=(Yo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Yo(e){return nn()?e instanceof Node||e instanceof Ne(e).Node:!1}function be(e){return nn()?e instanceof Element||e instanceof Ne(e).Element:!1}function Ye(e){return nn()?e instanceof HTMLElement||e instanceof Ne(e).HTMLElement:!1}function Ko(e){return!nn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ne(e).ShadowRoot}const nu=new Set(["inline","contents"]);function Rt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Be(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!nu.has(o)}const ru=new Set(["table","td","th"]);function ou(e){return ru.has(Ct(e))}const iu=[":popover-open",":modal"];function rn(e){return iu.some(t=>{try{return e.matches(t)}catch{return!1}})}const su=["transform","translate","scale","rotate","perspective"],lu=["transform","translate","scale","rotate","perspective","filter"],au=["paint","layout","strict","content"];function rr(e){const t=or(),n=be(e)?Be(e):e;return su.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)||lu.some(r=>(n.willChange||"").includes(r))||au.some(r=>(n.contain||"").includes(r))}function uu(e){let t=st(e);for(;Ye(t)&&!St(t);){if(rr(t))return t;if(rn(t))return null;t=st(t)}return null}function or(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cu=new Set(["html","body","#document"]);function St(e){return cu.has(Ct(e))}function Be(e){return Ne(e).getComputedStyle(e)}function on(e){return be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function st(e){if(Ct(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ko(e)&&e.host||Ge(e);return Ko(t)?t.host:t}function qo(e){const t=st(e);return St(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ye(t)&&Rt(t)?t:qo(t)}function Bt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=qo(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),u=Ne(o);if(s){const a=ir(u);return t.concat(u,u.visualViewport||[],Rt(o)?o:[],a&&n?Bt(a):[])}return t.concat(o,Bt(o,[],n))}function ir(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fu(){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 mt=Math.min,ye=Math.max,Wt=Math.round,sn=Math.floor,Ke=e=>({x:e,y:e}),du={left:"right",right:"left",bottom:"top",top:"bottom"},pu={start:"end",end:"start"};function Qo(e,t,n){return ye(e,mt(t,n))}function Ot(e,t){return typeof e=="function"?e(t):e}function lt(e){return e.split("-")[0]}function Ut(e){return e.split("-")[1]}function Xo(e){return e==="x"?"y":"x"}function Jo(e){return e==="y"?"height":"width"}const hu=new Set(["top","bottom"]);function et(e){return hu.has(lt(e))?"y":"x"}function Zo(e){return Xo(et(e))}function mu(e,t,n){n===void 0&&(n=!1);const r=Ut(e),o=Zo(e),s=Jo(o);let u=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(u=ln(u)),[u,ln(u)]}function gu(e){const t=ln(e);return[sr(e),t,sr(t)]}function sr(e){return e.replace(/start|end/g,t=>pu[t])}const ei=["left","right"],ti=["right","left"],vu=["top","bottom"],bu=["bottom","top"];function yu(e,t,n){switch(e){case"top":case"bottom":return n?t?ti:ei:t?ei:ti;case"left":case"right":return t?vu:bu;default:return[]}}function xu(e,t,n,r){const o=Ut(e);let s=yu(lt(e),n==="start",r);return o&&(s=s.map(u=>u+"-"+o),t&&(s=s.concat(s.map(sr)))),s}function ln(e){return e.replace(/left|right|bottom|top/g,t=>du[t])}function wu(e){return{top:0,right:0,bottom:0,left:0,...e}}function Eu(e){return typeof e!="number"?wu(e):{top:e,right:e,bottom:e,left:e}}function an(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 ni(e,t,n){let{reference:r,floating:o}=e;const s=et(t),u=Zo(t),a=Jo(u),i=lt(t),l=s==="y",c=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let f;switch(i){case"top":f={x:c,y:r.y-o.height};break;case"bottom":f={x:c,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-o.width,y:p};break;default:f={x:r.x,y:r.y}}switch(Ut(t)){case"start":f[u]-=m*(n&&l?-1:1);break;case"end":f[u]+=m*(n&&l?-1:1);break}return f}const Cu=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:u}=n,a=s.filter(Boolean),i=await(u.isRTL==null?void 0:u.isRTL(t));let l=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:p}=ni(l,r,i),m=r,f={},b=0;for(let y=0;y<a.length;y++){const{name:N,fn:I}=a[y],{x:w,y:T,data:j,reset:_}=await I({x:c,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:l,platform:u,elements:{reference:e,floating:t}});c=w??c,p=T??p,f={...f,[N]:{...f[N],...j}},_&&b<=50&&(b++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(l=_.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:c,y:p}=ni(l,m,i)),y=-1)}return{x:c,y:p,placement:m,strategy:o,middlewareData:f}};async function un(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:u,elements:a,strategy:i}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:m=!1,padding:f=0}=Ot(t,e),b=Eu(f),N=a[m?p==="floating"?"reference":"floating":p],I=an(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(N)))==null||n?N:N.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:c,strategy:i})),w=p==="floating"?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),j=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},_=an(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:T,strategy:i}):w);return{top:(I.top-_.top+b.top)/j.y,bottom:(_.bottom-I.bottom+b.bottom)/j.y,left:(I.left-_.left+b.left)/j.x,right:(_.right-I.right+b.right)/j.x}}const Su=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:u,initialPlacement:a,platform:i,elements:l}=t,{mainAxis:c=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...N}=Ot(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const I=lt(o),w=et(a),T=lt(a)===a,j=await(i.isRTL==null?void 0:i.isRTL(l.floating)),_=m||(T||!y?[ln(a)]:gu(a)),B=b!=="none";!m&&B&&_.push(...xu(a,y,b,j));const W=[a,..._],h=await un(t,N),v=[];let g=((r=s.flip)==null?void 0:r.overflows)||[];if(c&&v.push(h[I]),p){const P=mu(o,u,j);v.push(h[P[0]],h[P[1]])}if(g=[...g,{placement:o,overflows:v}],!v.every(P=>P<=0)){var x,C;const P=(((x=s.flip)==null?void 0:x.index)||0)+1,S=W[P];if(S&&(!(p==="alignment"?w!==et(S):!1)||g.every(E=>et(E.placement)===w?E.overflows[0]>0:!0)))return{data:{index:P,overflows:g},reset:{placement:S}};let $=(C=g.filter(L=>L.overflows[0]<=0).sort((L,E)=>L.overflows[1]-E.overflows[1])[0])==null?void 0:C.placement;if(!$)switch(f){case"bestFit":{var A;const L=(A=g.filter(E=>{if(B){const D=et(E.placement);return D===w||D==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(D=>D>0).reduce((D,F)=>D+F,0)]).sort((E,D)=>E[1]-D[1])[0])==null?void 0:A[0];L&&($=L);break}case"initialPlacement":$=a;break}if(o!==$)return{reset:{placement:$}}}return{}}}},Ou=new Set(["left","top"]);async function Au(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),u=lt(n),a=Ut(n),i=et(n)==="y",l=Ou.has(u)?-1:1,c=s&&i?-1:1,p=Ot(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof b=="number"&&(f=a==="end"?b*-1:b),i?{x:f*c,y:m*l}:{x:m*l,y:f*c}}const Nu=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:u,middlewareData:a}=t,i=await Au(t,e);return u===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+i.x,y:s+i.y,data:{...i,placement:u}}}}},$u=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:u=!1,limiter:a={fn:N=>{let{x:I,y:w}=N;return{x:I,y:w}}},...i}=Ot(e,t),l={x:n,y:r},c=await un(t,i),p=et(lt(o)),m=Xo(p);let f=l[m],b=l[p];if(s){const N=m==="y"?"top":"left",I=m==="y"?"bottom":"right",w=f+c[N],T=f-c[I];f=Qo(w,f,T)}if(u){const N=p==="y"?"top":"left",I=p==="y"?"bottom":"right",w=b+c[N],T=b-c[I];b=Qo(w,b,T)}const y=a.fn({...t,[m]:f,[p]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:s,[p]:u}}}}}},Tu=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:u,elements:a}=t,{apply:i=()=>{},...l}=Ot(e,t),c=await un(t,l),p=lt(o),m=Ut(o),f=et(o)==="y",{width:b,height:y}=s.floating;let N,I;p==="top"||p==="bottom"?(N=p,I=m===(await(u.isRTL==null?void 0:u.isRTL(a.floating))?"start":"end")?"left":"right"):(I=p,N=m==="end"?"top":"bottom");const w=y-c.top-c.bottom,T=b-c.left-c.right,j=mt(y-c[N],w),_=mt(b-c[I],T),B=!t.middlewareData.shift;let W=j,h=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(h=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(W=w),B&&!m){const g=ye(c.left,0),x=ye(c.right,0),C=ye(c.top,0),A=ye(c.bottom,0);f?h=b-2*(g!==0||x!==0?g+x:ye(c.left,c.right)):W=y-2*(C!==0||A!==0?C+A:ye(c.top,c.bottom))}await i({...t,availableWidth:h,availableHeight:W});const v=await u.getDimensions(a.floating);return b!==v.width||y!==v.height?{reset:{rects:!0}}:{}}}};function ri(e){const t=Be(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ye(e),s=o?e.offsetWidth:n,u=o?e.offsetHeight:r,a=Wt(n)!==s||Wt(r)!==u;return a&&(n=s,r=u),{width:n,height:r,$:a}}function lr(e){return be(e)?e:e.contextElement}function At(e){const t=lr(e);if(!Ye(t))return Ke(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ri(t);let u=(s?Wt(n.width):n.width)/r,a=(s?Wt(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!a||!Number.isFinite(a))&&(a=1),{x:u,y:a}}const Pu=Ke(0);function oi(e){const t=Ne(e);return!or()||!t.visualViewport?Pu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ne(e)?!1:t}function gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=lr(e);let u=Ke(1);t&&(r?be(r)&&(u=At(r)):u=At(e));const a=Mu(s,n,r)?oi(s):Ke(0);let i=(o.left+a.x)/u.x,l=(o.top+a.y)/u.y,c=o.width/u.x,p=o.height/u.y;if(s){const m=Ne(s),f=r&&be(r)?Ne(r):r;let b=m,y=ir(b);for(;y&&r&&f!==b;){const N=At(y),I=y.getBoundingClientRect(),w=Be(y),T=I.left+(y.clientLeft+parseFloat(w.paddingLeft))*N.x,j=I.top+(y.clientTop+parseFloat(w.paddingTop))*N.y;i*=N.x,l*=N.y,c*=N.x,p*=N.y,i+=T,l+=j,b=Ne(y),y=ir(b)}}return an({width:c,height:p,x:i,y:l})}function cn(e,t){const n=on(e).scrollLeft;return t?t.left+n:gt(Ge(e)).left+n}function ii(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-cn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Lu(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",u=Ge(r),a=t?rn(t.floating):!1;if(r===u||a&&s)return n;let i={scrollLeft:0,scrollTop:0},l=Ke(1);const c=Ke(0),p=Ye(r);if((p||!p&&!s)&&((Ct(r)!=="body"||Rt(u))&&(i=on(r)),Ye(r))){const f=gt(r);l=At(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const m=u&&!p&&!s?ii(u,i):Ke(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+c.x+m.x,y:n.y*l.y-i.scrollTop*l.y+c.y+m.y}}function Iu(e){return Array.from(e.getClientRects())}function Du(e){const t=Ge(e),n=on(e),r=e.ownerDocument.body,o=ye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let u=-n.scrollLeft+cn(e);const a=-n.scrollTop;return Be(r).direction==="rtl"&&(u+=ye(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:u,y:a}}const si=25;function Fu(e,t){const n=Ne(e),r=Ge(e),o=n.visualViewport;let s=r.clientWidth,u=r.clientHeight,a=0,i=0;if(o){s=o.width,u=o.height;const c=or();(!c||c&&t==="fixed")&&(a=o.offsetLeft,i=o.offsetTop)}const l=cn(r);if(l<=0){const c=r.ownerDocument,p=c.body,m=getComputedStyle(p),f=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(r.clientWidth-p.clientWidth-f);b<=si&&(s-=b)}else l<=si&&(s+=l);return{width:s,height:u,x:a,y:i}}const _u=new Set(["absolute","fixed"]);function ju(e,t){const n=gt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ye(e)?At(e):Ke(1),u=e.clientWidth*s.x,a=e.clientHeight*s.y,i=o*s.x,l=r*s.y;return{width:u,height:a,x:i,y:l}}function li(e,t,n){let r;if(t==="viewport")r=Fu(e,n);else if(t==="document")r=Du(Ge(e));else if(be(t))r=ju(t,n);else{const o=oi(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return an(r)}function ai(e,t){const n=st(e);return n===t||!be(n)||St(n)?!1:Be(n).position==="fixed"||ai(n,t)}function ku(e,t){const n=t.get(e);if(n)return n;let r=Bt(e,[],!1).filter(a=>be(a)&&Ct(a)!=="body"),o=null;const s=Be(e).position==="fixed";let u=s?st(e):e;for(;be(u)&&!St(u);){const a=Be(u),i=rr(u);!i&&a.position==="fixed"&&(o=null),(s?!i&&!o:!i&&a.position==="static"&&!!o&&_u.has(o.position)||Rt(u)&&!i&&ai(e,u))?r=r.filter(c=>c!==u):o=a,u=st(u)}return t.set(e,r),r}function Ru(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const u=[...n==="clippingAncestors"?rn(t)?[]:ku(t,this._c):[].concat(n),r],a=u[0],i=u.reduce((l,c)=>{const p=li(t,c,o);return l.top=ye(p.top,l.top),l.right=mt(p.right,l.right),l.bottom=mt(p.bottom,l.bottom),l.left=ye(p.left,l.left),l},li(t,a,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function Bu(e){const{width:t,height:n}=ri(e);return{width:t,height:n}}function Wu(e,t,n){const r=Ye(t),o=Ge(t),s=n==="fixed",u=gt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const i=Ke(0);function l(){i.x=cn(o)}if(r||!r&&!s)if((Ct(t)!=="body"||Rt(o))&&(a=on(t)),r){const f=gt(t,!0,s,t);i.x=f.x+t.clientLeft,i.y=f.y+t.clientTop}else o&&l();s&&!r&&o&&l();const c=o&&!r&&!s?ii(o,a):Ke(0),p=u.left+a.scrollLeft-i.x-c.x,m=u.top+a.scrollTop-i.y-c.y;return{x:p,y:m,width:u.width,height:u.height}}function ar(e){return Be(e).position==="static"}function ui(e,t){if(!Ye(e)||Be(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ge(e)===n&&(n=n.ownerDocument.body),n}function ci(e,t){const n=Ne(e);if(rn(e))return n;if(!Ye(e)){let o=st(e);for(;o&&!St(o);){if(be(o)&&!ar(o))return o;o=st(o)}return n}let r=ui(e,t);for(;r&&ou(r)&&ar(r);)r=ui(r,t);return r&&St(r)&&ar(r)&&!rr(r)?n:r||uu(e)||n}const Uu=async function(e){const t=this.getOffsetParent||ci,n=this.getDimensions,r=await n(e.floating);return{reference:Wu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Vu(e){return Be(e).direction==="rtl"}const zu={convertOffsetParentRelativeRectToViewportRelativeRect:Lu,getDocumentElement:Ge,getClippingRect:Ru,getOffsetParent:ci,getElementRects:Uu,getClientRects:Iu,getDimensions:Bu,getScale:At,isElement:be,isRTL:Vu};function fi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hu(e,t){let n=null,r;const o=Ge(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function u(a,i){a===void 0&&(a=!1),i===void 0&&(i=1),s();const l=e.getBoundingClientRect(),{left:c,top:p,width:m,height:f}=l;if(a||t(),!m||!f)return;const b=sn(p),y=sn(o.clientWidth-(c+m)),N=sn(o.clientHeight-(p+f)),I=sn(c),T={rootMargin:-b+"px "+-y+"px "+-N+"px "+-I+"px",threshold:ye(0,mt(1,i))||1};let j=!0;function _(B){const W=B[0].intersectionRatio;if(W!==i){if(!j)return u();W?u(!1,W):r=setTimeout(()=>{u(!1,1e-7)},1e3)}W===1&&!fi(l,e.getBoundingClientRect())&&u(),j=!1}try{n=new IntersectionObserver(_,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,T)}n.observe(e)}return u(!0),s}function Gu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,l=lr(e),c=o||s?[...l?Bt(l):[],...Bt(t)]:[];c.forEach(I=>{o&&I.addEventListener("scroll",n,{passive:!0}),s&&I.addEventListener("resize",n)});const p=l&&a?Hu(l,n):null;let m=-1,f=null;u&&(f=new ResizeObserver(I=>{let[w]=I;w&&w.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var T;(T=f)==null||T.observe(t)})),n()}),l&&!i&&f.observe(l),f.observe(t));let b,y=i?gt(e):null;i&&N();function N(){const I=gt(e);y&&!fi(y,I)&&n(),y=I,b=requestAnimationFrame(N)}return n(),()=>{var I;c.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),p==null||p(),(I=f)==null||I.disconnect(),f=null,i&&cancelAnimationFrame(b)}}const ur=un,Yu=Nu,Ku=$u,qu=Su,Qu=Tu,Xu=(e,t,n)=>{const r=new Map,o={platform:zu,...n},s={...o.platform,_c:r};return Cu(e,t,{...o,platform:s})};var Ju=typeof document<"u",Zu=function(){},fn=Ju?d.useLayoutEffect:Zu;function dn(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(!dn(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)&&!dn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function di(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pi(e,t){const n=di(e);return Math.round(t*n)/n}function cr(e){const t=H.useRef(e);return fn(()=>{t.current=e}),t}function ec(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:u}={},transform:a=!0,whileElementsMounted:i,open:l}=e,[c,p]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=H.useState(r);dn(m,r)||f(r);const[b,y]=H.useState(null),[N,I]=H.useState(null),w=H.useCallback(E=>{E!==B.current&&(B.current=E,y(E))},[]),T=H.useCallback(E=>{E!==W.current&&(W.current=E,I(E))},[]),j=s||b,_=u||N,B=H.useRef(null),W=H.useRef(null),h=H.useRef(c),v=i!=null,g=cr(i),x=cr(o),C=cr(l),A=H.useCallback(()=>{if(!B.current||!W.current)return;const E={placement:t,strategy:n,middleware:m};x.current&&(E.platform=x.current),Xu(B.current,W.current,E).then(D=>{const F={...D,isPositioned:C.current!==!1};P.current&&!dn(h.current,F)&&(h.current=F,Gt.flushSync(()=>{p(F)}))})},[m,t,n,x,C]);fn(()=>{l===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,p(E=>({...E,isPositioned:!1})))},[l]);const P=H.useRef(!1);fn(()=>(P.current=!0,()=>{P.current=!1}),[]),fn(()=>{if(j&&(B.current=j),_&&(W.current=_),j&&_){if(g.current)return g.current(j,_,A);A()}},[j,_,A,g,v]);const S=H.useMemo(()=>({reference:B,floating:W,setReference:w,setFloating:T}),[w,T]),$=H.useMemo(()=>({reference:j,floating:_}),[j,_]),L=H.useMemo(()=>{const E={position:n,left:0,top:0};if(!$.floating)return E;const D=pi($.floating,c.x),F=pi($.floating,c.y);return a?{...E,transform:"translate("+D+"px, "+F+"px)",...di($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:F}},[n,a,$.floating,c.x,c.y]);return H.useMemo(()=>({...c,update:A,refs:S,elements:$,floatingStyles:L}),[c,A,S,$,L])}const hi=(e,t)=>({...Yu(e),options:[e,t]}),tc=(e,t)=>({...Ku(e),options:[e,t]}),nc=(e,t)=>({...qu(e),options:[e,t]}),rc=(e,t)=>({...Qu(e),options:[e,t]}),mi={...H},oc=mi.useInsertionEffect||(e=>e());function gi(e){const t=H.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return oc(()=>{t.current=e}),H.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 fr=typeof document<"u"?d.useLayoutEffect:d.useEffect;let vi=!1,ic=0;const bi=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ic++;function sc(){const[e,t]=H.useState(()=>vi?bi():void 0);return fr(()=>{e==null&&t(bi())},[]),H.useEffect(()=>{vi=!0},[]),e}const lc=mi.useId||sc;let Vt;process.env.NODE_ENV!=="production"&&(Vt=new Set);function ac(){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=Vt)!=null&&e.has(o))){var s;(s=Vt)==null||s.add(o),console.warn(o)}}function uc(){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=Vt)!=null&&e.has(o))){var s;(s=Vt)==null||s.add(o),console.error(o)}}function cc(){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 fc=H.createContext(null),dc=H.createContext(null),pc=()=>{var e;return((e=H.useContext(fc))==null?void 0:e.id)||null},hc=()=>H.useContext(dc),mc="data-floating-ui-focusable";function gc(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=lc(),s=H.useRef({}),[u]=H.useState(()=>cc()),a=pc()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!be(f)&&uc("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]=H.useState(r.reference),c=gi((f,b,y)=>{s.current.openEvent=f?b:void 0,u.emit("openchange",{open:f,event:b,reason:y,nested:a}),n==null||n(f,b,y)}),p=H.useMemo(()=>({setPositionReference:l}),[]),m=H.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return H.useMemo(()=>({dataRef:s,open:t,onOpenChange:c,elements:m,events:u,floatingId:o,refs:p}),[t,c,m,u,o,p])}function vc(e){e===void 0&&(e={});const{nodeId:t}=e,n=gc({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,u]=H.useState(null),[a,i]=H.useState(null),c=(o==null?void 0:o.domReference)||s,p=H.useRef(null),m=hc();fr(()=>{c&&(p.current=c)},[c]);const f=ec({...e,elements:{...o,...a&&{reference:a}}}),b=H.useCallback(T=>{const j=be(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;i(j),f.refs.setReference(j)},[f.refs]),y=H.useCallback(T=>{(be(T)||T===null)&&(p.current=T,u(T)),(be(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!be(T))&&f.refs.setReference(T)},[f.refs]),N=H.useMemo(()=>({...f.refs,setReference:y,setPositionReference:b,domReference:p}),[f.refs,y,b]),I=H.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=H.useMemo(()=>({...f,...r,refs:N,elements:I,nodeId:t}),[f,N,I,t,r]);return fr(()=>{r.dataRef.current.floatingContext=w;const T=m==null?void 0:m.nodesRef.current.find(j=>j.id===t);T&&(T.context=w)}),H.useMemo(()=>({...f,context:w,refs:N,elements:I}),[f,N,I,w])}const yi="active",xi="selected";function dr(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[yi]:u,[xi]:a,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[mc]:""},...s,...t.map(u=>{const a=u?u[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((u,a)=>(a&&Object.entries(a).forEach(i=>{let[l,c]=i;if(!(o&&[yi,xi].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof c=="function"){var p;(p=r.get(l))==null||p.push(c),u[l]=function(){for(var m,f=arguments.length,b=new Array(f),y=0;y<f;y++)b[y]=arguments[y];return(m=r.get(l))==null?void 0:m.map(N=>N(...b)).find(N=>N!==void 0)}}}else u[l]=c}),u),{})}}function bc(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=H.useCallback(a=>dr(a,e,"reference"),t),s=H.useCallback(a=>dr(a,e,"floating"),n),u=H.useCallback(a=>dr(a,e,"item"),r);return H.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:u}),[o,s,u])}function wi(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const yc=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:u=0,minItemsVisible:a=4,referenceOverflowThreshold:i=0,scrollRef:l,...c}=Ot(e,t),{rects:p,elements:{floating:m}}=t,f=n.current[u],b=(l==null?void 0:l.current)||m,y=m.clientTop||b.clientTop,N=m.clientTop!==0,I=b.clientTop!==0,w=m===b;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||ac('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const T={...t,...await hi(-f.offsetTop-m.clientTop-p.reference.height/2-f.offsetHeight/2-s).fn(t)},j=await ur(wi(T,b.scrollHeight+y+m.clientTop),c),_=await ur(T,{...c,elementContext:"reference"}),B=ye(0,j.top),W=T.y+B,g=(b.scrollHeight>b.clientHeight?x=>x:Wt)(ye(0,b.scrollHeight+(N&&w||I?y*2:0)-B-ye(0,j.bottom)));if(b.style.maxHeight=g+"px",b.scrollTop=B,o){const x=b.offsetHeight<f.offsetHeight*mt(a,n.current.length)-1||_.top>=-i||_.bottom>=-i;Gt.flushSync(()=>o(x))}return r&&(r.current=await ur(wi({...T,y:W},b.offsetHeight+y+m.clientTop),c)),{y:W}}});function xc(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:u,onChange:a}=t,i=gi(a),l=H.useRef(!1),c=H.useRef(null),p=H.useRef(null);H.useEffect(()=>{if(!o)return;function f(y){if(y.ctrlKey||!b||s.current==null)return;const N=y.deltaY,I=s.current.top>=-.5,w=s.current.bottom>=-.5,T=b.scrollHeight-b.clientHeight,j=N<0?-1:1,_=N<0?"max":"min";b.scrollHeight<=b.clientHeight||(!I&&N>0||!w&&N<0?(y.preventDefault(),Gt.flushSync(()=>{i(B=>B+Math[_](N,T*j))})):/firefox/i.test(fu())&&(b.scrollTop+=N))}const b=(u==null?void 0:u.current)||r.floating;if(n&&b)return b.addEventListener("wheel",f),requestAnimationFrame(()=>{c.current=b.scrollTop,s.current!=null&&(p.current={...s.current})}),()=>{c.current=null,p.current=null,b.removeEventListener("wheel",f)}},[o,n,r.floating,s,u,i]);const m=H.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const f=(u==null?void 0:u.current)||r.floating;if(!(!s.current||!f||!l.current)){if(c.current!==null){const b=f.scrollTop-c.current;(s.current.bottom<-.5&&b<-1||s.current.top<-.5&&b>1)&&Gt.flushSync(()=>i(y=>y+b))}requestAnimationFrame(()=>{c.current=f.scrollTop})}}}),[r.floating,i,s,u]);return H.useMemo(()=>o?{floating:m}:{},[o,m])}let Nt=d.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Nt.displayName="FloatingContext";let pr=d.createContext(null);pr.displayName="PlacementContext";function wc(e){return d.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Ec(){return d.useContext(Nt).setReference}function Cc(){return d.useContext(Nt).getReferenceProps}function Sc(){let{getFloatingProps:e,slot:t}=d.useContext(Nt);return d.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Oc(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=d.useContext(pr),n=d.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var u;return(u=s==null?void 0:s.outerHTML)!=null?u:s})]);le(()=>{t==null||t(n??null)},[t,n]);let r=d.useContext(Nt);return d.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Ei=4;function Ac({children:e,enabled:t=!0}){let[n,r]=d.useState(null),[o,s]=d.useState(0),u=d.useRef(null),[a,i]=d.useState(null);Nc(a);let l=t&&n!==null&&a!==null,{to:c="bottom",gap:p=0,offset:m=0,padding:f=0,inner:b}=$c(n,a),[y,N="center"]=c.split(" ");le(()=>{l&&s(0)},[l]);let{refs:I,floatingStyles:w,context:T}=vc({open:l,placement:y==="selection"?N==="center"?"bottom":`bottom-${N}`:N==="center"?`${y}`:`${y}-${N}`,strategy:"absolute",transform:!1,middleware:[hi({mainAxis:y==="selection"?0:p,crossAxis:m}),tc({padding:f}),y!=="selection"&&nc({padding:f}),y==="selection"&&b?yc({...b,padding:f,overflowRef:u,offset:o,minItemsVisible:Ei,referenceOverflowThreshold:f,onFallbackChange(x){var C,A;if(!x)return;let P=T.elements.floating;if(!P)return;let S=parseFloat(getComputedStyle(P).scrollPaddingBottom)||0,$=Math.min(Ei,P.childElementCount),L=0,E=0;for(let D of(A=(C=T.elements.floating)==null?void 0:C.childNodes)!=null?A:[])if(Ze(D)){let F=D.offsetTop,R=F+D.clientHeight+S,U=P.scrollTop,G=U+P.clientHeight;if(F>=U&&R<=G)$--;else{E=Math.max(0,Math.min(R,G)-Math.max(F,U)),L=D.clientHeight;break}}$>=1&&s(D=>{let F=L*$-E+S;return D>=F?D:F})}}):null,rc({padding:f,apply({availableWidth:x,availableHeight:C,elements:A}){Object.assign(A.floating.style,{overflow:"auto",maxWidth:`${x}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:Gu}),[j=y,_=N]=T.placement.split("-");y==="selection"&&(j="selection");let B=d.useMemo(()=>({anchor:[j,_].filter(Boolean).join(" ")}),[j,_]),W=xc(T,{overflowRef:u,onChange:s}),{getReferenceProps:h,getFloatingProps:v}=bc([W]),g=Z(x=>{i(x),I.setFloating(x)});return H.createElement(pr.Provider,{value:r},H.createElement(Nt.Provider,{value:{setFloating:g,setReference:I.setReference,styles:w,getReferenceProps:h,getFloatingProps:v,slot:B}},e))}function Nc(e){le(()=>{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 $c(e,t){var n,r,o;let s=hr((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),u=hr((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=hr((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:u,padding:a}}function hr(e,t,n=void 0){let r=xt(),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 c=Si(i,l);return[c,p=>{let m=Ci(i);{let f=m.map(b=>window.getComputedStyle(l).getPropertyValue(b));r.requestAnimationFrame(function b(){r.nextFrame(b);let y=!1;for(let[I,w]of m.entries()){let T=window.getComputedStyle(l).getPropertyValue(w);if(f[I]!==T){f[I]=T,y=!0;break}}if(!y)return;let N=Si(i,l);c!==N&&(p(N),c=N)})}return r.dispose}]}return[n,null]}),s=d.useMemo(()=>o(e,t)[0],[e,t]),[u=s,a]=d.useState();return le(()=>{let[i,l]=o(e,t);if(a(i),!!l)return l(a)},[e,t]),u}function Ci(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,...Ci(o)]:[r]}return[]}function Si(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 Tc(e,t){let[n,r]=d.useState(t);return!e&&n!==t&&r(t),e?n:t}let mr=d.createContext(null);mr.displayName="OpenClosedContext";var We=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(We||{});function gr(){return d.useContext(mr)}function Oi({value:e,children:t}){return d.createElement(mr.Provider,{value:e},t)}function Pc(e){throw new Error("Unexpected object: "+e)}var ae=(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))(ae||{});function pn(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:Pc(e)}}var Ai=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Ai||{});function Ni(e){let t=Z(e),n=d.useRef(!1);d.useEffect(()=>(n.current=!1,()=>{n.current=!0,so(()=>{n.current&&t()})}),[t])}function Mc(){let e=typeof document>"u";return"useSyncExternalStore"in H?(t=>t.useSyncExternalStore)(H)(()=>()=>{},()=>!1,()=>!e):!1}function vr(){let e=Mc(),[t,n]=H.useState(ze.isHandoffComplete);return t&&ze.isHandoffComplete===!1&&n(!1),H.useEffect(()=>{t!==!0&&n(!0)},[t]),H.useEffect(()=>ze.handoff(),[]),e?!1:t}let Lc=d.createContext(!1);function Ic(){return d.useContext(Lc)}function Dc(e){let t=Ic(),n=d.useContext(Ti),[r,o]=d.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(ze.isServer)return null;let u=e==null?void 0:e.getElementById("headlessui-portal-root");if(u)return u;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});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 $i=d.Fragment,Fc=Ee(function(e,t){let{ownerDocument:n=null,...r}=e,o=d.useRef(null),s=Pe(Zl(f=>{o.current=f}),t),u=nr(o),a=n??u,i=Dc(a),[l]=d.useState(()=>{var f;return ze.isServer?null:(f=a==null?void 0:a.createElement("div"))!=null?f:null}),c=d.useContext(Rc),p=vr();le(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),le(()=>{if(l&&c)return c.register(l)},[c,l]),Ni(()=>{var f;!i||!l||(Vn(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let m=Ae();return p?!i||!l?null:xe.createPortal(m({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:$i,name:"Portal"}),l):null});function _c(e,t){let n=Pe(t),{enabled:r=!0,ownerDocument:o,...s}=e,u=Ae();return r?d.createElement(Fc,{...s,ownerDocument:o,ref:n}):u({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:$i,name:"Portal"})}let jc=d.Fragment,Ti=d.createContext(null);function kc(e,t){let{target:n,...r}=e,o={ref:Pe(t)},s=Ae();return d.createElement(Ti.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:jc,name:"Popover.Group"}))}let Rc=d.createContext(null),Bc=Ee(_c),Wc=Ee(kc),Uc=Object.assign(Bc,{Group:Wc});function Vc(){let e=d.useRef(!1);return le(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Pi(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Li)!==d.Fragment||d.Children.count(e.children)===1}let hn=d.createContext(null);hn.displayName="TransitionContext";var zc=(e=>(e.Visible="visible",e.Hidden="hidden",e))(zc||{});function Hc(){let e=d.useContext(hn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Gc(){let e=d.useContext(mn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let mn=d.createContext(null);mn.displayName="NestingContext";function gn(e){return"children"in e?gn(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Mi(e,t){let n=pt(e),r=d.useRef([]),o=Vc(),s=xt(),u=Z((f,b=ot.Hidden)=>{let y=r.current.findIndex(({el:N})=>N===f);y!==-1&&(Te(b,{[ot.Unmount](){r.current.splice(y,1)},[ot.Hidden](){r.current[y].state="hidden"}}),s.microTask(()=>{var N;!gn(r)&&o.current&&((N=n.current)==null||N.call(n))}))}),a=Z(f=>{let b=r.current.find(({el:y})=>y===f);return b?b.state!=="visible"&&(b.state="visible"):r.current.push({el:f,state:"visible"}),()=>u(f,ot.Unmount)}),i=d.useRef([]),l=d.useRef(Promise.resolve()),c=d.useRef({enter:[],leave:[]}),p=Z((f,b,y)=>{i.current.splice(0),t&&(t.chains.current[b]=t.chains.current[b].filter(([N])=>N!==f)),t==null||t.chains.current[b].push([f,new Promise(N=>{i.current.push(N)})]),t==null||t.chains.current[b].push([f,new Promise(N=>{Promise.all(c.current[b].map(([I,w])=>w)).then(()=>N())})]),b==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>y(b)):y(b)}),m=Z((f,b,y)=>{Promise.all(c.current[b].splice(0).map(([N,I])=>I)).then(()=>{var N;(N=i.current.shift())==null||N()}).then(()=>y(b))});return d.useMemo(()=>({children:r,register:a,unregister:u,onStart:p,onStop:m,wait:l,chains:c}),[a,u,r,p,m,c,l])}let Li=d.Fragment,Ii=Xt.RenderStrategy;function Yc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:u,beforeLeave:a,afterLeave:i,enter:l,enterFrom:c,enterTo:p,entered:m,leave:f,leaveFrom:b,leaveTo:y,...N}=e,[I,w]=d.useState(null),T=d.useRef(null),j=Pi(e),_=Pe(...j?[T,t,w]:t===null?[]:[t]),B=(n=N.unmount)==null||n?ot.Unmount:ot.Hidden,{show:W,appear:h,initial:v}=Hc(),[g,x]=d.useState(W?"visible":"hidden"),C=Gc(),{register:A,unregister:P}=C;le(()=>A(T),[A,T]),le(()=>{if(B===ot.Hidden&&T.current){if(W&&g!=="visible"){x("visible");return}return Te(g,{hidden:()=>P(T),visible:()=>A(T)})}},[g,T,A,P,W,B]);let S=vr();le(()=>{if(j&&S&&g==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,g,S,j]);let $=v&&!h,L=h&&W&&v,E=d.useRef(!1),D=Mi(()=>{E.current||(x("hidden"),P(T))},C),F=Z(z=>{E.current=!0;let re=z?"enter":"leave";D.onStart(T,re,de=>{de==="enter"?s==null||s():de==="leave"&&(a==null||a())})}),R=Z(z=>{let re=z?"enter":"leave";E.current=!1,D.onStop(T,re,de=>{de==="enter"?u==null||u():de==="leave"&&(i==null||i())}),re==="leave"&&!gn(D)&&(x("hidden"),P(T))});d.useEffect(()=>{j&&o||(F(W),R(W))},[W,j,o]);let U=!(!o||!j||!S||$),[,G]=Go(U,I,W,{start:F,end:R}),ee=it({ref:_,className:((r=Bn(N.className,L&&l,L&&c,G.enter&&l,G.enter&&G.closed&&c,G.enter&&!G.closed&&p,G.leave&&f,G.leave&&!G.closed&&b,G.leave&&G.closed&&y,!G.transition&&W&&m))==null?void 0:r.trim())||void 0,...Ho(G)}),q=0;g==="visible"&&(q|=We.Open),g==="hidden"&&(q|=We.Closed),W&&g==="hidden"&&(q|=We.Opening),!W&&g==="visible"&&(q|=We.Closing);let X=Ae();return d.createElement(mn.Provider,{value:D},d.createElement(Oi,{value:q},X({ourProps:ee,theirProps:N,defaultTag:Li,features:Ii,visible:g==="visible",name:"Transition.Child"})))}function Kc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,u=d.useRef(null),a=Pi(e),i=Pe(...a?[u,t]:t===null?[]:[t]);vr();let l=gr();if(n===void 0&&l!==null&&(n=(l&We.Open)===We.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,p]=d.useState(n?"visible":"hidden"),m=Mi(()=>{n||p("hidden")}),[f,b]=d.useState(!0),y=d.useRef([n]);le(()=>{f!==!1&&y.current[y.current.length-1]!==n&&(y.current.push(n),b(!1))},[y,n]);let N=d.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);le(()=>{n?p("visible"):!gn(m)&&u.current!==null&&p("hidden")},[n,m]);let I={unmount:o},w=Z(()=>{var _;f&&b(!1),(_=e.beforeEnter)==null||_.call(e)}),T=Z(()=>{var _;f&&b(!1),(_=e.beforeLeave)==null||_.call(e)}),j=Ae();return d.createElement(mn.Provider,{value:m},d.createElement(hn.Provider,{value:N},j({ourProps:{...I,as:d.Fragment,children:d.createElement(Di,{ref:i,...I,...s,beforeEnter:w,beforeLeave:T})},theirProps:{},defaultTag:d.Fragment,features:Ii,visible:c==="visible",name:"Transition"})))}function qc(e,t){let n=d.useContext(hn)!==null,r=gr()!==null;return d.createElement(d.Fragment,null,!n&&r?d.createElement(br,{ref:t,...e}):d.createElement(Di,{ref:t,...e}))}let br=Ee(Kc),Di=Ee(Yc),Qc=Ee(qc),Fi=Object.assign(br,{Child:Qc,Root:br});function Xc(e,t){let n=d.useRef({left:0,top:0});if(le(()=>{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 _i=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ji(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Ze(o))return r;let s=!1;for(let a of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),s=!0;let u=s?(n=o.innerText)!=null?n:"":r;return _i.test(u)&&(u=u.replace(_i,"")),u}function Jc(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 u=s.getAttribute("aria-label");return typeof u=="string"?u.trim():ji(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ji(e).trim()}function Zc(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=Jc(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var ef=Object.defineProperty,tf=(e,t,n)=>t in e?ef(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ki=(e,t,n)=>(tf(e,typeof t!="symbol"?t+"":t,n),n),me=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(me||{}),qe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(qe||{}),vn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(vn||{}),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 Bi(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=jo(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 nf={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ae.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,u;if(e.dataRef.current.disabled||e.listboxState===1)return e;let a={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ae.Nothing)return{...a,activeOptionIndex:null};if(t.focus===ae.Specific)return{...a,activeOptionIndex:e.options.findIndex(c=>c.id===t.id)};if(t.focus===ae.Previous){let c=e.activeOptionIndex;if(c!==null){let p=e.options[c].dataRef.current.domRef,m=pn(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{...a,activeOptionIndex:m}}}}else if(t.focus===ae.Next){let c=e.activeOptionIndex;if(c!==null){let p=e.options[c].dataRef.current.domRef,m=pn(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||((u=f.current)==null?void 0:u.nextElementSibling)===null)return{...a,activeOptionIndex:m}}}}let i=Bi(e),l=pn(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...a,...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(u=>{var a;return!u.dataRef.current.disabled&&((a=u.dataRef.current.textValue)==null?void 0:a.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!==ae.Nothing&&(r=pn(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(u=>o==null?void 0:o(u.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ae.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,u]of n.entries())if(o.has(u.id)&&(r.push(s),o.delete(u.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,...Bi(e),pendingShouldSort:!1}:e};class yr extends Oo{constructor(t){super(t),ki(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:u}=this.state.dataRef.current;return Te(s,{0:()=>r==null?void 0:r(n),1:()=>{let a=u.slice(),i=a.findIndex(l=>o(l,n));return i===-1?a.push(n):a.splice(i,1),r==null?void 0:r(a)}})},registerOption:Yn(()=>{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:Yn(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Yn(()=>{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:ae.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})}}),ki(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,u=n.options;return s!==null?((o=u[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=Kn.get(null);this.disposables.add(r.on(To.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 yr({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ae.Nothing},__demoMode:n})}reduce(t,n){return Te(n.type,nf,t,n)}}const Wi=d.createContext(null);function xr(e){let t=d.useContext(Wi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ui),n}return t}function Ui({id:e,__demoMode:t=!1}){let n=d.useMemo(()=>yr.new({id:e,__demoMode:t}),[]);return Ni(()=>n.dispose()),n}let bn=d.createContext(null);bn.displayName="ListboxDataContext";function zt(e){let t=d.useContext(bn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,zt),n}return t}let rf=d.Fragment;function of(e,t){let n=d.useId(),r=Rn(),{value:o,defaultValue:s,form:u,name:a,onChange:i,by:l,invalid:c=!1,disabled:p=r||!1,horizontal:m=!1,multiple:f=!1,__demoMode:b=!1,...y}=e;const N=m?"horizontal":"vertical";let I=Pe(t),w=kl(s),[T=f?[]:void 0,j]=jl(o,i,w),_=Ui({id:n,__demoMode:b}),B=d.useRef({static:!1,hold:!1}),W=d.useRef(new Map),h=ca(l),v=d.useCallback(U=>Te(g.mode,{[qe.Multi]:()=>T.some(G=>h(G,U)),[qe.Single]:()=>h(T,U)}),[T]),g=d.useMemo(()=>({value:T,disabled:p,invalid:c,mode:f?qe.Multi:qe.Single,orientation:N,onChange:j,compare:h,isSelected:v,optionsPropsRef:B,listRef:W}),[T,p,c,f,N,j,h,v,B,W]);le(()=>{_.state.dataRef.current=g},[g]);let x=Le(_,U=>U.listboxState),C=Kn.get(null),A=Le(C,d.useCallback(U=>C.selectors.isTop(U,n),[C,n])),[P,S]=Le(_,U=>[U.buttonElement,U.optionsElement]);ja(A,[P,S],(U,G)=>{_.send({type:Ri.CloseListbox}),_o(G,tr.Loose)||(U.preventDefault(),P==null||P.focus())});let $=d.useMemo(()=>({open:x===me.Open,disabled:p,invalid:c,value:T}),[x,p,c,T]),[L,E]=oa({inherit:!0}),D={ref:I},F=d.useCallback(()=>{if(w!==void 0)return j==null?void 0:j(w)},[j,w]),R=Ae();return d.createElement(E,{value:L,props:{htmlFor:P==null?void 0:P.id},slot:{open:x===me.Open,disabled:p}},d.createElement(Ac,null,d.createElement(Wi.Provider,{value:_},d.createElement(bn.Provider,{value:g},d.createElement(Oi,{value:Te(x,{[me.Open]:We.Open,[me.Closed]:We.Closed})},a!=null&&T!=null&&d.createElement(zl,{disabled:p,data:{[a]:T},form:u,onReset:F}),R({ourProps:D,theirProps:y,slot:$,defaultTag:rf,name:"Listbox"}))))))}let sf="button";function lf(e,t){let n=d.useId(),r=ho(),o=zt("Listbox.Button"),s=xr("Listbox.Button"),{id:u=r||`headlessui-listbox-button-${n}`,disabled:a=o.disabled||!1,autoFocus:i=!1,...l}=e,c=Pe(t,Ec(),s.actions.setButtonElement),p=Cc(),[m,f,b]=Le(s,E=>[E.listboxState,E.buttonElement,E.optionsElement]),y=m===me.Open;Ba(y,{trigger:f,action:d.useCallback(E=>{if(f!=null&&f.contains(E.target))return tn.Ignore;let D=E.target.closest('[role="option"]:not([data-disabled])');return Ze(D)?tn.Select(D):b!=null&&b.contains(E.target)?tn.Ignore:tn.Close},[f,b]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let N=Z(E=>{switch(E.key){case he.Enter:Rl(E.currentTarget);break;case he.Space:case he.ArrowDown:E.preventDefault(),s.actions.openListbox({focus:o.value?ae.Nothing:ae.First});break;case he.ArrowUp:E.preventDefault(),s.actions.openListbox({focus:o.value?ae.Nothing:ae.Last});break}}),I=Z(E=>{switch(E.key){case he.Space:E.preventDefault();break}}),w=Z(E=>{var D;if(E.button===Ai.Left){if(Xl(E.currentTarget))return E.preventDefault();s.state.listboxState===me.Open?(xe.flushSync(()=>s.actions.closeListbox()),(D=s.state.buttonElement)==null||D.focus({preventScroll:!0})):(E.preventDefault(),s.actions.openListbox({focus:ae.Nothing}))}}),T=d.useRef(null),j=Z(E=>{T.current=E.pointerType,E.pointerType==="mouse"&&w(E)}),_=Z(E=>{T.current!=="mouse"&&w(E)}),B=Z(E=>E.preventDefault()),W=wo([u]),h=ea(),{isFocusVisible:v,focusProps:g}=Ol({autoFocus:i}),{isHovered:x,hoverProps:C}=Sl({isDisabled:a}),{pressed:A,pressProps:P}=Ml({disabled:a}),S=d.useMemo(()=>({open:m===me.Open,active:A||m===me.Open,disabled:a,invalid:o.invalid,value:o.value,hover:x,focus:v,autofocus:i}),[m,o.value,a,x,v,A,o.invalid,i]),$=Le(s,E=>E.listboxState===me.Open),L=ao(p(),{ref:c,id:u,type:Wa(e,f),"aria-haspopup":"listbox","aria-controls":b==null?void 0:b.id,"aria-expanded":$,"aria-labelledby":W,"aria-describedby":h,disabled:a||void 0,autoFocus:i,onKeyDown:N,onKeyUp:I,onKeyPress:B,onPointerDown:j,onClick:_},g,C,P);return Ae()({ourProps:L,theirProps:l,slot:S,defaultTag:sf,name:"Listbox.Button"})}let Vi=d.createContext(!1),af="div",uf=Xt.RenderStrategy|Xt.Static;function cf(e,t){let n=d.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:u=!0,transition:a=!1,...i}=e,l=wc(o),[c,p]=d.useState(null);l&&(s=!0);let m=zt("Listbox.Options"),f=xr("Listbox.Options"),[b,y,N,I]=Le(f,z=>[z.listboxState,z.buttonElement,z.optionsElement,z.__demoMode]),w=nr(y),T=nr(N),j=gr(),[_,B]=Go(a,c,j!==null?(j&We.Open)===We.Open:b===me.Open);Oa(_,y,f.actions.closeListbox);let W=I?!1:u&&b===me.Open;qa(W,T);let h=I?!1:u&&b===me.Open;Sa(h,{allowed:d.useCallback(()=>[y,N],[y,N])});let v=b!==me.Open,g=Xc(v,y)?!1:_,x=_&&b===me.Closed,C=Tc(x,m.value),A=Z(z=>m.compare(C,z)),P=Le(f,z=>{var re;if(l==null||!((re=l==null?void 0:l.to)!=null&&re.includes("selection")))return null;let de=z.options.findIndex(_e=>A(_e.dataRef.current.value));return de===-1&&(de=0),de}),S=(()=>{if(l==null)return;if(P===null)return{...l,inner:void 0};let z=Array.from(m.listRef.current.values());return{...l,inner:{listRef:{current:z},index:P}}})(),[$,L]=Oc(S),E=Sc(),D=Pe(t,l?$:null,f.actions.setOptionsElement,p),F=xt();d.useEffect(()=>{var z;let re=N;re&&b===me.Open&&re!==((z=Ft(re))==null?void 0:z.activeElement)&&(re==null||re.focus({preventScroll:!0}))},[b,N]);let R=Z(z=>{var re,de;switch(F.dispose(),z.key){case he.Space:if(f.state.searchQuery!=="")return z.preventDefault(),z.stopPropagation(),f.actions.search(z.key);case he.Enter:if(z.preventDefault(),z.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:_e}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(_e.current.value)}m.mode===qe.Single&&(xe.flushSync(()=>f.actions.closeListbox()),(re=f.state.buttonElement)==null||re.focus({preventScroll:!0}));break;case Te(m.orientation,{vertical:he.ArrowDown,horizontal:he.ArrowRight}):return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.Next});case Te(m.orientation,{vertical:he.ArrowUp,horizontal:he.ArrowLeft}):return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.Previous});case he.Home:case he.PageUp:return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.First});case he.End:case he.PageDown:return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.Last});case he.Escape:z.preventDefault(),z.stopPropagation(),xe.flushSync(()=>f.actions.closeListbox()),(de=f.state.buttonElement)==null||de.focus({preventScroll:!0});return;case he.Tab:z.preventDefault(),z.stopPropagation(),xe.flushSync(()=>f.actions.closeListbox()),Ia(f.state.buttonElement,z.shiftKey?er.Previous:er.Next);break;default:z.key.length===1&&(f.actions.search(z.key),F.setTimeout(()=>f.actions.clearSearch(),350));break}}),U=Le(f,z=>{var re;return(re=z.buttonElement)==null?void 0:re.id}),G=d.useMemo(()=>({open:b===me.Open}),[b]),ee=ao(l?E():{},{id:r,ref:D,"aria-activedescendant":Le(f,f.selectors.activeDescendantId),"aria-multiselectable":m.mode===qe.Multi?!0:void 0,"aria-labelledby":U,"aria-orientation":m.orientation,onKeyDown:R,role:"listbox",tabIndex:b===me.Open?0:void 0,style:{...i.style,...L,"--button-width":da(y,!0).width},...Ho(B)}),q=Ae(),X=d.useMemo(()=>m.mode===qe.Multi?m:{...m,isSelected:A},[m,A]);return d.createElement(Uc,{enabled:s?e.static||_:!1,ownerDocument:w},d.createElement(bn.Provider,{value:X},q({ourProps:ee,theirProps:i,slot:G,defaultTag:af,features:uf,visible:g,name:"Listbox.Options"})))}let ff="div";function df(e,t){let n=d.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...u}=e,a=d.useContext(Vi)===!0,i=zt("Listbox.Option"),l=xr("Listbox.Option"),c=Le(l,g=>l.selectors.isActive(g,r)),p=i.isSelected(s),m=d.useRef(null),f=Zc(m),b=pt({disabled:o,value:s,domRef:m,get textValue(){return f()}}),y=Pe(t,m,g=>{g?i.listRef.current.set(r,g):i.listRef.current.delete(r)}),N=Le(l,g=>l.selectors.shouldScrollIntoView(g,r));le(()=>{if(N)return Re().requestAnimationFrame(()=>{var g,x;(x=(g=m.current)==null?void 0:g.scrollIntoView)==null||x.call(g,{block:"nearest"})})},[N,m]),le(()=>{if(!a)return l.actions.registerOption(r,b),()=>l.actions.unregisterOption(r)},[b,r,a]);let I=Z(g=>{var x;if(o)return g.preventDefault();l.actions.onChange(s),i.mode===qe.Single&&(xe.flushSync(()=>l.actions.closeListbox()),(x=l.state.buttonElement)==null||x.focus({preventScroll:!0}))}),w=Z(()=>{if(o)return l.actions.goToOption({focus:ae.Nothing});l.actions.goToOption({focus:ae.Specific,id:r})}),T=Qa(),j=Z(g=>T.update(g)),_=Z(g=>{T.wasMoved(g)&&(o||c&&l.state.activationTrigger===vn.Pointer||l.actions.goToOption({focus:ae.Specific,id:r},vn.Pointer))}),B=Z(g=>{T.wasMoved(g)&&(o||c&&l.state.activationTrigger===vn.Pointer&&l.actions.goToOption({focus:ae.Nothing}))}),W=d.useMemo(()=>({active:c,focus:c,selected:p,disabled:o,selectedOption:p&&a}),[c,p,o,a]),h=a?{}:{id:r,ref:y,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:I,onFocus:w,onPointerEnter:j,onMouseEnter:j,onPointerMove:_,onMouseMove:_,onPointerLeave:B,onMouseLeave:B},v=Ae();return!p&&a?null:v({ourProps:h,theirProps:u,slot:W,defaultTag:ff,name:"Listbox.Option"})}let pf=d.Fragment;function hf(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pe(t)},u=zt("ListboxSelectedOption"),a=d.useMemo(()=>({}),[]),i=u.value===void 0||u.value===null||u.mode===qe.Multi&&Array.isArray(u.value)&&u.value.length===0,l=Ae();return d.createElement(Vi.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:d.createElement(d.Fragment,null,r&&i?r:n)},slot:a,defaultTag:pf,name:"ListboxSelectedOption"}))}let mf=Ee(of),gf=Ee(lf),vf=aa,bf=Ee(cf),yf=Ee(df),xf=Ee(hf),at=Object.assign(mf,{Button:gf,Label:vf,Options:bf,Option:yf,SelectedOption:xf});function wf({title:e,titleId:t,...n},r){return H.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?H.createElement("title",{id:t},e):null,H.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 zi=H.forwardRef(wf),Ef=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>M.jsx("div",{className:`relative ${o}`,children:M.jsx(at,{value:t,onChange:n,disabled:r,children:({open:s})=>M.jsxs(M.Fragment,{children:[M.jsxs(at.Button,{className:`
79
+ */var vi;function Bu(){return vi||(vi=1,process.env.NODE_ENV!=="production"&&function(){function e(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=m,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,i=t.useEffect,a=t.useMemo,u=t.useDebugValue;vr.useSyncExternalStoreWithSelector=function(s,l,c,d,p){var f=o(null);if(f.current===null){var g={hasValue:!1,value:null};f.current=g}else g=f.current;f=a(function(){function E(R){if(!I){if(I=!0,w=R,R=d(R),p!==void 0&&g.hasValue){var B=g.value;if(p(B,R))return P=B}return P=R}if(B=P,n(w,R))return B;var V=d(R);return p!==void 0&&p(B,V)?(w=R,B):(w=R,P=V)}var I=!1,w,P,F=c===void 0?null:c;return[function(){return E(l())},F===null?void 0:function(){return E(F())}]},[l,c,d,p]);var v=r(s,f[0],f[1]);return i(function(){g.hasValue=!0,g.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())}()),vr}process.env.NODE_ENV==="production"?hr.exports=_u():hr.exports=Bu();var Wu=hr.exports;function je(e,t,n=di){return Wu.useSyncExternalStoreWithSelector(ee(r=>e.subscribe(Uu,r)),ee(()=>e.state),ee(()=>e.state),ee(t),n)}function Uu(e){return e}function bi(e,t){let n=m.useId(),r=mr.get(t),[o,i]=je(r,m.useCallback(a=>[r.selectors.isTop(a,n),r.selectors.inStack(a,n)],[r,n]));return ae(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?i?o:!0:!1}let br=new Map,Xt=new Map;function xi(e){var t;let n=(t=Xt.get(e))!=null?t:0;return Xt.set(e,n+1),n!==0?()=>yi(e):(br.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>yi(e))}function yi(e){var t;let n=(t=Xt.get(e))!=null?t:1;if(n===1?Xt.delete(e):Xt.set(e,n-1),n!==1)return;let r=br.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,br.delete(e))}function Vu(e,{allowed:t,disallowed:n}={}){let r=bi(e,"inert-others");ae(()=>{var o,i;if(!r)return;let a=Ve();for(let s of(o=n==null?void 0:n())!=null?o:[])s&&a.add(xi(s));let u=(i=t==null?void 0:t())!=null?i:[];for(let s of u){if(!s)continue;let l=Yt(s);if(!l)continue;let c=s.parentElement;for(;c&&c!==l.body;){for(let d of c.children)u.some(p=>d.contains(p))||a.add(xi(d));c=c.parentElement}}return a.dispose},[r,t,n])}function Hu(e,t,n){let r=Et(o=>{let i=o.getBoundingClientRect();i.x===0&&i.y===0&&i.width===0&&i.height===0&&n()});m.useEffect(()=>{if(!e)return;let o=t===null?null:st(t)?t:t.current;if(!o)return;let i=Ve();if(typeof ResizeObserver<"u"){let a=new ResizeObserver(()=>r.current(o));a.observe(o),i.add(()=>a.disconnect())}if(typeof IntersectionObserver<"u"){let a=new IntersectionObserver(()=>r.current(o));a.observe(o),i.add(()=>a.disconnect())}return()=>i.dispose()},[t,r,e])}let xr=["[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(","),zu=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var yr=(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))(yr||{}),Gu=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Gu||{}),Yu=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Yu||{});function wi(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(xr)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Ku(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(zu)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var wr=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(wr||{});function Ei(e,t=0){var n;return e===((n=Yt(e))==null?void 0:n.body)?!1:De(t,{0(){return e.matches(xr)},1(){let r=e;for(;r!==null;){if(r.matches(xr))return!0;r=r.parentElement}return!1}})}var qu=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(qu||{});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 Xu=["textarea","input"].join(",");function Qu(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Xu))!=null?n:!1}function Si(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),i=t(r);if(o===null||i===null)return 0;let a=o.compareDocumentPosition(i);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ju(e,t){return Zu(wi(),t,{relativeTo:e})}function Zu(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?Si(e):e:t&64?Ku(e):wi(e);o.length>0&&a.length>1&&(a=a.filter(f=>!o.some(g=>g!=null&&"current"in g?(g==null?void 0:g.current)===f:g===f))),r=r??i.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")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,a.indexOf(r))-1;if(t&4)return Math.max(0,a.indexOf(r))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},c=0,d=a.length,p;do{if(c>=d||c+d<=0)return 0;let f=s+c;if(t&16)f=(f+d)%d;else{if(f<0)return 3;if(f>=d)return 1}p=a[f],p==null||p.focus(l),c+=u}while(p!==i.activeElement);return t&6&&Qu(p)&&p.select(),2}function Ci(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function ec(){return/Android/gi.test(window.navigator.userAgent)}function Oi(){return Ci()||ec()}function Lt(e,t,n,r){let o=Et(n);m.useEffect(()=>{if(!e)return;function i(a){o.current(a)}return document.addEventListener(t,i,r),()=>document.removeEventListener(t,i,r)},[e,t,r])}function tc(e,t,n,r){let o=Et(n);m.useEffect(()=>{if(!e)return;function i(a){o.current(a)}return window.addEventListener(t,i,r),()=>window.removeEventListener(t,i,r)},[e,t,r])}const Ti=30;function nc(e,t,n){let r=Et(n),o=m.useCallback(function(u,s){if(u.defaultPrevented)return;let l=s(u);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let d of c)if(d!==null&&(d.contains(l)||u.composed&&u.composedPath().includes(d)))return;return!Ei(l,wr.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),i=m.useRef(null);Lt(e,"pointerdown",u=>{var s,l;Oi()||(i.current=((l=(s=u.composedPath)==null?void 0:s.call(u))==null?void 0:l[0])||u.target)},!0),Lt(e,"pointerup",u=>{if(Oi()||!i.current)return;let s=i.current;return i.current=null,o(u,()=>s)},!0);let a=m.useRef({x:0,y:0});Lt(e,"touchstart",u=>{a.current.x=u.touches[0].clientX,a.current.y=u.touches[0].clientY},!0),Lt(e,"touchend",u=>{let s={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(s.x-a.current.x)>=Ti||Math.abs(s.y-a.current.y)>=Ti))return o(u,()=>Pt(u.target)?u.target:null)},!0),tc(e,"blur",u=>o(u,()=>pu(window.document.activeElement)?window.document.activeElement:null),!0)}function Er(...e){return m.useMemo(()=>Yt(...e),[...e])}var rc=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(rc||{});const gn={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},oc=200,Ni=5;function ic(e,{trigger:t,action:n,close:r,select:o}){let i=m.useRef(null),a=m.useRef(null),u=m.useRef(null);Lt(e&&t!==null,"pointerdown",s=>{ur(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(a.current=s.x,u.current=s.y,i.current=s.timeStamp)}),Lt(e&&t!==null,"pointerup",s=>{var l,c;let d=i.current;if(d===null||(i.current=null,!Pt(s.target))||Math.abs(s.x-((l=a.current)!=null?l:s.x))<Ni&&Math.abs(s.y-((c=u.current)!=null?c:s.y))<Ni)return;let p=n(s);switch(p.kind){case 0:return;case 1:{s.timeStamp-d>oc&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function sc(e,t){return m.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function lc(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function ac(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...i){let a=t[o].call(n,...i);a&&(n=a,r.forEach(u=>u()))}}}function uc(){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),i=Math.max(0,e-o);n.style(r,"paddingRight",`${i}px`)}}}function cc(){return Ci()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(i=>i()).some(i=>i.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let u=Ve();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let i=(o=window.scrollY)!=null?o:window.pageYOffset,a=null;t.addEventListener(e,"click",u=>{if(Pt(u.target))try{let s=u.target.closest("a");if(!s)return;let{hash:l}=new URL(s.href),c=e.querySelector(l);Pt(c)&&!r(c)&&(a=c)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(Pt(u.target)&&du(u.target))if(r(u.target)){let s=u.target;for(;s.parentElement&&r(s.parentElement);)s=s.parentElement;t.style(s,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(Pt(u.target)){if(ti(u.target))return;if(r(u.target)){let s=u.target;for(;s.parentElement&&s.dataset.headlessuiPortal!==""&&!(s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth);)s=s.parentElement;s.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let s=(u=window.scrollY)!=null?u:window.pageYOffset;i!==s&&window.scrollTo(0,i),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)})})}}:{}}function fc(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function dc(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let St=ac(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Ve(),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:dc(n)},o=[cc(),uc(),fc()];o.forEach(({before:i})=>i==null?void 0:i(r)),o.forEach(({after:i})=>i==null?void 0:i(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});St.subscribe(()=>{let e=St.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)&&St.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&St.dispatch("TEARDOWN",n)}});function pc(e,t,n=()=>({containers:[]})){let r=lc(St),o=t?r.get(t):void 0,i=o?o.count>0:!1;return ae(()=>{if(!(!t||!e))return St.dispatch("PUSH",t,n),()=>St.dispatch("POP",t,n)},[e,t]),i}function mc(e,t,n=()=>[document.body]){let r=bi(e,"scroll-lock");pc(r,t,o=>{var i;return{containers:[...(i=o.containers)!=null?i:[],n]}})}function Ai(e){return[e.screenX,e.screenY]}function hc(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=Ai(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Ai(t)}}}function gc(e=0){let[t,n]=m.useState(e),r=m.useCallback(s=>n(s),[t]),o=m.useCallback(s=>n(l=>l|s),[t]),i=m.useCallback(s=>(t&s)===s,[t]),a=m.useCallback(s=>n(l=>l&~s),[n]),u=m.useCallback(s=>n(l=>l^s),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:i,removeFlag:a,toggleFlag:u}}var $i,Pi;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&(($i=process==null?void 0:process.env)==null?void 0:$i.NODE_ENV)==="test"&&typeof((Pi=Element==null?void 0:Element.prototype)==null?void 0:Pi.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
80
+ `)),[]});var vc=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(vc||{});function Li(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Mi(e,t,n,r){let[o,i]=m.useState(n),{hasFlag:a,addFlag:u,removeFlag:s}=gc(e&&o?3:0),l=m.useRef(!1),c=m.useRef(!1),d=$t();return ae(()=>{var p;if(e){if(n&&i(!0),!t){n&&u(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),bc(t,{inFlight:l,prepare(){c.current?c.current=!1:c.current=l.current,l.current=!0,!c.current&&(n?(u(3),s(4)):(u(4),s(2)))},run(){c.current?n?(s(3),u(4)):(s(4),u(3)):n?s(1):u(1)},done(){var f;c.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,s(7),n||i(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function bc(e,{prepare:t,run:n,done:r,inFlight:o}){let i=Ve();return yc(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(xc(e,r))})}),i.dispose}function xc(e,t){var n,r;let o=Ve();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let a=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return a.length===0?(t(),o.dispose):(Promise.allSettled(a.map(u=>u.finished)).then(()=>{i||t()}),o.dispose)}function yc(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 vn(){return typeof window<"u"}function Mt(e){return Sr(e)?(e.nodeName||"").toLowerCase():"#document"}function Oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xe(e){var t;return(t=(Sr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Sr(e){return vn()?e instanceof Node||e instanceof Oe(e).Node:!1}function re(e){return vn()?e instanceof Element||e instanceof Oe(e).Element:!1}function Ee(e){return vn()?e instanceof HTMLElement||e instanceof Oe(e).HTMLElement:!1}function Cr(e){return!vn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oe(e).ShadowRoot}const wc=new Set(["inline","contents"]);function Qt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Re(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!wc.has(o)}const Ec=new Set(["table","td","th"]);function Sc(e){return Ec.has(Mt(e))}const Cc=[":popover-open",":modal"];function bn(e){return Cc.some(t=>{try{return e.matches(t)}catch{return!1}})}const Oc=["transform","translate","scale","rotate","perspective"],Tc=["transform","translate","scale","rotate","perspective","filter"],Nc=["paint","layout","strict","content"];function Or(e){const t=xn(),n=re(e)?Re(e):e;return Oc.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)||Tc.some(r=>(n.willChange||"").includes(r))||Nc.some(r=>(n.contain||"").includes(r))}function Ac(e){let t=at(e);for(;Ee(t)&&!lt(t);){if(Or(t))return t;if(bn(t))return null;t=at(t)}return null}function xn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const $c=new Set(["html","body","#document"]);function lt(e){return $c.has(Mt(e))}function Re(e){return Oe(e).getComputedStyle(e)}function yn(e){return re(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function at(e){if(Mt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Cr(e)&&e.host||Xe(e);return Cr(t)?t.host:t}function Di(e){const t=at(e);return lt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ee(t)&&Qt(t)?t:Di(t)}function gt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Di(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Oe(o);if(i){const u=Tr(a);return t.concat(a,a.visualViewport||[],Qt(o)?o:[],u&&n?gt(u):[])}return t.concat(o,gt(o,[],n))}function Tr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pc(){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 ut=Math.min,xe=Math.max,Jt=Math.round,wn=Math.floor,Qe=e=>({x:e,y:e}),Lc={left:"right",right:"left",bottom:"top",top:"bottom"},Mc={start:"end",end:"start"};function Nr(e,t,n){return xe(e,ut(t,n))}function Ct(e,t){return typeof e=="function"?e(t):e}function vt(e){return e.split("-")[0]}function Dt(e){return e.split("-")[1]}function Ii(e){return e==="x"?"y":"x"}function Ar(e){return e==="y"?"height":"width"}const Dc=new Set(["top","bottom"]);function ct(e){return Dc.has(vt(e))?"y":"x"}function $r(e){return Ii(ct(e))}function Ic(e,t,n){n===void 0&&(n=!1);const r=Dt(e),o=$r(e),i=Ar(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=En(a)),[a,En(a)]}function Fc(e){const t=En(e);return[Pr(e),t,Pr(t)]}function Pr(e){return e.replace(/start|end/g,t=>Mc[t])}const Fi=["left","right"],ji=["right","left"],jc=["top","bottom"],Rc=["bottom","top"];function kc(e,t,n){switch(e){case"top":case"bottom":return n?t?ji:Fi:t?Fi:ji;case"left":case"right":return t?jc:Rc;default:return[]}}function _c(e,t,n,r){const o=Dt(e);let i=kc(vt(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Pr)))),i}function En(e){return e.replace(/left|right|bottom|top/g,t=>Lc[t])}function Bc(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ri(e){return typeof e!="number"?Bc(e):{top:e,right:e,bottom:e,left:e}}function Sn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
81
+ * tabbable 6.2.0
82
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
83
+ */var Wc=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Lr=Wc.join(","),ki=typeof Element>"u",Zt=ki?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Cn=!ki&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},On=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",a=i||n&&t&&e(t.parentNode);return a},Uc=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Vc=function(t,n,r){if(On(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Lr));return n&&Zt.call(t,Lr)&&o.unshift(t),o=o.filter(r),o},Hc=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!On(a,!1))if(a.tagName==="SLOT"){var u=a.assignedElements(),s=u.length?u:a.children,l=e(s,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:a,candidates:l})}else{var c=Zt.call(a,Lr);c&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var d=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),p=!On(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(d&&p){var f=e(d===!0?a.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:a,candidates:f})}else i.unshift.apply(i,a.children)}}return o},_i=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Bi=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Uc(t))&&!_i(t)?0:t.tabIndex},zc=function(t,n){var r=Bi(t);return r<0&&n&&!_i(t)?0:r},Gc=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Wi=function(t){return t.tagName==="INPUT"},Yc=function(t){return Wi(t)&&t.type==="hidden"},Kc=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},qc=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Xc=function(t){if(!t.name)return!0;var n=t.form||Cn(t),r=function(u){return n.querySelectorAll('input[type="radio"][name="'+u+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var i=qc(o,t.form);return!i||i===t},Qc=function(t){return Wi(t)&&t.type==="radio"},Jc=function(t){return Qc(t)&&!Xc(t)},Zc=function(t){var n,r=t&&Cn(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var a,u,s;for(i=!!((a=o)!==null&&a!==void 0&&(u=a.ownerDocument)!==null&&u!==void 0&&u.contains(o)||t!=null&&(s=t.ownerDocument)!==null&&s!==void 0&&s.contains(t));!i&&o;){var l,c,d;r=Cn(o),o=(l=r)===null||l===void 0?void 0:l.host,i=!!((c=o)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Ui=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},ef=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Zt.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(Zt.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var u=t;t;){var s=t.parentElement,l=Cn(t);if(s&&!s.shadowRoot&&o(s)===!0)return Ui(t);t.assignedSlot?t=t.assignedSlot:!s&&l!==t.ownerDocument?t=l.host:t=s}t=u}if(Zc(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ui(t);return!1},tf=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Zt.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},nf=function(t,n){return!(n.disabled||On(n)||Yc(n)||ef(n,t)||Kc(n)||tf(n))},Vi=function(t,n){return!(Jc(n)||Bi(n)<0||!nf(t,n))},rf=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},of=function e(t){var n=[],r=[];return t.forEach(function(o,i){var a=!!o.scopeParent,u=a?o.scopeParent:o,s=zc(u,a),l=a?e(o.candidates):u;s===0?a?n.push.apply(n,l):n.push(u):r.push({documentOrder:i,tabIndex:s,item:o,isScope:a,content:l})}),r.sort(Gc).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Hi=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hc([t],n.includeContainer,{filter:Vi.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:rf}):r=Vc(t,n.includeContainer,Vi.bind(null,n)),of(r)};function zi(e,t,n){let{reference:r,floating:o}=e;const i=ct(t),a=$r(t),u=Ar(a),s=vt(t),l=i==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[u]/2-o[u]/2;let f;switch(s){case"top":f={x:c,y:r.y-o.height};break;case"bottom":f={x:c,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Dt(t)){case"start":f[a]-=p*(n&&l?-1:1);break;case"end":f[a]+=p*(n&&l?-1:1);break}return f}const sf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,u=i.filter(Boolean),s=await(a.isRTL==null?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=zi(l,r,s),p=r,f={},g=0;for(let v=0;v<u.length;v++){const{name:E,fn:I}=u[v],{x:w,y:P,data:F,reset:R}=await I({x:c,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:l,platform:a,elements:{reference:e,floating:t}});c=w??c,d=P??d,f={...f,[E]:{...f[E],...F}},R&&g<=50&&(g++,typeof R=="object"&&(R.placement&&(p=R.placement),R.rects&&(l=R.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:c,y:d}=zi(l,p,s)),v=-1)}return{x:c,y:d,placement:p,strategy:o,middlewareData:f}};async function Tn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:u,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Ct(t,e),g=Ri(f),E=u[p?d==="floating"?"reference":"floating":d],I=Sn(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(E)))==null||n?E:E.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:l,rootBoundary:c,strategy:s})),w=d==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),F=await(i.isElement==null?void 0:i.isElement(P))?await(i.getScale==null?void 0:i.getScale(P))||{x:1,y:1}:{x:1,y:1},R=Sn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:w,offsetParent:P,strategy:s}):w);return{top:(I.top-R.top+g.top)/F.y,bottom:(R.bottom-I.bottom+g.bottom)/F.y,left:(I.left-R.left+g.left)/F.x,right:(R.right-I.right+g.right)/F.x}}const lf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:u,middlewareData:s}=t,{element:l,padding:c=0}=Ct(e,t)||{};if(l==null)return{};const d=Ri(c),p={x:n,y:r},f=$r(o),g=Ar(f),v=await a.getDimensions(l),E=f==="y",I=E?"top":"left",w=E?"bottom":"right",P=E?"clientHeight":"clientWidth",F=i.reference[g]+i.reference[f]-p[f]-i.floating[g],R=p[f]-i.reference[f],B=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l));let V=B?B[P]:0;(!V||!await(a.isElement==null?void 0:a.isElement(B)))&&(V=u.floating[P]||i.floating[g]);const h=F/2-R/2,x=V/2-v[g]/2-1,b=ut(d[I],x),A=ut(d[w],x),C=b,N=V-v[g]-A,T=V/2-v[g]/2+h,S=Nr(C,T,N),L=!s.arrow&&Dt(o)!=null&&T!==S&&i.reference[g]/2-(T<C?b:A)-v[g]/2<0,$=L?T<C?T-C:T-N:0;return{[f]:p[f]+$,data:{[f]:S,centerOffset:T-S-$,...L&&{alignmentOffset:$}},reset:L}}}),af=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:u,platform:s,elements:l}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...E}=Ct(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const I=vt(o),w=ct(u),P=vt(u)===u,F=await(s.isRTL==null?void 0:s.isRTL(l.floating)),R=p||(P||!v?[En(u)]:Fc(u)),B=g!=="none";!p&&B&&R.push(..._c(u,v,g,F));const V=[u,...R],h=await Tn(t,E),x=[];let b=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&x.push(h[I]),d){const T=Ic(o,a,F);x.push(h[T[0]],h[T[1]])}if(b=[...b,{placement:o,overflows:x}],!x.every(T=>T<=0)){var A,C;const T=(((A=i.flip)==null?void 0:A.index)||0)+1,S=V[T];if(S&&(!(d==="alignment"?w!==ct(S):!1)||b.every(y=>ct(y.placement)===w?y.overflows[0]>0:!0)))return{data:{index:T,overflows:b},reset:{placement:S}};let L=(C=b.filter($=>$.overflows[0]<=0).sort(($,y)=>$.overflows[1]-y.overflows[1])[0])==null?void 0:C.placement;if(!L)switch(f){case"bestFit":{var N;const $=(N=b.filter(y=>{if(B){const D=ct(y.placement);return D===w||D==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(D=>D>0).reduce((D,_)=>D+_,0)]).sort((y,D)=>y[1]-D[1])[0])==null?void 0:N[0];$&&(L=$);break}case"initialPlacement":L=u;break}if(o!==L)return{reset:{placement:L}}}return{}}}},uf=new Set(["left","top"]);async function cf(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=vt(n),u=Dt(n),s=ct(n)==="y",l=uf.has(a)?-1:1,c=i&&s?-1:1,d=Ct(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return u&&typeof g=="number"&&(f=u==="end"?g*-1:g),s?{x:f*c,y:p*l}:{x:p*l,y:f*c}}const ff=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:u}=t,s=await cf(t,e);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}},df=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:u={fn:E=>{let{x:I,y:w}=E;return{x:I,y:w}}},...s}=Ct(e,t),l={x:n,y:r},c=await Tn(t,s),d=ct(vt(o)),p=Ii(d);let f=l[p],g=l[d];if(i){const E=p==="y"?"top":"left",I=p==="y"?"bottom":"right",w=f+c[E],P=f-c[I];f=Nr(w,f,P)}if(a){const E=d==="y"?"top":"left",I=d==="y"?"bottom":"right",w=g+c[E],P=g-c[I];g=Nr(w,g,P)}const v=u.fn({...t,[p]:f,[d]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[d]:a}}}}}},pf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:u}=t,{apply:s=()=>{},...l}=Ct(e,t),c=await Tn(t,l),d=vt(o),p=Dt(o),f=ct(o)==="y",{width:g,height:v}=i.floating;let E,I;d==="top"||d==="bottom"?(E=d,I=p===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(I=d,E=p==="end"?"top":"bottom");const w=v-c.top-c.bottom,P=g-c.left-c.right,F=ut(v-c[E],w),R=ut(g-c[I],P),B=!t.middlewareData.shift;let V=F,h=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(h=P),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(V=w),B&&!p){const b=xe(c.left,0),A=xe(c.right,0),C=xe(c.top,0),N=xe(c.bottom,0);f?h=g-2*(b!==0||A!==0?b+A:xe(c.left,c.right)):V=v-2*(C!==0||N!==0?C+N:xe(c.top,c.bottom))}await s({...t,availableWidth:h,availableHeight:V});const x=await a.getDimensions(u.floating);return g!==x.width||v!==x.height?{reset:{rects:!0}}:{}}}};function Gi(e){const t=Re(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ee(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,u=Jt(n)!==i||Jt(r)!==a;return u&&(n=i,r=a),{width:n,height:r,$:u}}function Mr(e){return re(e)?e:e.contextElement}function It(e){const t=Mr(e);if(!Ee(t))return Qe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Gi(t);let a=(i?Jt(n.width):n.width)/r,u=(i?Jt(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const mf=Qe(0);function Yi(e){const t=Oe(e);return!xn()||!t.visualViewport?mf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Oe(e)?!1:t}function Ot(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Mr(e);let a=Qe(1);t&&(r?re(r)&&(a=It(r)):a=It(e));const u=hf(i,n,r)?Yi(i):Qe(0);let s=(o.left+u.x)/a.x,l=(o.top+u.y)/a.y,c=o.width/a.x,d=o.height/a.y;if(i){const p=Oe(i),f=r&&re(r)?Oe(r):r;let g=p,v=Tr(g);for(;v&&r&&f!==g;){const E=It(v),I=v.getBoundingClientRect(),w=Re(v),P=I.left+(v.clientLeft+parseFloat(w.paddingLeft))*E.x,F=I.top+(v.clientTop+parseFloat(w.paddingTop))*E.y;s*=E.x,l*=E.y,c*=E.x,d*=E.y,s+=P,l+=F,g=Oe(v),v=Tr(g)}}return Sn({width:c,height:d,x:s,y:l})}function Nn(e,t){const n=yn(e).scrollLeft;return t?t.left+n:Ot(Xe(e)).left+n}function Ki(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Nn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function gf(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=Xe(r),u=t?bn(t.floating):!1;if(r===a||u&&i)return n;let s={scrollLeft:0,scrollTop:0},l=Qe(1);const c=Qe(0),d=Ee(r);if((d||!d&&!i)&&((Mt(r)!=="body"||Qt(a))&&(s=yn(r)),Ee(r))){const f=Ot(r);l=It(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const p=a&&!d&&!i?Ki(a,s):Qe(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-s.scrollLeft*l.x+c.x+p.x,y:n.y*l.y-s.scrollTop*l.y+c.y+p.y}}function vf(e){return Array.from(e.getClientRects())}function bf(e){const t=Xe(e),n=yn(e),r=e.ownerDocument.body,o=xe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=xe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Nn(e);const u=-n.scrollTop;return Re(r).direction==="rtl"&&(a+=xe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:u}}const qi=25;function xf(e,t){const n=Oe(e),r=Xe(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,u=0,s=0;if(o){i=o.width,a=o.height;const c=xn();(!c||c&&t==="fixed")&&(u=o.offsetLeft,s=o.offsetTop)}const l=Nn(r);if(l<=0){const c=r.ownerDocument,d=c.body,p=getComputedStyle(d),f=c.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-f);g<=qi&&(i-=g)}else l<=qi&&(i+=l);return{width:i,height:a,x:u,y:s}}const yf=new Set(["absolute","fixed"]);function wf(e,t){const n=Ot(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ee(e)?It(e):Qe(1),a=e.clientWidth*i.x,u=e.clientHeight*i.y,s=o*i.x,l=r*i.y;return{width:a,height:u,x:s,y:l}}function Xi(e,t,n){let r;if(t==="viewport")r=xf(e,n);else if(t==="document")r=bf(Xe(e));else if(re(t))r=wf(t,n);else{const o=Yi(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Sn(r)}function Qi(e,t){const n=at(e);return n===t||!re(n)||lt(n)?!1:Re(n).position==="fixed"||Qi(n,t)}function Ef(e,t){const n=t.get(e);if(n)return n;let r=gt(e,[],!1).filter(u=>re(u)&&Mt(u)!=="body"),o=null;const i=Re(e).position==="fixed";let a=i?at(e):e;for(;re(a)&&!lt(a);){const u=Re(a),s=Or(a);!s&&u.position==="fixed"&&(o=null),(i?!s&&!o:!s&&u.position==="static"&&!!o&&yf.has(o.position)||Qt(a)&&!s&&Qi(e,a))?r=r.filter(c=>c!==a):o=u,a=at(a)}return t.set(e,r),r}function Sf(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?bn(t)?[]:Ef(t,this._c):[].concat(n),r],u=a[0],s=a.reduce((l,c)=>{const d=Xi(t,c,o);return l.top=xe(d.top,l.top),l.right=ut(d.right,l.right),l.bottom=ut(d.bottom,l.bottom),l.left=xe(d.left,l.left),l},Xi(t,u,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Cf(e){const{width:t,height:n}=Gi(e);return{width:t,height:n}}function Of(e,t,n){const r=Ee(t),o=Xe(t),i=n==="fixed",a=Ot(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const s=Qe(0);function l(){s.x=Nn(o)}if(r||!r&&!i)if((Mt(t)!=="body"||Qt(o))&&(u=yn(t)),r){const f=Ot(t,!0,i,t);s.x=f.x+t.clientLeft,s.y=f.y+t.clientTop}else o&&l();i&&!r&&o&&l();const c=o&&!r&&!i?Ki(o,u):Qe(0),d=a.left+u.scrollLeft-s.x-c.x,p=a.top+u.scrollTop-s.y-c.y;return{x:d,y:p,width:a.width,height:a.height}}function Dr(e){return Re(e).position==="static"}function Ji(e,t){if(!Ee(e)||Re(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xe(e)===n&&(n=n.ownerDocument.body),n}function Zi(e,t){const n=Oe(e);if(bn(e))return n;if(!Ee(e)){let o=at(e);for(;o&&!lt(o);){if(re(o)&&!Dr(o))return o;o=at(o)}return n}let r=Ji(e,t);for(;r&&Sc(r)&&Dr(r);)r=Ji(r,t);return r&&lt(r)&&Dr(r)&&!Or(r)?n:r||Ac(e)||n}const Tf=async function(e){const t=this.getOffsetParent||Zi,n=this.getDimensions,r=await n(e.floating);return{reference:Of(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Nf(e){return Re(e).direction==="rtl"}const Af={convertOffsetParentRelativeRectToViewportRelativeRect:gf,getDocumentElement:Xe,getClippingRect:Sf,getOffsetParent:Zi,getElementRects:Tf,getClientRects:vf,getDimensions:Cf,getScale:It,isElement:re,isRTL:Nf};function es(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $f(e,t){let n=null,r;const o=Xe(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,s){u===void 0&&(u=!1),s===void 0&&(s=1),i();const l=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=l;if(u||t(),!p||!f)return;const g=wn(d),v=wn(o.clientWidth-(c+p)),E=wn(o.clientHeight-(d+f)),I=wn(c),P={rootMargin:-g+"px "+-v+"px "+-E+"px "+-I+"px",threshold:xe(0,ut(1,s))||1};let F=!0;function R(B){const V=B[0].intersectionRatio;if(V!==s){if(!F)return a();V?a(!1,V):r=setTimeout(()=>{a(!1,1e-7)},1e3)}V===1&&!es(l,e.getBoundingClientRect())&&a(),F=!1}try{n=new IntersectionObserver(R,{...P,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,P)}n.observe(e)}return a(!0),i}function ts(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:s=!1}=r,l=Mr(e),c=o||i?[...l?gt(l):[],...gt(t)]:[];c.forEach(I=>{o&&I.addEventListener("scroll",n,{passive:!0}),i&&I.addEventListener("resize",n)});const d=l&&u?$f(l,n):null;let p=-1,f=null;a&&(f=new ResizeObserver(I=>{let[w]=I;w&&w.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=f)==null||P.observe(t)})),n()}),l&&!s&&f.observe(l),f.observe(t));let g,v=s?Ot(e):null;s&&E();function E(){const I=Ot(e);v&&!es(v,I)&&n(),v=I,g=requestAnimationFrame(E)}return n(),()=>{var I;c.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(I=f)==null||I.disconnect(),f=null,s&&cancelAnimationFrame(g)}}const Ir=Tn,Pf=ff,Lf=df,Mf=af,Df=pf,ns=lf,If=(e,t,n)=>{const r=new Map,o={platform:Af,...n},i={...o.platform,_c:r};return sf(e,t,{...o,platform:i})};var Ff=typeof document<"u",jf=function(){},An=Ff?m.useLayoutEffect:jf;function $n(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(!$n(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 i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!$n(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function rs(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function os(e,t){const n=rs(e);return Math.round(t*n)/n}function Fr(e){const t=j.useRef(e);return An(()=>{t.current=e}),t}function is(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:u=!0,whileElementsMounted:s,open:l}=e,[c,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=j.useState(r);$n(p,r)||f(r);const[g,v]=j.useState(null),[E,I]=j.useState(null),w=j.useCallback(y=>{y!==B.current&&(B.current=y,v(y))},[]),P=j.useCallback(y=>{y!==V.current&&(V.current=y,I(y))},[]),F=i||g,R=a||E,B=j.useRef(null),V=j.useRef(null),h=j.useRef(c),x=s!=null,b=Fr(s),A=Fr(o),C=Fr(l),N=j.useCallback(()=>{if(!B.current||!V.current)return;const y={placement:t,strategy:n,middleware:p};A.current&&(y.platform=A.current),If(B.current,V.current,y).then(D=>{const _={...D,isPositioned:C.current!==!1};T.current&&!$n(h.current,_)&&(h.current=_,Ut.flushSync(()=>{d(_)}))})},[p,t,n,A,C]);An(()=>{l===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,d(y=>({...y,isPositioned:!1})))},[l]);const T=j.useRef(!1);An(()=>(T.current=!0,()=>{T.current=!1}),[]),An(()=>{if(F&&(B.current=F),R&&(V.current=R),F&&R){if(b.current)return b.current(F,R,N);N()}},[F,R,N,b,x]);const S=j.useMemo(()=>({reference:B,floating:V,setReference:w,setFloating:P}),[w,P]),L=j.useMemo(()=>({reference:F,floating:R}),[F,R]),$=j.useMemo(()=>{const y={position:n,left:0,top:0};if(!L.floating)return y;const D=os(L.floating,c.x),_=os(L.floating,c.y);return u?{...y,transform:"translate("+D+"px, "+_+"px)",...rs(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:_}},[n,u,L.floating,c.x,c.y]);return j.useMemo(()=>({...c,update:N,refs:S,elements:L,floatingStyles:$}),[c,N,S,L,$])}const Rf=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ns({element:r.current,padding:o}).fn(n):{}:r?ns({element:r,padding:o}).fn(n):{}}}},jr=(e,t)=>({...Pf(e),options:[e,t]}),ss=(e,t)=>({...Lf(e),options:[e,t]}),ls=(e,t)=>({...Mf(e),options:[e,t]}),kf=(e,t)=>({...Df(e),options:[e,t]}),_f=(e,t)=>({...Rf(e),options:[e,t]}),as={...j},Bf=as.useInsertionEffect||(e=>e());function us(e){const t=j.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Bf(()=>{t.current=e}),j.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 Rr=typeof document<"u"?m.useLayoutEffect:m.useEffect;let cs=!1,Wf=0;const fs=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Wf++;function Uf(){const[e,t]=j.useState(()=>cs?fs():void 0);return Rr(()=>{e==null&&t(fs())},[]),j.useEffect(()=>{cs=!0},[]),e}const Vf=as.useId||Uf;let en;process.env.NODE_ENV!=="production"&&(en=new Set);function Hf(){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=en)!=null&&e.has(o))){var i;(i=en)==null||i.add(o),console.warn(o)}}function zf(){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=en)!=null&&e.has(o))){var i;(i=en)==null||i.add(o),console.error(o)}}function Gf(){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 Yf=j.createContext(null),Kf=j.createContext(null),qf=()=>{var e;return((e=j.useContext(Yf))==null?void 0:e.id)||null},Xf=()=>j.useContext(Kf),Qf="data-floating-ui-focusable";function Jf(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Vf(),i=j.useRef({}),[a]=j.useState(()=>Gf()),u=qf()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!re(f)&&zf("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,l]=j.useState(r.reference),c=us((f,g,v)=>{i.current.openEvent=f?g:void 0,a.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=j.useMemo(()=>({setPositionReference:l}),[]),p=j.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return j.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:a,floatingId:o,refs:d}),[t,c,p,a,o,d])}function Zf(e){e===void 0&&(e={});const{nodeId:t}=e,n=Jf({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,a]=j.useState(null),[u,s]=j.useState(null),c=(o==null?void 0:o.domReference)||i,d=j.useRef(null),p=Xf();Rr(()=>{c&&(d.current=c)},[c]);const f=is({...e,elements:{...o,...u&&{reference:u}}}),g=j.useCallback(P=>{const F=re(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;s(F),f.refs.setReference(F)},[f.refs]),v=j.useCallback(P=>{(re(P)||P===null)&&(d.current=P,a(P)),(re(f.refs.reference.current)||f.refs.reference.current===null||P!==null&&!re(P))&&f.refs.setReference(P)},[f.refs]),E=j.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),I=j.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=j.useMemo(()=>({...f,...r,refs:E,elements:I,nodeId:t}),[f,E,I,t,r]);return Rr(()=>{r.dataRef.current.floatingContext=w;const P=p==null?void 0:p.nodesRef.current.find(F=>F.id===t);P&&(P.context=w)}),j.useMemo(()=>({...f,context:w,refs:E,elements:I}),[f,E,I,w])}const ds="active",ps="selected";function kr(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[ds]:a,[ps]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[Qf]:""},...i,...t.map(a=>{const u=a?a[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((a,u)=>(u&&Object.entries(u).forEach(s=>{let[l,c]=s;if(!(o&&[ds,ps].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof c=="function"){var d;(d=r.get(l))==null||d.push(c),a[l]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(l))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else a[l]=c}),a),{})}}function ed(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=j.useCallback(u=>kr(u,e,"reference"),t),i=j.useCallback(u=>kr(u,e,"floating"),n),a=j.useCallback(u=>kr(u,e,"item"),r);return j.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:a}),[o,i,a])}function ms(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const td=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:a=0,minItemsVisible:u=4,referenceOverflowThreshold:s=0,scrollRef:l,...c}=Ct(e,t),{rects:d,elements:{floating:p}}=t,f=n.current[a],g=(l==null?void 0:l.current)||p,v=p.clientTop||g.clientTop,E=p.clientTop!==0,I=g.clientTop!==0,w=p===g;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Hf('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const P={...t,...await jr(-f.offsetTop-p.clientTop-d.reference.height/2-f.offsetHeight/2-i).fn(t)},F=await Ir(ms(P,g.scrollHeight+v+p.clientTop),c),R=await Ir(P,{...c,elementContext:"reference"}),B=xe(0,F.top),V=P.y+B,b=(g.scrollHeight>g.clientHeight?A=>A:Jt)(xe(0,g.scrollHeight+(E&&w||I?v*2:0)-B-xe(0,F.bottom)));if(g.style.maxHeight=b+"px",g.scrollTop=B,o){const A=g.offsetHeight<f.offsetHeight*ut(u,n.current.length)-1||R.top>=-s||R.bottom>=-s;Ut.flushSync(()=>o(A))}return r&&(r.current=await Ir(ms({...P,y:V},g.offsetHeight+v+p.clientTop),c)),{y:V}}});function nd(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:a,onChange:u}=t,s=us(u),l=j.useRef(!1),c=j.useRef(null),d=j.useRef(null);j.useEffect(()=>{if(!o)return;function f(v){if(v.ctrlKey||!g||i.current==null)return;const E=v.deltaY,I=i.current.top>=-.5,w=i.current.bottom>=-.5,P=g.scrollHeight-g.clientHeight,F=E<0?-1:1,R=E<0?"max":"min";g.scrollHeight<=g.clientHeight||(!I&&E>0||!w&&E<0?(v.preventDefault(),Ut.flushSync(()=>{s(B=>B+Math[R](E,P*F))})):/firefox/i.test(Pc())&&(g.scrollTop+=E))}const g=(a==null?void 0:a.current)||r.floating;if(n&&g)return g.addEventListener("wheel",f),requestAnimationFrame(()=>{c.current=g.scrollTop,i.current!=null&&(d.current={...i.current})}),()=>{c.current=null,d.current=null,g.removeEventListener("wheel",f)}},[o,n,r.floating,i,a,s]);const p=j.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const f=(a==null?void 0:a.current)||r.floating;if(!(!i.current||!f||!l.current)){if(c.current!==null){const g=f.scrollTop-c.current;(i.current.bottom<-.5&&g<-1||i.current.top<-.5&&g>1)&&Ut.flushSync(()=>s(v=>v+g))}requestAnimationFrame(()=>{c.current=f.scrollTop})}}}),[r.floating,s,i,a]);return j.useMemo(()=>o?{floating:p}:{},[o,p])}let Ft=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Ft.displayName="FloatingContext";let _r=m.createContext(null);_r.displayName="PlacementContext";function rd(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function od(){return m.useContext(Ft).setReference}function id(){return m.useContext(Ft).getReferenceProps}function sd(){let{getFloatingProps:e,slot:t}=m.useContext(Ft);return m.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function ld(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(_r),n=m.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var a;return(a=i==null?void 0:i.outerHTML)!=null?a:i})]);ae(()=>{t==null||t(n??null)},[t,n]);let r=m.useContext(Ft);return m.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let hs=4;function ad({children:e,enabled:t=!0}){let[n,r]=m.useState(null),[o,i]=m.useState(0),a=m.useRef(null),[u,s]=m.useState(null);ud(u);let l=t&&n!==null&&u!==null,{to:c="bottom",gap:d=0,offset:p=0,padding:f=0,inner:g}=cd(n,u),[v,E="center"]=c.split(" ");ae(()=>{l&&i(0)},[l]);let{refs:I,floatingStyles:w,context:P}=Zf({open:l,placement:v==="selection"?E==="center"?"bottom":`bottom-${E}`:E==="center"?`${v}`:`${v}-${E}`,strategy:"absolute",transform:!1,middleware:[jr({mainAxis:v==="selection"?0:d,crossAxis:p}),ss({padding:f}),v!=="selection"&&ls({padding:f}),v==="selection"&&g?td({...g,padding:f,overflowRef:a,offset:o,minItemsVisible:hs,referenceOverflowThreshold:f,onFallbackChange(A){var C,N;if(!A)return;let T=P.elements.floating;if(!T)return;let S=parseFloat(getComputedStyle(T).scrollPaddingBottom)||0,L=Math.min(hs,T.childElementCount),$=0,y=0;for(let D of(N=(C=P.elements.floating)==null?void 0:C.childNodes)!=null?N:[])if(st(D)){let _=D.offsetTop,k=_+D.clientHeight+S,W=T.scrollTop,H=W+T.clientHeight;if(_>=W&&k<=H)L--;else{y=Math.max(0,Math.min(k,H)-Math.max(_,W)),$=D.clientHeight;break}}L>=1&&i(D=>{let _=$*L-y+S;return D>=_?D:_})}}):null,kf({padding:f,apply({availableWidth:A,availableHeight:C,elements:N}){Object.assign(N.floating.style,{overflow:"auto",maxWidth:`${A}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:ts}),[F=v,R=E]=P.placement.split("-");v==="selection"&&(F="selection");let B=m.useMemo(()=>({anchor:[F,R].filter(Boolean).join(" ")}),[F,R]),V=nd(P,{overflowRef:a,onChange:i}),{getReferenceProps:h,getFloatingProps:x}=ed([V]),b=ee(A=>{s(A),I.setFloating(A)});return j.createElement(_r.Provider,{value:r},j.createElement(Ft.Provider,{value:{setFloating:b,setReference:I.setReference,styles:w,getReferenceProps:h,getFloatingProps:x,slot:B}},e))}function ud(e){ae(()=>{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 cd(e,t){var n,r,o;let i=Br((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),a=Br((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Br((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:a,padding:u}}function Br(e,t,n=void 0){let r=$t(),o=ee((s,l)=>{if(s==null)return[n,null];if(typeof s=="number")return[s,null];if(typeof s=="string"){if(!l)return[n,null];let c=vs(s,l);return[c,d=>{let p=gs(s);{let f=p.map(g=>window.getComputedStyle(l).getPropertyValue(g));r.requestAnimationFrame(function g(){r.nextFrame(g);let v=!1;for(let[I,w]of p.entries()){let P=window.getComputedStyle(l).getPropertyValue(w);if(f[I]!==P){f[I]=P,v=!0;break}}if(!v)return;let E=vs(s,l);c!==E&&(d(E),c=E)})}return r.dispose}]}return[n,null]}),i=m.useMemo(()=>o(e,t)[0],[e,t]),[a=i,u]=m.useState();return ae(()=>{let[s,l]=o(e,t);if(u(s),!!l)return l(u)},[e,t]),a}function gs(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,...gs(o)]:[r]}return[]}function vs(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 fd(e,t){let[n,r]=m.useState(t);return!e&&n!==t&&r(t),e?n:t}let Wr=m.createContext(null);Wr.displayName="OpenClosedContext";var He=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(He||{});function Ur(){return m.useContext(Wr)}function bs({value:e,children:t}){return m.createElement(Wr.Provider,{value:e},t)}function dd(e){throw new Error("Unexpected object: "+e)}var ue=(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))(ue||{});function Pn(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 i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{o===-1&&(o=n.length);for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:dd(e)}}var xs=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(xs||{});function ys(e){let t=ee(e),n=m.useRef(!1);m.useEffect(()=>(n.current=!1,()=>{n.current=!0,Yo(()=>{n.current&&t()})}),[t])}function pd(){let e=typeof document>"u";return"useSyncExternalStore"in j?(t=>t.useSyncExternalStore)(j)(()=>()=>{},()=>!1,()=>!e):!1}function Vr(){let e=pd(),[t,n]=j.useState(Ke.isHandoffComplete);return t&&Ke.isHandoffComplete===!1&&n(!1),j.useEffect(()=>{t!==!0&&n(!0)},[t]),j.useEffect(()=>Ke.handoff(),[]),e?!1:t}let md=m.createContext(!1);function hd(){return m.useContext(md)}function gd(e){let t=hd(),n=m.useContext(Es),[r,o]=m.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(Ke.isServer)return null;let a=e==null?void 0:e.getElementById("headlessui-portal-root");if(a)return a;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return m.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),m.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let ws=m.Fragment,vd=Ce(function(e,t){let{ownerDocument:n=null,...r}=e,o=m.useRef(null),i=Ie(bu(f=>{o.current=f}),t),a=Er(o),u=n??a,s=gd(u),[l]=m.useState(()=>{var f;return Ke.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),c=m.useContext(wd),d=Vr();ae(()=>{!s||!l||s.contains(l)||(l.setAttribute("data-headlessui-portal",""),s.appendChild(l))},[s,l]),ae(()=>{if(l&&c)return c.register(l)},[c,l]),ys(()=>{var f;!s||!l||(ur(l)&&s.contains(l)&&s.removeChild(l),s.childNodes.length<=0&&((f=s.parentElement)==null||f.removeChild(s)))});let p=Pe();return d?!s||!l?null:we.createPortal(p({ourProps:{ref:i},theirProps:r,slot:{},defaultTag:ws,name:"Portal"}),l):null});function bd(e,t){let n=Ie(t),{enabled:r=!0,ownerDocument:o,...i}=e,a=Pe();return r?m.createElement(vd,{...i,ownerDocument:o,ref:n}):a({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:ws,name:"Portal"})}let xd=m.Fragment,Es=m.createContext(null);function yd(e,t){let{target:n,...r}=e,o={ref:Ie(t)},i=Pe();return m.createElement(Es.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:xd,name:"Popover.Group"}))}let wd=m.createContext(null),Ed=Ce(bd),Sd=Ce(yd),Cd=Object.assign(Ed,{Group:Sd});function Od(){let e=m.useRef(!1);return ae(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ss(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Os)!==m.Fragment||m.Children.count(e.children)===1}let Ln=m.createContext(null);Ln.displayName="TransitionContext";var Td=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Td||{});function Nd(){let e=m.useContext(Ln);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Ad(){let e=m.useContext(Mn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Mn=m.createContext(null);Mn.displayName="NestingContext";function Dn(e){return"children"in e?Dn(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Cs(e,t){let n=Et(e),r=m.useRef([]),o=Od(),i=$t(),a=ee((f,g=mt.Hidden)=>{let v=r.current.findIndex(({el:E})=>E===f);v!==-1&&(De(g,{[mt.Unmount](){r.current.splice(v,1)},[mt.Hidden](){r.current[v].state="hidden"}}),i.microTask(()=>{var E;!Dn(r)&&o.current&&((E=n.current)==null||E.call(n))}))}),u=ee(f=>{let g=r.current.find(({el:v})=>v===f);return g?g.state!=="visible"&&(g.state="visible"):r.current.push({el:f,state:"visible"}),()=>a(f,mt.Unmount)}),s=m.useRef([]),l=m.useRef(Promise.resolve()),c=m.useRef({enter:[],leave:[]}),d=ee((f,g,v)=>{s.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([E])=>E!==f)),t==null||t.chains.current[g].push([f,new Promise(E=>{s.current.push(E)})]),t==null||t.chains.current[g].push([f,new Promise(E=>{Promise.all(c.current[g].map(([I,w])=>w)).then(()=>E())})]),g==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(g)):v(g)}),p=ee((f,g,v)=>{Promise.all(c.current[g].splice(0).map(([E,I])=>I)).then(()=>{var E;(E=s.current.shift())==null||E()}).then(()=>v(g))});return m.useMemo(()=>({children:r,register:u,unregister:a,onStart:d,onStop:p,wait:l,chains:c}),[u,a,r,d,p,c,l])}let Os=m.Fragment,Ts=dn.RenderStrategy;function $d(e,t){var n,r;let{transition:o=!0,beforeEnter:i,afterEnter:a,beforeLeave:u,afterLeave:s,enter:l,enterFrom:c,enterTo:d,entered:p,leave:f,leaveFrom:g,leaveTo:v,...E}=e,[I,w]=m.useState(null),P=m.useRef(null),F=Ss(e),R=Ie(...F?[P,t,w]:t===null?[]:[t]),B=(n=E.unmount)==null||n?mt.Unmount:mt.Hidden,{show:V,appear:h,initial:x}=Nd(),[b,A]=m.useState(V?"visible":"hidden"),C=Ad(),{register:N,unregister:T}=C;ae(()=>N(P),[N,P]),ae(()=>{if(B===mt.Hidden&&P.current){if(V&&b!=="visible"){A("visible");return}return De(b,{hidden:()=>T(P),visible:()=>N(P)})}},[b,P,N,T,V,B]);let S=Vr();ae(()=>{if(F&&S&&b==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,b,S,F]);let L=x&&!h,$=h&&V&&x,y=m.useRef(!1),D=Cs(()=>{y.current||(A("hidden"),T(P))},C),_=ee(G=>{y.current=!0;let oe=G?"enter":"leave";D.onStart(P,oe,fe=>{fe==="enter"?i==null||i():fe==="leave"&&(u==null||u())})}),k=ee(G=>{let oe=G?"enter":"leave";y.current=!1,D.onStop(P,oe,fe=>{fe==="enter"?a==null||a():fe==="leave"&&(s==null||s())}),oe==="leave"&&!Dn(D)&&(A("hidden"),T(P))});m.useEffect(()=>{F&&o||(_(V),k(V))},[V,F,o]);let W=!(!o||!F||!S||L),[,H]=Mi(W,I,V,{start:_,end:k}),Q=ht({ref:R,className:((r=sr(E.className,$&&l,$&&c,H.enter&&l,H.enter&&H.closed&&c,H.enter&&!H.closed&&d,H.leave&&f,H.leave&&!H.closed&&g,H.leave&&H.closed&&v,!H.transition&&V&&p))==null?void 0:r.trim())||void 0,...Li(H)}),z=0;b==="visible"&&(z|=He.Open),b==="hidden"&&(z|=He.Closed),V&&b==="hidden"&&(z|=He.Opening),!V&&b==="visible"&&(z|=He.Closing);let K=Pe();return m.createElement(Mn.Provider,{value:D},m.createElement(bs,{value:z},K({ourProps:Q,theirProps:E,defaultTag:Os,features:Ts,visible:b==="visible",name:"Transition.Child"})))}function Pd(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,a=m.useRef(null),u=Ss(e),s=Ie(...u?[a,t]:t===null?[]:[t]);Vr();let l=Ur();if(n===void 0&&l!==null&&(n=(l&He.Open)===He.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,d]=m.useState(n?"visible":"hidden"),p=Cs(()=>{n||d("hidden")}),[f,g]=m.useState(!0),v=m.useRef([n]);ae(()=>{f!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),g(!1))},[v,n]);let E=m.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);ae(()=>{n?d("visible"):!Dn(p)&&a.current!==null&&d("hidden")},[n,p]);let I={unmount:o},w=ee(()=>{var R;f&&g(!1),(R=e.beforeEnter)==null||R.call(e)}),P=ee(()=>{var R;f&&g(!1),(R=e.beforeLeave)==null||R.call(e)}),F=Pe();return m.createElement(Mn.Provider,{value:p},m.createElement(Ln.Provider,{value:E},F({ourProps:{...I,as:m.Fragment,children:m.createElement(Ns,{ref:s,...I,...i,beforeEnter:w,beforeLeave:P})},theirProps:{},defaultTag:m.Fragment,features:Ts,visible:c==="visible",name:"Transition"})))}function Ld(e,t){let n=m.useContext(Ln)!==null,r=Ur()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(Hr,{ref:t,...e}):m.createElement(Ns,{ref:t,...e}))}let Hr=Ce(Pd),Ns=Ce($d),Md=Ce(Ld),As=Object.assign(Hr,{Child:Md,Root:Hr});function Dd(e,t){let n=m.useRef({left:0,top:0});if(ae(()=>{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 $s=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ps(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!st(o))return r;let i=!1;for(let u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),i=!0;let a=i?(n=o.innerText)!=null?n:"":r;return $s.test(a)&&(a=a.replace($s,"")),a}function Id(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 i=document.getElementById(o);if(i){let a=i.getAttribute("aria-label");return typeof a=="string"?a.trim():Ps(i).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Ps(e).trim()}function Fd(e){let t=m.useRef(""),n=m.useRef("");return ee(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let i=Id(r).trim().toLowerCase();return t.current=o,n.current=i,i})}var jd=Object.defineProperty,Rd=(e,t,n)=>t in e?jd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ls=(e,t,n)=>(Rd(e,typeof t!="symbol"?t+"":t,n),n),ve=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ve||{}),Je=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Je||{}),In=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(In||{}),Ms=(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))(Ms||{});function Ds(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Si(t(e.options.slice()),i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let kd={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ue.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(i=>r(i.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,i,a;if(e.dataRef.current.disabled||e.listboxState===1)return e;let u={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ue.Nothing)return{...u,activeOptionIndex:null};if(t.focus===ue.Specific)return{...u,activeOptionIndex:e.options.findIndex(c=>c.id===t.id)};if(t.focus===ue.Previous){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=Pn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].dataRef.current.domRef;if(((r=d.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...u,activeOptionIndex:p}}}}else if(t.focus===ue.Next){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=Pn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(p!==null){let f=e.options[p].dataRef.current.domRef;if(((i=d.current)==null?void 0:i.nextElementSibling)===f.current||((a=f.current)==null?void 0:a.nextElementSibling)===null)return{...u,activeOptionIndex:p}}}}let s=Ds(e),l=Pn(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...u,...s,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(a=>{var u;return!a.dataRef.current.disabled&&((u=a.dataRef.current.textValue)==null?void 0:u.startsWith(r))}),i=o?e.options.indexOf(o):-1;return i===-1||i===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:i,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!==ue.Nothing&&(r=Pn(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 i=n.findIndex(a=>o==null?void 0:o(a.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ue.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[i,a]of n.entries())if(o.has(a.id)&&(r.push(i),o.delete(a.id),o.size===0))break;if(r.length>0){n=n.slice();for(let i of r.reverse())n.splice(i,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,...Ds(e),pendingShouldSort:!1}:e};class zr extends fi{constructor(t){super(t),Ls(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:i,value:a}=this.state.dataRef.current;return De(i,{0:()=>r==null?void 0:r(n),1:()=>{let u=a.slice(),s=u.findIndex(l=>o(l,n));return s===-1?u.push(n):u.splice(s,1),r==null?void 0:r(u)}})},registerOption:pr(()=>{let n=[],r=new Set;return[(o,i)=>{r.has(i)||(r.add(i),n.push({id:o,dataRef:i}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:pr(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:pr(()=>{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:ue.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})}}),Ls(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,i=n.options;return o===null||(r=i[o])==null?void 0:r.id},isActive(n,r){var o;let i=n.activeOptionIndex,a=n.options;return i!==null?((o=a[i])==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=mr.get(null);this.disposables.add(r.on(hi.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 zr({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ue.Nothing},__demoMode:n})}reduce(t,n){return De(n.type,kd,t,n)}}const Is=m.createContext(null);function Gr(e){let t=m.useContext(Is);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Fs),n}return t}function Fs({id:e,__demoMode:t=!1}){let n=m.useMemo(()=>zr.new({id:e,__demoMode:t}),[]);return ys(()=>n.dispose()),n}let Fn=m.createContext(null);Fn.displayName="ListboxDataContext";function tn(e){let t=m.useContext(Fn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,tn),n}return t}let _d=m.Fragment;function Bd(e,t){let n=m.useId(),r=ir(),{value:o,defaultValue:i,form:a,name:u,onChange:s,by:l,invalid:c=!1,disabled:d=r||!1,horizontal:p=!1,multiple:f=!1,__demoMode:g=!1,...v}=e;const E=p?"horizontal":"vertical";let I=Ie(t),w=ru(i),[P=f?[]:void 0,F]=nu(o,s,w),R=Fs({id:n,__demoMode:g}),B=m.useRef({static:!1,hold:!1}),V=m.useRef(new Map),h=$u(l),x=m.useCallback(W=>De(b.mode,{[Je.Multi]:()=>P.some(H=>h(H,W)),[Je.Single]:()=>h(P,W)}),[P]),b=m.useMemo(()=>({value:P,disabled:d,invalid:c,mode:f?Je.Multi:Je.Single,orientation:E,onChange:F,compare:h,isSelected:x,optionsPropsRef:B,listRef:V}),[P,d,c,f,E,F,h,x,B,V]);ae(()=>{R.state.dataRef.current=b},[b]);let A=je(R,W=>W.listboxState),C=mr.get(null),N=je(C,m.useCallback(W=>C.selectors.isTop(W,n),[C,n])),[T,S]=je(R,W=>[W.buttonElement,W.optionsElement]);nc(N,[T,S],(W,H)=>{R.send({type:Ms.CloseListbox}),Ei(H,wr.Loose)||(W.preventDefault(),T==null||T.focus())});let L=m.useMemo(()=>({open:A===ve.Open,disabled:d,invalid:c,value:P}),[A,d,c,P]),[$,y]=Su({inherit:!0}),D={ref:I},_=m.useCallback(()=>{if(w!==void 0)return F==null?void 0:F(w)},[F,w]),k=Pe();return m.createElement(y,{value:$,props:{htmlFor:T==null?void 0:T.id},slot:{open:A===ve.Open,disabled:d}},m.createElement(ad,null,m.createElement(Is.Provider,{value:R},m.createElement(Fn.Provider,{value:b},m.createElement(bs,{value:De(A,{[ve.Open]:He.Open,[ve.Closed]:He.Closed})},u!=null&&P!=null&&m.createElement(uu,{disabled:d,data:{[u]:P},form:a,onReset:_}),k({ourProps:D,theirProps:v,slot:L,defaultTag:_d,name:"Listbox"}))))))}let Wd="button";function Ud(e,t){let n=m.useId(),r=ei(),o=tn("Listbox.Button"),i=Gr("Listbox.Button"),{id:a=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:s=!1,...l}=e,c=Ie(t,od(),i.actions.setButtonElement),d=id(),[p,f,g]=je(i,y=>[y.listboxState,y.buttonElement,y.optionsElement]),v=p===ve.Open;ic(v,{trigger:f,action:m.useCallback(y=>{if(f!=null&&f.contains(y.target))return gn.Ignore;let D=y.target.closest('[role="option"]:not([data-disabled])');return st(D)?gn.Select(D):g!=null&&g.contains(y.target)?gn.Ignore:gn.Close},[f,g]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let E=ee(y=>{switch(y.key){case ge.Enter:ou(y.currentTarget);break;case ge.Space:case ge.ArrowDown:y.preventDefault(),i.actions.openListbox({focus:o.value?ue.Nothing:ue.First});break;case ge.ArrowUp:y.preventDefault(),i.actions.openListbox({focus:o.value?ue.Nothing:ue.Last});break}}),I=ee(y=>{switch(y.key){case ge.Space:y.preventDefault();break}}),w=ee(y=>{var D;if(y.button===xs.Left){if(gu(y.currentTarget))return y.preventDefault();i.state.listboxState===ve.Open?(we.flushSync(()=>i.actions.closeListbox()),(D=i.state.buttonElement)==null||D.focus({preventScroll:!0})):(y.preventDefault(),i.actions.openListbox({focus:ue.Nothing}))}}),P=m.useRef(null),F=ee(y=>{P.current=y.pointerType,y.pointerType==="mouse"&&w(y)}),R=ee(y=>{P.current!=="mouse"&&w(y)}),B=ee(y=>y.preventDefault()),V=li([a]),h=xu(),{isFocusVisible:x,focusProps:b}=Ha({autoFocus:s}),{isHovered:A,hoverProps:C}=Va({isDisabled:u}),{pressed:N,pressProps:T}=Xa({disabled:u}),S=m.useMemo(()=>({open:p===ve.Open,active:N||p===ve.Open,disabled:u,invalid:o.invalid,value:o.value,hover:A,focus:x,autofocus:s}),[p,o.value,u,A,x,N,o.invalid,s]),L=je(i,y=>y.listboxState===ve.Open),$=qo(d(),{ref:c,id:a,type:sc(e,f),"aria-haspopup":"listbox","aria-controls":g==null?void 0:g.id,"aria-expanded":L,"aria-labelledby":V,"aria-describedby":h,disabled:u||void 0,autoFocus:s,onKeyDown:E,onKeyUp:I,onKeyPress:B,onPointerDown:F,onClick:R},b,C,T);return Pe()({ourProps:$,theirProps:l,slot:S,defaultTag:Wd,name:"Listbox.Button"})}let js=m.createContext(!1),Vd="div",Hd=dn.RenderStrategy|dn.Static;function zd(e,t){let n=m.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:i=!1,modal:a=!0,transition:u=!1,...s}=e,l=rd(o),[c,d]=m.useState(null);l&&(i=!0);let p=tn("Listbox.Options"),f=Gr("Listbox.Options"),[g,v,E,I]=je(f,G=>[G.listboxState,G.buttonElement,G.optionsElement,G.__demoMode]),w=Er(v),P=Er(E),F=Ur(),[R,B]=Mi(u,c,F!==null?(F&He.Open)===He.Open:g===ve.Open);Hu(R,v,f.actions.closeListbox);let V=I?!1:a&&g===ve.Open;mc(V,P);let h=I?!1:a&&g===ve.Open;Vu(h,{allowed:m.useCallback(()=>[v,E],[v,E])});let x=g!==ve.Open,b=Dd(x,v)?!1:R,A=R&&g===ve.Closed,C=fd(A,p.value),N=ee(G=>p.compare(C,G)),T=je(f,G=>{var oe;if(l==null||!((oe=l==null?void 0:l.to)!=null&&oe.includes("selection")))return null;let fe=G.options.findIndex(Ne=>N(Ne.dataRef.current.value));return fe===-1&&(fe=0),fe}),S=(()=>{if(l==null)return;if(T===null)return{...l,inner:void 0};let G=Array.from(p.listRef.current.values());return{...l,inner:{listRef:{current:G},index:T}}})(),[L,$]=ld(S),y=sd(),D=Ie(t,l?L:null,f.actions.setOptionsElement,d),_=$t();m.useEffect(()=>{var G;let oe=E;oe&&g===ve.Open&&oe!==((G=Yt(oe))==null?void 0:G.activeElement)&&(oe==null||oe.focus({preventScroll:!0}))},[g,E]);let k=ee(G=>{var oe,fe;switch(_.dispose(),G.key){case ge.Space:if(f.state.searchQuery!=="")return G.preventDefault(),G.stopPropagation(),f.actions.search(G.key);case ge.Enter:if(G.preventDefault(),G.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:Ne}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(Ne.current.value)}p.mode===Je.Single&&(we.flushSync(()=>f.actions.closeListbox()),(oe=f.state.buttonElement)==null||oe.focus({preventScroll:!0}));break;case De(p.orientation,{vertical:ge.ArrowDown,horizontal:ge.ArrowRight}):return G.preventDefault(),G.stopPropagation(),f.actions.goToOption({focus:ue.Next});case De(p.orientation,{vertical:ge.ArrowUp,horizontal:ge.ArrowLeft}):return G.preventDefault(),G.stopPropagation(),f.actions.goToOption({focus:ue.Previous});case ge.Home:case ge.PageUp:return G.preventDefault(),G.stopPropagation(),f.actions.goToOption({focus:ue.First});case ge.End:case ge.PageDown:return G.preventDefault(),G.stopPropagation(),f.actions.goToOption({focus:ue.Last});case ge.Escape:G.preventDefault(),G.stopPropagation(),we.flushSync(()=>f.actions.closeListbox()),(fe=f.state.buttonElement)==null||fe.focus({preventScroll:!0});return;case ge.Tab:G.preventDefault(),G.stopPropagation(),we.flushSync(()=>f.actions.closeListbox()),Ju(f.state.buttonElement,G.shiftKey?yr.Previous:yr.Next);break;default:G.key.length===1&&(f.actions.search(G.key),_.setTimeout(()=>f.actions.clearSearch(),350));break}}),W=je(f,G=>{var oe;return(oe=G.buttonElement)==null?void 0:oe.id}),H=m.useMemo(()=>({open:g===ve.Open}),[g]),Q=qo(l?y():{},{id:r,ref:D,"aria-activedescendant":je(f,f.selectors.activeDescendantId),"aria-multiselectable":p.mode===Je.Multi?!0:void 0,"aria-labelledby":W,"aria-orientation":p.orientation,onKeyDown:k,role:"listbox",tabIndex:g===ve.Open?0:void 0,style:{...s.style,...$,"--button-width":Lu(v,!0).width},...Li(B)}),z=Pe(),K=m.useMemo(()=>p.mode===Je.Multi?p:{...p,isSelected:N},[p,N]);return m.createElement(Cd,{enabled:i?e.static||R:!1,ownerDocument:w},m.createElement(Fn.Provider,{value:K},z({ourProps:Q,theirProps:s,slot:H,defaultTag:Vd,features:Hd,visible:b,name:"Listbox.Options"})))}let Gd="div";function Yd(e,t){let n=m.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:i,...a}=e,u=m.useContext(js)===!0,s=tn("Listbox.Option"),l=Gr("Listbox.Option"),c=je(l,b=>l.selectors.isActive(b,r)),d=s.isSelected(i),p=m.useRef(null),f=Fd(p),g=Et({disabled:o,value:i,domRef:p,get textValue(){return f()}}),v=Ie(t,p,b=>{b?s.listRef.current.set(r,b):s.listRef.current.delete(r)}),E=je(l,b=>l.selectors.shouldScrollIntoView(b,r));ae(()=>{if(E)return Ve().requestAnimationFrame(()=>{var b,A;(A=(b=p.current)==null?void 0:b.scrollIntoView)==null||A.call(b,{block:"nearest"})})},[E,p]),ae(()=>{if(!u)return l.actions.registerOption(r,g),()=>l.actions.unregisterOption(r)},[g,r,u]);let I=ee(b=>{var A;if(o)return b.preventDefault();l.actions.onChange(i),s.mode===Je.Single&&(we.flushSync(()=>l.actions.closeListbox()),(A=l.state.buttonElement)==null||A.focus({preventScroll:!0}))}),w=ee(()=>{if(o)return l.actions.goToOption({focus:ue.Nothing});l.actions.goToOption({focus:ue.Specific,id:r})}),P=hc(),F=ee(b=>P.update(b)),R=ee(b=>{P.wasMoved(b)&&(o||c&&l.state.activationTrigger===In.Pointer||l.actions.goToOption({focus:ue.Specific,id:r},In.Pointer))}),B=ee(b=>{P.wasMoved(b)&&(o||c&&l.state.activationTrigger===In.Pointer&&l.actions.goToOption({focus:ue.Nothing}))}),V=m.useMemo(()=>({active:c,focus:c,selected:d,disabled:o,selectedOption:d&&u}),[c,d,o,u]),h=u?{}:{id:r,ref:v,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:I,onFocus:w,onPointerEnter:F,onMouseEnter:F,onPointerMove:R,onMouseMove:R,onPointerLeave:B,onMouseLeave:B},x=Pe();return!d&&u?null:x({ourProps:h,theirProps:a,slot:V,defaultTag:Gd,name:"Listbox.Option"})}let Kd=m.Fragment;function qd(e,t){let{options:n,placeholder:r,...o}=e,i={ref:Ie(t)},a=tn("ListboxSelectedOption"),u=m.useMemo(()=>({}),[]),s=a.value===void 0||a.value===null||a.mode===Je.Multi&&Array.isArray(a.value)&&a.value.length===0,l=Pe();return m.createElement(js.Provider,{value:!0},l({ourProps:i,theirProps:{...o,children:m.createElement(m.Fragment,null,r&&s?r:n)},slot:u,defaultTag:Kd,name:"ListboxSelectedOption"}))}let Xd=Ce(Bd),Qd=Ce(Ud),Jd=Nu,Zd=Ce(zd),ep=Ce(Yd),tp=Ce(qd),bt=Object.assign(Xd,{Button:Qd,Label:Jd,Options:Zd,Option:ep,SelectedOption:tp});function np({title:e,titleId:t,...n},r){return j.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?j.createElement("title",{id:t},e):null,j.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 Rs=j.forwardRef(np),rp=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>{const{t:i}=Ye();return O.jsx("div",{className:`relative ${o}`,children:O.jsx(bt,{value:t,onChange:n,disabled:r,children:({open:a})=>O.jsxs(O.Fragment,{children:[O.jsxs(bt.Button,{className:`
76
84
  relative w-full h-9 text-text-primary bg-fill-input-primary
77
85
  items-center justify-between flex px-3 rounded-lg
78
86
  focus:outline-none
79
87
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
80
- ${s?"ring-1 ring-white":""}
81
- `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Asset"}),M.jsxs("div",{className:"flex items-center",children:[t.iconUrl?M.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${s?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(Fi,{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:M.jsx(at.Options,{className:`
88
+ ${a?"ring-1 ring-white":""}
89
+ `,children:[O.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.asset")}),O.jsxs("div",{className:"flex items-center",children:[t.iconUrl?O.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):O.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),O.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),O.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${a?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[O.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:O.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),O.jsx("defs",{children:O.jsx("clipPath",{id:"clip0_12919_27745",children:O.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),O.jsx(As,{as:m.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:O.jsx(bt.Options,{className:`
82
90
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
83
91
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
84
92
  focus:outline-none
85
- `,children:e.map(u=>M.jsx(at.Option,{value:u,className:({active:a,selected:i})=>`relative cursor-pointer select-none py-3 px-3 ${i?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,active:i})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[u.iconUrl?M.jsx("img",{src:u.iconUrl,alt:u.token,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:u.token.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${a||i?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),a&&M.jsx(zi,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})}),Cf=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>M.jsx("div",{className:`relative ${o}`,children:M.jsx(at,{value:t,onChange:n,disabled:r,children:({open:u})=>M.jsxs(M.Fragment,{children:[M.jsxs(at.Button,{className:`
93
+ `,children:e.map(u=>O.jsx(bt.Option,{value:u,className:({active:s,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":s?"bg-fill-input-secondary":""}`,children:({selected:s,active:l})=>O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center space-x-3",children:[u.iconUrl?O.jsx("img",{src:u.iconUrl,alt:u.token,className:"w-5 h-5 rounded-full"}):O.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:u.token.charAt(0)})}),O.jsx("div",{className:"flex flex-col",children:O.jsx("span",{className:`text-sm font-medium ${s||l?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),s&&O.jsx(Rs,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})})},op=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:i="mpc"})=>{const{t:a}=Ye();return O.jsx("div",{className:`relative ${o}`,children:O.jsx(bt,{value:t,onChange:n,disabled:r,children:({open:u})=>O.jsxs(O.Fragment,{children:[O.jsxs(bt.Button,{className:`
86
94
  relative w-full h-9 text-text-primary bg-fill-input-primary
87
95
  items-center justify-between flex px-3 rounded-lg
88
96
  focus:outline-none
89
97
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
90
98
  ${u?"ring-1 ring-white":""}
91
- `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Chain"}),M.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?M.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(Fi,{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:M.jsx(at.Options,{className:`
99
+ `,children:[O.jsx("span",{className:"text-sm leading-[18px] font-medium",children:a("deposit.chain")}),O.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?O.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):O.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),O.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),O.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[O.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:O.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),O.jsx("defs",{children:O.jsx("clipPath",{id:"clip0_12919_27745",children:O.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),O.jsx(As,{as:m.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:O.jsx(bt.Options,{className:`
92
100
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
93
101
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
94
102
  focus:outline-none
95
- `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>M.jsx(at.Option,{value:a,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})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?M.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${i||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),i&&M.jsx(zi,{className:"w-4 h-4 text-blue-400"})]})},a.chainId))})})]})})}),wr=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const u=d.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),a=f=>{if(n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(y=>y.token===r||y.symbol===r)){const y=f.tokenList[0];o(y.symbol||y.token)}},i=f=>{o(f.symbol||f.token)},l=d.useMemo(()=>t.map(f=>f),[t]),c=d.useMemo(()=>l.find(f=>f.chainId===e.chainId)||l[0],[l,e.chainId]),p=d.useMemo(()=>u.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[u]),m=d.useMemo(()=>{if(p.length!==0)return p.find(f=>f.token===r||f.symbol===r)||p[0]},[p,r]);return M.jsxs("div",{className:"space-y-4",children:[M.jsx(Cf,{chains:l,selectedChain:c,onChainChange:f=>{const b=t.find(y=>y.chainId===f.chainId);b&&a(b)},walletType:s,className:"w-full"}),p.length>0?m&&M.jsx(Ef,{tokens:p,selectedToken:m,onTokenChange:i,className:"w-full"}):M.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:M.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},Sf=(e,t)=>Number(e)>Number(t),Ue=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"},Er=(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 Er(i,t)}const s=parseFloat(e),u=parseFloat(t);if(!isNaN(s)&&!isNaN(u)&&s>u)return{isValid:!0,formattedValue:Ue(t),errorType:"auto_adjusted_to_max"};let a=e;return!isNaN(s)&&!e.endsWith(".")&&e.includes(".")&&(a=e.replace(/\.?0+$/,""),a.includes(".")||(a=a)),{isValid:!0,formattedValue:a}},Of=(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)},Hi={ETHEREUM:1,SEPOLIA:11155111},Af=[Hi.ETHEREUM,Hi.SEPOLIA],Nf=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!Af.includes(t)}return!0},$f=[{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}],Cr={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Sr={address:"0x1234567890123456789012345678901234567890"},Or={multiChain:{minDeposit:10}};var yn={},Tf=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},Pf=Tf,Gi={"text/plain":"Text","text/html":"Url",default:"Text"},Mf="Copy to clipboard: #{key}, Enter";function Lf(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function If(e,t){var n,r,o,s,u,a,i=!1;t||(t={}),n=t.debug||!1;try{o=Pf(),s=document.createRange(),u=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(c){if(c.stopPropagation(),t.format)if(c.preventDefault(),typeof c.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var p=Gi[t.format]||Gi.default;window.clipboardData.setData(p,e)}else c.clipboardData.clearData(),c.clipboardData.setData(t.format,e);t.onCopy&&(c.preventDefault(),t.onCopy(c.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),u.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");i=!0}catch(c){n&&console.error("unable to copy using execCommand: ",c),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),i=!0}catch(p){n&&console.error("unable to copy using clipboardData: ",p),n&&console.error("falling back to prompt"),r=Lf("message"in t?t.message:Mf),window.prompt(r,e)}}finally{u&&(typeof u.removeRange=="function"?u.removeRange(s):u.removeAllRanges()),a&&document.body.removeChild(a),o()}return i}var Df=If;function Ar(e){"@babel/helpers - typeof";return Ar=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ar(e)}Object.defineProperty(yn,"__esModule",{value:!0}),yn.CopyToClipboard=void 0;var xn=Yi(d),Ff=Yi(Df),_f=["text","onCopy","options","children"];function Yi(e){return e&&e.__esModule?e:{default:e}}function Ki(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function qi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ki(Object(n),!0).forEach(function(r){$r(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ki(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jf(e,t){if(e==null)return{};var n=kf(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kf(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Rf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Wf(e,t,n){return t&&Bf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Nr(e,t)}function Nr(e,t){return Nr=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},Nr(e,t)}function Vf(e){var t=Hf();return function(){var r=wn(e),o;if(t){var s=wn(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return zf(this,o)}}function zf(e,t){if(t&&(Ar(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qi(e)}function Qi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function wn(e){return wn=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},wn(e)}function $r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xi=function(e){Uf(n,e);var t=Vf(n);function n(){var r;Rf(this,n);for(var o=arguments.length,s=new Array(o),u=0;u<o;u++)s[u]=arguments[u];return r=t.call.apply(t,[this].concat(s)),$r(Qi(r),"onClick",function(a){var i=r.props,l=i.text,c=i.onCopy,p=i.children,m=i.options,f=xn.default.Children.only(p),b=(0,Ff.default)(l,m);c&&c(l,b),f&&f.props&&typeof f.props.onClick=="function"&&f.props.onClick(a)}),r}return Wf(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,u=jf(o,_f),a=xn.default.Children.only(s);return xn.default.cloneElement(a,qi(qi({},u),{},{onClick:this.onClick}))}}]),n}(xn.default.PureComponent);yn.CopyToClipboard=Xi,$r(Xi,"defaultProps",{onCopy:void 0,options:void 0});var Gf=yn,Tr=Gf.CopyToClipboard;Tr.CopyToClipboard=Tr;var Yf=Tr;const Kf=Ws(Yf);var qf=Object.defineProperty,En=Object.getOwnPropertySymbols,Ji=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,es=(e,t,n)=>t in e?qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pr=(e,t)=>{for(var n in t||(t={}))Ji.call(t,n)&&es(e,n,t[n]);if(En)for(var n of En(t))Zi.call(t,n)&&es(e,n,t[n]);return e},Mr=(e,t)=>{var n={};for(var r in e)Ji.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&En)for(var r of En(e))t.indexOf(r)<0&&Zi.call(e,r)&&(n[r]=e[r]);return n};/**
103
+ `,children:e.filter(s=>s[i==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(s=>O.jsx(bt.Option,{value:s,className:({active:l,selected:c})=>`relative cursor-pointer select-none py-3 px-3 ${c?"bg-fill-btn-secondary":l?"bg-fill-input-secondary":""}`,children:({selected:l,active:c})=>O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center space-x-3",children:[s.chainIconUrl?O.jsx("img",{src:s.chainIconUrl,alt:s.chain,className:"w-5 h-5 rounded-full"}):O.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:O.jsx("span",{className:"text-xs text-white font-bold",children:s.chain.charAt(0)})}),O.jsx("div",{className:"flex flex-col",children:O.jsx("span",{className:`text-sm font-medium ${l||c?"text-text-primary":"text-text-tertiary"}`,children:s.chain})})]}),l&&O.jsx(Rs,{className:"w-4 h-4 text-blue-400"})]})},s.chainId))})})]})})})},Yr=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:i="mpc"})=>{const a=m.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),u=f=>{if(n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(v=>v.token===r||v.symbol===r)){const v=f.tokenList[0];o(v.symbol||v.token)}},s=f=>{o(f.symbol||f.token)},l=m.useMemo(()=>t.map(f=>f),[t]),c=m.useMemo(()=>l.find(f=>f.chainId===e.chainId)||l[0],[l,e.chainId]),d=m.useMemo(()=>a.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[a]),p=m.useMemo(()=>{if(d.length!==0)return d.find(f=>f.token===r||f.symbol===r)||d[0]},[d,r]);return O.jsxs("div",{className:"space-y-4",children:[O.jsx(op,{chains:l,selectedChain:c,onChainChange:f=>{const g=t.find(v=>v.chainId===f.chainId);g&&u(g)},walletType:i,className:"w-full"}),d.length>0?p&&O.jsx(rp,{tokens:d,selectedToken:p,onTokenChange:s,className:"w-full"}):O.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:O.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},ip=(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 i=r[1]||"";return i.length>6&&(i=i.substring(0,6)),i=i.replace(/0+$/,""),i?(i.length===1&&(i+="0"),o+"."+i):o+".00"},Kr=(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 s=o[0]+"."+o[1].substring(0,6);return Kr(s,t)}const i=parseFloat(e),a=parseFloat(t);if(!isNaN(i)&&!isNaN(a)&&i>a)return{isValid:!0,formattedValue:ze(t),errorType:"auto_adjusted_to_max"};let u=e;return!isNaN(i)&&!e.endsWith(".")&&e.includes(".")&&(u=e.replace(/\.?0+$/,""),u.includes(".")||(u=u)),{isValid:!0,formattedValue:u}},sp=(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)},ks={ETHEREUM:1,SEPOLIA:11155111},lp=[ks.ETHEREUM,ks.SEPOLIA],ap=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!lp.includes(t)}return!0},up=[{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}],qr={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Xr={address:"0x1234567890123456789012345678901234567890"},Qr={multiChain:{minDeposit:10}};var jn={},cp=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},fp=cp,_s={"text/plain":"Text","text/html":"Url",default:"Text"},dp="Copy to clipboard: #{key}, Enter";function pp(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function mp(e,t){var n,r,o,i,a,u,s=!1;t||(t={}),n=t.debug||!1;try{o=fp(),i=document.createRange(),a=document.getSelection(),u=document.createElement("span"),u.textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(c){if(c.stopPropagation(),t.format)if(c.preventDefault(),typeof c.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=_s[t.format]||_s.default;window.clipboardData.setData(d,e)}else c.clipboardData.clearData(),c.clipboardData.setData(t.format,e);t.onCopy&&(c.preventDefault(),t.onCopy(c.clipboardData))}),document.body.appendChild(u),i.selectNodeContents(u),a.addRange(i);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");s=!0}catch(c){n&&console.error("unable to copy using execCommand: ",c),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),r=pp("message"in t?t.message:dp),window.prompt(r,e)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(i):a.removeAllRanges()),u&&document.body.removeChild(u),o()}return s}var hp=mp;function Jr(e){"@babel/helpers - typeof";return Jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jr(e)}Object.defineProperty(jn,"__esModule",{value:!0}),jn.CopyToClipboard=void 0;var Rn=Bs(m),gp=Bs(hp),vp=["text","onCopy","options","children"];function Bs(e){return e&&e.__esModule?e:{default:e}}function Ws(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Us(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ws(Object(n),!0).forEach(function(r){eo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ws(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bp(e,t){if(e==null)return{};var n=xp(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xp(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function yp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ep(e,t,n){return t&&wp(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Zr(e,t)}function Zr(e,t){return Zr=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},Zr(e,t)}function Cp(e){var t=Tp();return function(){var r=kn(e),o;if(t){var i=kn(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Op(this,o)}}function Op(e,t){if(t&&(Jr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vs(e)}function Vs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tp(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function kn(e){return kn=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},kn(e)}function eo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Hs=function(e){Sp(n,e);var t=Cp(n);function n(){var r;yp(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i)),eo(Vs(r),"onClick",function(u){var s=r.props,l=s.text,c=s.onCopy,d=s.children,p=s.options,f=Rn.default.Children.only(d),g=(0,gp.default)(l,p);c&&c(l,g),f&&f.props&&typeof f.props.onClick=="function"&&f.props.onClick(u)}),r}return Ep(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var i=o.children,a=bp(o,vp),u=Rn.default.Children.only(i);return Rn.default.cloneElement(u,Us(Us({},a),{},{onClick:this.onClick}))}}]),n}(Rn.default.PureComponent);jn.CopyToClipboard=Hs,eo(Hs,"defaultProps",{onCopy:void 0,options:void 0});var Np=jn,to=Np.CopyToClipboard;to.CopyToClipboard=to;var Ap=to;const $p=Zl(Ap);var Pp=Object.defineProperty,_n=Object.getOwnPropertySymbols,zs=Object.prototype.hasOwnProperty,Gs=Object.prototype.propertyIsEnumerable,Ys=(e,t,n)=>t in e?Pp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,no=(e,t)=>{for(var n in t||(t={}))zs.call(t,n)&&Ys(e,n,t[n]);if(_n)for(var n of _n(t))Gs.call(t,n)&&Ys(e,n,t[n]);return e},ro=(e,t)=>{var n={};for(var r in e)zs.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_n)for(var r of _n(e))t.indexOf(r)<0&&Gs.call(e,r)&&(n[r]=e[r]);return n};/**
96
104
  * @license QR Code generator library (TypeScript)
97
105
  * Copyright (c) Project Nayuki.
98
106
  * SPDX-License-Identifier: MIT
99
- */var vt;(e=>{const t=class Q{constructor(i,l,c,p){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<Q.MIN_VERSION||i>Q.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 b=0;b<this.size;b++)m.push(!1);for(let b=0;b<this.size;b++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(c);if(this.drawCodewords(f),p==-1){let b=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);const N=this.getPenaltyScore();N<b&&(p=y,b=N),this.applyMask(y)}}o(0<=p&&p<=7),this.mask=p,this.applyMask(p),this.drawFormatBits(p),this.isFunction=[]}static encodeText(i,l){const c=e.QrSegment.makeSegments(i);return Q.encodeSegments(c,l)}static encodeBinary(i,l){const c=e.QrSegment.makeBytes(i);return Q.encodeSegments([c],l)}static encodeSegments(i,l,c=1,p=40,m=-1,f=!0){if(!(Q.MIN_VERSION<=c&&c<=p&&p<=Q.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let b,y;for(b=c;;b++){const T=Q.getNumDataCodewords(b,l)*8,j=u.getTotalBits(i,b);if(j<=T){y=j;break}if(b>=p)throw new RangeError("Data too long")}for(const T of[Q.Ecc.MEDIUM,Q.Ecc.QUARTILE,Q.Ecc.HIGH])f&&y<=Q.getNumDataCodewords(b,T)*8&&(l=T);let N=[];for(const T of i){n(T.mode.modeBits,4,N),n(T.numChars,T.mode.numCharCountBits(b),N);for(const j of T.getData())N.push(j)}o(N.length==y);const I=Q.getNumDataCodewords(b,l)*8;o(N.length<=I),n(0,Math.min(4,I-N.length),N),n(0,(8-N.length%8)%8,N),o(N.length%8==0);for(let T=236;N.length<I;T^=253)n(T,8,N);let w=[];for(;w.length*8<N.length;)w.push(0);return N.forEach((T,j)=>w[j>>>3]|=T<<7-(j&7)),new Q(b,l,w,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 c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let c=0;c<l;c++)for(let p=0;p<l;p++)c==0&&p==0||c==0&&p==l-1||c==l-1&&p==0||this.drawAlignmentPattern(i[c],i[p]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let c=l;for(let m=0;m<10;m++)c=c<<1^(c>>>9)*1335;const p=(l<<10|c)^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 c=0;c<12;c++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let c=0;c<18;c++){const p=r(l,c),m=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(m,f,p),this.setFunctionModule(f,m,p)}}drawFinderPattern(i,l){for(let c=-4;c<=4;c++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(c)),f=i+p,b=l+c;0<=f&&f<this.size&&0<=b&&b<this.size&&this.setFunctionModule(f,b,m!=2&&m!=4)}}drawAlignmentPattern(i,l){for(let c=-2;c<=2;c++)for(let p=-2;p<=2;p++)this.setFunctionModule(i+p,l+c,Math.max(Math.abs(p),Math.abs(c))!=1)}setFunctionModule(i,l,c){this.modules[l][i]=c,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,c=this.errorCorrectionLevel;if(i.length!=Q.getNumDataCodewords(l,c))throw new RangeError("Invalid argument");const p=Q.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l],m=Q.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l],f=Math.floor(Q.getNumRawDataModules(l)/8),b=p-f%p,y=Math.floor(f/p);let N=[];const I=Q.reedSolomonComputeDivisor(m);for(let T=0,j=0;T<p;T++){let _=i.slice(j,j+y-m+(T<b?0:1));j+=_.length;const B=Q.reedSolomonComputeRemainder(_,I);T<b&&_.push(0),N.push(_.concat(B))}let w=[];for(let T=0;T<N[0].length;T++)N.forEach((j,_)=>{(T!=y-m||_>=b)&&w.push(j[T])});return o(w.length==f),w}drawCodewords(i){if(i.length!=Math.floor(Q.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let p=0;p<this.size;p++)for(let m=0;m<2;m++){const f=c-m,y=(c+1&2)==0?this.size-1-p:p;!this.isFunction[y][f]&&l<i.length*8&&(this.modules[y][f]=r(i[l>>>3],7-(l&7)),l++)}}o(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let c=0;c<this.size;c++){let p;switch(i){case 0:p=(c+l)%2==0;break;case 1:p=l%2==0;break;case 2:p=c%3==0;break;case 3:p=(c+l)%3==0;break;case 4:p=(Math.floor(c/3)+Math.floor(l/2))%2==0;break;case 5:p=c*l%2+c*l%3==0;break;case 6:p=(c*l%2+c*l%3)%2==0;break;case 7:p=((c+l)%2+c*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][c]&&p&&(this.modules[l][c]=!this.modules[l][c])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let f=!1,b=0,y=[0,0,0,0,0,0,0];for(let N=0;N<this.size;N++)this.modules[m][N]==f?(b++,b==5?i+=Q.PENALTY_N1:b>5&&i++):(this.finderPenaltyAddHistory(b,y),f||(i+=this.finderPenaltyCountPatterns(y)*Q.PENALTY_N3),f=this.modules[m][N],b=1);i+=this.finderPenaltyTerminateAndCount(f,b,y)*Q.PENALTY_N3}for(let m=0;m<this.size;m++){let f=!1,b=0,y=[0,0,0,0,0,0,0];for(let N=0;N<this.size;N++)this.modules[N][m]==f?(b++,b==5?i+=Q.PENALTY_N1:b>5&&i++):(this.finderPenaltyAddHistory(b,y),f||(i+=this.finderPenaltyCountPatterns(y)*Q.PENALTY_N3),f=this.modules[N][m],b=1);i+=this.finderPenaltyTerminateAndCount(f,b,y)*Q.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let f=0;f<this.size-1;f++){const b=this.modules[m][f];b==this.modules[m][f+1]&&b==this.modules[m+1][f]&&b==this.modules[m+1][f+1]&&(i+=Q.PENALTY_N2)}let l=0;for(const m of this.modules)l=m.reduce((f,b)=>f+(b?1:0),l);const c=this.size*this.size,p=Math.ceil(Math.abs(l*20-c*10)/c)-1;return o(0<=p&&p<=9),i+=p*Q.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let c=[6];for(let p=this.size-7;c.length<i;p-=l)c.splice(1,0,p);return c}}static getNumRawDataModules(i){if(i<Q.MIN_VERSION||i>Q.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const c=Math.floor(i/7)+2;l-=(25*c-10)*c-55,i>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(Q.getNumRawDataModules(i)/8)-Q.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*Q.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 c=1;for(let p=0;p<i;p++){for(let m=0;m<l.length;m++)l[m]=Q.reedSolomonMultiply(l[m],c),m+1<l.length&&(l[m]^=l[m+1]);c=Q.reedSolomonMultiply(c,2)}return l}static reedSolomonComputeRemainder(i,l){let c=l.map(p=>0);for(const p of i){const m=p^c.shift();c.push(0),l.forEach((f,b)=>c[b]^=Q.reedSolomonMultiply(f,m))}return c}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let c=0;for(let p=7;p>=0;p--)c=c<<1^(c>>>7)*285,c^=(l>>>p&1)*i;return o(c>>>8==0),c}finderPenaltyCountPatterns(i){const l=i[1];o(l<=this.size*3);const c=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(c&&i[0]>=l*4&&i[6]>=l?1:0)+(c&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,c){return i&&(this.finderPenaltyAddHistory(l,c),l=0),l+=this.size,this.finderPenaltyAddHistory(l,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(a,i,l){if(i<0||i>31||a>>>i)throw new RangeError("Value out of range");for(let c=i-1;c>=0;c--)l.push(a>>>c&1)}function r(a,i){return(a>>>i&1)!=0}function o(a){if(!a)throw new Error("Assertion error")}const s=class ce{constructor(i,l,c){if(this.mode=i,this.numChars=l,this.bitData=c,l<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(i){let l=[];for(const c of i)n(c,8,l);return new ce(ce.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!ce.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let c=0;c<i.length;){const p=Math.min(i.length-c,3);n(parseInt(i.substring(c,c+p),10),p*3+1,l),c+=p}return new ce(ce.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!ce.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],c;for(c=0;c+2<=i.length;c+=2){let p=ce.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c))*45;p+=ce.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c+1)),n(p,11,l)}return c<i.length&&n(ce.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)),6,l),new ce(ce.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:ce.isNumeric(i)?[ce.makeNumeric(i)]:ce.isAlphanumeric(i)?[ce.makeAlphanumeric(i)]:[ce.makeBytes(ce.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 ce(ce.Mode.ECI,0,l)}static isNumeric(i){return ce.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return ce.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let c=0;for(const p of i){const m=p.mode.numCharCountBits(l);if(p.numChars>=1<<m)return 1/0;c+=4+m+p.bitData.length}return c}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let c=0;c<i.length;c++)i.charAt(c)!="%"?l.push(i.charCodeAt(c)):(l.push(parseInt(i.substring(c+1,c+3),16)),c+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=s;e.QrSegment=s})(vt||(vt={})),(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={}))})(vt||(vt={})),(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={}))})(vt||(vt={}));var $t=vt;/**
107
+ */var Tt;(e=>{const t=class J{constructor(s,l,c,d){if(this.version=s,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],s<J.MIN_VERSION||s>J.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=s*4+17;let p=[];for(let g=0;g<this.size;g++)p.push(!1);for(let g=0;g<this.size;g++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(c);if(this.drawCodewords(f),d==-1){let g=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const E=this.getPenaltyScore();E<g&&(d=v,g=E),this.applyMask(v)}}o(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(s,l){const c=e.QrSegment.makeSegments(s);return J.encodeSegments(c,l)}static encodeBinary(s,l){const c=e.QrSegment.makeBytes(s);return J.encodeSegments([c],l)}static encodeSegments(s,l,c=1,d=40,p=-1,f=!0){if(!(J.MIN_VERSION<=c&&c<=d&&d<=J.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let g,v;for(g=c;;g++){const P=J.getNumDataCodewords(g,l)*8,F=a.getTotalBits(s,g);if(F<=P){v=F;break}if(g>=d)throw new RangeError("Data too long")}for(const P of[J.Ecc.MEDIUM,J.Ecc.QUARTILE,J.Ecc.HIGH])f&&v<=J.getNumDataCodewords(g,P)*8&&(l=P);let E=[];for(const P of s){n(P.mode.modeBits,4,E),n(P.numChars,P.mode.numCharCountBits(g),E);for(const F of P.getData())E.push(F)}o(E.length==v);const I=J.getNumDataCodewords(g,l)*8;o(E.length<=I),n(0,Math.min(4,I-E.length),E),n(0,(8-E.length%8)%8,E),o(E.length%8==0);for(let P=236;E.length<I;P^=253)n(P,8,E);let w=[];for(;w.length*8<E.length;)w.push(0);return E.forEach((P,F)=>w[F>>>3]|=P<<7-(F&7)),new J(g,l,w,p)}getModule(s,l){return 0<=s&&s<this.size&&0<=l&&l<this.size&&this.modules[l][s]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const s=this.getAlignmentPatternPositions(),l=s.length;for(let c=0;c<l;c++)for(let d=0;d<l;d++)c==0&&d==0||c==0&&d==l-1||c==l-1&&d==0||this.drawAlignmentPattern(s[c],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const l=this.errorCorrectionLevel.formatBits<<3|s;let c=l;for(let p=0;p<10;p++)c=c<<1^(c>>>9)*1335;const d=(l<<10|c)^21522;o(d>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(d,p));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(d,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(d,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(d,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let s=this.version;for(let c=0;c<12;c++)s=s<<1^(s>>>11)*7973;const l=this.version<<12|s;o(l>>>18==0);for(let c=0;c<18;c++){const d=r(l,c),p=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(p,f,d),this.setFunctionModule(f,p,d)}}drawFinderPattern(s,l){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const p=Math.max(Math.abs(d),Math.abs(c)),f=s+d,g=l+c;0<=f&&f<this.size&&0<=g&&g<this.size&&this.setFunctionModule(f,g,p!=2&&p!=4)}}drawAlignmentPattern(s,l){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,l+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(s,l,c){this.modules[l][s]=c,this.isFunction[l][s]=!0}addEccAndInterleave(s){const l=this.version,c=this.errorCorrectionLevel;if(s.length!=J.getNumDataCodewords(l,c))throw new RangeError("Invalid argument");const d=J.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l],p=J.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l],f=Math.floor(J.getNumRawDataModules(l)/8),g=d-f%d,v=Math.floor(f/d);let E=[];const I=J.reedSolomonComputeDivisor(p);for(let P=0,F=0;P<d;P++){let R=s.slice(F,F+v-p+(P<g?0:1));F+=R.length;const B=J.reedSolomonComputeRemainder(R,I);P<g&&R.push(0),E.push(R.concat(B))}let w=[];for(let P=0;P<E[0].length;P++)E.forEach((F,R)=>{(P!=v-p||R>=g)&&w.push(F[P])});return o(w.length==f),w}drawCodewords(s){if(s.length!=Math.floor(J.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let p=0;p<2;p++){const f=c-p,v=(c+1&2)==0?this.size-1-d:d;!this.isFunction[v][f]&&l<s.length*8&&(this.modules[v][f]=r(s[l>>>3],7-(l&7)),l++)}}o(l==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let c=0;c<this.size;c++){let d;switch(s){case 0:d=(c+l)%2==0;break;case 1:d=l%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+l)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(l/2))%2==0;break;case 5:d=c*l%2+c*l%3==0;break;case 6:d=(c*l%2+c*l%3)%2==0;break;case 7:d=((c+l)%2+c*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][c]&&d&&(this.modules[l][c]=!this.modules[l][c])}}getPenaltyScore(){let s=0;for(let p=0;p<this.size;p++){let f=!1,g=0,v=[0,0,0,0,0,0,0];for(let E=0;E<this.size;E++)this.modules[p][E]==f?(g++,g==5?s+=J.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*J.PENALTY_N3),f=this.modules[p][E],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*J.PENALTY_N3}for(let p=0;p<this.size;p++){let f=!1,g=0,v=[0,0,0,0,0,0,0];for(let E=0;E<this.size;E++)this.modules[E][p]==f?(g++,g==5?s+=J.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*J.PENALTY_N3),f=this.modules[E][p],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*J.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let f=0;f<this.size-1;f++){const g=this.modules[p][f];g==this.modules[p][f+1]&&g==this.modules[p+1][f]&&g==this.modules[p+1][f+1]&&(s+=J.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((f,g)=>f+(g?1:0),l);const c=this.size*this.size,d=Math.ceil(Math.abs(l*20-c*10)/c)-1;return o(0<=d&&d<=9),s+=d*J.PENALTY_N4,o(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(s*2-2))*2;let c=[6];for(let d=this.size-7;c.length<s;d-=l)c.splice(1,0,d);return c}}static getNumRawDataModules(s){if(s<J.MIN_VERSION||s>J.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*s+128)*s+64;if(s>=2){const c=Math.floor(s/7)+2;l-=(25*c-10)*c-55,s>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(s,l){return Math.floor(J.getNumRawDataModules(s)/8)-J.ECC_CODEWORDS_PER_BLOCK[l.ordinal][s]*J.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let l=[];for(let d=0;d<s-1;d++)l.push(0);l.push(1);let c=1;for(let d=0;d<s;d++){for(let p=0;p<l.length;p++)l[p]=J.reedSolomonMultiply(l[p],c),p+1<l.length&&(l[p]^=l[p+1]);c=J.reedSolomonMultiply(c,2)}return l}static reedSolomonComputeRemainder(s,l){let c=l.map(d=>0);for(const d of s){const p=d^c.shift();c.push(0),l.forEach((f,g)=>c[g]^=J.reedSolomonMultiply(f,p))}return c}static reedSolomonMultiply(s,l){if(s>>>8||l>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(l>>>d&1)*s;return o(c>>>8==0),c}finderPenaltyCountPatterns(s){const l=s[1];o(l<=this.size*3);const c=l>0&&s[2]==l&&s[3]==l*3&&s[4]==l&&s[5]==l;return(c&&s[0]>=l*4&&s[6]>=l?1:0)+(c&&s[6]>=l*4&&s[0]>=l?1:0)}finderPenaltyTerminateAndCount(s,l,c){return s&&(this.finderPenaltyAddHistory(l,c),l=0),l+=this.size,this.finderPenaltyAddHistory(l,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(s,l){l[0]==0&&(s+=this.size),l.pop(),l.unshift(s)}};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,s,l){if(s<0||s>31||u>>>s)throw new RangeError("Value out of range");for(let c=s-1;c>=0;c--)l.push(u>>>c&1)}function r(u,s){return(u>>>s&1)!=0}function o(u){if(!u)throw new Error("Assertion error")}const i=class de{constructor(s,l,c){if(this.mode=s,this.numChars=l,this.bitData=c,l<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(s){let l=[];for(const c of s)n(c,8,l);return new de(de.Mode.BYTE,s.length,l)}static makeNumeric(s){if(!de.isNumeric(s))throw new RangeError("String contains non-numeric characters");let l=[];for(let c=0;c<s.length;){const d=Math.min(s.length-c,3);n(parseInt(s.substring(c,c+d),10),d*3+1,l),c+=d}return new de(de.Mode.NUMERIC,s.length,l)}static makeAlphanumeric(s){if(!de.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],c;for(c=0;c+2<=s.length;c+=2){let d=de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c))*45;d+=de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c+1)),n(d,11,l)}return c<s.length&&n(de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c)),6,l),new de(de.Mode.ALPHANUMERIC,s.length,l)}static makeSegments(s){return s==""?[]:de.isNumeric(s)?[de.makeNumeric(s)]:de.isAlphanumeric(s)?[de.makeAlphanumeric(s)]:[de.makeBytes(de.toUtf8ByteArray(s))]}static makeEci(s){let l=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)n(s,8,l);else if(s<16384)n(2,2,l),n(s,14,l);else if(s<1e6)n(6,3,l),n(s,21,l);else throw new RangeError("ECI assignment value out of range");return new de(de.Mode.ECI,0,l)}static isNumeric(s){return de.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return de.ALPHANUMERIC_REGEX.test(s)}getData(){return this.bitData.slice()}static getTotalBits(s,l){let c=0;for(const d of s){const p=d.mode.numCharCountBits(l);if(d.numChars>=1<<p)return 1/0;c+=4+p+d.bitData.length}return c}static toUtf8ByteArray(s){s=encodeURI(s);let l=[];for(let c=0;c<s.length;c++)s.charAt(c)!="%"?l.push(s.charCodeAt(c)):(l.push(parseInt(s.substring(c+1,c+3),16)),c+=2);return l}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let a=i;e.QrSegment=i})(Tt||(Tt={})),(e=>{(t=>{const n=class{constructor(o,i){this.ordinal=o,this.formatBits=i}};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={}))})(Tt||(Tt={})),(e=>{(t=>{const n=class{constructor(o,i){this.modeBits=o,this.numBitsCharCount=i}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={}))})(Tt||(Tt={}));var jt=Tt;/**
100
108
  * @license qrcode.react
101
109
  * Copyright (c) Paul O'Shannessy
102
110
  * SPDX-License-Identifier: ISC
103
- */var Qf={L:$t.QrCode.Ecc.LOW,M:$t.QrCode.Ecc.MEDIUM,Q:$t.QrCode.Ecc.QUARTILE,H:$t.QrCode.Ecc.HIGH},ts=128,ns="L",rs="#FFFFFF",os="#000000",is=!1,ss=1,Xf=4,Jf=0,Zf=.1;function ls(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(u,a){if(!u&&s!==null){n.push(`M${s+t} ${o+t}h${a-s}v1H${s+t}z`),s=null;return}if(a===r.length-1){if(!u)return;s===null?n.push(`M${a+t},${o+t} h1v1H${a+t}z`):n.push(`M${s+t},${o+t} h${a+1-s}v1H${s+t}z`);return}u&&s===null&&(s=a)})}),n.join("")}function as(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 ed(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Zf),u=o/t,a=(r.width||s)*u,i=(r.height||s)*u,l=r.x==null?e.length/2-a/2:r.x*u,c=r.y==null?e.length/2-i/2:r.y*u,p=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let b=Math.floor(l),y=Math.floor(c),N=Math.ceil(a+l-b),I=Math.ceil(i+c-y);m={x:b,y,w:N,h:I}}const f=r.crossOrigin;return{x:l,y:c,h:i,w:a,excavation:m,opacity:p,crossOrigin:f}}function td(e,t){return t!=null?Math.max(Math.floor(t),0):e?Xf:Jf}function us({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:u,boostLevel:a}){let i=d.useMemo(()=>{const b=(Array.isArray(e)?e:[e]).reduce((y,N)=>(y.push(...$t.QrSegment.makeSegments(N)),y),[]);return $t.QrCode.encodeSegments(b,Qf[t],n,void 0,void 0,a)},[e,t,n,a]);const{cells:l,margin:c,numCells:p,calculatedImageSettings:m}=d.useMemo(()=>{let f=i.getModules();const b=td(r,o),y=f.length+b*2,N=ed(f,u,b,s);return{cells:f,margin:b,numCells:y,calculatedImageSettings:N}},[i,u,s,r,o]);return{qrcode:i,margin:c,cells:l,numCells:p,calculatedImageSettings:m}}var nd=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),rd=d.forwardRef(function(t,n){const r=t,{value:o,size:s=ts,level:u=ns,bgColor:a=rs,fgColor:i=os,includeMargin:l=is,minVersion:c=ss,boostLevel:p,marginSize:m,imageSettings:f}=r,y=Mr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:N}=y,I=Mr(y,["style"]),w=f==null?void 0:f.src,T=d.useRef(null),j=d.useRef(null),_=d.useCallback(P=>{T.current=P,typeof n=="function"?n(P):n&&(n.current=P)},[n]),[B,W]=d.useState(!1),{margin:h,cells:v,numCells:g,calculatedImageSettings:x}=us({value:o,level:u,minVersion:c,boostLevel:p,includeMargin:l,marginSize:m,imageSettings:f,size:s});d.useEffect(()=>{if(T.current!=null){const P=T.current,S=P.getContext("2d");if(!S)return;let $=v;const L=j.current,E=x!=null&&L!==null&&L.complete&&L.naturalHeight!==0&&L.naturalWidth!==0;E&&x.excavation!=null&&($=as(v,x.excavation));const D=window.devicePixelRatio||1;P.height=P.width=s*D;const F=s/g*D;S.scale(F,F),S.fillStyle=a,S.fillRect(0,0,g,g),S.fillStyle=i,nd?S.fill(new Path2D(ls($,h))):v.forEach(function(R,U){R.forEach(function(G,ee){G&&S.fillRect(ee+h,U+h,1,1)})}),x&&(S.globalAlpha=x.opacity),E&&S.drawImage(L,x.x+h,x.y+h,x.w,x.h)}}),d.useEffect(()=>{W(!1)},[w]);const C=Pr({height:s,width:s},N);let A=null;return w!=null&&(A=d.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{W(!0)},ref:j,crossOrigin:x==null?void 0:x.crossOrigin})),d.createElement(d.Fragment,null,d.createElement("canvas",Pr({style:C,height:s,width:s,ref:_,role:"img"},I)),A)});rd.displayName="QRCodeCanvas";var cs=d.forwardRef(function(t,n){const r=t,{value:o,size:s=ts,level:u=ns,bgColor:a=rs,fgColor:i=os,includeMargin:l=is,minVersion:c=ss,boostLevel:p,title:m,marginSize:f,imageSettings:b}=r,y=Mr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:N,cells:I,numCells:w,calculatedImageSettings:T}=us({value:o,level:u,minVersion:c,boostLevel:p,includeMargin:l,marginSize:f,imageSettings:b,size:s});let j=I,_=null;b!=null&&T!=null&&(T.excavation!=null&&(j=as(I,T.excavation)),_=d.createElement("image",{href:b.src,height:T.h,width:T.w,x:T.x+N,y:T.y+N,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const B=ls(j,N);return d.createElement("svg",Pr({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},y),!!m&&d.createElement("title",null,m),d.createElement("path",{fill:a,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),d.createElement("path",{fill:i,d:B,shapeRendering:"crispEdges"}),_)});cs.displayName="QRCodeSVG";const fs="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",od=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var u;const s=d.useMemo(()=>Nf(n||{}),[n]);return M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex justify-center mt-4 mb-3",children:M.jsx("div",{className:"bg-white rounded-lg",children:M.jsx(cs,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),M.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[M.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),M.jsx(Kf,{onCopy:()=>{const a=(e==null?void 0:e.getDisplayAddress())||"";o&&o(a)},text:e==null?void 0:e.getDisplayAddress(),children:M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[M.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),M.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),M.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[M.jsxs("div",{className:"flex items-start",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:fs,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1",children:M.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."]})})]}),s&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."})]})]}),M.jsxs("div",{className:"text-sm",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[M.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),M.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"]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((u=r==null?void 0:r.multiChain)==null?void 0:u.minDeposit)||10," ",t]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},id=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onCopy:u,onClose:a})=>{var b;const[i,l]=d.useState(()=>{var y;return!e||e.length===0?1:t||((y=e[0])==null?void 0:y.chainId)||1}),[c,p]=d.useState(()=>{var w;if(!e||e.length===0)return"";const y=t||((w=e[0])==null?void 0:w.chainId),N=e.find(T=>T.chainId===y);if(!N||!N.tokenList||N.tokenList.length===0)return"";const I=N.tokenList.find(T=>T.tokenAddress===n)||N.tokenList[0];return(I==null?void 0:I.token)||""}),m=e&&e.length>0?e.find(y=>y.chainId===i)||e[0]:null,f=(b=m==null?void 0:m.tokenList)==null?void 0:b.find(y=>y.token===c);return!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):m?M.jsxs(M.Fragment,{children:[M.jsx(wr,{currentActiveChain:m,chainList:e,onChainChange:l,curSelectToken:c,onTokenChange:p,walletType:"mpc"}),M.jsx(od,{walletAdapter:r,curSelectToken:c,currentActiveChain:m,metadata:o,onCopy:u}),M.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{s&&s({amount:"",chainId:i,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:c}),a()},children:"Deposit"})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})};var sd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Lr=Math.ceil,Ie=Math.floor,Ce="[BigNumber Error] ",ds=Ce+"Number primitive has more than 15 significant digits: ",Ve=1e14,K=14,Ir=9007199254740991,Dr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ut=1e7,ge=1e9;function ps(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},s=new w(1),u=20,a=4,i=-7,l=21,c=-1e7,p=1e7,m=!1,f=1,b=0,y={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},N="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function w(h,v){var g,x,C,A,P,S,$,L,E=this;if(!(E instanceof w))return new w(h,v);if(v==null){if(h&&h._isBigNumber===!0){E.s=h.s,!h.c||h.e>p?E.c=E.e=null:h.e<c?E.c=[E.e=0]:(E.e=h.e,E.c=h.c.slice());return}if((S=typeof h=="number")&&h*0==0){if(E.s=1/h<0?(h=-h,-1):1,h===~~h){for(A=0,P=h;P>=10;P/=10,A++);A>p?E.c=E.e=null:(E.e=A,E.c=[h]);return}L=String(h)}else{if(!sd.test(L=String(h)))return r(E,L,S);E.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(A=L.indexOf("."))>-1&&(L=L.replace(".","")),(P=L.search(/e/i))>0?(A<0&&(A=P),A+=+L.slice(P+1),L=L.substring(0,P)):A<0&&(A=L.length)}else{if(ue(v,2,N.length,"Base"),v==10&&I)return E=new w(h),B(E,u+E.e+1,a);if(L=String(h),S=typeof h=="number"){if(h*0!=0)return r(E,L,S,v);if(E.s=1/h<0?(L=L.slice(1),-1):1,w.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(ds+h)}else E.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(g=N.slice(0,v),A=P=0,$=L.length;P<$;P++)if(g.indexOf(x=L.charAt(P))<0){if(x=="."){if(P>A){A=$;continue}}else if(!C&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){C=!0,P=-1,A=0;continue}return r(E,String(h),S,v)}S=!1,L=n(L,v,10,E.s),(A=L.indexOf("."))>-1?L=L.replace(".",""):A=L.length}for(P=0;L.charCodeAt(P)===48;P++);for($=L.length;L.charCodeAt(--$)===48;);if(L=L.slice(P,++$)){if($-=P,S&&w.DEBUG&&$>15&&(h>Ir||h!==Ie(h)))throw Error(ds+E.s*h);if((A=A-P-1)>p)E.c=E.e=null;else if(A<c)E.c=[E.e=0];else{if(E.e=A,E.c=[],P=(A+1)%K,A<0&&(P+=K),P<$){for(P&&E.c.push(+L.slice(0,P)),$-=K;P<$;)E.c.push(+L.slice(P,P+=K));P=K-(L=L.slice(P)).length}else P-=$;for(;P--;L+="0");E.c.push(+L)}}else E.c=[E.e=0]}w.clone=ps,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(h){var v,g;if(h!=null)if(typeof h=="object"){if(h.hasOwnProperty(v="DECIMAL_PLACES")&&(g=h[v],ue(g,0,ge,v),u=g),h.hasOwnProperty(v="ROUNDING_MODE")&&(g=h[v],ue(g,0,8,v),a=g),h.hasOwnProperty(v="EXPONENTIAL_AT")&&(g=h[v],g&&g.pop?(ue(g[0],-ge,0,v),ue(g[1],0,ge,v),i=g[0],l=g[1]):(ue(g,-ge,ge,v),i=-(l=g<0?-g:g))),h.hasOwnProperty(v="RANGE"))if(g=h[v],g&&g.pop)ue(g[0],-ge,-1,v),ue(g[1],1,ge,v),c=g[0],p=g[1];else if(ue(g,-ge,ge,v),g)c=-(p=g<0?-g:g);else throw Error(Ce+v+" cannot be zero: "+g);if(h.hasOwnProperty(v="CRYPTO"))if(g=h[v],g===!!g)if(g)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=g;else throw m=!g,Error(Ce+"crypto unavailable");else m=g;else throw Error(Ce+v+" not true or false: "+g);if(h.hasOwnProperty(v="MODULO_MODE")&&(g=h[v],ue(g,0,9,v),f=g),h.hasOwnProperty(v="POW_PRECISION")&&(g=h[v],ue(g,0,ge,v),b=g),h.hasOwnProperty(v="FORMAT"))if(g=h[v],typeof g=="object")y=g;else throw Error(Ce+v+" not an object: "+g);if(h.hasOwnProperty(v="ALPHABET"))if(g=h[v],typeof g=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(g))I=g.slice(0,10)=="0123456789",N=g;else throw Error(Ce+v+" invalid: "+g)}else throw Error(Ce+"Object expected: "+h);return{DECIMAL_PLACES:u,ROUNDING_MODE:a,EXPONENTIAL_AT:[i,l],RANGE:[c,p],CRYPTO:m,MODULO_MODE:f,POW_PRECISION:b,FORMAT:y,ALPHABET:N}},w.isBigNumber=function(h){if(!h||h._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var v,g,x=h.c,C=h.e,A=h.s;e:if({}.toString.call(x)=="[object Array]"){if((A===1||A===-1)&&C>=-ge&&C<=ge&&C===Ie(C)){if(x[0]===0){if(C===0&&x.length===1)return!0;break e}if(v=(C+1)%K,v<1&&(v+=K),String(x[0]).length==v){for(v=0;v<x.length;v++)if(g=x[v],g<0||g>=Ve||g!==Ie(g))break e;if(g!==0)return!0}}}else if(x===null&&C===null&&(A===null||A===1||A===-1))return!0;throw Error(Ce+"Invalid BigNumber: "+h)},w.maximum=w.max=function(){return j(arguments,-1)},w.minimum=w.min=function(){return j(arguments,1)},w.random=function(){var h=9007199254740992,v=Math.random()*h&2097151?function(){return Ie(Math.random()*h)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(g){var x,C,A,P,S,$=0,L=[],E=new w(s);if(g==null?g=u:ue(g,0,ge),P=Lr(g/K),m)if(crypto.getRandomValues){for(x=crypto.getRandomValues(new Uint32Array(P*=2));$<P;)S=x[$]*131072+(x[$+1]>>>11),S>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),x[$]=C[0],x[$+1]=C[1]):(L.push(S%1e14),$+=2);$=P/2}else if(crypto.randomBytes){for(x=crypto.randomBytes(P*=7);$<P;)S=(x[$]&31)*281474976710656+x[$+1]*1099511627776+x[$+2]*4294967296+x[$+3]*16777216+(x[$+4]<<16)+(x[$+5]<<8)+x[$+6],S>=9e15?crypto.randomBytes(7).copy(x,$):(L.push(S%1e14),$+=7);$=P/7}else throw m=!1,Error(Ce+"crypto unavailable");if(!m)for(;$<P;)S=v(),S<9e15&&(L[$++]=S%1e14);for(P=L[--$],g%=K,P&&g&&(S=Dr[K-g],L[$]=Ie(P/S)*S);L[$]===0;L.pop(),$--);if($<0)L=[A=0];else{for(A=-1;L[0]===0;L.splice(0,1),A-=K);for($=1,S=L[0];S>=10;S/=10,$++);$<K&&(A-=K-$)}return E.e=A,E.c=L,E}}(),w.sum=function(){for(var h=1,v=arguments,g=new w(v[0]);h<v.length;)g=g.plus(v[h++]);return g},n=function(){var h="0123456789";function v(g,x,C,A){for(var P,S=[0],$,L=0,E=g.length;L<E;){for($=S.length;$--;S[$]*=x);for(S[0]+=A.indexOf(g.charAt(L++)),P=0;P<S.length;P++)S[P]>C-1&&(S[P+1]==null&&(S[P+1]=0),S[P+1]+=S[P]/C|0,S[P]%=C)}return S.reverse()}return function(g,x,C,A,P){var S,$,L,E,D,F,R,U,G=g.indexOf("."),ee=u,q=a;for(G>=0&&(E=b,b=0,g=g.replace(".",""),U=new w(x),F=U.pow(g.length-G),b=E,U.c=v(tt(Fe(F.c),F.e,"0"),10,C,h),U.e=U.c.length),R=v(g,x,C,P?(S=N,h):(S=h,N)),L=E=R.length;R[--E]==0;R.pop());if(!R[0])return S.charAt(0);if(G<0?--L:(F.c=R,F.e=L,F.s=A,F=t(F,U,ee,q,C),R=F.c,D=F.r,L=F.e),$=L+ee+1,G=R[$],E=C/2,D=D||$<0||R[$+1]!=null,D=q<4?(G!=null||D)&&(q==0||q==(F.s<0?3:2)):G>E||G==E&&(q==4||D||q==6&&R[$-1]&1||q==(F.s<0?8:7)),$<1||!R[0])g=D?tt(S.charAt(1),-ee,S.charAt(0)):S.charAt(0);else{if(R.length=$,D)for(--C;++R[--$]>C;)R[$]=0,$||(++L,R=[1].concat(R));for(E=R.length;!R[--E];);for(G=0,g="";G<=E;g+=S.charAt(R[G++]));g=tt(g,L,S.charAt(0))}return g}}(),t=function(){function h(x,C,A){var P,S,$,L,E=0,D=x.length,F=C%ut,R=C/ut|0;for(x=x.slice();D--;)$=x[D]%ut,L=x[D]/ut|0,P=R*$+L*F,S=F*$+P%ut*ut+E,E=(S/A|0)+(P/ut|0)+R*L,x[D]=S%A;return E&&(x=[E].concat(x)),x}function v(x,C,A,P){var S,$;if(A!=P)$=A>P?1:-1;else for(S=$=0;S<A;S++)if(x[S]!=C[S]){$=x[S]>C[S]?1:-1;break}return $}function g(x,C,A,P){for(var S=0;A--;)x[A]-=S,S=x[A]<C[A]?1:0,x[A]=S*P+x[A]-C[A];for(;!x[0]&&x.length>1;x.splice(0,1));}return function(x,C,A,P,S){var $,L,E,D,F,R,U,G,ee,q,X,z,re,de,_e,je,ct,Se=x.s==C.s?1:-1,ve=x.c,ie=C.c;if(!ve||!ve[0]||!ie||!ie[0])return new w(!x.s||!C.s||(ve?ie&&ve[0]==ie[0]:!ie)?NaN:ve&&ve[0]==0||!ie?Se*0:Se/0);for(G=new w(Se),ee=G.c=[],L=x.e-C.e,Se=A+L+1,S||(S=Ve,L=De(x.e/K)-De(C.e/K),Se=Se/K|0),E=0;ie[E]==(ve[E]||0);E++);if(ie[E]>(ve[E]||0)&&L--,Se<0)ee.push(1),D=!0;else{for(de=ve.length,je=ie.length,E=0,Se+=2,F=Ie(S/(ie[0]+1)),F>1&&(ie=h(ie,F,S),ve=h(ve,F,S),je=ie.length,de=ve.length),re=je,q=ve.slice(0,je),X=q.length;X<je;q[X++]=0);ct=ie.slice(),ct=[0].concat(ct),_e=ie[0],ie[1]>=S/2&&_e++;do{if(F=0,$=v(ie,q,je,X),$<0){if(z=q[0],je!=X&&(z=z*S+(q[1]||0)),F=Ie(z/_e),F>1)for(F>=S&&(F=S-1),R=h(ie,F,S),U=R.length,X=q.length;v(R,q,U,X)==1;)F--,g(R,je<U?ct:ie,U,S),U=R.length,$=1;else F==0&&($=F=1),R=ie.slice(),U=R.length;if(U<X&&(R=[0].concat(R)),g(q,R,X,S),X=q.length,$==-1)for(;v(ie,q,je,X)<1;)F++,g(q,je<X?ct:ie,X,S),X=q.length}else $===0&&(F++,q=[0]);ee[E++]=F,q[0]?q[X++]=ve[re]||0:(q=[ve[re]],X=1)}while((re++<de||q[0]!=null)&&Se--);D=q[0]!=null,ee[0]||ee.splice(0,1)}if(S==Ve){for(E=1,Se=ee[0];Se>=10;Se/=10,E++);B(G,A+(G.e=E+L*K-1)+1,P,D)}else G.e=L,G.r=+D;return G}}();function T(h,v,g,x){var C,A,P,S,$;if(g==null?g=a:ue(g,0,8),!h.c)return h.toString();if(C=h.c[0],P=h.e,v==null)$=Fe(h.c),$=x==1||x==2&&(P<=i||P>=l)?Sn($,P):tt($,P,"0");else if(h=B(new w(h),v,g),A=h.e,$=Fe(h.c),S=$.length,x==1||x==2&&(v<=A||A<=i)){for(;S<v;$+="0",S++);$=Sn($,A)}else if(v-=P+(x===2&&A>P),$=tt($,A,"0"),A+1>S){if(--v>0)for($+=".";v--;$+="0");}else if(v+=A-S,v>0)for(A+1==S&&($+=".");v--;$+="0");return h.s<0&&C?"-"+$:$}function j(h,v){for(var g,x,C=1,A=new w(h[0]);C<h.length;C++)x=new w(h[C]),(!x.s||(g=bt(A,x))===v||g===0&&A.s===v)&&(A=x);return A}function _(h,v,g){for(var x=1,C=v.length;!v[--C];v.pop());for(C=v[0];C>=10;C/=10,x++);return(g=x+g*K-1)>p?h.c=h.e=null:g<c?h.c=[h.e=0]:(h.e=g,h.c=v),h}r=function(){var h=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,g=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,P,S,$){var L,E=S?P:P.replace(C,"");if(x.test(E))A.s=isNaN(E)?null:E<0?-1:1;else{if(!S&&(E=E.replace(h,function(D,F,R){return L=(R=R.toLowerCase())=="x"?16:R=="b"?2:8,!$||$==L?F:D}),$&&(L=$,E=E.replace(v,"$1").replace(g,"0.$1")),P!=E))return new w(E,L);if(w.DEBUG)throw Error(Ce+"Not a"+($?" base "+$:"")+" number: "+P);A.s=null}A.c=A.e=null}}();function B(h,v,g,x){var C,A,P,S,$,L,E,D=h.c,F=Dr;if(D){e:{for(C=1,S=D[0];S>=10;S/=10,C++);if(A=v-C,A<0)A+=K,P=v,$=D[L=0],E=Ie($/F[C-P-1]%10);else if(L=Lr((A+1)/K),L>=D.length)if(x){for(;D.length<=L;D.push(0));$=E=0,C=1,A%=K,P=A-K+1}else break e;else{for($=S=D[L],C=1;S>=10;S/=10,C++);A%=K,P=A-K+C,E=P<0?0:Ie($/F[C-P-1]%10)}if(x=x||v<0||D[L+1]!=null||(P<0?$:$%F[C-P-1]),x=g<4?(E||x)&&(g==0||g==(h.s<0?3:2)):E>5||E==5&&(g==4||x||g==6&&(A>0?P>0?$/F[C-P]:0:D[L-1])%10&1||g==(h.s<0?8:7)),v<1||!D[0])return D.length=0,x?(v-=h.e+1,D[0]=F[(K-v%K)%K],h.e=-v||0):D[0]=h.e=0,h;if(A==0?(D.length=L,S=1,L--):(D.length=L+1,S=F[K-A],D[L]=P>0?Ie($/F[C-P]%F[P])*S:0),x)for(;;)if(L==0){for(A=1,P=D[0];P>=10;P/=10,A++);for(P=D[0]+=S,S=1;P>=10;P/=10,S++);A!=S&&(h.e++,D[0]==Ve&&(D[0]=1));break}else{if(D[L]+=S,D[L]!=Ve)break;D[L--]=0,S=1}for(A=D.length;D[--A]===0;D.pop());}h.e>p?h.c=h.e=null:h.e<c&&(h.c=[h.e=0])}return h}function W(h){var v,g=h.e;return g===null?h.toString():(v=Fe(h.c),v=g<=i||g>=l?Sn(v,g):tt(v,g,"0"),h.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var h=new w(this);return h.s<0&&(h.s=1),h},o.comparedTo=function(h,v){return bt(this,new w(h,v))},o.decimalPlaces=o.dp=function(h,v){var g,x,C,A=this;if(h!=null)return ue(h,0,ge),v==null?v=a:ue(v,0,8),B(new w(A),h+A.e+1,v);if(!(g=A.c))return null;if(x=((C=g.length-1)-De(this.e/K))*K,C=g[C])for(;C%10==0;C/=10,x--);return x<0&&(x=0),x},o.dividedBy=o.div=function(h,v){return t(this,new w(h,v),u,a)},o.dividedToIntegerBy=o.idiv=function(h,v){return t(this,new w(h,v),0,1)},o.exponentiatedBy=o.pow=function(h,v){var g,x,C,A,P,S,$,L,E,D=this;if(h=new w(h),h.c&&!h.isInteger())throw Error(Ce+"Exponent not an integer: "+W(h));if(v!=null&&(v=new w(v)),S=h.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!h.c||!h.c[0])return E=new w(Math.pow(+W(D),S?h.s*(2-Cn(h)):+W(h))),v?E.mod(v):E;if($=h.s<0,v){if(v.c?!v.c[0]:!v.s)return new w(NaN);x=!$&&D.isInteger()&&v.isInteger(),x&&(D=D.mod(v))}else{if(h.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||S&&D.c[1]>=24e7:D.c[0]<8e13||S&&D.c[0]<=9999975e7)))return A=D.s<0&&Cn(h)?-0:0,D.e>-1&&(A=1/A),new w($?1/A:A);b&&(A=Lr(b/K+2))}for(S?(g=new w(.5),$&&(h.s=1),L=Cn(h)):(C=Math.abs(+W(h)),L=C%2),E=new w(s);;){if(L){if(E=E.times(D),!E.c)break;A?E.c.length>A&&(E.c.length=A):x&&(E=E.mod(v))}if(C){if(C=Ie(C/2),C===0)break;L=C%2}else if(h=h.times(g),B(h,h.e+1,1),h.e>14)L=Cn(h);else{if(C=+W(h),C===0)break;L=C%2}D=D.times(D),A?D.c&&D.c.length>A&&(D.c.length=A):x&&(D=D.mod(v))}return x?E:($&&(E=s.div(E)),v?E.mod(v):A?B(E,b,a,P):E)},o.integerValue=function(h){var v=new w(this);return h==null?h=a:ue(h,0,8),B(v,v.e+1,h)},o.isEqualTo=o.eq=function(h,v){return bt(this,new w(h,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(h,v){return bt(this,new w(h,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(h,v){return(v=bt(this,new w(h,v)))===1||v===0},o.isInteger=function(){return!!this.c&&De(this.e/K)>this.c.length-2},o.isLessThan=o.lt=function(h,v){return bt(this,new w(h,v))<0},o.isLessThanOrEqualTo=o.lte=function(h,v){return(v=bt(this,new w(h,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(h,v){var g,x,C,A,P=this,S=P.s;if(h=new w(h,v),v=h.s,!S||!v)return new w(NaN);if(S!=v)return h.s=-v,P.plus(h);var $=P.e/K,L=h.e/K,E=P.c,D=h.c;if(!$||!L){if(!E||!D)return E?(h.s=-v,h):new w(D?P:NaN);if(!E[0]||!D[0])return D[0]?(h.s=-v,h):new w(E[0]?P:a==3?-0:0)}if($=De($),L=De(L),E=E.slice(),S=$-L){for((A=S<0)?(S=-S,C=E):(L=$,C=D),C.reverse(),v=S;v--;C.push(0));C.reverse()}else for(x=(A=(S=E.length)<(v=D.length))?S:v,S=v=0;v<x;v++)if(E[v]!=D[v]){A=E[v]<D[v];break}if(A&&(C=E,E=D,D=C,h.s=-h.s),v=(x=D.length)-(g=E.length),v>0)for(;v--;E[g++]=0);for(v=Ve-1;x>S;){if(E[--x]<D[x]){for(g=x;g&&!E[--g];E[g]=v);--E[g],E[x]+=Ve}E[x]-=D[x]}for(;E[0]==0;E.splice(0,1),--L);return E[0]?_(h,E,L):(h.s=a==3?-1:1,h.c=[h.e=0],h)},o.modulo=o.mod=function(h,v){var g,x,C=this;return h=new w(h,v),!C.c||!h.s||h.c&&!h.c[0]?new w(NaN):!h.c||C.c&&!C.c[0]?new w(C):(f==9?(x=h.s,h.s=1,g=t(C,h,0,3),h.s=x,g.s*=x):g=t(C,h,0,f),h=C.minus(g.times(h)),!h.c[0]&&f==1&&(h.s=C.s),h)},o.multipliedBy=o.times=function(h,v){var g,x,C,A,P,S,$,L,E,D,F,R,U,G,ee,q=this,X=q.c,z=(h=new w(h,v)).c;if(!X||!z||!X[0]||!z[0])return!q.s||!h.s||X&&!X[0]&&!z||z&&!z[0]&&!X?h.c=h.e=h.s=null:(h.s*=q.s,!X||!z?h.c=h.e=null:(h.c=[0],h.e=0)),h;for(x=De(q.e/K)+De(h.e/K),h.s*=q.s,$=X.length,D=z.length,$<D&&(U=X,X=z,z=U,C=$,$=D,D=C),C=$+D,U=[];C--;U.push(0));for(G=Ve,ee=ut,C=D;--C>=0;){for(g=0,F=z[C]%ee,R=z[C]/ee|0,P=$,A=C+P;A>C;)L=X[--P]%ee,E=X[P]/ee|0,S=R*L+E*F,L=F*L+S%ee*ee+U[A]+g,g=(L/G|0)+(S/ee|0)+R*E,U[A--]=L%G;U[A]=g}return g?++x:U.splice(0,1),_(h,U,x)},o.negated=function(){var h=new w(this);return h.s=-h.s||null,h},o.plus=function(h,v){var g,x=this,C=x.s;if(h=new w(h,v),v=h.s,!C||!v)return new w(NaN);if(C!=v)return h.s=-v,x.minus(h);var A=x.e/K,P=h.e/K,S=x.c,$=h.c;if(!A||!P){if(!S||!$)return new w(C/0);if(!S[0]||!$[0])return $[0]?h:new w(S[0]?x:C*0)}if(A=De(A),P=De(P),S=S.slice(),C=A-P){for(C>0?(P=A,g=$):(C=-C,g=S),g.reverse();C--;g.push(0));g.reverse()}for(C=S.length,v=$.length,C-v<0&&(g=$,$=S,S=g,v=C),C=0;v;)C=(S[--v]=S[v]+$[v]+C)/Ve|0,S[v]=Ve===S[v]?0:S[v]%Ve;return C&&(S=[C].concat(S),++P),_(h,S,P)},o.precision=o.sd=function(h,v){var g,x,C,A=this;if(h!=null&&h!==!!h)return ue(h,1,ge),v==null?v=a:ue(v,0,8),B(new w(A),h,v);if(!(g=A.c))return null;if(C=g.length-1,x=C*K+1,C=g[C]){for(;C%10==0;C/=10,x--);for(C=g[0];C>=10;C/=10,x++);}return h&&A.e+1>x&&(x=A.e+1),x},o.shiftedBy=function(h){return ue(h,-Ir,Ir),this.times("1e"+h)},o.squareRoot=o.sqrt=function(){var h,v,g,x,C,A=this,P=A.c,S=A.s,$=A.e,L=u+4,E=new w("0.5");if(S!==1||!P||!P[0])return new w(!S||S<0&&(!P||P[0])?NaN:P?A:1/0);if(S=Math.sqrt(+W(A)),S==0||S==1/0?(v=Fe(P),(v.length+$)%2==0&&(v+="0"),S=Math.sqrt(+v),$=De(($+1)/2)-($<0||$%2),S==1/0?v="5e"+$:(v=S.toExponential(),v=v.slice(0,v.indexOf("e")+1)+$),g=new w(v)):g=new w(S+""),g.c[0]){for($=g.e,S=$+L,S<3&&(S=0);;)if(C=g,g=E.times(C.plus(t(A,C,L,1))),Fe(C.c).slice(0,S)===(v=Fe(g.c)).slice(0,S))if(g.e<$&&--S,v=v.slice(S-3,S+1),v=="9999"||!x&&v=="4999"){if(!x&&(B(C,C.e+u+2,0),C.times(C).eq(A))){g=C;break}L+=4,S+=4,x=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(B(g,g.e+u+2,1),h=!g.times(g).eq(A));break}}return B(g,g.e+u+1,a,h)},o.toExponential=function(h,v){return h!=null&&(ue(h,0,ge),h++),T(this,h,v,1)},o.toFixed=function(h,v){return h!=null&&(ue(h,0,ge),h=h+this.e+1),T(this,h,v)},o.toFormat=function(h,v,g){var x,C=this;if(g==null)h!=null&&v&&typeof v=="object"?(g=v,v=null):h&&typeof h=="object"?(g=h,h=v=null):g=y;else if(typeof g!="object")throw Error(Ce+"Argument not an object: "+g);if(x=C.toFixed(h,v),C.c){var A,P=x.split("."),S=+g.groupSize,$=+g.secondaryGroupSize,L=g.groupSeparator||"",E=P[0],D=P[1],F=C.s<0,R=F?E.slice(1):E,U=R.length;if($&&(A=S,S=$,$=A,U-=A),S>0&&U>0){for(A=U%S||S,E=R.substr(0,A);A<U;A+=S)E+=L+R.substr(A,S);$>0&&(E+=L+R.slice(A)),F&&(E="-"+E)}x=D?E+(g.decimalSeparator||"")+(($=+g.fractionGroupSize)?D.replace(new RegExp("\\d{"+$+"}\\B","g"),"$&"+(g.fractionGroupSeparator||"")):D):E}return(g.prefix||"")+x+(g.suffix||"")},o.toFraction=function(h){var v,g,x,C,A,P,S,$,L,E,D,F,R=this,U=R.c;if(h!=null&&(S=new w(h),!S.isInteger()&&(S.c||S.s!==1)||S.lt(s)))throw Error(Ce+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+W(S));if(!U)return new w(R);for(v=new w(s),L=g=new w(s),x=$=new w(s),F=Fe(U),A=v.e=F.length-R.e-1,v.c[0]=Dr[(P=A%K)<0?K+P:P],h=!h||S.comparedTo(v)>0?A>0?v:L:S,P=p,p=1/0,S=new w(F),$.c[0]=0;E=t(S,v,0,1),C=g.plus(E.times(x)),C.comparedTo(h)!=1;)g=x,x=C,L=$.plus(E.times(C=L)),$=C,v=S.minus(E.times(C=v)),S=C;return C=t(h.minus(g),x,0,1),$=$.plus(C.times(L)),g=g.plus(C.times(x)),$.s=L.s=R.s,A=A*2,D=t(L,x,A,a).minus(R).abs().comparedTo(t($,g,A,a).minus(R).abs())<1?[L,x]:[$,g],p=P,D},o.toNumber=function(){return+W(this)},o.toPrecision=function(h,v){return h!=null&&ue(h,1,ge),T(this,h,v,2)},o.toString=function(h){var v,g=this,x=g.s,C=g.e;return C===null?x?(v="Infinity",x<0&&(v="-"+v)):v="NaN":(h==null?v=C<=i||C>=l?Sn(Fe(g.c),C):tt(Fe(g.c),C,"0"):h===10&&I?(g=B(new w(g),u+C+1,a),v=tt(Fe(g.c),g.e,"0")):(ue(h,2,N.length,"Base"),v=n(tt(Fe(g.c),C,"0"),10,h,x,!0)),x<0&&g.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return W(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function De(e){var t=e|0;return e>0||e===t?t:t-1}function Fe(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=K-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function bt(e,t){var n,r,o=e.c,s=t.c,u=e.s,a=t.s,i=e.e,l=t.e;if(!u||!a)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-a:u;if(u!=a)return u;if(n=u<0,r=i==l,!o||!s)return r?0:!o^n?1:-1;if(!r)return i>l^n?1:-1;for(a=(i=o.length)<(l=s.length)?i:l,u=0;u<a;u++)if(o[u]!=s[u])return o[u]>s[u]^n?1:-1;return i==l?0:i>l^n?1:-1}function ue(e,t,n,r){if(e<t||e>n||e!==Ie(e))throw Error(Ce+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Cn(e){var t=e.c.length-1;return De(e.e/K)==t&&e.c[t]%2!=0}function Sn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function tt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var hs=ps();const ld=Object.values({MAINNET:1,SEPOLIA:11155111}),On=e=>ld.includes(+e),ad=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:u,decimals:a,tokenBalance:i,platformBalance:l="0",onDepositAmountChange:c,onApprove:p})=>{const m=d.useMemo(()=>{if(On(o==null?void 0:o.chainId))return!1;try{const y=new hs(e||"0"),N=new hs("250000");return y.isNaN()||N.isNaN()?!1:y.gte(N)}catch{return!1}},[o,e]),f=y=>{const N=y.target.value,w=Er(N,i||"0");if(w.isValid)c(w.formattedValue),w.errorType;else return w.errorType==="exceed_balance",void 0},b=()=>{const y=parseFloat(i||"0"),N=parseFloat(e||"0");if(N>0){const I=y-N,w=Ue(Math.max(0,I).toString());return`${Ue(i||"0")} → ${w} ${t}`}return`${Ue(i||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:f,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:()=>{c(i||"0")},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:b()})]})]}),!r&&Sf(e||"0",0)&&M.jsxs("div",{className:"flex justify-center flex-col items-center",children:[M.jsxs("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:["Enable ",t," on ",o==null?void 0:o.chain]}),M.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,"."]}),M.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]})]}),m&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:fs,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",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."})]}),M.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:"总资产"}),M.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?`${Ue(l)} → ${Ue((parseFloat(l)+parseFloat(e)).toString())} ${t}`:`${Ue(l)} ${t}`})]})})]})},ud=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var i,l;const u=(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)}}),a=(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:u,allowance:a})},[u,a,e.tokenAddress,s]),null},ms=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var b;const s=d.useMemo(()=>r.filter(y=>y.tokenAddress&&y.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[u,a]=d.useState({}),i=d.useCallback((y,N)=>{a(I=>({...I,[y]:N}))},[]),l=(b=o==null?void 0:o.useBalance)==null?void 0:b.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),c=d.useMemo(()=>s.map(y=>d.createElement(ud,{key:y.tokenAddress,token:y,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 y=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=s.map(T=>{const j=u[T.tokenAddress],_=j==null?void 0:j.balance,B=_==null?void 0:_.data;return{address:T.tokenAddress,value:(B==null?void 0:B.value)||BigInt(0),formatted:(B==null?void 0:B.formatted)||"0",decimals:(B==null?void 0:B.decimals)||T.decimals}}).filter(T=>T.address),I=s.map(T=>{const j=u[T.tokenAddress],_=j==null?void 0:j.allowance,B=_==null?void 0:_.data,W=BigInt(B?B.toString():0);return{address:T.tokenAddress,value:W,formatted:(W/BigInt(10)**BigInt(T.decimals)).toString(),decimals:T.decimals}}).filter(T=>T.address),w=N.reduce((T,j)=>{const _=I.find(B=>B.address===j.address);return{...T,[j.address]:{balance:j,allowance:_||{address:j.address,value:BigInt(0),formatted:"0",decimals:j.decimals}}}},{});return{balanceList:N,allowanceList:I,baseTokenBalance:y,combinedData:w}},[l,u,s,o==null?void 0:o.useBalance]),m=d.useCallback(async()=>p,[p]),f=d.useMemo(()=>{const y=(l==null?void 0:l.isLoading)||!1,N=Object.values(u).some(I=>{var w,T;return((w=I.balance)==null?void 0:w.isLoading)||((T=I.allowance)==null?void 0:T.isLoading)});return y||N},[l==null?void 0:l.isLoading,u]);return{multicallRun:m,multicallResult:p,validErcTokens:s,isLoading:f,queryComponents:c}},cd=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:u,platformBalance:a="0",wagmiHooks:i,approved:l,onApproved:c,onDeposit:p,onClose:m,onChainChange:f,onTokenChange:b})=>{var D;const[y,N]=d.useState(()=>{var F;return!e||e.length===0?1:t||((F=e[0])==null?void 0:F.chainId)||1}),[I,w]=d.useState(()=>{var G;if(!e||e.length===0)return"";const F=t||((G=e[0])==null?void 0:G.chainId),R=e.find(ee=>ee.chainId===F);if(!R||!R.tokenList||R.tokenList.length===0)return"";const U=R.tokenList.find(ee=>ee.tokenAddress===n)||R.tokenList[0];return(U==null?void 0:U.token)||""}),[T,j]=d.useState(r),_=d.useCallback(F=>{N(F),f==null||f(F)},[f]),B=d.useCallback(F=>{w(F),b==null||b(F)},[b]),W=d.useRef(!0),h=d.useRef(I),v=d.useRef(y);d.useEffect(()=>{if(W.current){W.current=!1,h.current=I,v.current=y;return}(h.current!==I||v.current!==y)&&(j(""),h.current=I,v.current=y)},[I,y]);const g=e&&e.length>0?e.find(F=>F.chainId===y)||e[0]:null,x=(D=g==null?void 0:g.tokenList)==null?void 0:D.find(F=>F.token===I),C=o==null?void 0:o.getDisplayAddress(),{multicallResult:A,queryComponents:P}=ms({account:C,chainId:y,contractAddress:void 0,tokens:(g==null?void 0:g.tokenList)||[],wagmiHooks:i}),S=d.useMemo(()=>{var R;if(!x)return;if(!x.tokenAddress||x.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return A.baseTokenBalance.formatted;const F=A.combinedData[x.tokenAddress];return((R=F==null?void 0:F.balance)==null?void 0:R.formatted)||"0"},[x,A]),$=l??!1,L=d.useMemo(()=>{const F=parseFloat(T||"0"),R=10,U=S||"0",G=Of(T,U,$);return!T||F===0?{text:"Confirm Deposit",disabled:!0}:$?F>parseFloat(U)?{text:"Insufficient Balance",disabled:!0}:F<R?{text:`Min Deposit ${R} ${I}`,disabled:!0}:{text:"Confirm Deposit",disabled:!G}:{text:"Confirm Deposit",disabled:!0}},[T,I,S,$]),E=d.useCallback(async()=>{p&&p({amount:T,chainId:y,tokenAddress:(x==null?void 0:x.tokenAddress)||"",tokenSymbol:I})},[p,T,y,x==null?void 0:x.tokenAddress,I]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):g?M.jsxs(M.Fragment,{children:[P,M.jsx(wr,{currentActiveChain:g,chainList:e,onChainChange:_,curSelectToken:I,onTokenChange:B,walletType:"evm"}),M.jsx(ad,{depositAmount:T,curSelectToken:I,curSelectTokenData:{balance:x==null?void 0:x.balance,allowance:x==null?void 0:x.allowance},approved:$,currentActiveChain:g,currentEquity:u||0,amount:T,decimals:(x==null?void 0:x.decimals)||6,tokenBalance:S,platformBalance:a,onDepositAmountChange:j,onApprove:async()=>{c&&await c()}}),M.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:E,disabled:L.disabled,children:L.text})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},gs=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=Cr,smartWallet:o=Sr,chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i="",metadata:l=Or,currentEquity:c=5e3,platformBalance:p="0",wagmiHooks:m,approved:f,onApproved:b,onDeposit:y,onCopy:N,onChainChange:I,onTokenChange:w})=>{const T=d.useMemo(()=>{var _;return r?Yr(r,o,!1,(_=s[0])==null?void 0:_.chainId,"0","0"):null},[r,o,s]),j=(T==null?void 0:T.getWalletType())==="mpc";return e?xe.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:_=>{_.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:M.jsx(Hr,{className:"h-4 w-4"})})]}),j?M.jsx(id,{chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i,walletAdapter:T,metadata:l,currentEquity:c,onDeposit:y,onCopy:N,onClose:t}):M.jsx(cd,{chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i,walletAdapter:T,metadata:l,currentEquity:c,platformBalance:p,wagmiHooks:m,approved:f,onApproved:b,onDeposit:y,onClose:t,onChainChange:I,onTokenChange:w})]})})}),document.body):null};let Qe=null;const fd={symbol:"USDT"},vs=d.forwardRef((e,t)=>{const[n,r]=d.useState(!1),[o,s]=d.useState({chains:[]}),u=d.useCallback(c=>{s(c),r(!0)},[]),a=d.useCallback(c=>{s(p=>({...p,...c}))},[]),i=d.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=d.useCallback(()=>n,[n]);return d.useImperativeHandle(t,()=>({openDeposit:u,closeDeposit:i,updateDepositOptions:a,isOpen:l}),[u,i,a,l]),d.useEffect(()=>(Qe={openDeposit:u,closeDeposit:i,updateDepositOptions:a,isOpen:l},()=>{Qe=null}),[u,i,a,l]),M.jsx(gs,{isOpen:n,onClose:i,config:o.config||fd,currentActiveAccount:o.currentActiveAccount||Cr,smartWallet:o.smartWallet||Sr,chains:o.chains||$f,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||Or,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,approved:o.approved,onApproved:o.onApproved,onDeposit:o.onDeposit,onCopy:o.onCopy,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});vs.displayName="DepositManager";const bs=e=>{if(!Qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Qe.openDeposit(e||{chains:[]})},ys=()=>{if(!Qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Qe.closeDeposit()},xs=e=>{Qe&&Qe.updateDepositOptions(e)},dd=()=>Qe?Qe.isOpen():!1,pd=()=>({openDeposit:bs,closeDeposit:ys,updateDepositOptions:xs,isOpen:dd});d.createContext(null);const hd=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",walletType:o="evm",receiverAddress:s="",onWithdrawAmountChange:u,onReceiverAddressChange:a})=>{const i=p=>{const m=p.target.value,b=Er(m,r||"0");if(b.isValid)u(b.formattedValue),b.errorType;else return b.errorType==="exceed_balance",void 0},l=()=>{u(r)},c=()=>{const p=parseFloat(r||"0"),m=parseFloat(e||"0");if(m>0){const f=p-m,b=Ue(Math.max(0,f).toString());return`${Ue(r||"0")} → ${b} ${t}`}return`${Ue(r||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:i,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:l,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:c()})]})]}),o==="mpc"&&!On(n==null?void 0:n.chainId)&&M.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:M.jsx("input",{type:"text",placeholder:"Receiver Address",value:s,onChange:p=>a==null?void 0:a(p.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this."})}),M.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("span",{className:"text-text-tertiary text-xs",children:"Speed"}),M.jsxs("div",{className:"flex items-center space-x-1",children:[M.jsx("span",{className:"text-theme-normal",children:"⚡"}),M.jsx("span",{className:"text-theme-normal",children:"⚡"}),M.jsx("span",{className:"text-theme-normal",children:"⚡"})]})]}),M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:"Amount to receive"}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Ue(e)," ",t]})]})]})]})},md=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:u,platformBalance:a="0",wagmiHooks:i,onWithdraw:l,onClose:c,onChainChange:p,onTokenChange:m})=>{var D;const[f,b]=d.useState(()=>{var F;return!e||e.length===0?1:t||((F=e[0])==null?void 0:F.chainId)||1}),[y,N]=d.useState(()=>{var G;if(!e||e.length===0)return"";const F=t||((G=e[0])==null?void 0:G.chainId),R=e.find(ee=>ee.chainId===F);if(!R||!R.tokenList||R.tokenList.length===0)return"";const U=R.tokenList.find(ee=>ee.tokenAddress===n)||R.tokenList[0];return(U==null?void 0:U.token)||""}),[I,w]=d.useState(r),[T,j]=d.useState(""),_=(o==null?void 0:o.getWalletType())||"evm",B=d.useCallback(F=>{b(F),p==null||p(F)},[p]),W=d.useCallback(F=>{N(F),m==null||m(F)},[m]),h=d.useRef(!0),v=d.useRef(y),g=d.useRef(f);d.useEffect(()=>{if(h.current){h.current=!1,v.current=y,g.current=f;return}(v.current!==y||g.current!==f)&&(w(""),v.current=y,g.current=f)},[y,f]);const x=e&&e.length>0?e.find(F=>F.chainId===f)||e[0]:null,C=(D=x==null?void 0:x.tokenList)==null?void 0:D.find(F=>F.token===y),A=o==null?void 0:o.getDisplayAddress(),{multicallResult:P,queryComponents:S}=ms({account:A,chainId:f,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:i}),$=d.useMemo(()=>{var R;if(!C)return;if(!C.tokenAddress||C.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return P.baseTokenBalance.formatted;const F=P.combinedData[C.tokenAddress];return((R=F==null?void 0:F.balance)==null?void 0:R.formatted)||"0"},[C,P]),L=d.useMemo(()=>{const F=parseFloat(I||"0"),R=1,U=parseFloat(a||"0");return!I||F===0?{text:"Confirm Withdraw",disabled:!0}:_==="mpc"&&!On(f)&&!T.trim()?{text:"Enter Receiver Address",disabled:!0}:F>U?{text:"Insufficient Balance",disabled:!0}:F<R?{text:`Min Withdraw ${R} ${y}`,disabled:!0}:{text:"Confirm Withdraw",disabled:!1}},[I,y,a,_,T]),E=d.useCallback(async()=>{if(l){const F={amount:I,chainId:f,tokenAddress:(C==null?void 0:C.tokenAddress)||"",tokenSymbol:y};_==="mpc"&&!On(f)&&(F.receiverAddress=T),l(F)}},[l,I,f,C==null?void 0:C.tokenAddress,y,_,T]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?M.jsxs(M.Fragment,{children:[S,M.jsx(wr,{currentActiveChain:x,chainList:e,onChainChange:B,curSelectToken:y,onTokenChange:W,walletType:"evm"}),M.jsx(hd,{withdrawAmount:I,curSelectToken:y,curSelectTokenData:{balance:C==null?void 0:C.balance,allowance:C==null?void 0:C.allowance},currentActiveChain:x,currentEquity:u||0,amount:I,decimals:(C==null?void 0:C.decimals)||6,tokenBalance:$,platformBalance:a,walletType:_,receiverAddress:T,onWithdrawAmountChange:w,onReceiverAddressChange:j}),M.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:E,disabled:L.disabled,children:L.text})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},ws=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=Cr,smartWallet:o=Sr,chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i="",metadata:l=Or,currentEquity:c=5e3,platformBalance:p="0",wagmiHooks:m,onWithdraw:f,onChainChange:b,onTokenChange:y})=>{const N=d.useMemo(()=>{var I;return r?Yr(r,o,!1,(I=s[0])==null?void 0:I.chainId,"0","0"):null},[r,o,s]);return e?xe.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:I=>{I.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:"Withdraw"}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:M.jsx(Hr,{className:"h-4 w-4"})})]}),M.jsx(md,{chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i,walletAdapter:N,metadata:l,currentEquity:c,platformBalance:p,wagmiHooks:m,onWithdraw:f,onClose:t,onChainChange:b,onTokenChange:y})]})})}),document.body):null},gd=[],vd={};let Xe=null;const Es=d.forwardRef((e,t)=>{const[n,r]=d.useState(!1),[o,s]=d.useState({chains:[]}),u=d.useCallback(c=>{s(c||{chains:[]}),r(!0)},[]),a=d.useCallback(c=>{s(p=>({...p,...c}))},[]),i=d.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=d.useCallback(()=>n,[n]);return d.useImperativeHandle(t,()=>({openWithdraw:u,closeWithdraw:i,updateWithdrawOptions:a,isOpen:l}),[u,i,a,l]),d.useEffect(()=>(Xe={openWithdraw:u,closeWithdraw:i,updateWithdrawOptions:a,isOpen:l},()=>{Xe=null}),[u,i,a,l]),M.jsx(ws,{isOpen:n,onClose:i,config:o.config||{symbol:"USDT"},currentActiveAccount:o.currentActiveAccount,smartWallet:o.smartWallet,chains:o.chains||gd,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||vd,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,onWithdraw:o.onWithdraw,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});Es.displayName="WithdrawManager";const Cs=e=>{if(!Xe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Xe.openWithdraw(e||{chains:[]})},Ss=()=>{if(!Xe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Xe.closeWithdraw()},Os=e=>{if(!Xe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Xe.updateWithdrawOptions(e)},bd=()=>Xe?Xe.isOpen():!1,yd=()=>({openWithdraw:Cs,closeWithdraw:Ss,updateWithdrawOptions:Os,isOpen:bd});oe.ComponentProvider=Hs,oe.Deposit=gs,oe.DepositManager=vs,oe.Withdraw=ws,oe.WithdrawManager=Es,oe.closeDeposit=ys,oe.closeWithdraw=Ss,oe.openDeposit=bs,oe.openWithdraw=Cs,oe.updateDepositOptions=xs,oe.updateWithdrawOptions=Os,oe.useDeposit=Gs,oe.useDepositManager=pd,oe.useWithdraw=Ys,oe.useWithdrawManager=yd,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
111
+ */var Lp={L:jt.QrCode.Ecc.LOW,M:jt.QrCode.Ecc.MEDIUM,Q:jt.QrCode.Ecc.QUARTILE,H:jt.QrCode.Ecc.HIGH},Ks=128,qs="L",Xs="#FFFFFF",Qs="#000000",Js=!1,Zs=1,Mp=4,Dp=0,Ip=.1;function el(e,t=0){const n=[];return e.forEach(function(r,o){let i=null;r.forEach(function(a,u){if(!a&&i!==null){n.push(`M${i+t} ${o+t}h${u-i}v1H${i+t}z`),i=null;return}if(u===r.length-1){if(!a)return;i===null?n.push(`M${u+t},${o+t} h1v1H${u+t}z`):n.push(`M${i+t},${o+t} h${u+1-i}v1H${i+t}z`);return}a&&i===null&&(i=u)})}),n.join("")}function tl(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,i)=>i<t.x||i>=t.x+t.w?o:!1))}function Fp(e,t,n,r){if(r==null)return null;const o=e.length+n*2,i=Math.floor(t*Ip),a=o/t,u=(r.width||i)*a,s=(r.height||i)*a,l=r.x==null?e.length/2-u/2:r.x*a,c=r.y==null?e.length/2-s/2:r.y*a,d=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let g=Math.floor(l),v=Math.floor(c),E=Math.ceil(u+l-g),I=Math.ceil(s+c-v);p={x:g,y:v,w:E,h:I}}const f=r.crossOrigin;return{x:l,y:c,h:s,w:u,excavation:p,opacity:d,crossOrigin:f}}function jp(e,t){return t!=null?Math.max(Math.floor(t),0):e?Mp:Dp}function nl({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:i,size:a,boostLevel:u}){let s=m.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((v,E)=>(v.push(...jt.QrSegment.makeSegments(E)),v),[]);return jt.QrCode.encodeSegments(g,Lp[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:c,numCells:d,calculatedImageSettings:p}=m.useMemo(()=>{let f=s.getModules();const g=jp(r,o),v=f.length+g*2,E=Fp(f,a,g,i);return{cells:f,margin:g,numCells:v,calculatedImageSettings:E}},[s,a,i,r,o]);return{qrcode:s,margin:c,cells:l,numCells:d,calculatedImageSettings:p}}var Rp=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),kp=m.forwardRef(function(t,n){const r=t,{value:o,size:i=Ks,level:a=qs,bgColor:u=Xs,fgColor:s=Qs,includeMargin:l=Js,minVersion:c=Zs,boostLevel:d,marginSize:p,imageSettings:f}=r,v=ro(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:E}=v,I=ro(v,["style"]),w=f==null?void 0:f.src,P=m.useRef(null),F=m.useRef(null),R=m.useCallback(T=>{P.current=T,typeof n=="function"?n(T):n&&(n.current=T)},[n]),[B,V]=m.useState(!1),{margin:h,cells:x,numCells:b,calculatedImageSettings:A}=nl({value:o,level:a,minVersion:c,boostLevel:d,includeMargin:l,marginSize:p,imageSettings:f,size:i});m.useEffect(()=>{if(P.current!=null){const T=P.current,S=T.getContext("2d");if(!S)return;let L=x;const $=F.current,y=A!=null&&$!==null&&$.complete&&$.naturalHeight!==0&&$.naturalWidth!==0;y&&A.excavation!=null&&(L=tl(x,A.excavation));const D=window.devicePixelRatio||1;T.height=T.width=i*D;const _=i/b*D;S.scale(_,_),S.fillStyle=u,S.fillRect(0,0,b,b),S.fillStyle=s,Rp?S.fill(new Path2D(el(L,h))):x.forEach(function(k,W){k.forEach(function(H,Q){H&&S.fillRect(Q+h,W+h,1,1)})}),A&&(S.globalAlpha=A.opacity),y&&S.drawImage($,A.x+h,A.y+h,A.w,A.h)}}),m.useEffect(()=>{V(!1)},[w]);const C=no({height:i,width:i},E);let N=null;return w!=null&&(N=m.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{V(!0)},ref:F,crossOrigin:A==null?void 0:A.crossOrigin})),m.createElement(m.Fragment,null,m.createElement("canvas",no({style:C,height:i,width:i,ref:R,role:"img"},I)),N)});kp.displayName="QRCodeCanvas";var rl=m.forwardRef(function(t,n){const r=t,{value:o,size:i=Ks,level:a=qs,bgColor:u=Xs,fgColor:s=Qs,includeMargin:l=Js,minVersion:c=Zs,boostLevel:d,title:p,marginSize:f,imageSettings:g}=r,v=ro(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:E,cells:I,numCells:w,calculatedImageSettings:P}=nl({value:o,level:a,minVersion:c,boostLevel:d,includeMargin:l,marginSize:f,imageSettings:g,size:i});let F=I,R=null;g!=null&&P!=null&&(P.excavation!=null&&(F=tl(I,P.excavation)),R=m.createElement("image",{href:g.src,height:P.h,width:P.w,x:P.x+E,y:P.y+E,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const B=el(F,E);return m.createElement("svg",no({height:i,width:i,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},v),!!p&&m.createElement("title",null,p),m.createElement("path",{fill:u,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),m.createElement("path",{fill:s,d:B,shapeRendering:"crispEdges"}),R)});rl.displayName="QRCodeSVG";function _p(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Bp(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function ol(){return/apple/i.test(navigator.vendor)}function Wp(){return _p().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function Up(){return Bp().includes("jsdom/")}const il="data-floating-ui-focusable",Vp="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function oo(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Rt(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Cr(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function kt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function io(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Hp(e){return e.matches("html,body")}function Ze(e){return(e==null?void 0:e.ownerDocument)||document}function sl(e){return Ee(e)&&e.matches(Vp)}function zp(e){if(!e||Up())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Gp(e){return e?e.hasAttribute(il)?e:e.querySelector("["+il+"]")||e:null}function Bn(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Bn(e,o.id,n)])}function Yp(e){return"nativeEvent"in e}function nn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var Kp=typeof document<"u",qp=function(){},et=Kp?m.useLayoutEffect:qp;const Xp={...j};function Wn(e){const t=j.useRef(e);return et(()=>{t.current=e}),t}const Qp=Xp.useInsertionEffect||(e=>e());function tt(e){const t=j.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Qp(()=>{t.current=e}),j.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const ll=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function al(e,t){const n=Hi(e,ll()),r=n.length;if(r===0)return;const o=oo(Ze(e)),i=n.indexOf(o),a=i===-1?t===1?0:r-1:i+t;return n[a]}function Jp(e){return al(Ze(e).body,1)||e}function Zp(e){return al(Ze(e).body,-1)||e}function so(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Rt(n,r)}function em(e){Hi(e,ll()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function ul(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const tm="data-floating-ui-focusable",cl="active",fl="selected",nm={...j};let dl=!1,rm=0;const pl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+rm++;function om(){const[e,t]=j.useState(()=>dl?pl():void 0);return et(()=>{e==null&&t(pl())},[]),j.useEffect(()=>{dl=!0},[]),e}const lo=nm.useId||om;let ao;process.env.NODE_ENV!=="production"&&(ao=new Set);function im(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=ao)!=null&&e.has(o))){var i;(i=ao)==null||i.add(o),console.error(o)}}function sm(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const lm=j.createContext(null),am=j.createContext(null),uo=()=>{var e;return((e=j.useContext(lm))==null?void 0:e.id)||null},co=()=>j.useContext(am);function rn(e){return"data-floating-ui-"+e}function ke(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const ml=rn("safe-polygon");function fo(e,t,n){if(n&&!nn(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function po(e){return typeof e=="function"?e():e}function um(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:a}=e,{enabled:u=!0,delay:s=0,handleClose:l=null,mouseOnly:c=!1,restMs:d=0,move:p=!0}=t,f=co(),g=uo(),v=Wn(l),E=Wn(s),I=Wn(n),w=Wn(d),P=j.useRef(),F=j.useRef(-1),R=j.useRef(),B=j.useRef(-1),V=j.useRef(!0),h=j.useRef(!1),x=j.useRef(()=>{}),b=j.useRef(!1),A=tt(()=>{var $;const y=($=o.current.openEvent)==null?void 0:$.type;return(y==null?void 0:y.includes("mouse"))&&y!=="mousedown"});j.useEffect(()=>{if(!u)return;function $(y){let{open:D}=y;D||(ke(F),ke(B),V.current=!0,b.current=!1)}return i.on("openchange",$),()=>{i.off("openchange",$)}},[u,i]),j.useEffect(()=>{if(!u||!v.current||!n)return;function $(D){A()&&r(!1,D,"hover")}const y=Ze(a.floating).documentElement;return y.addEventListener("mouseleave",$),()=>{y.removeEventListener("mouseleave",$)}},[a.floating,n,r,u,v,A]);const C=j.useCallback(function($,y,D){y===void 0&&(y=!0),D===void 0&&(D="hover");const _=fo(E.current,"close",P.current);_&&!R.current?(ke(F),F.current=window.setTimeout(()=>r(!1,$,D),_)):y&&(ke(F),r(!1,$,D))},[E,r]),N=tt(()=>{x.current(),R.current=void 0}),T=tt(()=>{if(h.current){const $=Ze(a.floating).body;$.style.pointerEvents="",$.removeAttribute(ml),h.current=!1}}),S=tt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);j.useEffect(()=>{if(!u)return;function $(W){if(ke(F),V.current=!1,c&&!nn(P.current)||po(w.current)>0&&!fo(E.current,"open"))return;const H=fo(E.current,"open",P.current);H?F.current=window.setTimeout(()=>{I.current||r(!0,W,"hover")},H):n||r(!0,W,"hover")}function y(W){if(S()){T();return}x.current();const H=Ze(a.floating);if(ke(B),b.current=!1,v.current&&o.current.floatingContext){n||ke(F),R.current=v.current({...o.current.floatingContext,tree:f,x:W.clientX,y:W.clientY,onClose(){T(),N(),S()||C(W,!0,"safe-polygon")}});const z=R.current;H.addEventListener("mousemove",z),x.current=()=>{H.removeEventListener("mousemove",z)};return}(P.current==="touch"?!Rt(a.floating,W.relatedTarget):!0)&&C(W)}function D(W){S()||o.current.floatingContext&&(v.current==null||v.current({...o.current.floatingContext,tree:f,x:W.clientX,y:W.clientY,onClose(){T(),N(),S()||C(W)}})(W))}function _(){ke(F)}function k(W){S()||C(W,!1)}if(re(a.domReference)){const W=a.domReference,H=a.floating;return n&&W.addEventListener("mouseleave",D),p&&W.addEventListener("mousemove",$,{once:!0}),W.addEventListener("mouseenter",$),W.addEventListener("mouseleave",y),H&&(H.addEventListener("mouseleave",D),H.addEventListener("mouseenter",_),H.addEventListener("mouseleave",k)),()=>{n&&W.removeEventListener("mouseleave",D),p&&W.removeEventListener("mousemove",$),W.removeEventListener("mouseenter",$),W.removeEventListener("mouseleave",y),H&&(H.removeEventListener("mouseleave",D),H.removeEventListener("mouseenter",_),H.removeEventListener("mouseleave",k))}}},[a,u,e,c,p,C,N,T,r,n,I,f,E,v,o,S,w]),et(()=>{var $;if(u&&n&&($=v.current)!=null&&($=$.__options)!=null&&$.blockPointerEvents&&A()){h.current=!0;const D=a.floating;if(re(a.domReference)&&D){var y;const _=Ze(a.floating).body;_.setAttribute(ml,"");const k=a.domReference,W=f==null||(y=f.nodesRef.current.find(H=>H.id===g))==null||(y=y.context)==null?void 0:y.elements.floating;return W&&(W.style.pointerEvents=""),_.style.pointerEvents="none",k.style.pointerEvents="auto",D.style.pointerEvents="auto",()=>{_.style.pointerEvents="",k.style.pointerEvents="",D.style.pointerEvents=""}}}},[u,n,g,a,f,v,A]),et(()=>{n||(P.current=void 0,b.current=!1,N(),T())},[n,N,T]),j.useEffect(()=>()=>{N(),ke(F),ke(B),T()},[u,a.domReference,N,T]);const L=j.useMemo(()=>{function $(y){P.current=y.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(y){const{nativeEvent:D}=y;function _(){!V.current&&!I.current&&r(!0,D,"hover")}c&&!nn(P.current)||n||po(w.current)===0||b.current&&y.movementX**2+y.movementY**2<2||(ke(B),P.current==="touch"?_():(b.current=!0,B.current=window.setTimeout(_,po(w.current))))}}},[c,r,n,I,w]);return j.useMemo(()=>u?{reference:L}:{},[u,L])}const hl={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},gl=j.forwardRef(function(t,n){const[r,o]=j.useState();et(()=>{ol()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[rn("focus-guard")]:"",style:hl};return O.jsx("span",{...t,...i})}),vl=j.createContext(null),bl=rn("portal");function cm(e){e===void 0&&(e={});const{id:t,root:n}=e,r=lo(),o=dm(),[i,a]=j.useState(null),u=j.useRef(null);return et(()=>()=>{i==null||i.remove(),queueMicrotask(()=>{u.current=null})},[i]),et(()=>{if(!r||u.current)return;const s=t?document.getElementById(t):null;if(!s)return;const l=document.createElement("div");l.id=r,l.setAttribute(bl,""),s.appendChild(l),u.current=l,a(l)},[t,r]),et(()=>{if(n===null||!r||u.current)return;let s=n||(o==null?void 0:o.portalNode);s&&!Sr(s)&&(s=s.current),s=s||document.body;let l=null;t&&(l=document.createElement("div"),l.id=t,s.appendChild(l));const c=document.createElement("div");c.id=r,c.setAttribute(bl,""),s=l||s,s.appendChild(c),u.current=c,a(c)},[t,n,r,o]),i}function fm(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=cm({id:n,root:r}),[a,u]=j.useState(null),s=j.useRef(null),l=j.useRef(null),c=j.useRef(null),d=j.useRef(null),p=a==null?void 0:a.modal,f=a==null?void 0:a.open,g=!!a&&!a.modal&&a.open&&o&&!!(r||i);return j.useEffect(()=>{if(!i||!o||p)return;function v(E){i&&so(E)&&(E.type==="focusin"?ul:em)(i)}return i.addEventListener("focusin",v,!0),i.addEventListener("focusout",v,!0),()=>{i.removeEventListener("focusin",v,!0),i.removeEventListener("focusout",v,!0)}},[i,o,p]),j.useEffect(()=>{i&&(f||ul(i))},[f,i]),O.jsxs(vl.Provider,{value:j.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:l,beforeInsideRef:c,afterInsideRef:d,portalNode:i,setFocusManagerState:u}),[o,i]),children:[g&&i&&O.jsx(gl,{"data-type":"outside",ref:s,onFocus:v=>{if(so(v,i)){var E;(E=c.current)==null||E.focus()}else{const I=a?a.domReference:null,w=Zp(I);w==null||w.focus()}}}),g&&i&&O.jsx("span",{"aria-owns":i.id,style:hl}),i&&Ut.createPortal(t,i),g&&i&&O.jsx(gl,{"data-type":"outside",ref:l,onFocus:v=>{if(so(v,i)){var E;(E=d.current)==null||E.focus()}else{const I=a?a.domReference:null,w=Jp(I);w==null||w.focus(),a!=null&&a.closeOnFocusOut&&(a==null||a.onOpenChange(!1,v.nativeEvent,"focus-out"))}}})]})}const dm=()=>j.useContext(vl);function xl(e){return Ee(e.target)&&e.target.tagName==="BUTTON"}function pm(e){return Ee(e.target)&&e.target.tagName==="A"}function yl(e){return sl(e)}function mm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:a=!0,event:u="click",toggle:s=!0,ignoreMouse:l=!1,keyboardHandlers:c=!0,stickIfOpen:d=!0}=t,p=j.useRef(),f=j.useRef(!1),g=j.useMemo(()=>({onPointerDown(v){p.current=v.pointerType},onMouseDown(v){const E=p.current;v.button===0&&u!=="click"&&(nn(E,!0)&&l||(n&&s&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="mousedown")?r(!1,v.nativeEvent,"click"):(v.preventDefault(),r(!0,v.nativeEvent,"click"))))},onClick(v){const E=p.current;if(u==="mousedown"&&p.current){p.current=void 0;return}nn(E,!0)&&l||(n&&s&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="click")?r(!1,v.nativeEvent,"click"):r(!0,v.nativeEvent,"click"))},onKeyDown(v){p.current=void 0,!(v.defaultPrevented||!c||xl(v))&&(v.key===" "&&!yl(i)&&(v.preventDefault(),f.current=!0),!pm(v)&&v.key==="Enter"&&r(!(n&&s),v.nativeEvent,"click"))},onKeyUp(v){v.defaultPrevented||!c||xl(v)||yl(i)||v.key===" "&&f.current&&(f.current=!1,r(!(n&&s),v.nativeEvent,"click"))}}),[o,i,u,l,c,r,n,d,s]);return j.useMemo(()=>a?{reference:g}:{},[a,g])}const hm={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},gm={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},wl=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function vm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:a=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:l="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:g}=t,v=co(),E=tt(typeof s=="function"?s:()=>!1),I=typeof s=="function"?E:s,w=j.useRef(!1),{escapeKey:P,outsidePress:F}=wl(f),{escapeKey:R,outsidePress:B}=wl(g),V=j.useRef(!1),h=tt(T=>{var S;if(!n||!a||!u||T.key!=="Escape"||V.current)return;const L=(S=i.current.floatingContext)==null?void 0:S.nodeId,$=v?Bn(v.nodesRef.current,L):[];if(!P&&(T.stopPropagation(),$.length>0)){let y=!0;if($.forEach(D=>{var _;if((_=D.context)!=null&&_.open&&!D.context.dataRef.current.__escapeKeyBubbles){y=!1;return}}),!y)return}r(!1,Yp(T)?T.nativeEvent:T,"escape-key")}),x=tt(T=>{var S;const L=()=>{var $;h(T),($=kt(T))==null||$.removeEventListener("keydown",L)};(S=kt(T))==null||S.addEventListener("keydown",L)}),b=tt(T=>{var S;const L=i.current.insideReactTree;i.current.insideReactTree=!1;const $=w.current;if(w.current=!1,l==="click"&&$||L||typeof I=="function"&&!I(T))return;const y=kt(T),D="["+rn("inert")+"]",_=Ze(o.floating).querySelectorAll(D);let k=re(y)?y:null;for(;k&&!lt(k);){const z=at(k);if(lt(z)||!re(z))break;k=z}if(_.length&&re(y)&&!Hp(y)&&!Rt(y,o.floating)&&Array.from(_).every(z=>!Rt(k,z)))return;if(Ee(y)&&N){const z=lt(y),K=Re(y),G=/auto|scroll/,oe=z||G.test(K.overflowX),fe=z||G.test(K.overflowY),Ne=oe&&y.clientWidth>0&&y.scrollWidth>y.clientWidth,Ae=fe&&y.clientHeight>0&&y.scrollHeight>y.clientHeight,ot=K.direction==="rtl",ye=Ae&&(ot?T.offsetX<=y.offsetWidth-y.clientWidth:T.offsetX>y.clientWidth),he=Ne&&T.offsetY>y.clientHeight;if(ye||he)return}const W=(S=i.current.floatingContext)==null?void 0:S.nodeId,H=v&&Bn(v.nodesRef.current,W).some(z=>{var K;return io(T,(K=z.context)==null?void 0:K.elements.floating)});if(io(T,o.floating)||io(T,o.domReference)||H)return;const Q=v?Bn(v.nodesRef.current,W):[];if(Q.length>0){let z=!0;if(Q.forEach(K=>{var G;if((G=K.context)!=null&&G.open&&!K.context.dataRef.current.__outsidePressBubbles){z=!1;return}}),!z)return}r(!1,T,"outside-press")}),A=tt(T=>{var S;const L=()=>{var $;b(T),($=kt(T))==null||$.removeEventListener(l,L)};(S=kt(T))==null||S.addEventListener(l,L)});j.useEffect(()=>{if(!n||!a)return;i.current.__escapeKeyBubbles=P,i.current.__outsidePressBubbles=F;let T=-1;function S(_){r(!1,_,"ancestor-scroll")}function L(){window.clearTimeout(T),V.current=!0}function $(){T=window.setTimeout(()=>{V.current=!1},xn()?5:0)}const y=Ze(o.floating);u&&(y.addEventListener("keydown",R?x:h,R),y.addEventListener("compositionstart",L),y.addEventListener("compositionend",$)),I&&y.addEventListener(l,B?A:b,B);let D=[];return p&&(re(o.domReference)&&(D=gt(o.domReference)),re(o.floating)&&(D=D.concat(gt(o.floating))),!re(o.reference)&&o.reference&&o.reference.contextElement&&(D=D.concat(gt(o.reference.contextElement)))),D=D.filter(_=>{var k;return _!==((k=y.defaultView)==null?void 0:k.visualViewport)}),D.forEach(_=>{_.addEventListener("scroll",S,{passive:!0})}),()=>{u&&(y.removeEventListener("keydown",R?x:h,R),y.removeEventListener("compositionstart",L),y.removeEventListener("compositionend",$)),I&&y.removeEventListener(l,B?A:b,B),D.forEach(_=>{_.removeEventListener("scroll",S)}),window.clearTimeout(T)}},[i,o,u,I,l,n,r,p,a,P,F,h,R,x,b,B,A]),j.useEffect(()=>{i.current.insideReactTree=!1},[i,I,l]);const C=j.useMemo(()=>({onKeyDown:h,...c&&{[hm[d]]:T=>{r(!1,T.nativeEvent,"reference-press")},...d!=="click"&&{onClick(T){r(!1,T.nativeEvent,"reference-press")}}}}),[h,r,c,d]),N=j.useMemo(()=>({onKeyDown:h,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[gm[l]]:()=>{i.current.insideReactTree=!0}}),[h,l,i]);return j.useMemo(()=>a?{reference:C,floating:N}:{},[a,C,N])}function bm(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=lo(),i=j.useRef({}),[a]=j.useState(()=>sm()),u=uo()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!re(f)&&im("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,l]=j.useState(r.reference),c=tt((f,g,v)=>{i.current.openEvent=f?g:void 0,a.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=j.useMemo(()=>({setPositionReference:l}),[]),p=j.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return j.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:a,floatingId:o,refs:d}),[t,c,p,a,o,d])}function xm(e){e===void 0&&(e={});const{nodeId:t}=e,n=bm({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,a]=j.useState(null),[u,s]=j.useState(null),c=(o==null?void 0:o.domReference)||i,d=j.useRef(null),p=co();et(()=>{c&&(d.current=c)},[c]);const f=is({...e,elements:{...o,...u&&{reference:u}}}),g=j.useCallback(P=>{const F=re(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;s(F),f.refs.setReference(F)},[f.refs]),v=j.useCallback(P=>{(re(P)||P===null)&&(d.current=P,a(P)),(re(f.refs.reference.current)||f.refs.reference.current===null||P!==null&&!re(P))&&f.refs.setReference(P)},[f.refs]),E=j.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),I=j.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=j.useMemo(()=>({...f,...r,refs:E,elements:I,nodeId:t}),[f,E,I,t,r]);return et(()=>{r.dataRef.current.floatingContext=w;const P=p==null?void 0:p.nodesRef.current.find(F=>F.id===t);P&&(P.context=w)}),j.useMemo(()=>({...f,context:w,refs:E,elements:I}),[f,E,I,w])}function mo(){return Wp()&&ol()}function ym(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:a}=e,{enabled:u=!0,visibleOnly:s=!0}=t,l=j.useRef(!1),c=j.useRef(-1),d=j.useRef(!0);j.useEffect(()=>{if(!u)return;const f=Oe(a.domReference);function g(){!n&&Ee(a.domReference)&&a.domReference===oo(Ze(a.domReference))&&(l.current=!0)}function v(){d.current=!0}function E(){d.current=!1}return f.addEventListener("blur",g),mo()&&(f.addEventListener("keydown",v,!0),f.addEventListener("pointerdown",E,!0)),()=>{f.removeEventListener("blur",g),mo()&&(f.removeEventListener("keydown",v,!0),f.removeEventListener("pointerdown",E,!0))}},[a.domReference,n,u]),j.useEffect(()=>{if(!u)return;function f(g){let{reason:v}=g;(v==="reference-press"||v==="escape-key")&&(l.current=!0)}return o.on("openchange",f),()=>{o.off("openchange",f)}},[o,u]),j.useEffect(()=>()=>{ke(c)},[]);const p=j.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(f){if(l.current)return;const g=kt(f.nativeEvent);if(s&&re(g)){if(mo()&&!f.relatedTarget){if(!d.current&&!sl(g))return}else if(!zp(g))return}r(!0,f.nativeEvent,"focus")},onBlur(f){l.current=!1;const g=f.relatedTarget,v=f.nativeEvent,E=re(g)&&g.hasAttribute(rn("focus-guard"))&&g.getAttribute("data-type")==="outside";c.current=window.setTimeout(()=>{var I;const w=oo(a.domReference?a.domReference.ownerDocument:document);!g&&w===a.domReference||Rt((I=i.current.floatingContext)==null?void 0:I.refs.floating.current,w)||Rt(a.domReference,w)||E||r(!1,v,"focus")})}}),[i,a.domReference,r,s]);return j.useMemo(()=>u?{reference:p}:{},[u,p])}function ho(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[cl]:a,[fl]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[tm]:""},...i,...t.map(a=>{const u=a?a[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((a,u)=>(u&&Object.entries(u).forEach(s=>{let[l,c]=s;if(!(o&&[cl,fl].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof c=="function"){var d;(d=r.get(l))==null||d.push(c),a[l]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(l))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else a[l]=c}),a),{})}}function wm(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=j.useCallback(u=>ho(u,e,"reference"),t),i=j.useCallback(u=>ho(u,e,"floating"),n),a=j.useCallback(u=>ho(u,e,"item"),r);return j.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:a}),[o,i,a])}const Em=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Sm(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:i,floatingId:a}=e,{enabled:u=!0,role:s="dialog"}=t,l=lo(),c=((n=i.domReference)==null?void 0:n.id)||l,d=j.useMemo(()=>{var w;return((w=Gp(i.floating))==null?void 0:w.id)||a},[i.floating,a]),p=(r=Em.get(s))!=null?r:s,g=uo()!=null,v=j.useMemo(()=>p==="tooltip"||s==="label"?{["aria-"+(s==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?d:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:c},...p==="menu"&&g&&{role:"menuitem"},...s==="select"&&{"aria-autocomplete":"none"},...s==="combobox"&&{"aria-autocomplete":"list"}},[p,d,g,o,c,s]),E=j.useMemo(()=>{const w={id:d,...p&&{role:p}};return p==="tooltip"||s==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":c}}},[p,d,c,s]),I=j.useCallback(w=>{let{active:P,selected:F}=w;const R={role:"option",...P&&{id:d+"-fui-option"}};switch(s){case"select":case"combobox":return{...R,"aria-selected":F}}return{}},[d,s]);return j.useMemo(()=>u?{reference:v,floating:E,item:I}:{},[u,v,E,I])}const El=m.forwardRef(({placement:e,className:t=""},n)=>{const o=(i=>{switch(i.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return O.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});El.displayName="TooltipArrow";const on=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:i="",disabled:a=!1,maxWidth:u="max-w-xs",trigger:s=["hover","focus"]})=>{const[l,c]=m.useState(!1),d=m.useRef(null),{refs:p,floatingStyles:f,context:g}=xm({open:l&&!a,onOpenChange:c,placement:n,whileElementsMounted:ts,middleware:[jr(o?12:8),ls({fallbackAxisSideDirection:"start",padding:8}),ss({padding:8}),...o?[_f({element:d})]:[]]}),v=um(g,{enabled:s.includes("hover"),delay:{open:r,close:150}}),E=ym(g,{enabled:s.includes("focus")}),I=mm(g,{enabled:s.includes("click")}),w=vm(g),P=Sm(g,{role:"tooltip"}),{getReferenceProps:F,getFloatingProps:R}=wm([v,E,I,w,P]);return a?O.jsx(O.Fragment,{children:e}):O.jsxs(O.Fragment,{children:[O.jsx("div",{ref:p.setReference,...F(),children:e}),l&&O.jsx(fm,{children:O.jsxs("div",{ref:p.setFloating,...R(),style:f,className:`
112
+ z-50 px-3 py-2
113
+ bg-fill-page-secondary
114
+ text-text-primary text-sm font-medium
115
+ rounded-lg shadow-lg
116
+ relative
117
+ ${u}
118
+ ${i}
119
+ `,children:[t,o&&O.jsx(El,{ref:d,placement:g.placement||n})]})})]})},Sl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",Cm=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var u;const{t:i}=Ye(),a=m.useMemo(()=>ap(n||{}),[n]);return O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"flex justify-center mt-4 mb-3",children:O.jsx("div",{className:"bg-white rounded-lg",children:O.jsx(rl,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),O.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[O.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),O.jsx($p,{onCopy:()=>{const s=(e==null?void 0:e.getDisplayAddress())||"";o&&o(s)},text:e==null?void 0:e.getDisplayAddress(),children:O.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[O.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),O.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),O.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[O.jsxs("div",{className:"flex items-start",children:[O.jsx("div",{className:"w-5",children:O.jsx("img",{src:Sl,className:"w-4 h-4",alt:"Warning"})}),O.jsx("div",{className:"flex-1",children:O.jsxs("p",{className:"text-xs text-functional-orange-1",children:["Only ",t," (",n==null?void 0:n.chain,") is supported for deposits to this address."]})})]}),a&&O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),O.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."})]})]}),O.jsxs("div",{className:"text-sm",children:[O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[O.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),O.jsx(on,{content:O.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[O.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60,v1:n==null?void 0:n.txConfirm})}),O.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:O.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60})})})]}),O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[O.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),O.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((u=r==null?void 0:r.multiChain)==null?void 0:u.minDeposit)||10," ",t]})]}),O.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[O.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),O.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},Om=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:i,onCopy:a,onClose:u})=>{var g;const[s,l]=m.useState(()=>{var v;return!e||e.length===0?1:t||((v=e[0])==null?void 0:v.chainId)||1}),[c,d]=m.useState(()=>{var w;if(!e||e.length===0)return"";const v=t||((w=e[0])==null?void 0:w.chainId),E=e.find(P=>P.chainId===v);if(!E||!E.tokenList||E.tokenList.length===0)return"";const I=E.tokenList.find(P=>P.tokenAddress===n)||E.tokenList[0];return(I==null?void 0:I.token)||""}),p=e&&e.length>0?e.find(v=>v.chainId===s)||e[0]:null,f=(g=p==null?void 0:p.tokenList)==null?void 0:g.find(v=>v.token===c);return!e||e.length===0?O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"No chains available"})}):p?O.jsxs(O.Fragment,{children:[O.jsx(Yr,{currentActiveChain:p,chainList:e,onChainChange:l,curSelectToken:c,onTokenChange:d,walletType:"mpc"}),O.jsx(Cm,{walletAdapter:r,curSelectToken:c,currentActiveChain:p,metadata:o,onCopy:a}),O.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{i&&i({amount:"",chainId:s,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:c}),u()},children:"Deposit"})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})};var Tm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,go=Math.ceil,_e=Math.floor,Te="[BigNumber Error] ",Cl=Te+"Number primitive has more than 15 significant digits: ",Ge=1e14,X=14,vo=9007199254740991,bo=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],xt=1e7,be=1e9;function Ol(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},i=new w(1),a=20,u=4,s=-7,l=21,c=-1e7,d=1e7,p=!1,f=1,g=0,v={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function w(h,x){var b,A,C,N,T,S,L,$,y=this;if(!(y instanceof w))return new w(h,x);if(x==null){if(h&&h._isBigNumber===!0){y.s=h.s,!h.c||h.e>d?y.c=y.e=null:h.e<c?y.c=[y.e=0]:(y.e=h.e,y.c=h.c.slice());return}if((S=typeof h=="number")&&h*0==0){if(y.s=1/h<0?(h=-h,-1):1,h===~~h){for(N=0,T=h;T>=10;T/=10,N++);N>d?y.c=y.e=null:(y.e=N,y.c=[h]);return}$=String(h)}else{if(!Tm.test($=String(h)))return r(y,$,S);y.s=$.charCodeAt(0)==45?($=$.slice(1),-1):1}(N=$.indexOf("."))>-1&&($=$.replace(".","")),(T=$.search(/e/i))>0?(N<0&&(N=T),N+=+$.slice(T+1),$=$.substring(0,T)):N<0&&(N=$.length)}else{if(ce(x,2,E.length,"Base"),x==10&&I)return y=new w(h),B(y,a+y.e+1,u);if($=String(h),S=typeof h=="number"){if(h*0!=0)return r(y,$,S,x);if(y.s=1/h<0?($=$.slice(1),-1):1,w.DEBUG&&$.replace(/^0\.0*|\./,"").length>15)throw Error(Cl+h)}else y.s=$.charCodeAt(0)===45?($=$.slice(1),-1):1;for(b=E.slice(0,x),N=T=0,L=$.length;T<L;T++)if(b.indexOf(A=$.charAt(T))<0){if(A=="."){if(T>N){N=L;continue}}else if(!C&&($==$.toUpperCase()&&($=$.toLowerCase())||$==$.toLowerCase()&&($=$.toUpperCase()))){C=!0,T=-1,N=0;continue}return r(y,String(h),S,x)}S=!1,$=n($,x,10,y.s),(N=$.indexOf("."))>-1?$=$.replace(".",""):N=$.length}for(T=0;$.charCodeAt(T)===48;T++);for(L=$.length;$.charCodeAt(--L)===48;);if($=$.slice(T,++L)){if(L-=T,S&&w.DEBUG&&L>15&&(h>vo||h!==_e(h)))throw Error(Cl+y.s*h);if((N=N-T-1)>d)y.c=y.e=null;else if(N<c)y.c=[y.e=0];else{if(y.e=N,y.c=[],T=(N+1)%X,N<0&&(T+=X),T<L){for(T&&y.c.push(+$.slice(0,T)),L-=X;T<L;)y.c.push(+$.slice(T,T+=X));T=X-($=$.slice(T)).length}else T-=L;for(;T--;$+="0");y.c.push(+$)}}else y.c=[y.e=0]}w.clone=Ol,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(h){var x,b;if(h!=null)if(typeof h=="object"){if(h.hasOwnProperty(x="DECIMAL_PLACES")&&(b=h[x],ce(b,0,be,x),a=b),h.hasOwnProperty(x="ROUNDING_MODE")&&(b=h[x],ce(b,0,8,x),u=b),h.hasOwnProperty(x="EXPONENTIAL_AT")&&(b=h[x],b&&b.pop?(ce(b[0],-be,0,x),ce(b[1],0,be,x),s=b[0],l=b[1]):(ce(b,-be,be,x),s=-(l=b<0?-b:b))),h.hasOwnProperty(x="RANGE"))if(b=h[x],b&&b.pop)ce(b[0],-be,-1,x),ce(b[1],1,be,x),c=b[0],d=b[1];else if(ce(b,-be,be,x),b)c=-(d=b<0?-b:b);else throw Error(Te+x+" cannot be zero: "+b);if(h.hasOwnProperty(x="CRYPTO"))if(b=h[x],b===!!b)if(b)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=b;else throw p=!b,Error(Te+"crypto unavailable");else p=b;else throw Error(Te+x+" not true or false: "+b);if(h.hasOwnProperty(x="MODULO_MODE")&&(b=h[x],ce(b,0,9,x),f=b),h.hasOwnProperty(x="POW_PRECISION")&&(b=h[x],ce(b,0,be,x),g=b),h.hasOwnProperty(x="FORMAT"))if(b=h[x],typeof b=="object")v=b;else throw Error(Te+x+" not an object: "+b);if(h.hasOwnProperty(x="ALPHABET"))if(b=h[x],typeof b=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(b))I=b.slice(0,10)=="0123456789",E=b;else throw Error(Te+x+" invalid: "+b)}else throw Error(Te+"Object expected: "+h);return{DECIMAL_PLACES:a,ROUNDING_MODE:u,EXPONENTIAL_AT:[s,l],RANGE:[c,d],CRYPTO:p,MODULO_MODE:f,POW_PRECISION:g,FORMAT:v,ALPHABET:E}},w.isBigNumber=function(h){if(!h||h._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var x,b,A=h.c,C=h.e,N=h.s;e:if({}.toString.call(A)=="[object Array]"){if((N===1||N===-1)&&C>=-be&&C<=be&&C===_e(C)){if(A[0]===0){if(C===0&&A.length===1)return!0;break e}if(x=(C+1)%X,x<1&&(x+=X),String(A[0]).length==x){for(x=0;x<A.length;x++)if(b=A[x],b<0||b>=Ge||b!==_e(b))break e;if(b!==0)return!0}}}else if(A===null&&C===null&&(N===null||N===1||N===-1))return!0;throw Error(Te+"Invalid BigNumber: "+h)},w.maximum=w.max=function(){return F(arguments,-1)},w.minimum=w.min=function(){return F(arguments,1)},w.random=function(){var h=9007199254740992,x=Math.random()*h&2097151?function(){return _e(Math.random()*h)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var A,C,N,T,S,L=0,$=[],y=new w(i);if(b==null?b=a:ce(b,0,be),T=go(b/X),p)if(crypto.getRandomValues){for(A=crypto.getRandomValues(new Uint32Array(T*=2));L<T;)S=A[L]*131072+(A[L+1]>>>11),S>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),A[L]=C[0],A[L+1]=C[1]):($.push(S%1e14),L+=2);L=T/2}else if(crypto.randomBytes){for(A=crypto.randomBytes(T*=7);L<T;)S=(A[L]&31)*281474976710656+A[L+1]*1099511627776+A[L+2]*4294967296+A[L+3]*16777216+(A[L+4]<<16)+(A[L+5]<<8)+A[L+6],S>=9e15?crypto.randomBytes(7).copy(A,L):($.push(S%1e14),L+=7);L=T/7}else throw p=!1,Error(Te+"crypto unavailable");if(!p)for(;L<T;)S=x(),S<9e15&&($[L++]=S%1e14);for(T=$[--L],b%=X,T&&b&&(S=bo[X-b],$[L]=_e(T/S)*S);$[L]===0;$.pop(),L--);if(L<0)$=[N=0];else{for(N=-1;$[0]===0;$.splice(0,1),N-=X);for(L=1,S=$[0];S>=10;S/=10,L++);L<X&&(N-=X-L)}return y.e=N,y.c=$,y}}(),w.sum=function(){for(var h=1,x=arguments,b=new w(x[0]);h<x.length;)b=b.plus(x[h++]);return b},n=function(){var h="0123456789";function x(b,A,C,N){for(var T,S=[0],L,$=0,y=b.length;$<y;){for(L=S.length;L--;S[L]*=A);for(S[0]+=N.indexOf(b.charAt($++)),T=0;T<S.length;T++)S[T]>C-1&&(S[T+1]==null&&(S[T+1]=0),S[T+1]+=S[T]/C|0,S[T]%=C)}return S.reverse()}return function(b,A,C,N,T){var S,L,$,y,D,_,k,W,H=b.indexOf("."),Q=a,z=u;for(H>=0&&(y=g,g=0,b=b.replace(".",""),W=new w(A),_=W.pow(b.length-H),g=y,W.c=x(ft(We(_.c),_.e,"0"),10,C,h),W.e=W.c.length),k=x(b,A,C,T?(S=E,h):(S=h,E)),$=y=k.length;k[--y]==0;k.pop());if(!k[0])return S.charAt(0);if(H<0?--$:(_.c=k,_.e=$,_.s=N,_=t(_,W,Q,z,C),k=_.c,D=_.r,$=_.e),L=$+Q+1,H=k[L],y=C/2,D=D||L<0||k[L+1]!=null,D=z<4?(H!=null||D)&&(z==0||z==(_.s<0?3:2)):H>y||H==y&&(z==4||D||z==6&&k[L-1]&1||z==(_.s<0?8:7)),L<1||!k[0])b=D?ft(S.charAt(1),-Q,S.charAt(0)):S.charAt(0);else{if(k.length=L,D)for(--C;++k[--L]>C;)k[L]=0,L||(++$,k=[1].concat(k));for(y=k.length;!k[--y];);for(H=0,b="";H<=y;b+=S.charAt(k[H++]));b=ft(b,$,S.charAt(0))}return b}}(),t=function(){function h(A,C,N){var T,S,L,$,y=0,D=A.length,_=C%xt,k=C/xt|0;for(A=A.slice();D--;)L=A[D]%xt,$=A[D]/xt|0,T=k*L+$*_,S=_*L+T%xt*xt+y,y=(S/N|0)+(T/xt|0)+k*$,A[D]=S%N;return y&&(A=[y].concat(A)),A}function x(A,C,N,T){var S,L;if(N!=T)L=N>T?1:-1;else for(S=L=0;S<N;S++)if(A[S]!=C[S]){L=A[S]>C[S]?1:-1;break}return L}function b(A,C,N,T){for(var S=0;N--;)A[N]-=S,S=A[N]<C[N]?1:0,A[N]=S*T+A[N]-C[N];for(;!A[0]&&A.length>1;A.splice(0,1));}return function(A,C,N,T,S){var L,$,y,D,_,k,W,H,Q,z,K,G,oe,fe,Ne,Ae,ot,ye=A.s==C.s?1:-1,he=A.c,se=C.c;if(!he||!he[0]||!se||!se[0])return new w(!A.s||!C.s||(he?se&&he[0]==se[0]:!se)?NaN:he&&he[0]==0||!se?ye*0:ye/0);for(H=new w(ye),Q=H.c=[],$=A.e-C.e,ye=N+$+1,S||(S=Ge,$=Be(A.e/X)-Be(C.e/X),ye=ye/X|0),y=0;se[y]==(he[y]||0);y++);if(se[y]>(he[y]||0)&&$--,ye<0)Q.push(1),D=!0;else{for(fe=he.length,Ae=se.length,y=0,ye+=2,_=_e(S/(se[0]+1)),_>1&&(se=h(se,_,S),he=h(he,_,S),Ae=se.length,fe=he.length),oe=Ae,z=he.slice(0,Ae),K=z.length;K<Ae;z[K++]=0);ot=se.slice(),ot=[0].concat(ot),Ne=se[0],se[1]>=S/2&&Ne++;do{if(_=0,L=x(se,z,Ae,K),L<0){if(G=z[0],Ae!=K&&(G=G*S+(z[1]||0)),_=_e(G/Ne),_>1)for(_>=S&&(_=S-1),k=h(se,_,S),W=k.length,K=z.length;x(k,z,W,K)==1;)_--,b(k,Ae<W?ot:se,W,S),W=k.length,L=1;else _==0&&(L=_=1),k=se.slice(),W=k.length;if(W<K&&(k=[0].concat(k)),b(z,k,K,S),K=z.length,L==-1)for(;x(se,z,Ae,K)<1;)_++,b(z,Ae<K?ot:se,K,S),K=z.length}else L===0&&(_++,z=[0]);Q[y++]=_,z[0]?z[K++]=he[oe]||0:(z=[he[oe]],K=1)}while((oe++<fe||z[0]!=null)&&ye--);D=z[0]!=null,Q[0]||Q.splice(0,1)}if(S==Ge){for(y=1,ye=Q[0];ye>=10;ye/=10,y++);B(H,N+(H.e=y+$*X-1)+1,T,D)}else H.e=$,H.r=+D;return H}}();function P(h,x,b,A){var C,N,T,S,L;if(b==null?b=u:ce(b,0,8),!h.c)return h.toString();if(C=h.c[0],T=h.e,x==null)L=We(h.c),L=A==1||A==2&&(T<=s||T>=l)?Vn(L,T):ft(L,T,"0");else if(h=B(new w(h),x,b),N=h.e,L=We(h.c),S=L.length,A==1||A==2&&(x<=N||N<=s)){for(;S<x;L+="0",S++);L=Vn(L,N)}else if(x-=T+(A===2&&N>T),L=ft(L,N,"0"),N+1>S){if(--x>0)for(L+=".";x--;L+="0");}else if(x+=N-S,x>0)for(N+1==S&&(L+=".");x--;L+="0");return h.s<0&&C?"-"+L:L}function F(h,x){for(var b,A,C=1,N=new w(h[0]);C<h.length;C++)A=new w(h[C]),(!A.s||(b=Nt(N,A))===x||b===0&&N.s===x)&&(N=A);return N}function R(h,x,b){for(var A=1,C=x.length;!x[--C];x.pop());for(C=x[0];C>=10;C/=10,A++);return(b=A+b*X-1)>d?h.c=h.e=null:b<c?h.c=[h.e=0]:(h.e=b,h.c=x),h}r=function(){var h=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,b=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(N,T,S,L){var $,y=S?T:T.replace(C,"");if(A.test(y))N.s=isNaN(y)?null:y<0?-1:1;else{if(!S&&(y=y.replace(h,function(D,_,k){return $=(k=k.toLowerCase())=="x"?16:k=="b"?2:8,!L||L==$?_:D}),L&&($=L,y=y.replace(x,"$1").replace(b,"0.$1")),T!=y))return new w(y,$);if(w.DEBUG)throw Error(Te+"Not a"+(L?" base "+L:"")+" number: "+T);N.s=null}N.c=N.e=null}}();function B(h,x,b,A){var C,N,T,S,L,$,y,D=h.c,_=bo;if(D){e:{for(C=1,S=D[0];S>=10;S/=10,C++);if(N=x-C,N<0)N+=X,T=x,L=D[$=0],y=_e(L/_[C-T-1]%10);else if($=go((N+1)/X),$>=D.length)if(A){for(;D.length<=$;D.push(0));L=y=0,C=1,N%=X,T=N-X+1}else break e;else{for(L=S=D[$],C=1;S>=10;S/=10,C++);N%=X,T=N-X+C,y=T<0?0:_e(L/_[C-T-1]%10)}if(A=A||x<0||D[$+1]!=null||(T<0?L:L%_[C-T-1]),A=b<4?(y||A)&&(b==0||b==(h.s<0?3:2)):y>5||y==5&&(b==4||A||b==6&&(N>0?T>0?L/_[C-T]:0:D[$-1])%10&1||b==(h.s<0?8:7)),x<1||!D[0])return D.length=0,A?(x-=h.e+1,D[0]=_[(X-x%X)%X],h.e=-x||0):D[0]=h.e=0,h;if(N==0?(D.length=$,S=1,$--):(D.length=$+1,S=_[X-N],D[$]=T>0?_e(L/_[C-T]%_[T])*S:0),A)for(;;)if($==0){for(N=1,T=D[0];T>=10;T/=10,N++);for(T=D[0]+=S,S=1;T>=10;T/=10,S++);N!=S&&(h.e++,D[0]==Ge&&(D[0]=1));break}else{if(D[$]+=S,D[$]!=Ge)break;D[$--]=0,S=1}for(N=D.length;D[--N]===0;D.pop());}h.e>d?h.c=h.e=null:h.e<c&&(h.c=[h.e=0])}return h}function V(h){var x,b=h.e;return b===null?h.toString():(x=We(h.c),x=b<=s||b>=l?Vn(x,b):ft(x,b,"0"),h.s<0?"-"+x:x)}return o.absoluteValue=o.abs=function(){var h=new w(this);return h.s<0&&(h.s=1),h},o.comparedTo=function(h,x){return Nt(this,new w(h,x))},o.decimalPlaces=o.dp=function(h,x){var b,A,C,N=this;if(h!=null)return ce(h,0,be),x==null?x=u:ce(x,0,8),B(new w(N),h+N.e+1,x);if(!(b=N.c))return null;if(A=((C=b.length-1)-Be(this.e/X))*X,C=b[C])for(;C%10==0;C/=10,A--);return A<0&&(A=0),A},o.dividedBy=o.div=function(h,x){return t(this,new w(h,x),a,u)},o.dividedToIntegerBy=o.idiv=function(h,x){return t(this,new w(h,x),0,1)},o.exponentiatedBy=o.pow=function(h,x){var b,A,C,N,T,S,L,$,y,D=this;if(h=new w(h),h.c&&!h.isInteger())throw Error(Te+"Exponent not an integer: "+V(h));if(x!=null&&(x=new w(x)),S=h.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!h.c||!h.c[0])return y=new w(Math.pow(+V(D),S?h.s*(2-Un(h)):+V(h))),x?y.mod(x):y;if(L=h.s<0,x){if(x.c?!x.c[0]:!x.s)return new w(NaN);A=!L&&D.isInteger()&&x.isInteger(),A&&(D=D.mod(x))}else{if(h.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||S&&D.c[1]>=24e7:D.c[0]<8e13||S&&D.c[0]<=9999975e7)))return N=D.s<0&&Un(h)?-0:0,D.e>-1&&(N=1/N),new w(L?1/N:N);g&&(N=go(g/X+2))}for(S?(b=new w(.5),L&&(h.s=1),$=Un(h)):(C=Math.abs(+V(h)),$=C%2),y=new w(i);;){if($){if(y=y.times(D),!y.c)break;N?y.c.length>N&&(y.c.length=N):A&&(y=y.mod(x))}if(C){if(C=_e(C/2),C===0)break;$=C%2}else if(h=h.times(b),B(h,h.e+1,1),h.e>14)$=Un(h);else{if(C=+V(h),C===0)break;$=C%2}D=D.times(D),N?D.c&&D.c.length>N&&(D.c.length=N):A&&(D=D.mod(x))}return A?y:(L&&(y=i.div(y)),x?y.mod(x):N?B(y,g,u,T):y)},o.integerValue=function(h){var x=new w(this);return h==null?h=u:ce(h,0,8),B(x,x.e+1,h)},o.isEqualTo=o.eq=function(h,x){return Nt(this,new w(h,x))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(h,x){return Nt(this,new w(h,x))>0},o.isGreaterThanOrEqualTo=o.gte=function(h,x){return(x=Nt(this,new w(h,x)))===1||x===0},o.isInteger=function(){return!!this.c&&Be(this.e/X)>this.c.length-2},o.isLessThan=o.lt=function(h,x){return Nt(this,new w(h,x))<0},o.isLessThanOrEqualTo=o.lte=function(h,x){return(x=Nt(this,new w(h,x)))===-1||x===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(h,x){var b,A,C,N,T=this,S=T.s;if(h=new w(h,x),x=h.s,!S||!x)return new w(NaN);if(S!=x)return h.s=-x,T.plus(h);var L=T.e/X,$=h.e/X,y=T.c,D=h.c;if(!L||!$){if(!y||!D)return y?(h.s=-x,h):new w(D?T:NaN);if(!y[0]||!D[0])return D[0]?(h.s=-x,h):new w(y[0]?T:u==3?-0:0)}if(L=Be(L),$=Be($),y=y.slice(),S=L-$){for((N=S<0)?(S=-S,C=y):($=L,C=D),C.reverse(),x=S;x--;C.push(0));C.reverse()}else for(A=(N=(S=y.length)<(x=D.length))?S:x,S=x=0;x<A;x++)if(y[x]!=D[x]){N=y[x]<D[x];break}if(N&&(C=y,y=D,D=C,h.s=-h.s),x=(A=D.length)-(b=y.length),x>0)for(;x--;y[b++]=0);for(x=Ge-1;A>S;){if(y[--A]<D[A]){for(b=A;b&&!y[--b];y[b]=x);--y[b],y[A]+=Ge}y[A]-=D[A]}for(;y[0]==0;y.splice(0,1),--$);return y[0]?R(h,y,$):(h.s=u==3?-1:1,h.c=[h.e=0],h)},o.modulo=o.mod=function(h,x){var b,A,C=this;return h=new w(h,x),!C.c||!h.s||h.c&&!h.c[0]?new w(NaN):!h.c||C.c&&!C.c[0]?new w(C):(f==9?(A=h.s,h.s=1,b=t(C,h,0,3),h.s=A,b.s*=A):b=t(C,h,0,f),h=C.minus(b.times(h)),!h.c[0]&&f==1&&(h.s=C.s),h)},o.multipliedBy=o.times=function(h,x){var b,A,C,N,T,S,L,$,y,D,_,k,W,H,Q,z=this,K=z.c,G=(h=new w(h,x)).c;if(!K||!G||!K[0]||!G[0])return!z.s||!h.s||K&&!K[0]&&!G||G&&!G[0]&&!K?h.c=h.e=h.s=null:(h.s*=z.s,!K||!G?h.c=h.e=null:(h.c=[0],h.e=0)),h;for(A=Be(z.e/X)+Be(h.e/X),h.s*=z.s,L=K.length,D=G.length,L<D&&(W=K,K=G,G=W,C=L,L=D,D=C),C=L+D,W=[];C--;W.push(0));for(H=Ge,Q=xt,C=D;--C>=0;){for(b=0,_=G[C]%Q,k=G[C]/Q|0,T=L,N=C+T;N>C;)$=K[--T]%Q,y=K[T]/Q|0,S=k*$+y*_,$=_*$+S%Q*Q+W[N]+b,b=($/H|0)+(S/Q|0)+k*y,W[N--]=$%H;W[N]=b}return b?++A:W.splice(0,1),R(h,W,A)},o.negated=function(){var h=new w(this);return h.s=-h.s||null,h},o.plus=function(h,x){var b,A=this,C=A.s;if(h=new w(h,x),x=h.s,!C||!x)return new w(NaN);if(C!=x)return h.s=-x,A.minus(h);var N=A.e/X,T=h.e/X,S=A.c,L=h.c;if(!N||!T){if(!S||!L)return new w(C/0);if(!S[0]||!L[0])return L[0]?h:new w(S[0]?A:C*0)}if(N=Be(N),T=Be(T),S=S.slice(),C=N-T){for(C>0?(T=N,b=L):(C=-C,b=S),b.reverse();C--;b.push(0));b.reverse()}for(C=S.length,x=L.length,C-x<0&&(b=L,L=S,S=b,x=C),C=0;x;)C=(S[--x]=S[x]+L[x]+C)/Ge|0,S[x]=Ge===S[x]?0:S[x]%Ge;return C&&(S=[C].concat(S),++T),R(h,S,T)},o.precision=o.sd=function(h,x){var b,A,C,N=this;if(h!=null&&h!==!!h)return ce(h,1,be),x==null?x=u:ce(x,0,8),B(new w(N),h,x);if(!(b=N.c))return null;if(C=b.length-1,A=C*X+1,C=b[C]){for(;C%10==0;C/=10,A--);for(C=b[0];C>=10;C/=10,A++);}return h&&N.e+1>A&&(A=N.e+1),A},o.shiftedBy=function(h){return ce(h,-vo,vo),this.times("1e"+h)},o.squareRoot=o.sqrt=function(){var h,x,b,A,C,N=this,T=N.c,S=N.s,L=N.e,$=a+4,y=new w("0.5");if(S!==1||!T||!T[0])return new w(!S||S<0&&(!T||T[0])?NaN:T?N:1/0);if(S=Math.sqrt(+V(N)),S==0||S==1/0?(x=We(T),(x.length+L)%2==0&&(x+="0"),S=Math.sqrt(+x),L=Be((L+1)/2)-(L<0||L%2),S==1/0?x="5e"+L:(x=S.toExponential(),x=x.slice(0,x.indexOf("e")+1)+L),b=new w(x)):b=new w(S+""),b.c[0]){for(L=b.e,S=L+$,S<3&&(S=0);;)if(C=b,b=y.times(C.plus(t(N,C,$,1))),We(C.c).slice(0,S)===(x=We(b.c)).slice(0,S))if(b.e<L&&--S,x=x.slice(S-3,S+1),x=="9999"||!A&&x=="4999"){if(!A&&(B(C,C.e+a+2,0),C.times(C).eq(N))){b=C;break}$+=4,S+=4,A=1}else{(!+x||!+x.slice(1)&&x.charAt(0)=="5")&&(B(b,b.e+a+2,1),h=!b.times(b).eq(N));break}}return B(b,b.e+a+1,u,h)},o.toExponential=function(h,x){return h!=null&&(ce(h,0,be),h++),P(this,h,x,1)},o.toFixed=function(h,x){return h!=null&&(ce(h,0,be),h=h+this.e+1),P(this,h,x)},o.toFormat=function(h,x,b){var A,C=this;if(b==null)h!=null&&x&&typeof x=="object"?(b=x,x=null):h&&typeof h=="object"?(b=h,h=x=null):b=v;else if(typeof b!="object")throw Error(Te+"Argument not an object: "+b);if(A=C.toFixed(h,x),C.c){var N,T=A.split("."),S=+b.groupSize,L=+b.secondaryGroupSize,$=b.groupSeparator||"",y=T[0],D=T[1],_=C.s<0,k=_?y.slice(1):y,W=k.length;if(L&&(N=S,S=L,L=N,W-=N),S>0&&W>0){for(N=W%S||S,y=k.substr(0,N);N<W;N+=S)y+=$+k.substr(N,S);L>0&&(y+=$+k.slice(N)),_&&(y="-"+y)}A=D?y+(b.decimalSeparator||"")+((L=+b.fractionGroupSize)?D.replace(new RegExp("\\d{"+L+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):D):y}return(b.prefix||"")+A+(b.suffix||"")},o.toFraction=function(h){var x,b,A,C,N,T,S,L,$,y,D,_,k=this,W=k.c;if(h!=null&&(S=new w(h),!S.isInteger()&&(S.c||S.s!==1)||S.lt(i)))throw Error(Te+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+V(S));if(!W)return new w(k);for(x=new w(i),$=b=new w(i),A=L=new w(i),_=We(W),N=x.e=_.length-k.e-1,x.c[0]=bo[(T=N%X)<0?X+T:T],h=!h||S.comparedTo(x)>0?N>0?x:$:S,T=d,d=1/0,S=new w(_),L.c[0]=0;y=t(S,x,0,1),C=b.plus(y.times(A)),C.comparedTo(h)!=1;)b=A,A=C,$=L.plus(y.times(C=$)),L=C,x=S.minus(y.times(C=x)),S=C;return C=t(h.minus(b),A,0,1),L=L.plus(C.times($)),b=b.plus(C.times(A)),L.s=$.s=k.s,N=N*2,D=t($,A,N,u).minus(k).abs().comparedTo(t(L,b,N,u).minus(k).abs())<1?[$,A]:[L,b],d=T,D},o.toNumber=function(){return+V(this)},o.toPrecision=function(h,x){return h!=null&&ce(h,1,be),P(this,h,x,2)},o.toString=function(h){var x,b=this,A=b.s,C=b.e;return C===null?A?(x="Infinity",A<0&&(x="-"+x)):x="NaN":(h==null?x=C<=s||C>=l?Vn(We(b.c),C):ft(We(b.c),C,"0"):h===10&&I?(b=B(new w(b),a+C+1,u),x=ft(We(b.c),b.e,"0")):(ce(h,2,E.length,"Base"),x=n(ft(We(b.c),C,"0"),10,h,A,!0)),A<0&&b.c[0]&&(x="-"+x)),x},o.valueOf=o.toJSON=function(){return V(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function Be(e){var t=e|0;return e>0||e===t?t:t-1}function We(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=X-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function Nt(e,t){var n,r,o=e.c,i=t.c,a=e.s,u=t.s,s=e.e,l=t.e;if(!a||!u)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-u:a;if(a!=u)return a;if(n=a<0,r=s==l,!o||!i)return r?0:!o^n?1:-1;if(!r)return s>l^n?1:-1;for(u=(s=o.length)<(l=i.length)?s:l,a=0;a<u;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return s==l?0:s>l^n?1:-1}function ce(e,t,n,r){if(e<t||e>n||e!==_e(e))throw Error(Te+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Un(e){var t=e.c.length-1;return Be(e.e/X)==t&&e.c[t]%2!=0}function Vn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ft(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Tl=Ol();const Nm=Object.values({MAINNET:1,SEPOLIA:11155111}),_t=e=>Nm.includes(+e),Am=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:i,amount:a,decimals:u,tokenBalance:s,platformBalance:l="0",onDepositAmountChange:c,onApprove:d})=>{const{t:p}=Ye(),f=m.useMemo(()=>{if(_t(o==null?void 0:o.chainId))return!1;try{const E=new Tl(e||"0"),I=new Tl("250000");return E.isNaN()||I.isNaN()?!1:E.gte(I)}catch{return!1}},[o,e]),g=E=>{const I=E.target.value,P=Kr(I,s||"0");if(P.isValid)c(P.formattedValue),P.errorType;else return P.errorType==="exceed_balance",void 0},v=()=>{const E=parseFloat(s||"0"),I=parseFloat(e||"0");if(I>0){const w=E-I,P=ze(Math.max(0,w).toString());return O.jsxs("span",{className:"flex items-center gap-1",children:[ze(s||"0"),O.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),P," ",t]})}return`${ze(s||"0")} ${t}`};return O.jsxs(O.Fragment,{children:[O.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[O.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[O.jsx("input",{type:"text",placeholder:p("deposit.amount"),value:e,onChange:g,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"}),O.jsx("button",{onClick:()=>{c(s||"0")},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:p("deposit.max")})]}),O.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),O.jsxs("div",{className:"flex justify-between items-center",children:[O.jsx(on,{content:p("deposit.availableDesc"),children:O.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:p("deposit.available")})}),O.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:v()})]})]}),!r&&ip(e||"0",0)&&O.jsxs("div",{className:"flex justify-center flex-col items-center",children:[O.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:p("deposit.enableSystemProWithToken",{token:t,network:o==null?void 0:o.chain})}),O.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:p("deposit.enableTokenDesc",{token:t,network:o==null?void 0:o.chain})}),O.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4",onClick:d,children:p("deposit.enableWithToken",{token:t})})]}),f&&O.jsxs("div",{className:"flex mb-4",children:[O.jsx("div",{className:"w-5",children:O.jsx("img",{src:Sl,className:"w-4 h-4",alt:"Warning"})}),O.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:p("deposit.depositTipFor25w")})]}),O.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:O.jsxs("div",{className:"flex justify-between items-center",children:[O.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:p("deposit.equity")}),O.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?O.jsxs("span",{className:"flex items-center gap-1",children:[ze(l),O.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),ze((parseFloat(l)+parseFloat(e)).toString())," ",t]}):`${ze(l)} ${t}`})]})})]})},$m=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:i})=>{var s,l;const a=(s=o==null?void 0:o.useBalance)==null?void 0:s.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 m.useEffect(()=>{i(e.tokenAddress,{balance:a,allowance:u})},[a,u,e.tokenAddress,i]),null},Nl=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var g;const i=m.useMemo(()=>r.filter(v=>v.tokenAddress&&v.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[a,u]=m.useState({}),s=m.useCallback((v,E)=>{u(I=>({...I,[v]:E}))},[]),l=(g=o==null?void 0:o.useBalance)==null?void 0:g.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),c=m.useMemo(()=>i.map(v=>m.createElement($m,{key:v.tokenAddress,token:v,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:s})),[i,e,t,n,o,s]),d=m.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"},E=i.map(P=>{const F=a[P.tokenAddress],R=F==null?void 0:F.balance,B=R==null?void 0:R.data;return{address:P.tokenAddress,value:(B==null?void 0:B.value)||BigInt(0),formatted:(B==null?void 0:B.formatted)||"0",decimals:(B==null?void 0:B.decimals)||P.decimals}}).filter(P=>P.address),I=i.map(P=>{const F=a[P.tokenAddress],R=F==null?void 0:F.allowance,B=R==null?void 0:R.data,V=BigInt(B?B.toString():0);return{address:P.tokenAddress,value:V,formatted:(V/BigInt(10)**BigInt(P.decimals)).toString(),decimals:P.decimals}}).filter(P=>P.address),w=E.reduce((P,F)=>{const R=I.find(B=>B.address===F.address);return{...P,[F.address]:{balance:F,allowance:R||{address:F.address,value:BigInt(0),formatted:"0",decimals:F.decimals}}}},{});return{balanceList:E,allowanceList:I,baseTokenBalance:v,combinedData:w}},[l,a,i,o==null?void 0:o.useBalance]),p=m.useCallback(async()=>d,[d]),f=m.useMemo(()=>{const v=(l==null?void 0:l.isLoading)||!1,E=Object.values(a).some(I=>{var w,P;return((w=I.balance)==null?void 0:w.isLoading)||((P=I.allowance)==null?void 0:P.isLoading)});return v||E},[l==null?void 0:l.isLoading,a]);return{multicallRun:p,multicallResult:d,validErcTokens:i,isLoading:f,queryComponents:c}},Pm=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:a,platformBalance:u="0",wagmiHooks:s,approved:l,onApproved:c,onDeposit:d,onClose:p,onChainChange:f,onTokenChange:g})=>{var _;const{t:v}=Ye(),[E,I]=m.useState(()=>{var k;return!e||e.length===0?1:t||((k=e[0])==null?void 0:k.chainId)||1}),[w,P]=m.useState(()=>{var Q;if(!e||e.length===0)return"";const k=t||((Q=e[0])==null?void 0:Q.chainId),W=e.find(z=>z.chainId===k);if(!W||!W.tokenList||W.tokenList.length===0)return"";const H=W.tokenList.find(z=>z.tokenAddress===n)||W.tokenList[0];return(H==null?void 0:H.token)||""}),[F,R]=m.useState(r),B=m.useCallback(k=>{I(k),f==null||f(k)},[f]),V=m.useCallback(k=>{P(k),g==null||g(k)},[g]),h=m.useRef(!0),x=m.useRef(w),b=m.useRef(E);m.useEffect(()=>{if(h.current){h.current=!1,x.current=w,b.current=E;return}(x.current!==w||b.current!==E)&&(R(""),x.current=w,b.current=E)},[w,E]);const A=e&&e.length>0?e.find(k=>k.chainId===E)||e[0]:null,C=(_=A==null?void 0:A.tokenList)==null?void 0:_.find(k=>k.token===w),N=o==null?void 0:o.getDisplayAddress(),{multicallResult:T,queryComponents:S}=Nl({account:N,chainId:E,contractAddress:void 0,tokens:(A==null?void 0:A.tokenList)||[],wagmiHooks:s}),L=m.useMemo(()=>{var W;if(!C)return;if(!C.tokenAddress||C.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return T.baseTokenBalance.formatted;const k=T.combinedData[C.tokenAddress];return((W=k==null?void 0:k.balance)==null?void 0:W.formatted)||"0"},[C,T]),$=l??!1,y=m.useMemo(()=>{const k=parseFloat(F||"0"),W=10,H=L||"0",Q=sp(F,H,$);return!F||k===0||!$?{text:v("deposit.confirmDeposit"),disabled:!0}:k>parseFloat(H)?{text:"Insufficient Balance",disabled:!0}:k<W?{text:`Min Deposit ${W} ${w}`,disabled:!0}:{text:v("deposit.confirmDeposit"),disabled:!Q}},[F,w,L,$]),D=m.useCallback(async()=>{d&&d({amount:F,chainId:E,tokenAddress:(C==null?void 0:C.tokenAddress)||"",tokenSymbol:w})},[d,F,E,C==null?void 0:C.tokenAddress,w]);return!(s!=null&&s.useBalance)||!(s!=null&&s.useReadContract)||!(s!=null&&s.useAccount)?O.jsxs("div",{className:"p-6 text-center",children:[O.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),O.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"No chains available"})}):A?O.jsxs(O.Fragment,{children:[S,O.jsx(Yr,{currentActiveChain:A,chainList:e,onChainChange:B,curSelectToken:w,onTokenChange:V,walletType:"evm"}),O.jsx(Am,{depositAmount:F,curSelectToken:w,curSelectTokenData:{balance:C==null?void 0:C.balance,allowance:C==null?void 0:C.allowance},approved:$,currentActiveChain:A,currentEquity:a||0,amount:F,decimals:(C==null?void 0:C.decimals)||6,tokenBalance:L,platformBalance:u,onDepositAmountChange:R,onApprove:async()=>{c&&await c()}}),O.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${y.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:D,disabled:y.disabled,children:y.text})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Al=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=qr,smartWallet:o=Xr,chains:i,defaultChainId:a,defaultTokenAddress:u,defaultAmount:s="",metadata:l=Qr,currentEquity:c=5e3,platformBalance:d="0",wagmiHooks:p,approved:f,onApproved:g,onDeposit:v,onCopy:E,onChainChange:I,onTokenChange:w})=>{const{t:P}=Ye(),F=m.useMemo(()=>{var B;return r?Io(r,o,!1,(B=i[0])==null?void 0:B.chainId,"0","0"):null},[r,o,i]),R=(F==null?void 0:F.getWalletType())==="mpc";return e?we.createPortal(O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:O.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:B=>{B.stopPropagation()},children:[O.jsxs("div",{className:"flex items-center justify-between mb-4",children:[O.jsx("h2",{className:"text-lg font-semibold text-white",children:P("deposit.title")}),O.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:O.jsx(Mo,{className:"h-4 w-4"})})]}),R?O.jsx(Om,{chains:i,defaultChainId:a,defaultTokenAddress:u,defaultAmount:s,walletAdapter:F,metadata:l,currentEquity:c,onDeposit:v,onCopy:E,onClose:t}):O.jsx(Pm,{chains:i,defaultChainId:a,defaultTokenAddress:u,defaultAmount:s,walletAdapter:F,metadata:l,currentEquity:c,platformBalance:d,wagmiHooks:p,approved:f,onApproved:g,onDeposit:v,onClose:t,onChainChange:I,onTokenChange:w})]})})}),document.body):null};let nt=null;const Lm={symbol:"USDT"},$l=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState({chains:[]}),a=m.useCallback(c=>{i(c),r(!0)},[]),u=m.useCallback(c=>{i(d=>({...d,...c}))},[]),s=m.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=m.useCallback(()=>n,[n]);return m.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:s,updateDepositOptions:u,isOpen:l}),[a,s,u,l]),m.useEffect(()=>(nt={openDeposit:a,closeDeposit:s,updateDepositOptions:u,isOpen:l},()=>{nt=null}),[a,s,u,l]),O.jsx(Al,{isOpen:n,onClose:s,config:o.config||Lm,currentActiveAccount:o.currentActiveAccount||qr,smartWallet:o.smartWallet||Xr,chains:o.chains||up,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||Qr,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,approved:o.approved,onApproved:o.onApproved,onDeposit:o.onDeposit,onCopy:o.onCopy,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});$l.displayName="DepositManager";const Pl=e=>{if(!nt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}nt.openDeposit(e||{chains:[]})},Ll=()=>{if(!nt){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}nt.closeDeposit()},Ml=e=>{nt&&nt.updateDepositOptions(e)},Mm=()=>nt?nt.isOpen():!1,Dm=()=>({openDeposit:Pl,closeDeposit:Ll,updateDepositOptions:Ml,isOpen:Mm});m.createContext(null);const Im=()=>O.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[O.jsx("g",{clipPath:"url(#clip0_active)",children:O.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),O.jsx("defs",{children:O.jsx("clipPath",{id:"clip0_active",children:O.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Fm=()=>O.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[O.jsx("g",{clipPath:"url(#clip0_inactive)",children:O.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),O.jsx("defs",{children:O.jsx("clipPath",{id:"clip0_inactive",children:O.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Hn=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,i)=>i+1);return O.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>O.jsx("div",{className:"flex items-center justify-center",children:o<=e?O.jsx(Im,{}):O.jsx(Fm,{})},o))})};class dt{}Le(dt,"FAST",3),Le(dt,"Medium",2),Le(dt,"SLOW",1),Le(dt,"NONE",0);const jm=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",walletType:o="evm",receiverAddress:i="",onWithdrawAmountChange:a,onReceiverAddressChange:u})=>{const{t:s}=Ye(),l=p=>{const f=p.target.value,v=Kr(f,r||"0");if(v.isValid)a(v.formattedValue),v.errorType;else return v.errorType==="exceed_balance",void 0},c=()=>{a(r)},d=()=>{const p=parseFloat(r||"0"),f=parseFloat(e||"0");if(f>0){const g=p-f,v=ze(Math.max(0,g).toString());return O.jsxs("span",{className:"flex items-center gap-1",children:[ze(r||"0"),O.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),v," ",t]})}return`${ze(r||"0")} ${t}`};return O.jsxs(O.Fragment,{children:[O.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[O.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[O.jsx("input",{type:"text",placeholder:s("deposit.amount"),value:e,onChange:l,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"}),O.jsx("button",{onClick:c,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:s("deposit.max")})]}),O.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),O.jsxs("div",{className:"flex justify-between items-center",children:[O.jsx(on,{content:s("deposit.availableDesc"),children:O.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:s("deposit.available")})}),O.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:d()})]})]}),o==="mpc"&&!_t(n==null?void 0:n.chainId)&&O.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:O.jsx("input",{type:"text",placeholder:s("withdraw.receiverAddress"),value:i,onChange:p=>u==null?void 0:u(p.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),O.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:_t(n==null?void 0:n.chainId)?O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:s("withdraw.noticeDesc")}),O.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:s("withdraw.commonWithdraw")})]}):O.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:s("withdraw.crossChainTips")})}),O.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsx("span",{className:"text-text-tertiary text-xs",children:s("withdraw.speed")}),O.jsx("div",{className:"flex items-center",children:O.jsx(on,{content:O.jsxs("div",{children:[O.jsx("div",{children:s("withdraw.speedNote")}),O.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[O.jsx(Hn,{selectedLevel:dt.FAST,maxLevel:3}),O.jsx("span",{children:s("withdraw.speedNoteSpeed1")})]}),O.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[O.jsx(Hn,{selectedLevel:dt.Medium,maxLevel:3}),O.jsx("span",{children:s("withdraw.speedNoteSpeed2")})]}),O.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[O.jsx(Hn,{selectedLevel:dt.SLOW,maxLevel:3}),O.jsx("span",{children:s("withdraw.speedNoteSpeed3")})]})]}),children:O.jsx(Hn,{selectedLevel:_t(n==null?void 0:n.chainId)?dt.SLOW:dt.FAST,maxLevel:3})})})]}),O.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[O.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:"Amount to receive"}),O.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[ze(e)," ",t]})]})]})]})},Rm=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:a,platformBalance:u="0",wagmiHooks:s,onWithdraw:l,onClose:c,onChainChange:d,onTokenChange:p})=>{var _;const{t:f}=Ye(),[g,v]=m.useState(()=>{var k;return!e||e.length===0?1:t||((k=e[0])==null?void 0:k.chainId)||1}),[E,I]=m.useState(()=>{var Q;if(!e||e.length===0)return"";const k=t||((Q=e[0])==null?void 0:Q.chainId),W=e.find(z=>z.chainId===k);if(!W||!W.tokenList||W.tokenList.length===0)return"";const H=W.tokenList.find(z=>z.tokenAddress===n)||W.tokenList[0];return(H==null?void 0:H.token)||""}),[w,P]=m.useState(r),[F,R]=m.useState(""),B=(o==null?void 0:o.getWalletType())||"evm",V=m.useCallback(k=>{v(k),d==null||d(k)},[d]),h=m.useCallback(k=>{I(k),p==null||p(k)},[p]),x=m.useRef(!0),b=m.useRef(E),A=m.useRef(g);m.useEffect(()=>{if(x.current){x.current=!1,b.current=E,A.current=g;return}(b.current!==E||A.current!==g)&&(P(""),b.current=E,A.current=g)},[E,g]);const C=e&&e.length>0?e.find(k=>k.chainId===g)||e[0]:null,N=(_=C==null?void 0:C.tokenList)==null?void 0:_.find(k=>k.token===E),T=o==null?void 0:o.getDisplayAddress(),{multicallResult:S,queryComponents:L}=Nl({account:T,chainId:g,contractAddress:void 0,tokens:(C==null?void 0:C.tokenList)||[],wagmiHooks:s}),$=m.useMemo(()=>{var W;if(!N)return;if(!N.tokenAddress||N.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return S.baseTokenBalance.formatted;const k=S.combinedData[N.tokenAddress];return((W=k==null?void 0:k.balance)==null?void 0:W.formatted)||"0"},[N,S]),y=m.useMemo(()=>{const k=parseFloat(w||"0");return!w||k===0?{text:f("withdraw.confirmWithdraw"),disabled:!0}:B==="mpc"&&!_t(g)&&!F.trim()?{text:"Enter Receiver Address",disabled:!0}:{text:f("withdraw.confirmWithdraw"),disabled:!1}},[f,g,w,B,F]),D=m.useCallback(async()=>{if(l){const k={amount:w,chainId:g,tokenAddress:(N==null?void 0:N.tokenAddress)||"",tokenSymbol:E};B==="mpc"&&!_t(g)&&(k.receiverAddress=F),l(k)}},[l,w,g,N==null?void 0:N.tokenAddress,E,B,F]);return!(s!=null&&s.useBalance)||!(s!=null&&s.useReadContract)||!(s!=null&&s.useAccount)?O.jsxs("div",{className:"p-6 text-center",children:[O.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),O.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"No chains available"})}):C?O.jsxs(O.Fragment,{children:[L,O.jsx(Yr,{currentActiveChain:C,chainList:e,onChainChange:V,curSelectToken:E,onTokenChange:h,walletType:"evm"}),O.jsx(jm,{withdrawAmount:w,curSelectToken:E,curSelectTokenData:{balance:N==null?void 0:N.balance,allowance:N==null?void 0:N.allowance},currentActiveChain:C,currentEquity:a||0,amount:w,decimals:(N==null?void 0:N.decimals)||6,tokenBalance:$,platformBalance:u,walletType:B,receiverAddress:F,onWithdrawAmountChange:P,onReceiverAddressChange:R}),O.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${y.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:D,disabled:y.disabled,children:y.text})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Dl=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=qr,smartWallet:o=Xr,chains:i,defaultChainId:a,defaultTokenAddress:u,defaultAmount:s="",metadata:l=Qr,currentEquity:c=5e3,platformBalance:d="0",wagmiHooks:p,onWithdraw:f,onChainChange:g,onTokenChange:v})=>{const{t:E}=Ye(),I=m.useMemo(()=>{var w;return r?Io(r,o,!1,(w=i[0])==null?void 0:w.chainId,"0","0"):null},[r,o,i]);return e?we.createPortal(O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:O.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:O.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:w=>{w.stopPropagation()},children:[O.jsxs("div",{className:"flex items-center justify-between mb-4",children:[O.jsx("h2",{className:"text-lg font-semibold text-white",children:E("withdraw.withdraw")}),O.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:O.jsx(Mo,{className:"h-4 w-4"})})]}),O.jsx(Rm,{chains:i,defaultChainId:a,defaultTokenAddress:u,defaultAmount:s,walletAdapter:I,metadata:l,currentEquity:c,platformBalance:d,wagmiHooks:p,onWithdraw:f,onClose:t,onChainChange:g,onTokenChange:v})]})})}),document.body):null},km=[],_m={};let rt=null;const Il=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState({chains:[]}),a=m.useCallback(c=>{i(c||{chains:[]}),r(!0)},[]),u=m.useCallback(c=>{i(d=>({...d,...c}))},[]),s=m.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=m.useCallback(()=>n,[n]);return m.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:s,updateWithdrawOptions:u,isOpen:l}),[a,s,u,l]),m.useEffect(()=>(rt={openWithdraw:a,closeWithdraw:s,updateWithdrawOptions:u,isOpen:l},()=>{rt=null}),[a,s,u,l]),O.jsx(Dl,{isOpen:n,onClose:s,config:o.config||{symbol:"USDT"},currentActiveAccount:o.currentActiveAccount,smartWallet:o.smartWallet,chains:o.chains||km,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||_m,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,onWithdraw:o.onWithdraw,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});Il.displayName="WithdrawManager";const Fl=e=>{if(!rt){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}rt.openWithdraw(e||{chains:[]})},jl=()=>{if(!rt){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}rt.closeWithdraw()},Rl=e=>{if(!rt){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}rt.updateWithdrawOptions(e)},Bm=()=>rt?rt.isOpen():!1,Wm=()=>({openWithdraw:Fl,closeWithdraw:jl,updateWithdrawOptions:Rl,isOpen:Bm});te.ComponentProvider=ca,te.DEFAULT_LOCALE=ln,te.Deposit=Al,te.DepositManager=$l,te.LOCALE_NAMES=la,te.SUPPORTED_LOCALES=Yn,te.Tooltip=on,te.Withdraw=Dl,te.WithdrawManager=Il,te.closeDeposit=Ll,te.closeWithdraw=jl,te.openDeposit=Pl,te.openWithdraw=Fl,te.updateDepositOptions=Ml,te.updateWithdrawOptions=Rl,te.useComponentConfig=$o,te.useDeposit=fa,te.useDepositManager=Dm,te.useTranslation=Ye,te.useWithdraw=da,te.useWithdrawManager=Wm,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})});
104
120
  //# sourceMappingURL=index.umd.js.map