@edgex-web/components 0.1.0-beta.22 → 0.1.0-beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(J,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):(J=typeof globalThis<"u"?globalThis:J||self,m(J.EdgeXComponents={},J.React,J.ReactDOM))})(this,function(J,m,we){"use strict";var gh=Object.defineProperty;var vh=(J,m,we)=>m in J?gh(J,m,{enumerable:!0,configurable:!0,writable:!0,value:we}):J[m]=we;var Me=(J,m,we)=>vh(J,typeof m!="symbol"?m+"":m,we);function Lo(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 k=Lo(m),Vt=Lo(we);function oa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xn={exports:{}},zt={};/**
1
+ (function(J,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):(J=typeof globalThis<"u"?globalThis:J||self,m(J.EdgeXComponents={},J.React,J.ReactDOM))})(this,function(J,m,we){"use strict";var gh=Object.defineProperty;var vh=(J,m,we)=>m in J?gh(J,m,{enumerable:!0,configurable:!0,writable:!0,value:we}):J[m]=we;var Ie=(J,m,we)=>vh(J,typeof m!="symbol"?m+"":m,we);function Lo(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 R=Lo(m),Vt=Lo(we);function oa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xn={exports:{}},zt={};/**
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 $o;function ia(){if($o)return zt;$o=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 l(u,s,a){var c,d={},p=null,f=null;a!==void 0&&(p=""+a),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 zt.Fragment=n,zt.jsx=l,zt.jsxs=l,zt}var Ht={};/**
9
+ */var Po;function ia(){if(Po)return zt;Po=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 l(u,s,a){var c,d={},p=null,f=null;a!==void 0&&(p=""+a),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 zt.Fragment=n,zt.jsx=l,zt.jsxs=l,zt}var Ht={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,30 +14,30 @@
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 Po;function sa(){return Po||(Po=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"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),a=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(D){if(D===null||typeof D!="object")return null;var W=g&&D[g]||D[v];return typeof W=="function"?W:null}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(D){{for(var W=arguments.length,Y=new Array(W>1?W-1:0),X=1;X<W;X++)Y[X-1]=arguments[X];T("error",D,Y)}}function T(D,W,Y){{var X=M.ReactDebugCurrentFrame,ie=X.getStackAddendum();ie!==""&&(W+="%s",Y=Y.concat([ie]));var le=Y.map(function(re){return String(re)});le.unshift("Warning: "+W),Function.prototype.apply.call(console[D],console,le)}}var j=!1,F=!1,_=!1,B=!1,h=!1,b;b=Symbol.for("react.module.reference");function x(D){return!!(typeof D=="string"||typeof D=="function"||D===r||D===i||h||D===o||D===a||D===c||B||D===f||j||F||_||typeof D=="object"&&D!==null&&(D.$$typeof===p||D.$$typeof===d||D.$$typeof===l||D.$$typeof===u||D.$$typeof===s||D.$$typeof===b||D.getModuleId!==void 0))}function A(D,W,Y){var X=D.displayName;if(X)return X;var ie=W.displayName||W.name||"";return ie!==""?Y+"("+ie+")":Y}function P(D){return D.displayName||"Context"}function L(D){if(D==null)return null;if(typeof D.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case o:return"StrictMode";case a:return"Suspense";case c:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case u:var W=D;return P(W)+".Consumer";case l:var Y=D;return P(Y._context)+".Provider";case s:return A(D,D.render,"ForwardRef");case d:var X=D.displayName||null;return X!==null?X:L(D.type)||"Memo";case p:{var ie=D,le=ie._payload,re=ie._init;try{return L(re(le))}catch{return null}}}return null}var S=Object.assign,C=0,N,$,w,I,R,V,z;function G(){}G.__reactDisabledLog=!0;function q(){{if(C===0){N=console.log,$=console.info,w=console.warn,I=console.error,R=console.group,V=console.groupCollapsed,z=console.groupEnd;var D={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:D,log:D,warn:D,error:D,group:D,groupCollapsed:D,groupEnd:D})}C++}}function U(){{if(C--,C===0){var D={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},D,{value:N}),info:S({},D,{value:$}),warn:S({},D,{value:w}),error:S({},D,{value:I}),group:S({},D,{value:R}),groupCollapsed:S({},D,{value:V}),groupEnd:S({},D,{value:z})})}C<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=M.ReactCurrentDispatcher,H;function Z(D,W,Y){{if(H===void 0)try{throw Error()}catch(ie){var X=ie.stack.trim().match(/\n( *(at )?)/);H=X&&X[1]||""}return`
18
- `+H+D}}var ae=!1,$e;{var Pe=typeof WeakMap=="function"?WeakMap:Map;$e=new Pe}function st(D,W){if(!D||ae)return"";{var Y=$e.get(D);if(Y!==void 0)return Y}var X;ae=!0;var ie=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var le;le=K.current,K.current=null,q();try{if(W){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(Ae){X=Ae}Reflect.construct(D,[],re)}else{try{re.call()}catch(Ae){X=Ae}D.call(re.prototype)}}else{try{throw Error()}catch(Ae){X=Ae}D()}}catch(Ae){if(Ae&&X&&typeof Ae.stack=="string"){for(var te=Ae.stack.split(`
17
+ */var $o;function sa(){return $o||($o=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"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),a=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(D){if(D===null||typeof D!="object")return null;var U=g&&D[g]||D[v];return typeof U=="function"?U:null}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(D){{for(var U=arguments.length,Y=new Array(U>1?U-1:0),X=1;X<U;X++)Y[X-1]=arguments[X];N("error",D,Y)}}function N(D,U,Y){{var X=M.ReactDebugCurrentFrame,ie=X.getStackAddendum();ie!==""&&(U+="%s",Y=Y.concat([ie]));var le=Y.map(function(re){return String(re)});le.unshift("Warning: "+U),Function.prototype.apply.call(console[D],console,le)}}var j=!1,F=!1,k=!1,W=!1,h=!1,b;b=Symbol.for("react.module.reference");function x(D){return!!(typeof D=="string"||typeof D=="function"||D===r||D===i||h||D===o||D===a||D===c||W||D===f||j||F||k||typeof D=="object"&&D!==null&&(D.$$typeof===p||D.$$typeof===d||D.$$typeof===l||D.$$typeof===u||D.$$typeof===s||D.$$typeof===b||D.getModuleId!==void 0))}function $(D,U,Y){var X=D.displayName;if(X)return X;var ie=U.displayName||U.name||"";return ie!==""?Y+"("+ie+")":Y}function P(D){return D.displayName||"Context"}function A(D){if(D==null)return null;if(typeof D.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case o:return"StrictMode";case a:return"Suspense";case c:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case u:var U=D;return P(U)+".Consumer";case l:var Y=D;return P(Y._context)+".Provider";case s:return $(D,D.render,"ForwardRef");case d:var X=D.displayName||null;return X!==null?X:A(D.type)||"Memo";case p:{var ie=D,le=ie._payload,re=ie._init;try{return A(re(le))}catch{return null}}}return null}var S=Object.assign,O=0,T,L,y,I,_,V,z;function G(){}G.__reactDisabledLog=!0;function q(){{if(O===0){T=console.log,L=console.info,y=console.warn,I=console.error,_=console.group,V=console.groupCollapsed,z=console.groupEnd;var D={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:D,log:D,warn:D,error:D,group:D,groupCollapsed:D,groupEnd:D})}O++}}function B(){{if(O--,O===0){var D={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},D,{value:T}),info:S({},D,{value:L}),warn:S({},D,{value:y}),error:S({},D,{value:I}),group:S({},D,{value:_}),groupCollapsed:S({},D,{value:V}),groupEnd:S({},D,{value:z})})}O<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=M.ReactCurrentDispatcher,H;function Z(D,U,Y){{if(H===void 0)try{throw Error()}catch(ie){var X=ie.stack.trim().match(/\n( *(at )?)/);H=X&&X[1]||""}return`
18
+ `+H+D}}var ae=!1,Pe;{var $e=typeof WeakMap=="function"?WeakMap:Map;Pe=new $e}function st(D,U){if(!D||ae)return"";{var Y=Pe.get(D);if(Y!==void 0)return Y}var X;ae=!0;var ie=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var le;le=K.current,K.current=null,q();try{if(U){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(De){X=De}Reflect.construct(D,[],re)}else{try{re.call()}catch(De){X=De}D.call(re.prototype)}}else{try{throw Error()}catch(De){X=De}D()}}catch(De){if(De&&X&&typeof De.stack=="string"){for(var te=De.stack.split(`
19
19
  `),Se=X.stack.split(`
20
20
  `),pe=te.length-1,me=Se.length-1;pe>=1&&me>=0&&te[pe]!==Se[me];)me--;for(;pe>=1&&me>=0;pe--,me--)if(te[pe]!==Se[me]){if(pe!==1||me!==1)do if(pe--,me--,me<0||te[pe]!==Se[me]){var Ge=`
21
- `+te[pe].replace(" at new "," at ");return D.displayName&&Ge.includes("<anonymous>")&&(Ge=Ge.replace("<anonymous>",D.displayName)),typeof D=="function"&&$e.set(D,Ge),Ge}while(pe>=1&&me>=0);break}}}finally{ae=!1,K.current=le,U(),Error.prepareStackTrace=ie}var Ut=D?D.displayName||D.name:"",Pt=Ut?Z(Ut):"";return typeof D=="function"&&$e.set(D,Pt),Pt}function ye(D,W,Y){return st(D,!1)}function he(D){var W=D.prototype;return!!(W&&W.isReactComponent)}function se(D,W,Y){if(D==null)return"";if(typeof D=="function")return st(D,he(D));if(typeof D=="string")return Z(D);switch(D){case a:return Z("Suspense");case c:return Z("SuspenseList")}if(typeof D=="object")switch(D.$$typeof){case s:return ye(D.render);case d:return se(D.type,W,Y);case p:{var X=D,ie=X._payload,le=X._init;try{return se(le(ie),W,Y)}catch{}}}return""}var ln=Object.prototype.hasOwnProperty,Vl={},zl=M.ReactDebugCurrentFrame;function qn(D){if(D){var W=D._owner,Y=se(D.type,D._source,W?W.type:null);zl.setExtraStackFrame(Y)}else zl.setExtraStackFrame(null)}function Km(D,W,Y,X,ie){{var le=Function.call.bind(ln);for(var re in D)if(le(D,re)){var te=void 0;try{if(typeof D[re]!="function"){var Se=Error((X||"React class")+": "+Y+" type `"+re+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof D[re]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Se.name="Invariant Violation",Se}te=D[re](W,re,X,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(pe){te=pe}te&&!(te instanceof Error)&&(qn(ie),y("%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).",X||"React class",Y,re,typeof te),qn(null)),te instanceof Error&&!(te.message in Vl)&&(Vl[te.message]=!0,qn(ie),y("Failed %s type: %s",Y,te.message),qn(null))}}}var qm=Array.isArray;function So(D){return qm(D)}function Xm(D){{var W=typeof Symbol=="function"&&Symbol.toStringTag,Y=W&&D[Symbol.toStringTag]||D.constructor.name||"Object";return Y}}function Qm(D){try{return Hl(D),!1}catch{return!0}}function Hl(D){return""+D}function Gl(D){if(Qm(D))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xm(D)),Hl(D)}var Yl=M.ReactCurrentOwner,Jm={key:!0,ref:!0,__self:!0,__source:!0},Kl,ql;function Zm(D){if(ln.call(D,"ref")){var W=Object.getOwnPropertyDescriptor(D,"ref").get;if(W&&W.isReactWarning)return!1}return D.ref!==void 0}function eh(D){if(ln.call(D,"key")){var W=Object.getOwnPropertyDescriptor(D,"key").get;if(W&&W.isReactWarning)return!1}return D.key!==void 0}function th(D,W){typeof D.ref=="string"&&Yl.current}function nh(D,W){{var Y=function(){Kl||(Kl=!0,y("%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)",W))};Y.isReactWarning=!0,Object.defineProperty(D,"key",{get:Y,configurable:!0})}}function rh(D,W){{var Y=function(){ql||(ql=!0,y("%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)",W))};Y.isReactWarning=!0,Object.defineProperty(D,"ref",{get:Y,configurable:!0})}}var oh=function(D,W,Y,X,ie,le,re){var te={$$typeof:t,type:D,key:W,ref:Y,props:re,_owner:le};return te._store={},Object.defineProperty(te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.defineProperty(te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.freeze&&(Object.freeze(te.props),Object.freeze(te)),te};function ih(D,W,Y,X,ie){{var le,re={},te=null,Se=null;Y!==void 0&&(Gl(Y),te=""+Y),eh(W)&&(Gl(W.key),te=""+W.key),Zm(W)&&(Se=W.ref,th(W,ie));for(le in W)ln.call(W,le)&&!Jm.hasOwnProperty(le)&&(re[le]=W[le]);if(D&&D.defaultProps){var pe=D.defaultProps;for(le in pe)re[le]===void 0&&(re[le]=pe[le])}if(te||Se){var me=typeof D=="function"?D.displayName||D.name||"Unknown":D;te&&nh(re,me),Se&&rh(re,me)}return oh(D,te,Se,ie,X,Yl.current,re)}}var Co=M.ReactCurrentOwner,Xl=M.ReactDebugCurrentFrame;function Wt(D){if(D){var W=D._owner,Y=se(D.type,D._source,W?W.type:null);Xl.setExtraStackFrame(Y)}else Xl.setExtraStackFrame(null)}var Oo;Oo=!1;function To(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function Ql(){{if(Co.current){var D=L(Co.current.type);if(D)return`
21
+ `+te[pe].replace(" at new "," at ");return D.displayName&&Ge.includes("<anonymous>")&&(Ge=Ge.replace("<anonymous>",D.displayName)),typeof D=="function"&&Pe.set(D,Ge),Ge}while(pe>=1&&me>=0);break}}}finally{ae=!1,K.current=le,B(),Error.prepareStackTrace=ie}var Ut=D?D.displayName||D.name:"",Pt=Ut?Z(Ut):"";return typeof D=="function"&&Pe.set(D,Pt),Pt}function ye(D,U,Y){return st(D,!1)}function he(D){var U=D.prototype;return!!(U&&U.isReactComponent)}function se(D,U,Y){if(D==null)return"";if(typeof D=="function")return st(D,he(D));if(typeof D=="string")return Z(D);switch(D){case a:return Z("Suspense");case c:return Z("SuspenseList")}if(typeof D=="object")switch(D.$$typeof){case s:return ye(D.render);case d:return se(D.type,U,Y);case p:{var X=D,ie=X._payload,le=X._init;try{return se(le(ie),U,Y)}catch{}}}return""}var an=Object.prototype.hasOwnProperty,Vl={},zl=M.ReactDebugCurrentFrame;function qn(D){if(D){var U=D._owner,Y=se(D.type,D._source,U?U.type:null);zl.setExtraStackFrame(Y)}else zl.setExtraStackFrame(null)}function Km(D,U,Y,X,ie){{var le=Function.call.bind(an);for(var re in D)if(le(D,re)){var te=void 0;try{if(typeof D[re]!="function"){var Se=Error((X||"React class")+": "+Y+" type `"+re+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof D[re]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Se.name="Invariant Violation",Se}te=D[re](U,re,X,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(pe){te=pe}te&&!(te instanceof Error)&&(qn(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).",X||"React class",Y,re,typeof te),qn(null)),te instanceof Error&&!(te.message in Vl)&&(Vl[te.message]=!0,qn(ie),w("Failed %s type: %s",Y,te.message),qn(null))}}}var qm=Array.isArray;function Co(D){return qm(D)}function Xm(D){{var U=typeof Symbol=="function"&&Symbol.toStringTag,Y=U&&D[Symbol.toStringTag]||D.constructor.name||"Object";return Y}}function Qm(D){try{return Hl(D),!1}catch{return!0}}function Hl(D){return""+D}function Gl(D){if(Qm(D))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xm(D)),Hl(D)}var Yl=M.ReactCurrentOwner,Jm={key:!0,ref:!0,__self:!0,__source:!0},Kl,ql;function Zm(D){if(an.call(D,"ref")){var U=Object.getOwnPropertyDescriptor(D,"ref").get;if(U&&U.isReactWarning)return!1}return D.ref!==void 0}function eh(D){if(an.call(D,"key")){var U=Object.getOwnPropertyDescriptor(D,"key").get;if(U&&U.isReactWarning)return!1}return D.key!==void 0}function th(D,U){typeof D.ref=="string"&&Yl.current}function nh(D,U){{var Y=function(){Kl||(Kl=!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(D,"key",{get:Y,configurable:!0})}}function rh(D,U){{var Y=function(){ql||(ql=!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(D,"ref",{get:Y,configurable:!0})}}var oh=function(D,U,Y,X,ie,le,re){var te={$$typeof:t,type:D,key:U,ref:Y,props:re,_owner:le};return te._store={},Object.defineProperty(te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.defineProperty(te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ie}),Object.freeze&&(Object.freeze(te.props),Object.freeze(te)),te};function ih(D,U,Y,X,ie){{var le,re={},te=null,Se=null;Y!==void 0&&(Gl(Y),te=""+Y),eh(U)&&(Gl(U.key),te=""+U.key),Zm(U)&&(Se=U.ref,th(U,ie));for(le in U)an.call(U,le)&&!Jm.hasOwnProperty(le)&&(re[le]=U[le]);if(D&&D.defaultProps){var pe=D.defaultProps;for(le in pe)re[le]===void 0&&(re[le]=pe[le])}if(te||Se){var me=typeof D=="function"?D.displayName||D.name||"Unknown":D;te&&nh(re,me),Se&&rh(re,me)}return oh(D,te,Se,ie,X,Yl.current,re)}}var Oo=M.ReactCurrentOwner,Xl=M.ReactDebugCurrentFrame;function Bt(D){if(D){var U=D._owner,Y=se(D.type,D._source,U?U.type:null);Xl.setExtraStackFrame(Y)}else Xl.setExtraStackFrame(null)}var To;To=!1;function No(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function Ql(){{if(Oo.current){var D=A(Oo.current.type);if(D)return`
22
22
 
23
- Check the render method of \``+D+"`."}return""}}function sh(D){return""}var Jl={};function lh(D){{var W=Ql();if(!W){var Y=typeof D=="string"?D:D.displayName||D.name;Y&&(W=`
23
+ Check the render method of \``+D+"`."}return""}}function sh(D){return""}var Jl={};function lh(D){{var U=Ql();if(!U){var Y=typeof D=="string"?D:D.displayName||D.name;Y&&(U=`
24
24
 
25
- Check the top-level render call using <`+Y+">.")}return W}}function Zl(D,W){{if(!D._store||D._store.validated||D.key!=null)return;D._store.validated=!0;var Y=lh(W);if(Jl[Y])return;Jl[Y]=!0;var X="";D&&D._owner&&D._owner!==Co.current&&(X=" It was passed a child from "+L(D._owner.type)+"."),Wt(D),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,X),Wt(null)}}function ea(D,W){{if(typeof D!="object")return;if(So(D))for(var Y=0;Y<D.length;Y++){var X=D[Y];To(X)&&Zl(X,W)}else if(To(D))D._store&&(D._store.validated=!0);else if(D){var ie=E(D);if(typeof ie=="function"&&ie!==D.entries)for(var le=ie.call(D),re;!(re=le.next()).done;)To(re.value)&&Zl(re.value,W)}}}function ah(D){{var W=D.type;if(W==null||typeof W=="string")return;var Y;if(typeof W=="function")Y=W.propTypes;else if(typeof W=="object"&&(W.$$typeof===s||W.$$typeof===d))Y=W.propTypes;else return;if(Y){var X=L(W);Km(Y,D.props,"prop",X,D)}else if(W.PropTypes!==void 0&&!Oo){Oo=!0;var ie=L(W);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ie||"Unknown")}typeof W.getDefaultProps=="function"&&!W.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function uh(D){{for(var W=Object.keys(D.props),Y=0;Y<W.length;Y++){var X=W[Y];if(X!=="children"&&X!=="key"){Wt(D),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",X),Wt(null);break}}D.ref!==null&&(Wt(D),y("Invalid attribute `ref` supplied to `React.Fragment`."),Wt(null))}}var ta={};function na(D,W,Y,X,ie,le){{var re=x(D);if(!re){var te="";(D===void 0||typeof D=="object"&&D!==null&&Object.keys(D).length===0)&&(te+=" 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=sh();Se?te+=Se:te+=Ql();var pe;D===null?pe="null":So(D)?pe="array":D!==void 0&&D.$$typeof===t?(pe="<"+(L(D.type)||"Unknown")+" />",te=" Did you accidentally export a JSX literal instead of a component?"):pe=typeof D,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",pe,te)}var me=ih(D,W,Y,ie,le);if(me==null)return me;if(re){var Ge=W.children;if(Ge!==void 0)if(X)if(So(Ge)){for(var Ut=0;Ut<Ge.length;Ut++)ea(Ge[Ut],D);Object.freeze&&Object.freeze(Ge)}else y("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 ea(Ge,D)}if(ln.call(W,"key")){var Pt=L(D),Ae=Object.keys(W).filter(function(hh){return hh!=="key"}),No=Ae.length>0?"{key: someKey, "+Ae.join(": ..., ")+": ...}":"{key: someKey}";if(!ta[Pt+No]){var mh=Ae.length>0?"{"+Ae.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+Y+">.")}return U}}function Zl(D,U){{if(!D._store||D._store.validated||D.key!=null)return;D._store.validated=!0;var Y=lh(U);if(Jl[Y])return;Jl[Y]=!0;var X="";D&&D._owner&&D._owner!==Oo.current&&(X=" It was passed a child from "+A(D._owner.type)+"."),Bt(D),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,X),Bt(null)}}function ea(D,U){{if(typeof D!="object")return;if(Co(D))for(var Y=0;Y<D.length;Y++){var X=D[Y];No(X)&&Zl(X,U)}else if(No(D))D._store&&(D._store.validated=!0);else if(D){var ie=E(D);if(typeof ie=="function"&&ie!==D.entries)for(var le=ie.call(D),re;!(re=le.next()).done;)No(re.value)&&Zl(re.value,U)}}}function ah(D){{var U=D.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 X=A(U);Km(Y,D.props,"prop",X,D)}else if(U.PropTypes!==void 0&&!To){To=!0;var ie=A(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 uh(D){{for(var U=Object.keys(D.props),Y=0;Y<U.length;Y++){var X=U[Y];if(X!=="children"&&X!=="key"){Bt(D),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",X),Bt(null);break}}D.ref!==null&&(Bt(D),w("Invalid attribute `ref` supplied to `React.Fragment`."),Bt(null))}}var ta={};function na(D,U,Y,X,ie,le){{var re=x(D);if(!re){var te="";(D===void 0||typeof D=="object"&&D!==null&&Object.keys(D).length===0)&&(te+=" 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=sh();Se?te+=Se:te+=Ql();var pe;D===null?pe="null":Co(D)?pe="array":D!==void 0&&D.$$typeof===t?(pe="<"+(A(D.type)||"Unknown")+" />",te=" Did you accidentally export a JSX literal instead of a component?"):pe=typeof D,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,te)}var me=ih(D,U,Y,ie,le);if(me==null)return me;if(re){var Ge=U.children;if(Ge!==void 0)if(X)if(Co(Ge)){for(var Ut=0;Ut<Ge.length;Ut++)ea(Ge[Ut],D);Object.freeze&&Object.freeze(Ge)}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 ea(Ge,D)}if(an.call(U,"key")){var Pt=A(D),De=Object.keys(U).filter(function(hh){return hh!=="key"}),Ao=De.length>0?"{key: someKey, "+De.join(": ..., ")+": ...}":"{key: someKey}";if(!ta[Pt+Ao]){var mh=De.length>0?"{"+De.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} />`,No,Pt,mh,Pt),ta[Pt+No]=!0}}return D===r?uh(me):ah(me),me}}function ch(D,W,Y){return na(D,W,Y,!0)}function fh(D,W,Y){return na(D,W,Y,!1)}var dh=fh,ph=ch;Ht.Fragment=r,Ht.jsx=dh,Ht.jsxs=ph}()),Ht}process.env.NODE_ENV==="production"?Xn.exports=ia():Xn.exports=sa();var O=Xn.exports;const la={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",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:"接收地址",fee:"手续费"}},aa={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",minDeposit:"Minimum Deposit Amount",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:"≈ {{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",fee:"Fee"}},ua={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",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:"受取アドレス",fee:"手数料"}},ca={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",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:"Адрес получателя",fee:"Комиссия"}},fa={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",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:"接收地址",fee:"手續費"}},Qn=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],Ao={"en-US":aa,"ja-JP":ua,"ru-RU":ca,"zh-CN":la,"zh-TW":fa},an="en-US",da={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},pa=e=>Qn.includes(e)?Ao[e]:Ao[an],ma=e=>Qn.includes(e),Do=m.createContext(null),ha=({config:e,children:t})=>{const n=m.useMemo(()=>{const r=e.locale||an,o=ma(r)?r:an,i=pa(o);return{...e,currentLocale:o,translations:i}},[e]);return O.jsx(Do.Provider,{value:n,children:t})},Mo=()=>{const e=m.useContext(Do);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var ga=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Jn=Math.ceil,Ie=Math.floor,Ce="[BigNumber Error] ",Io=Ce+"Number primitive has more than 15 significant digits: ",Ye=1e14,Q=14,Zn=9007199254740991,er=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ht=1e7,ge=1e9;function jo(e){var t,n,r,o=y.prototype={constructor:y,toString:null,valueOf:null},i=new y(1),l=20,u=4,s=-7,a=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",M=!0;function y(h,b){var x,A,P,L,S,C,N,$,w=this;if(!(w instanceof y))return new y(h,b);if(b==null){if(h&&h._isBigNumber===!0){w.s=h.s,!h.c||h.e>d?w.c=w.e=null:h.e<c?w.c=[w.e=0]:(w.e=h.e,w.c=h.c.slice());return}if((C=typeof h=="number")&&h*0==0){if(w.s=1/h<0?(h=-h,-1):1,h===~~h){for(L=0,S=h;S>=10;S/=10,L++);L>d?w.c=w.e=null:(w.e=L,w.c=[h]);return}$=String(h)}else{if(!ga.test($=String(h)))return r(w,$,C);w.s=$.charCodeAt(0)==45?($=$.slice(1),-1):1}(L=$.indexOf("."))>-1&&($=$.replace(".","")),(S=$.search(/e/i))>0?(L<0&&(L=S),L+=+$.slice(S+1),$=$.substring(0,S)):L<0&&(L=$.length)}else{if(ce(b,2,E.length,"Base"),b==10&&M)return w=new y(h),_(w,l+w.e+1,u);if($=String(h),C=typeof h=="number"){if(h*0!=0)return r(w,$,C,b);if(w.s=1/h<0?($=$.slice(1),-1):1,y.DEBUG&&$.replace(/^0\.0*|\./,"").length>15)throw Error(Io+h)}else w.s=$.charCodeAt(0)===45?($=$.slice(1),-1):1;for(x=E.slice(0,b),L=S=0,N=$.length;S<N;S++)if(x.indexOf(A=$.charAt(S))<0){if(A=="."){if(S>L){L=N;continue}}else if(!P&&($==$.toUpperCase()&&($=$.toLowerCase())||$==$.toLowerCase()&&($=$.toUpperCase()))){P=!0,S=-1,L=0;continue}return r(w,String(h),C,b)}C=!1,$=n($,b,10,w.s),(L=$.indexOf("."))>-1?$=$.replace(".",""):L=$.length}for(S=0;$.charCodeAt(S)===48;S++);for(N=$.length;$.charCodeAt(--N)===48;);if($=$.slice(S,++N)){if(N-=S,C&&y.DEBUG&&N>15&&(h>Zn||h!==Ie(h)))throw Error(Io+w.s*h);if((L=L-S-1)>d)w.c=w.e=null;else if(L<c)w.c=[w.e=0];else{if(w.e=L,w.c=[],S=(L+1)%Q,L<0&&(S+=Q),S<N){for(S&&w.c.push(+$.slice(0,S)),N-=Q;S<N;)w.c.push(+$.slice(S,S+=Q));S=Q-($=$.slice(S)).length}else S-=N;for(;S--;$+="0");w.c.push(+$)}}else w.c=[w.e=0]}y.clone=jo,y.ROUND_UP=0,y.ROUND_DOWN=1,y.ROUND_CEIL=2,y.ROUND_FLOOR=3,y.ROUND_HALF_UP=4,y.ROUND_HALF_DOWN=5,y.ROUND_HALF_EVEN=6,y.ROUND_HALF_CEIL=7,y.ROUND_HALF_FLOOR=8,y.EUCLID=9,y.config=y.set=function(h){var b,x;if(h!=null)if(typeof h=="object"){if(h.hasOwnProperty(b="DECIMAL_PLACES")&&(x=h[b],ce(x,0,ge,b),l=x),h.hasOwnProperty(b="ROUNDING_MODE")&&(x=h[b],ce(x,0,8,b),u=x),h.hasOwnProperty(b="EXPONENTIAL_AT")&&(x=h[b],x&&x.pop?(ce(x[0],-ge,0,b),ce(x[1],0,ge,b),s=x[0],a=x[1]):(ce(x,-ge,ge,b),s=-(a=x<0?-x:x))),h.hasOwnProperty(b="RANGE"))if(x=h[b],x&&x.pop)ce(x[0],-ge,-1,b),ce(x[1],1,ge,b),c=x[0],d=x[1];else if(ce(x,-ge,ge,b),x)c=-(d=x<0?-x:x);else throw Error(Ce+b+" cannot be zero: "+x);if(h.hasOwnProperty(b="CRYPTO"))if(x=h[b],x===!!x)if(x)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=x;else throw p=!x,Error(Ce+"crypto unavailable");else p=x;else throw Error(Ce+b+" not true or false: "+x);if(h.hasOwnProperty(b="MODULO_MODE")&&(x=h[b],ce(x,0,9,b),f=x),h.hasOwnProperty(b="POW_PRECISION")&&(x=h[b],ce(x,0,ge,b),g=x),h.hasOwnProperty(b="FORMAT"))if(x=h[b],typeof x=="object")v=x;else throw Error(Ce+b+" not an object: "+x);if(h.hasOwnProperty(b="ALPHABET"))if(x=h[b],typeof x=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(x))M=x.slice(0,10)=="0123456789",E=x;else throw Error(Ce+b+" invalid: "+x)}else throw Error(Ce+"Object expected: "+h);return{DECIMAL_PLACES:l,ROUNDING_MODE:u,EXPONENTIAL_AT:[s,a],RANGE:[c,d],CRYPTO:p,MODULO_MODE:f,POW_PRECISION:g,FORMAT:v,ALPHABET:E}},y.isBigNumber=function(h){if(!h||h._isBigNumber!==!0)return!1;if(!y.DEBUG)return!0;var b,x,A=h.c,P=h.e,L=h.s;e:if({}.toString.call(A)=="[object Array]"){if((L===1||L===-1)&&P>=-ge&&P<=ge&&P===Ie(P)){if(A[0]===0){if(P===0&&A.length===1)return!0;break e}if(b=(P+1)%Q,b<1&&(b+=Q),String(A[0]).length==b){for(b=0;b<A.length;b++)if(x=A[b],x<0||x>=Ye||x!==Ie(x))break e;if(x!==0)return!0}}}else if(A===null&&P===null&&(L===null||L===1||L===-1))return!0;throw Error(Ce+"Invalid BigNumber: "+h)},y.maximum=y.max=function(){return j(arguments,-1)},y.minimum=y.min=function(){return j(arguments,1)},y.random=function(){var h=9007199254740992,b=Math.random()*h&2097151?function(){return Ie(Math.random()*h)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var A,P,L,S,C,N=0,$=[],w=new y(i);if(x==null?x=l:ce(x,0,ge),S=Jn(x/Q),p)if(crypto.getRandomValues){for(A=crypto.getRandomValues(new Uint32Array(S*=2));N<S;)C=A[N]*131072+(A[N+1]>>>11),C>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),A[N]=P[0],A[N+1]=P[1]):($.push(C%1e14),N+=2);N=S/2}else if(crypto.randomBytes){for(A=crypto.randomBytes(S*=7);N<S;)C=(A[N]&31)*281474976710656+A[N+1]*1099511627776+A[N+2]*4294967296+A[N+3]*16777216+(A[N+4]<<16)+(A[N+5]<<8)+A[N+6],C>=9e15?crypto.randomBytes(7).copy(A,N):($.push(C%1e14),N+=7);N=S/7}else throw p=!1,Error(Ce+"crypto unavailable");if(!p)for(;N<S;)C=b(),C<9e15&&($[N++]=C%1e14);for(S=$[--N],x%=Q,S&&x&&(C=er[Q-x],$[N]=Ie(S/C)*C);$[N]===0;$.pop(),N--);if(N<0)$=[L=0];else{for(L=-1;$[0]===0;$.splice(0,1),L-=Q);for(N=1,C=$[0];C>=10;C/=10,N++);N<Q&&(L-=Q-N)}return w.e=L,w.c=$,w}}(),y.sum=function(){for(var h=1,b=arguments,x=new y(b[0]);h<b.length;)x=x.plus(b[h++]);return x},n=function(){var h="0123456789";function b(x,A,P,L){for(var S,C=[0],N,$=0,w=x.length;$<w;){for(N=C.length;N--;C[N]*=A);for(C[0]+=L.indexOf(x.charAt($++)),S=0;S<C.length;S++)C[S]>P-1&&(C[S+1]==null&&(C[S+1]=0),C[S+1]+=C[S]/P|0,C[S]%=P)}return C.reverse()}return function(x,A,P,L,S){var C,N,$,w,I,R,V,z,G=x.indexOf("."),q=l,U=u;for(G>=0&&(w=g,g=0,x=x.replace(".",""),z=new y(A),R=z.pow(x.length-G),g=w,z.c=b(lt(Fe(R.c),R.e,"0"),10,P,h),z.e=z.c.length),V=b(x,A,P,S?(C=E,h):(C=h,E)),$=w=V.length;V[--w]==0;V.pop());if(!V[0])return C.charAt(0);if(G<0?--$:(R.c=V,R.e=$,R.s=L,R=t(R,z,q,U,P),V=R.c,I=R.r,$=R.e),N=$+q+1,G=V[N],w=P/2,I=I||N<0||V[N+1]!=null,I=U<4?(G!=null||I)&&(U==0||U==(R.s<0?3:2)):G>w||G==w&&(U==4||I||U==6&&V[N-1]&1||U==(R.s<0?8:7)),N<1||!V[0])x=I?lt(C.charAt(1),-q,C.charAt(0)):C.charAt(0);else{if(V.length=N,I)for(--P;++V[--N]>P;)V[N]=0,N||(++$,V=[1].concat(V));for(w=V.length;!V[--w];);for(G=0,x="";G<=w;x+=C.charAt(V[G++]));x=lt(x,$,C.charAt(0))}return x}}(),t=function(){function h(A,P,L){var S,C,N,$,w=0,I=A.length,R=P%ht,V=P/ht|0;for(A=A.slice();I--;)N=A[I]%ht,$=A[I]/ht|0,S=V*N+$*R,C=R*N+S%ht*ht+w,w=(C/L|0)+(S/ht|0)+V*$,A[I]=C%L;return w&&(A=[w].concat(A)),A}function b(A,P,L,S){var C,N;if(L!=S)N=L>S?1:-1;else for(C=N=0;C<L;C++)if(A[C]!=P[C]){N=A[C]>P[C]?1:-1;break}return N}function x(A,P,L,S){for(var C=0;L--;)A[L]-=C,C=A[L]<P[L]?1:0,A[L]=C*S+A[L]-P[L];for(;!A[0]&&A.length>1;A.splice(0,1));}return function(A,P,L,S,C){var N,$,w,I,R,V,z,G,q,U,K,H,Z,ae,$e,Pe,st,ye=A.s==P.s?1:-1,he=A.c,se=P.c;if(!he||!he[0]||!se||!se[0])return new y(!A.s||!P.s||(he?se&&he[0]==se[0]:!se)?NaN:he&&he[0]==0||!se?ye*0:ye/0);for(G=new y(ye),q=G.c=[],$=A.e-P.e,ye=L+$+1,C||(C=Ye,$=je(A.e/Q)-je(P.e/Q),ye=ye/Q|0),w=0;se[w]==(he[w]||0);w++);if(se[w]>(he[w]||0)&&$--,ye<0)q.push(1),I=!0;else{for(ae=he.length,Pe=se.length,w=0,ye+=2,R=Ie(C/(se[0]+1)),R>1&&(se=h(se,R,C),he=h(he,R,C),Pe=se.length,ae=he.length),Z=Pe,U=he.slice(0,Pe),K=U.length;K<Pe;U[K++]=0);st=se.slice(),st=[0].concat(st),$e=se[0],se[1]>=C/2&&$e++;do{if(R=0,N=b(se,U,Pe,K),N<0){if(H=U[0],Pe!=K&&(H=H*C+(U[1]||0)),R=Ie(H/$e),R>1)for(R>=C&&(R=C-1),V=h(se,R,C),z=V.length,K=U.length;b(V,U,z,K)==1;)R--,x(V,Pe<z?st:se,z,C),z=V.length,N=1;else R==0&&(N=R=1),V=se.slice(),z=V.length;if(z<K&&(V=[0].concat(V)),x(U,V,K,C),K=U.length,N==-1)for(;b(se,U,Pe,K)<1;)R++,x(U,Pe<K?st:se,K,C),K=U.length}else N===0&&(R++,U=[0]);q[w++]=R,U[0]?U[K++]=he[Z]||0:(U=[he[Z]],K=1)}while((Z++<ae||U[0]!=null)&&ye--);I=U[0]!=null,q[0]||q.splice(0,1)}if(C==Ye){for(w=1,ye=q[0];ye>=10;ye/=10,w++);_(G,L+(G.e=w+$*Q-1)+1,S,I)}else G.e=$,G.r=+I;return G}}();function T(h,b,x,A){var P,L,S,C,N;if(x==null?x=u:ce(x,0,8),!h.c)return h.toString();if(P=h.c[0],S=h.e,b==null)N=Fe(h.c),N=A==1||A==2&&(S<=s||S>=a)?cn(N,S):lt(N,S,"0");else if(h=_(new y(h),b,x),L=h.e,N=Fe(h.c),C=N.length,A==1||A==2&&(b<=L||L<=s)){for(;C<b;N+="0",C++);N=cn(N,L)}else if(b-=S+(A===2&&L>S),N=lt(N,L,"0"),L+1>C){if(--b>0)for(N+=".";b--;N+="0");}else if(b+=L-C,b>0)for(L+1==C&&(N+=".");b--;N+="0");return h.s<0&&P?"-"+N:N}function j(h,b){for(var x,A,P=1,L=new y(h[0]);P<h.length;P++)A=new y(h[P]),(!A.s||(x=Et(L,A))===b||x===0&&L.s===b)&&(L=A);return L}function F(h,b,x){for(var A=1,P=b.length;!b[--P];b.pop());for(P=b[0];P>=10;P/=10,A++);return(x=A+x*Q-1)>d?h.c=h.e=null:x<c?h.c=[h.e=0]:(h.e=x,h.c=b),h}r=function(){var h=/^(-?)0([xbo])(?=\w[\w.]*$)/i,b=/^([^.]+)\.$/,x=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(L,S,C,N){var $,w=C?S:S.replace(P,"");if(A.test(w))L.s=isNaN(w)?null:w<0?-1:1;else{if(!C&&(w=w.replace(h,function(I,R,V){return $=(V=V.toLowerCase())=="x"?16:V=="b"?2:8,!N||N==$?R:I}),N&&($=N,w=w.replace(b,"$1").replace(x,"0.$1")),S!=w))return new y(w,$);if(y.DEBUG)throw Error(Ce+"Not a"+(N?" base "+N:"")+" number: "+S);L.s=null}L.c=L.e=null}}();function _(h,b,x,A){var P,L,S,C,N,$,w,I=h.c,R=er;if(I){e:{for(P=1,C=I[0];C>=10;C/=10,P++);if(L=b-P,L<0)L+=Q,S=b,N=I[$=0],w=Ie(N/R[P-S-1]%10);else if($=Jn((L+1)/Q),$>=I.length)if(A){for(;I.length<=$;I.push(0));N=w=0,P=1,L%=Q,S=L-Q+1}else break e;else{for(N=C=I[$],P=1;C>=10;C/=10,P++);L%=Q,S=L-Q+P,w=S<0?0:Ie(N/R[P-S-1]%10)}if(A=A||b<0||I[$+1]!=null||(S<0?N:N%R[P-S-1]),A=x<4?(w||A)&&(x==0||x==(h.s<0?3:2)):w>5||w==5&&(x==4||A||x==6&&(L>0?S>0?N/R[P-S]:0:I[$-1])%10&1||x==(h.s<0?8:7)),b<1||!I[0])return I.length=0,A?(b-=h.e+1,I[0]=R[(Q-b%Q)%Q],h.e=-b||0):I[0]=h.e=0,h;if(L==0?(I.length=$,C=1,$--):(I.length=$+1,C=R[Q-L],I[$]=S>0?Ie(N/R[P-S]%R[S])*C:0),A)for(;;)if($==0){for(L=1,S=I[0];S>=10;S/=10,L++);for(S=I[0]+=C,C=1;S>=10;S/=10,C++);L!=C&&(h.e++,I[0]==Ye&&(I[0]=1));break}else{if(I[$]+=C,I[$]!=Ye)break;I[$--]=0,C=1}for(L=I.length;I[--L]===0;I.pop());}h.e>d?h.c=h.e=null:h.e<c&&(h.c=[h.e=0])}return h}function B(h){var b,x=h.e;return x===null?h.toString():(b=Fe(h.c),b=x<=s||x>=a?cn(b,x):lt(b,x,"0"),h.s<0?"-"+b:b)}return o.absoluteValue=o.abs=function(){var h=new y(this);return h.s<0&&(h.s=1),h},o.comparedTo=function(h,b){return Et(this,new y(h,b))},o.decimalPlaces=o.dp=function(h,b){var x,A,P,L=this;if(h!=null)return ce(h,0,ge),b==null?b=u:ce(b,0,8),_(new y(L),h+L.e+1,b);if(!(x=L.c))return null;if(A=((P=x.length-1)-je(this.e/Q))*Q,P=x[P])for(;P%10==0;P/=10,A--);return A<0&&(A=0),A},o.dividedBy=o.div=function(h,b){return t(this,new y(h,b),l,u)},o.dividedToIntegerBy=o.idiv=function(h,b){return t(this,new y(h,b),0,1)},o.exponentiatedBy=o.pow=function(h,b){var x,A,P,L,S,C,N,$,w,I=this;if(h=new y(h),h.c&&!h.isInteger())throw Error(Ce+"Exponent not an integer: "+B(h));if(b!=null&&(b=new y(b)),C=h.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!h.c||!h.c[0])return w=new y(Math.pow(+B(I),C?h.s*(2-un(h)):+B(h))),b?w.mod(b):w;if(N=h.s<0,b){if(b.c?!b.c[0]:!b.s)return new y(NaN);A=!N&&I.isInteger()&&b.isInteger(),A&&(I=I.mod(b))}else{if(h.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||C&&I.c[1]>=24e7:I.c[0]<8e13||C&&I.c[0]<=9999975e7)))return L=I.s<0&&un(h)?-0:0,I.e>-1&&(L=1/L),new y(N?1/L:L);g&&(L=Jn(g/Q+2))}for(C?(x=new y(.5),N&&(h.s=1),$=un(h)):(P=Math.abs(+B(h)),$=P%2),w=new y(i);;){if($){if(w=w.times(I),!w.c)break;L?w.c.length>L&&(w.c.length=L):A&&(w=w.mod(b))}if(P){if(P=Ie(P/2),P===0)break;$=P%2}else if(h=h.times(x),_(h,h.e+1,1),h.e>14)$=un(h);else{if(P=+B(h),P===0)break;$=P%2}I=I.times(I),L?I.c&&I.c.length>L&&(I.c.length=L):A&&(I=I.mod(b))}return A?w:(N&&(w=i.div(w)),b?w.mod(b):L?_(w,g,u,S):w)},o.integerValue=function(h){var b=new y(this);return h==null?h=u:ce(h,0,8),_(b,b.e+1,h)},o.isEqualTo=o.eq=function(h,b){return Et(this,new y(h,b))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(h,b){return Et(this,new y(h,b))>0},o.isGreaterThanOrEqualTo=o.gte=function(h,b){return(b=Et(this,new y(h,b)))===1||b===0},o.isInteger=function(){return!!this.c&&je(this.e/Q)>this.c.length-2},o.isLessThan=o.lt=function(h,b){return Et(this,new y(h,b))<0},o.isLessThanOrEqualTo=o.lte=function(h,b){return(b=Et(this,new y(h,b)))===-1||b===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,b){var x,A,P,L,S=this,C=S.s;if(h=new y(h,b),b=h.s,!C||!b)return new y(NaN);if(C!=b)return h.s=-b,S.plus(h);var N=S.e/Q,$=h.e/Q,w=S.c,I=h.c;if(!N||!$){if(!w||!I)return w?(h.s=-b,h):new y(I?S:NaN);if(!w[0]||!I[0])return I[0]?(h.s=-b,h):new y(w[0]?S:u==3?-0:0)}if(N=je(N),$=je($),w=w.slice(),C=N-$){for((L=C<0)?(C=-C,P=w):($=N,P=I),P.reverse(),b=C;b--;P.push(0));P.reverse()}else for(A=(L=(C=w.length)<(b=I.length))?C:b,C=b=0;b<A;b++)if(w[b]!=I[b]){L=w[b]<I[b];break}if(L&&(P=w,w=I,I=P,h.s=-h.s),b=(A=I.length)-(x=w.length),b>0)for(;b--;w[x++]=0);for(b=Ye-1;A>C;){if(w[--A]<I[A]){for(x=A;x&&!w[--x];w[x]=b);--w[x],w[A]+=Ye}w[A]-=I[A]}for(;w[0]==0;w.splice(0,1),--$);return w[0]?F(h,w,$):(h.s=u==3?-1:1,h.c=[h.e=0],h)},o.modulo=o.mod=function(h,b){var x,A,P=this;return h=new y(h,b),!P.c||!h.s||h.c&&!h.c[0]?new y(NaN):!h.c||P.c&&!P.c[0]?new y(P):(f==9?(A=h.s,h.s=1,x=t(P,h,0,3),h.s=A,x.s*=A):x=t(P,h,0,f),h=P.minus(x.times(h)),!h.c[0]&&f==1&&(h.s=P.s),h)},o.multipliedBy=o.times=function(h,b){var x,A,P,L,S,C,N,$,w,I,R,V,z,G,q,U=this,K=U.c,H=(h=new y(h,b)).c;if(!K||!H||!K[0]||!H[0])return!U.s||!h.s||K&&!K[0]&&!H||H&&!H[0]&&!K?h.c=h.e=h.s=null:(h.s*=U.s,!K||!H?h.c=h.e=null:(h.c=[0],h.e=0)),h;for(A=je(U.e/Q)+je(h.e/Q),h.s*=U.s,N=K.length,I=H.length,N<I&&(z=K,K=H,H=z,P=N,N=I,I=P),P=N+I,z=[];P--;z.push(0));for(G=Ye,q=ht,P=I;--P>=0;){for(x=0,R=H[P]%q,V=H[P]/q|0,S=N,L=P+S;L>P;)$=K[--S]%q,w=K[S]/q|0,C=V*$+w*R,$=R*$+C%q*q+z[L]+x,x=($/G|0)+(C/q|0)+V*w,z[L--]=$%G;z[L]=x}return x?++A:z.splice(0,1),F(h,z,A)},o.negated=function(){var h=new y(this);return h.s=-h.s||null,h},o.plus=function(h,b){var x,A=this,P=A.s;if(h=new y(h,b),b=h.s,!P||!b)return new y(NaN);if(P!=b)return h.s=-b,A.minus(h);var L=A.e/Q,S=h.e/Q,C=A.c,N=h.c;if(!L||!S){if(!C||!N)return new y(P/0);if(!C[0]||!N[0])return N[0]?h:new y(C[0]?A:P*0)}if(L=je(L),S=je(S),C=C.slice(),P=L-S){for(P>0?(S=L,x=N):(P=-P,x=C),x.reverse();P--;x.push(0));x.reverse()}for(P=C.length,b=N.length,P-b<0&&(x=N,N=C,C=x,b=P),P=0;b;)P=(C[--b]=C[b]+N[b]+P)/Ye|0,C[b]=Ye===C[b]?0:C[b]%Ye;return P&&(C=[P].concat(C),++S),F(h,C,S)},o.precision=o.sd=function(h,b){var x,A,P,L=this;if(h!=null&&h!==!!h)return ce(h,1,ge),b==null?b=u:ce(b,0,8),_(new y(L),h,b);if(!(x=L.c))return null;if(P=x.length-1,A=P*Q+1,P=x[P]){for(;P%10==0;P/=10,A--);for(P=x[0];P>=10;P/=10,A++);}return h&&L.e+1>A&&(A=L.e+1),A},o.shiftedBy=function(h){return ce(h,-Zn,Zn),this.times("1e"+h)},o.squareRoot=o.sqrt=function(){var h,b,x,A,P,L=this,S=L.c,C=L.s,N=L.e,$=l+4,w=new y("0.5");if(C!==1||!S||!S[0])return new y(!C||C<0&&(!S||S[0])?NaN:S?L:1/0);if(C=Math.sqrt(+B(L)),C==0||C==1/0?(b=Fe(S),(b.length+N)%2==0&&(b+="0"),C=Math.sqrt(+b),N=je((N+1)/2)-(N<0||N%2),C==1/0?b="5e"+N:(b=C.toExponential(),b=b.slice(0,b.indexOf("e")+1)+N),x=new y(b)):x=new y(C+""),x.c[0]){for(N=x.e,C=N+$,C<3&&(C=0);;)if(P=x,x=w.times(P.plus(t(L,P,$,1))),Fe(P.c).slice(0,C)===(b=Fe(x.c)).slice(0,C))if(x.e<N&&--C,b=b.slice(C-3,C+1),b=="9999"||!A&&b=="4999"){if(!A&&(_(P,P.e+l+2,0),P.times(P).eq(L))){x=P;break}$+=4,C+=4,A=1}else{(!+b||!+b.slice(1)&&b.charAt(0)=="5")&&(_(x,x.e+l+2,1),h=!x.times(x).eq(L));break}}return _(x,x.e+l+1,u,h)},o.toExponential=function(h,b){return h!=null&&(ce(h,0,ge),h++),T(this,h,b,1)},o.toFixed=function(h,b){return h!=null&&(ce(h,0,ge),h=h+this.e+1),T(this,h,b)},o.toFormat=function(h,b,x){var A,P=this;if(x==null)h!=null&&b&&typeof b=="object"?(x=b,b=null):h&&typeof h=="object"?(x=h,h=b=null):x=v;else if(typeof x!="object")throw Error(Ce+"Argument not an object: "+x);if(A=P.toFixed(h,b),P.c){var L,S=A.split("."),C=+x.groupSize,N=+x.secondaryGroupSize,$=x.groupSeparator||"",w=S[0],I=S[1],R=P.s<0,V=R?w.slice(1):w,z=V.length;if(N&&(L=C,C=N,N=L,z-=L),C>0&&z>0){for(L=z%C||C,w=V.substr(0,L);L<z;L+=C)w+=$+V.substr(L,C);N>0&&(w+=$+V.slice(L)),R&&(w="-"+w)}A=I?w+(x.decimalSeparator||"")+((N=+x.fractionGroupSize)?I.replace(new RegExp("\\d{"+N+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):I):w}return(x.prefix||"")+A+(x.suffix||"")},o.toFraction=function(h){var b,x,A,P,L,S,C,N,$,w,I,R,V=this,z=V.c;if(h!=null&&(C=new y(h),!C.isInteger()&&(C.c||C.s!==1)||C.lt(i)))throw Error(Ce+"Argument "+(C.isInteger()?"out of range: ":"not an integer: ")+B(C));if(!z)return new y(V);for(b=new y(i),$=x=new y(i),A=N=new y(i),R=Fe(z),L=b.e=R.length-V.e-1,b.c[0]=er[(S=L%Q)<0?Q+S:S],h=!h||C.comparedTo(b)>0?L>0?b:$:C,S=d,d=1/0,C=new y(R),N.c[0]=0;w=t(C,b,0,1),P=x.plus(w.times(A)),P.comparedTo(h)!=1;)x=A,A=P,$=N.plus(w.times(P=$)),N=P,b=C.minus(w.times(P=b)),C=P;return P=t(h.minus(x),A,0,1),N=N.plus(P.times($)),x=x.plus(P.times(A)),N.s=$.s=V.s,L=L*2,I=t($,A,L,u).minus(V).abs().comparedTo(t(N,x,L,u).minus(V).abs())<1?[$,A]:[N,x],d=S,I},o.toNumber=function(){return+B(this)},o.toPrecision=function(h,b){return h!=null&&ce(h,1,ge),T(this,h,b,2)},o.toString=function(h){var b,x=this,A=x.s,P=x.e;return P===null?A?(b="Infinity",A<0&&(b="-"+b)):b="NaN":(h==null?b=P<=s||P>=a?cn(Fe(x.c),P):lt(Fe(x.c),P,"0"):h===10&&M?(x=_(new y(x),l+P+1,u),b=lt(Fe(x.c),x.e,"0")):(ce(h,2,E.length,"Base"),b=n(lt(Fe(x.c),P,"0"),10,h,A,!0)),A<0&&x.c[0]&&(b="-"+b)),b},o.valueOf=o.toJSON=function(){return B(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&y.set(e),y}function je(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,i=e[0]+"";r<o;){for(t=e[r++]+"",n=Q-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function Et(e,t){var n,r,o=e.c,i=t.c,l=e.s,u=t.s,s=e.e,a=t.e;if(!l||!u)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-u:l;if(l!=u)return l;if(n=l<0,r=s==a,!o||!i)return r?0:!o^n?1:-1;if(!r)return s>a^n?1:-1;for(u=(s=o.length)<(a=i.length)?s:a,l=0;l<u;l++)if(o[l]!=i[l])return o[l]>i[l]^n?1:-1;return s==a?0:s>a^n?1:-1}function ce(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 un(e){var t=e.c.length-1;return je(e.e/Q)==t&&e.c[t]%2!=0}function cn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function lt(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 ke=jo();const va=(e,t=6)=>{try{const n=new ke(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,ke.ROUND_DOWN),[o,i=""]=r.toString().split("."),l=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const u=(i||"").padEnd(t,"0");return`${l}.${u}`}return l}catch(n){return console.warn("formatThousands error:",n),"0"}},Ke=()=>{const{translations:e,currentLocale:t}=Mo();return{t:(i,l)=>{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 a=typeof s=="string"?s:i;return l&&typeof a=="string"&&Object.keys(l).forEach(c=>{const d=`{{${c}}}`;a=a.replace(new RegExp(d,"g"),String(l[c]))}),a}catch(u){return console.warn(`Translation error for key "${i}":`,u),i}},translations:e,locale:t,getTranslationObject:i=>{try{const l=i.split(".");let u=e;for(const s of l)if(u&&typeof u=="object"&&s in u)u=u[s];else return{};return typeof u=="object"?u:{}}catch(l){return console.warn(`Translation object error for key "${i}":`,l),{}}},hasTranslation:i=>{try{const l=i.split(".");let u=e;for(const s of l)if(u&&typeof u=="object"&&s in u)u=u[s];else return!1;return typeof u=="string"}catch{return!1}}}},ba=()=>({openDeposit:m.useCallback(t=>{},[])}),xa=()=>({openWithdraw:m.useCallback(t=>{},[])});/**
30
+ <%s key={someKey} {...props} />`,Ao,Pt,mh,Pt),ta[Pt+Ao]=!0}}return D===r?uh(me):ah(me),me}}function ch(D,U,Y){return na(D,U,Y,!0)}function fh(D,U,Y){return na(D,U,Y,!1)}var dh=fh,ph=ch;Ht.Fragment=r,Ht.jsx=dh,Ht.jsxs=ph}()),Ht}process.env.NODE_ENV==="production"?Xn.exports=ia():Xn.exports=sa();var C=Xn.exports;const la={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",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或负数时,不允许提现。",noPrivateKeyWalletWarning:"暂不支持无私钥钱包充值。若您是无私钥钱包,请勿进行充值。"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法"}},aa={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",minDeposit:"Minimum Deposit Amount",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:"≈ {{v}} minutes",availableDesc:"Max. amount you can withdraw. When the available amount shown is 0 or negative, you are not allowed to make withdrawals.",noPrivateKeyWalletWarning:"Deposits from wallets without private keys are not supported at the moment. If you are using such a wallet, please do not make a deposit."},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address"}},ua={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",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またはマイナスの場合、出金は行えません。",noPrivateKeyWalletWarning:"現在、秘密鍵のないウォレットからの入金はサポートされていません。該当ウォレットをご利用の場合は、入金しないでください。"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス"}},ca={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",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 или меньше, вывод невозможен.",noPrivateKeyWalletWarning:"В настоящее время пополнение кошельков без приватных ключей не поддерживается. Если у вас такой кошелёк, пожалуйста, не выполняйте пополнение."},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя"}},fa={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",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或負數時,不允許提現。",noPrivateKeyWalletWarning:"暫不支援無私鑰錢包充值。若您使用的是無私鑰錢包,請勿進行充值。"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法"}},Qn=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],Do={"en-US":aa,"ja-JP":ua,"ru-RU":ca,"zh-CN":la,"zh-TW":fa},un="en-US",da={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},pa=e=>Qn.includes(e)?Do[e]:Do[un],ma=e=>Qn.includes(e),Mo=m.createContext(null),ha=({config:e,children:t})=>{const n=m.useMemo(()=>{const r=e.locale||un,o=ma(r)?r:un,i=pa(o);return{...e,currentLocale:o,translations:i}},[e]);return C.jsx(Mo.Provider,{value:n,children:t})},Io=()=>{const e=m.useContext(Mo);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var ga=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Jn=Math.ceil,je=Math.floor,Ce="[BigNumber Error] ",jo=Ce+"Number primitive has more than 15 significant digits: ",Ye=1e14,Q=14,Zn=9007199254740991,er=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ht=1e7,ge=1e9;function Fo(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},i=new w(1),l=20,u=4,s=-7,a=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",M=!0;function w(h,b){var x,$,P,A,S,O,T,L,y=this;if(!(y instanceof w))return new w(h,b);if(b==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((O=typeof h=="number")&&h*0==0){if(y.s=1/h<0?(h=-h,-1):1,h===~~h){for(A=0,S=h;S>=10;S/=10,A++);A>d?y.c=y.e=null:(y.e=A,y.c=[h]);return}L=String(h)}else{if(!ga.test(L=String(h)))return r(y,L,O);y.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(A=L.indexOf("."))>-1&&(L=L.replace(".","")),(S=L.search(/e/i))>0?(A<0&&(A=S),A+=+L.slice(S+1),L=L.substring(0,S)):A<0&&(A=L.length)}else{if(ce(b,2,E.length,"Base"),b==10&&M)return y=new w(h),k(y,l+y.e+1,u);if(L=String(h),O=typeof h=="number"){if(h*0!=0)return r(y,L,O,b);if(y.s=1/h<0?(L=L.slice(1),-1):1,w.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(jo+h)}else y.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(x=E.slice(0,b),A=S=0,T=L.length;S<T;S++)if(x.indexOf($=L.charAt(S))<0){if($=="."){if(S>A){A=T;continue}}else if(!P&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){P=!0,S=-1,A=0;continue}return r(y,String(h),O,b)}O=!1,L=n(L,b,10,y.s),(A=L.indexOf("."))>-1?L=L.replace(".",""):A=L.length}for(S=0;L.charCodeAt(S)===48;S++);for(T=L.length;L.charCodeAt(--T)===48;);if(L=L.slice(S,++T)){if(T-=S,O&&w.DEBUG&&T>15&&(h>Zn||h!==je(h)))throw Error(jo+y.s*h);if((A=A-S-1)>d)y.c=y.e=null;else if(A<c)y.c=[y.e=0];else{if(y.e=A,y.c=[],S=(A+1)%Q,A<0&&(S+=Q),S<T){for(S&&y.c.push(+L.slice(0,S)),T-=Q;S<T;)y.c.push(+L.slice(S,S+=Q));S=Q-(L=L.slice(S)).length}else S-=T;for(;S--;L+="0");y.c.push(+L)}}else y.c=[y.e=0]}w.clone=Fo,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 b,x;if(h!=null)if(typeof h=="object"){if(h.hasOwnProperty(b="DECIMAL_PLACES")&&(x=h[b],ce(x,0,ge,b),l=x),h.hasOwnProperty(b="ROUNDING_MODE")&&(x=h[b],ce(x,0,8,b),u=x),h.hasOwnProperty(b="EXPONENTIAL_AT")&&(x=h[b],x&&x.pop?(ce(x[0],-ge,0,b),ce(x[1],0,ge,b),s=x[0],a=x[1]):(ce(x,-ge,ge,b),s=-(a=x<0?-x:x))),h.hasOwnProperty(b="RANGE"))if(x=h[b],x&&x.pop)ce(x[0],-ge,-1,b),ce(x[1],1,ge,b),c=x[0],d=x[1];else if(ce(x,-ge,ge,b),x)c=-(d=x<0?-x:x);else throw Error(Ce+b+" cannot be zero: "+x);if(h.hasOwnProperty(b="CRYPTO"))if(x=h[b],x===!!x)if(x)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=x;else throw p=!x,Error(Ce+"crypto unavailable");else p=x;else throw Error(Ce+b+" not true or false: "+x);if(h.hasOwnProperty(b="MODULO_MODE")&&(x=h[b],ce(x,0,9,b),f=x),h.hasOwnProperty(b="POW_PRECISION")&&(x=h[b],ce(x,0,ge,b),g=x),h.hasOwnProperty(b="FORMAT"))if(x=h[b],typeof x=="object")v=x;else throw Error(Ce+b+" not an object: "+x);if(h.hasOwnProperty(b="ALPHABET"))if(x=h[b],typeof x=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(x))M=x.slice(0,10)=="0123456789",E=x;else throw Error(Ce+b+" invalid: "+x)}else throw Error(Ce+"Object expected: "+h);return{DECIMAL_PLACES:l,ROUNDING_MODE:u,EXPONENTIAL_AT:[s,a],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 b,x,$=h.c,P=h.e,A=h.s;e:if({}.toString.call($)=="[object Array]"){if((A===1||A===-1)&&P>=-ge&&P<=ge&&P===je(P)){if($[0]===0){if(P===0&&$.length===1)return!0;break e}if(b=(P+1)%Q,b<1&&(b+=Q),String($[0]).length==b){for(b=0;b<$.length;b++)if(x=$[b],x<0||x>=Ye||x!==je(x))break e;if(x!==0)return!0}}}else if($===null&&P===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,b=Math.random()*h&2097151?function(){return je(Math.random()*h)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var $,P,A,S,O,T=0,L=[],y=new w(i);if(x==null?x=l:ce(x,0,ge),S=Jn(x/Q),p)if(crypto.getRandomValues){for($=crypto.getRandomValues(new Uint32Array(S*=2));T<S;)O=$[T]*131072+($[T+1]>>>11),O>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),$[T]=P[0],$[T+1]=P[1]):(L.push(O%1e14),T+=2);T=S/2}else if(crypto.randomBytes){for($=crypto.randomBytes(S*=7);T<S;)O=($[T]&31)*281474976710656+$[T+1]*1099511627776+$[T+2]*4294967296+$[T+3]*16777216+($[T+4]<<16)+($[T+5]<<8)+$[T+6],O>=9e15?crypto.randomBytes(7).copy($,T):(L.push(O%1e14),T+=7);T=S/7}else throw p=!1,Error(Ce+"crypto unavailable");if(!p)for(;T<S;)O=b(),O<9e15&&(L[T++]=O%1e14);for(S=L[--T],x%=Q,S&&x&&(O=er[Q-x],L[T]=je(S/O)*O);L[T]===0;L.pop(),T--);if(T<0)L=[A=0];else{for(A=-1;L[0]===0;L.splice(0,1),A-=Q);for(T=1,O=L[0];O>=10;O/=10,T++);T<Q&&(A-=Q-T)}return y.e=A,y.c=L,y}}(),w.sum=function(){for(var h=1,b=arguments,x=new w(b[0]);h<b.length;)x=x.plus(b[h++]);return x},n=function(){var h="0123456789";function b(x,$,P,A){for(var S,O=[0],T,L=0,y=x.length;L<y;){for(T=O.length;T--;O[T]*=$);for(O[0]+=A.indexOf(x.charAt(L++)),S=0;S<O.length;S++)O[S]>P-1&&(O[S+1]==null&&(O[S+1]=0),O[S+1]+=O[S]/P|0,O[S]%=P)}return O.reverse()}return function(x,$,P,A,S){var O,T,L,y,I,_,V,z,G=x.indexOf("."),q=l,B=u;for(G>=0&&(y=g,g=0,x=x.replace(".",""),z=new w($),_=z.pow(x.length-G),g=y,z.c=b(lt(Re(_.c),_.e,"0"),10,P,h),z.e=z.c.length),V=b(x,$,P,S?(O=E,h):(O=h,E)),L=y=V.length;V[--y]==0;V.pop());if(!V[0])return O.charAt(0);if(G<0?--L:(_.c=V,_.e=L,_.s=A,_=t(_,z,q,B,P),V=_.c,I=_.r,L=_.e),T=L+q+1,G=V[T],y=P/2,I=I||T<0||V[T+1]!=null,I=B<4?(G!=null||I)&&(B==0||B==(_.s<0?3:2)):G>y||G==y&&(B==4||I||B==6&&V[T-1]&1||B==(_.s<0?8:7)),T<1||!V[0])x=I?lt(O.charAt(1),-q,O.charAt(0)):O.charAt(0);else{if(V.length=T,I)for(--P;++V[--T]>P;)V[T]=0,T||(++L,V=[1].concat(V));for(y=V.length;!V[--y];);for(G=0,x="";G<=y;x+=O.charAt(V[G++]));x=lt(x,L,O.charAt(0))}return x}}(),t=function(){function h($,P,A){var S,O,T,L,y=0,I=$.length,_=P%ht,V=P/ht|0;for($=$.slice();I--;)T=$[I]%ht,L=$[I]/ht|0,S=V*T+L*_,O=_*T+S%ht*ht+y,y=(O/A|0)+(S/ht|0)+V*L,$[I]=O%A;return y&&($=[y].concat($)),$}function b($,P,A,S){var O,T;if(A!=S)T=A>S?1:-1;else for(O=T=0;O<A;O++)if($[O]!=P[O]){T=$[O]>P[O]?1:-1;break}return T}function x($,P,A,S){for(var O=0;A--;)$[A]-=O,O=$[A]<P[A]?1:0,$[A]=O*S+$[A]-P[A];for(;!$[0]&&$.length>1;$.splice(0,1));}return function($,P,A,S,O){var T,L,y,I,_,V,z,G,q,B,K,H,Z,ae,Pe,$e,st,ye=$.s==P.s?1:-1,he=$.c,se=P.c;if(!he||!he[0]||!se||!se[0])return new w(!$.s||!P.s||(he?se&&he[0]==se[0]:!se)?NaN:he&&he[0]==0||!se?ye*0:ye/0);for(G=new w(ye),q=G.c=[],L=$.e-P.e,ye=A+L+1,O||(O=Ye,L=Fe($.e/Q)-Fe(P.e/Q),ye=ye/Q|0),y=0;se[y]==(he[y]||0);y++);if(se[y]>(he[y]||0)&&L--,ye<0)q.push(1),I=!0;else{for(ae=he.length,$e=se.length,y=0,ye+=2,_=je(O/(se[0]+1)),_>1&&(se=h(se,_,O),he=h(he,_,O),$e=se.length,ae=he.length),Z=$e,B=he.slice(0,$e),K=B.length;K<$e;B[K++]=0);st=se.slice(),st=[0].concat(st),Pe=se[0],se[1]>=O/2&&Pe++;do{if(_=0,T=b(se,B,$e,K),T<0){if(H=B[0],$e!=K&&(H=H*O+(B[1]||0)),_=je(H/Pe),_>1)for(_>=O&&(_=O-1),V=h(se,_,O),z=V.length,K=B.length;b(V,B,z,K)==1;)_--,x(V,$e<z?st:se,z,O),z=V.length,T=1;else _==0&&(T=_=1),V=se.slice(),z=V.length;if(z<K&&(V=[0].concat(V)),x(B,V,K,O),K=B.length,T==-1)for(;b(se,B,$e,K)<1;)_++,x(B,$e<K?st:se,K,O),K=B.length}else T===0&&(_++,B=[0]);q[y++]=_,B[0]?B[K++]=he[Z]||0:(B=[he[Z]],K=1)}while((Z++<ae||B[0]!=null)&&ye--);I=B[0]!=null,q[0]||q.splice(0,1)}if(O==Ye){for(y=1,ye=q[0];ye>=10;ye/=10,y++);k(G,A+(G.e=y+L*Q-1)+1,S,I)}else G.e=L,G.r=+I;return G}}();function N(h,b,x,$){var P,A,S,O,T;if(x==null?x=u:ce(x,0,8),!h.c)return h.toString();if(P=h.c[0],S=h.e,b==null)T=Re(h.c),T=$==1||$==2&&(S<=s||S>=a)?fn(T,S):lt(T,S,"0");else if(h=k(new w(h),b,x),A=h.e,T=Re(h.c),O=T.length,$==1||$==2&&(b<=A||A<=s)){for(;O<b;T+="0",O++);T=fn(T,A)}else if(b-=S+($===2&&A>S),T=lt(T,A,"0"),A+1>O){if(--b>0)for(T+=".";b--;T+="0");}else if(b+=A-O,b>0)for(A+1==O&&(T+=".");b--;T+="0");return h.s<0&&P?"-"+T:T}function j(h,b){for(var x,$,P=1,A=new w(h[0]);P<h.length;P++)$=new w(h[P]),(!$.s||(x=Et(A,$))===b||x===0&&A.s===b)&&(A=$);return A}function F(h,b,x){for(var $=1,P=b.length;!b[--P];b.pop());for(P=b[0];P>=10;P/=10,$++);return(x=$+x*Q-1)>d?h.c=h.e=null:x<c?h.c=[h.e=0]:(h.e=x,h.c=b),h}r=function(){var h=/^(-?)0([xbo])(?=\w[\w.]*$)/i,b=/^([^.]+)\.$/,x=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,S,O,T){var L,y=O?S:S.replace(P,"");if($.test(y))A.s=isNaN(y)?null:y<0?-1:1;else{if(!O&&(y=y.replace(h,function(I,_,V){return L=(V=V.toLowerCase())=="x"?16:V=="b"?2:8,!T||T==L?_:I}),T&&(L=T,y=y.replace(b,"$1").replace(x,"0.$1")),S!=y))return new w(y,L);if(w.DEBUG)throw Error(Ce+"Not a"+(T?" base "+T:"")+" number: "+S);A.s=null}A.c=A.e=null}}();function k(h,b,x,$){var P,A,S,O,T,L,y,I=h.c,_=er;if(I){e:{for(P=1,O=I[0];O>=10;O/=10,P++);if(A=b-P,A<0)A+=Q,S=b,T=I[L=0],y=je(T/_[P-S-1]%10);else if(L=Jn((A+1)/Q),L>=I.length)if($){for(;I.length<=L;I.push(0));T=y=0,P=1,A%=Q,S=A-Q+1}else break e;else{for(T=O=I[L],P=1;O>=10;O/=10,P++);A%=Q,S=A-Q+P,y=S<0?0:je(T/_[P-S-1]%10)}if($=$||b<0||I[L+1]!=null||(S<0?T:T%_[P-S-1]),$=x<4?(y||$)&&(x==0||x==(h.s<0?3:2)):y>5||y==5&&(x==4||$||x==6&&(A>0?S>0?T/_[P-S]:0:I[L-1])%10&1||x==(h.s<0?8:7)),b<1||!I[0])return I.length=0,$?(b-=h.e+1,I[0]=_[(Q-b%Q)%Q],h.e=-b||0):I[0]=h.e=0,h;if(A==0?(I.length=L,O=1,L--):(I.length=L+1,O=_[Q-A],I[L]=S>0?je(T/_[P-S]%_[S])*O:0),$)for(;;)if(L==0){for(A=1,S=I[0];S>=10;S/=10,A++);for(S=I[0]+=O,O=1;S>=10;S/=10,O++);A!=O&&(h.e++,I[0]==Ye&&(I[0]=1));break}else{if(I[L]+=O,I[L]!=Ye)break;I[L--]=0,O=1}for(A=I.length;I[--A]===0;I.pop());}h.e>d?h.c=h.e=null:h.e<c&&(h.c=[h.e=0])}return h}function W(h){var b,x=h.e;return x===null?h.toString():(b=Re(h.c),b=x<=s||x>=a?fn(b,x):lt(b,x,"0"),h.s<0?"-"+b:b)}return o.absoluteValue=o.abs=function(){var h=new w(this);return h.s<0&&(h.s=1),h},o.comparedTo=function(h,b){return Et(this,new w(h,b))},o.decimalPlaces=o.dp=function(h,b){var x,$,P,A=this;if(h!=null)return ce(h,0,ge),b==null?b=u:ce(b,0,8),k(new w(A),h+A.e+1,b);if(!(x=A.c))return null;if($=((P=x.length-1)-Fe(this.e/Q))*Q,P=x[P])for(;P%10==0;P/=10,$--);return $<0&&($=0),$},o.dividedBy=o.div=function(h,b){return t(this,new w(h,b),l,u)},o.dividedToIntegerBy=o.idiv=function(h,b){return t(this,new w(h,b),0,1)},o.exponentiatedBy=o.pow=function(h,b){var x,$,P,A,S,O,T,L,y,I=this;if(h=new w(h),h.c&&!h.isInteger())throw Error(Ce+"Exponent not an integer: "+W(h));if(b!=null&&(b=new w(b)),O=h.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!h.c||!h.c[0])return y=new w(Math.pow(+W(I),O?h.s*(2-cn(h)):+W(h))),b?y.mod(b):y;if(T=h.s<0,b){if(b.c?!b.c[0]:!b.s)return new w(NaN);$=!T&&I.isInteger()&&b.isInteger(),$&&(I=I.mod(b))}else{if(h.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||O&&I.c[1]>=24e7:I.c[0]<8e13||O&&I.c[0]<=9999975e7)))return A=I.s<0&&cn(h)?-0:0,I.e>-1&&(A=1/A),new w(T?1/A:A);g&&(A=Jn(g/Q+2))}for(O?(x=new w(.5),T&&(h.s=1),L=cn(h)):(P=Math.abs(+W(h)),L=P%2),y=new w(i);;){if(L){if(y=y.times(I),!y.c)break;A?y.c.length>A&&(y.c.length=A):$&&(y=y.mod(b))}if(P){if(P=je(P/2),P===0)break;L=P%2}else if(h=h.times(x),k(h,h.e+1,1),h.e>14)L=cn(h);else{if(P=+W(h),P===0)break;L=P%2}I=I.times(I),A?I.c&&I.c.length>A&&(I.c.length=A):$&&(I=I.mod(b))}return $?y:(T&&(y=i.div(y)),b?y.mod(b):A?k(y,g,u,S):y)},o.integerValue=function(h){var b=new w(this);return h==null?h=u:ce(h,0,8),k(b,b.e+1,h)},o.isEqualTo=o.eq=function(h,b){return Et(this,new w(h,b))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(h,b){return Et(this,new w(h,b))>0},o.isGreaterThanOrEqualTo=o.gte=function(h,b){return(b=Et(this,new w(h,b)))===1||b===0},o.isInteger=function(){return!!this.c&&Fe(this.e/Q)>this.c.length-2},o.isLessThan=o.lt=function(h,b){return Et(this,new w(h,b))<0},o.isLessThanOrEqualTo=o.lte=function(h,b){return(b=Et(this,new w(h,b)))===-1||b===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,b){var x,$,P,A,S=this,O=S.s;if(h=new w(h,b),b=h.s,!O||!b)return new w(NaN);if(O!=b)return h.s=-b,S.plus(h);var T=S.e/Q,L=h.e/Q,y=S.c,I=h.c;if(!T||!L){if(!y||!I)return y?(h.s=-b,h):new w(I?S:NaN);if(!y[0]||!I[0])return I[0]?(h.s=-b,h):new w(y[0]?S:u==3?-0:0)}if(T=Fe(T),L=Fe(L),y=y.slice(),O=T-L){for((A=O<0)?(O=-O,P=y):(L=T,P=I),P.reverse(),b=O;b--;P.push(0));P.reverse()}else for($=(A=(O=y.length)<(b=I.length))?O:b,O=b=0;b<$;b++)if(y[b]!=I[b]){A=y[b]<I[b];break}if(A&&(P=y,y=I,I=P,h.s=-h.s),b=($=I.length)-(x=y.length),b>0)for(;b--;y[x++]=0);for(b=Ye-1;$>O;){if(y[--$]<I[$]){for(x=$;x&&!y[--x];y[x]=b);--y[x],y[$]+=Ye}y[$]-=I[$]}for(;y[0]==0;y.splice(0,1),--L);return y[0]?F(h,y,L):(h.s=u==3?-1:1,h.c=[h.e=0],h)},o.modulo=o.mod=function(h,b){var x,$,P=this;return h=new w(h,b),!P.c||!h.s||h.c&&!h.c[0]?new w(NaN):!h.c||P.c&&!P.c[0]?new w(P):(f==9?($=h.s,h.s=1,x=t(P,h,0,3),h.s=$,x.s*=$):x=t(P,h,0,f),h=P.minus(x.times(h)),!h.c[0]&&f==1&&(h.s=P.s),h)},o.multipliedBy=o.times=function(h,b){var x,$,P,A,S,O,T,L,y,I,_,V,z,G,q,B=this,K=B.c,H=(h=new w(h,b)).c;if(!K||!H||!K[0]||!H[0])return!B.s||!h.s||K&&!K[0]&&!H||H&&!H[0]&&!K?h.c=h.e=h.s=null:(h.s*=B.s,!K||!H?h.c=h.e=null:(h.c=[0],h.e=0)),h;for($=Fe(B.e/Q)+Fe(h.e/Q),h.s*=B.s,T=K.length,I=H.length,T<I&&(z=K,K=H,H=z,P=T,T=I,I=P),P=T+I,z=[];P--;z.push(0));for(G=Ye,q=ht,P=I;--P>=0;){for(x=0,_=H[P]%q,V=H[P]/q|0,S=T,A=P+S;A>P;)L=K[--S]%q,y=K[S]/q|0,O=V*L+y*_,L=_*L+O%q*q+z[A]+x,x=(L/G|0)+(O/q|0)+V*y,z[A--]=L%G;z[A]=x}return x?++$:z.splice(0,1),F(h,z,$)},o.negated=function(){var h=new w(this);return h.s=-h.s||null,h},o.plus=function(h,b){var x,$=this,P=$.s;if(h=new w(h,b),b=h.s,!P||!b)return new w(NaN);if(P!=b)return h.s=-b,$.minus(h);var A=$.e/Q,S=h.e/Q,O=$.c,T=h.c;if(!A||!S){if(!O||!T)return new w(P/0);if(!O[0]||!T[0])return T[0]?h:new w(O[0]?$:P*0)}if(A=Fe(A),S=Fe(S),O=O.slice(),P=A-S){for(P>0?(S=A,x=T):(P=-P,x=O),x.reverse();P--;x.push(0));x.reverse()}for(P=O.length,b=T.length,P-b<0&&(x=T,T=O,O=x,b=P),P=0;b;)P=(O[--b]=O[b]+T[b]+P)/Ye|0,O[b]=Ye===O[b]?0:O[b]%Ye;return P&&(O=[P].concat(O),++S),F(h,O,S)},o.precision=o.sd=function(h,b){var x,$,P,A=this;if(h!=null&&h!==!!h)return ce(h,1,ge),b==null?b=u:ce(b,0,8),k(new w(A),h,b);if(!(x=A.c))return null;if(P=x.length-1,$=P*Q+1,P=x[P]){for(;P%10==0;P/=10,$--);for(P=x[0];P>=10;P/=10,$++);}return h&&A.e+1>$&&($=A.e+1),$},o.shiftedBy=function(h){return ce(h,-Zn,Zn),this.times("1e"+h)},o.squareRoot=o.sqrt=function(){var h,b,x,$,P,A=this,S=A.c,O=A.s,T=A.e,L=l+4,y=new w("0.5");if(O!==1||!S||!S[0])return new w(!O||O<0&&(!S||S[0])?NaN:S?A:1/0);if(O=Math.sqrt(+W(A)),O==0||O==1/0?(b=Re(S),(b.length+T)%2==0&&(b+="0"),O=Math.sqrt(+b),T=Fe((T+1)/2)-(T<0||T%2),O==1/0?b="5e"+T:(b=O.toExponential(),b=b.slice(0,b.indexOf("e")+1)+T),x=new w(b)):x=new w(O+""),x.c[0]){for(T=x.e,O=T+L,O<3&&(O=0);;)if(P=x,x=y.times(P.plus(t(A,P,L,1))),Re(P.c).slice(0,O)===(b=Re(x.c)).slice(0,O))if(x.e<T&&--O,b=b.slice(O-3,O+1),b=="9999"||!$&&b=="4999"){if(!$&&(k(P,P.e+l+2,0),P.times(P).eq(A))){x=P;break}L+=4,O+=4,$=1}else{(!+b||!+b.slice(1)&&b.charAt(0)=="5")&&(k(x,x.e+l+2,1),h=!x.times(x).eq(A));break}}return k(x,x.e+l+1,u,h)},o.toExponential=function(h,b){return h!=null&&(ce(h,0,ge),h++),N(this,h,b,1)},o.toFixed=function(h,b){return h!=null&&(ce(h,0,ge),h=h+this.e+1),N(this,h,b)},o.toFormat=function(h,b,x){var $,P=this;if(x==null)h!=null&&b&&typeof b=="object"?(x=b,b=null):h&&typeof h=="object"?(x=h,h=b=null):x=v;else if(typeof x!="object")throw Error(Ce+"Argument not an object: "+x);if($=P.toFixed(h,b),P.c){var A,S=$.split("."),O=+x.groupSize,T=+x.secondaryGroupSize,L=x.groupSeparator||"",y=S[0],I=S[1],_=P.s<0,V=_?y.slice(1):y,z=V.length;if(T&&(A=O,O=T,T=A,z-=A),O>0&&z>0){for(A=z%O||O,y=V.substr(0,A);A<z;A+=O)y+=L+V.substr(A,O);T>0&&(y+=L+V.slice(A)),_&&(y="-"+y)}$=I?y+(x.decimalSeparator||"")+((T=+x.fractionGroupSize)?I.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):I):y}return(x.prefix||"")+$+(x.suffix||"")},o.toFraction=function(h){var b,x,$,P,A,S,O,T,L,y,I,_,V=this,z=V.c;if(h!=null&&(O=new w(h),!O.isInteger()&&(O.c||O.s!==1)||O.lt(i)))throw Error(Ce+"Argument "+(O.isInteger()?"out of range: ":"not an integer: ")+W(O));if(!z)return new w(V);for(b=new w(i),L=x=new w(i),$=T=new w(i),_=Re(z),A=b.e=_.length-V.e-1,b.c[0]=er[(S=A%Q)<0?Q+S:S],h=!h||O.comparedTo(b)>0?A>0?b:L:O,S=d,d=1/0,O=new w(_),T.c[0]=0;y=t(O,b,0,1),P=x.plus(y.times($)),P.comparedTo(h)!=1;)x=$,$=P,L=T.plus(y.times(P=L)),T=P,b=O.minus(y.times(P=b)),O=P;return P=t(h.minus(x),$,0,1),T=T.plus(P.times(L)),x=x.plus(P.times($)),T.s=L.s=V.s,A=A*2,I=t(L,$,A,u).minus(V).abs().comparedTo(t(T,x,A,u).minus(V).abs())<1?[L,$]:[T,x],d=S,I},o.toNumber=function(){return+W(this)},o.toPrecision=function(h,b){return h!=null&&ce(h,1,ge),N(this,h,b,2)},o.toString=function(h){var b,x=this,$=x.s,P=x.e;return P===null?$?(b="Infinity",$<0&&(b="-"+b)):b="NaN":(h==null?b=P<=s||P>=a?fn(Re(x.c),P):lt(Re(x.c),P,"0"):h===10&&M?(x=k(new w(x),l+P+1,u),b=lt(Re(x.c),x.e,"0")):(ce(h,2,E.length,"Base"),b=n(lt(Re(x.c),P,"0"),10,h,$,!0)),$<0&&x.c[0]&&(b="-"+b)),b},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 Fe(e){var t=e|0;return e>0||e===t?t:t-1}function Re(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=Q-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function Et(e,t){var n,r,o=e.c,i=t.c,l=e.s,u=t.s,s=e.e,a=t.e;if(!l||!u)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-u:l;if(l!=u)return l;if(n=l<0,r=s==a,!o||!i)return r?0:!o^n?1:-1;if(!r)return s>a^n?1:-1;for(u=(s=o.length)<(a=i.length)?s:a,l=0;l<u;l++)if(o[l]!=i[l])return o[l]>i[l]^n?1:-1;return s==a?0:s>a^n?1:-1}function ce(e,t,n,r){if(e<t||e>n||e!==je(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 Fe(e.e/Q)==t&&e.c[t]%2!=0}function fn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function lt(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 Oe=Fo();const va=(e,t=6)=>{try{const n=new Oe(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Oe.ROUND_DOWN),[o,i=""]=r.toString().split("."),l=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const u=(i||"").padEnd(t,"0");return`${l}.${u}`}return l}catch(n){return console.warn("formatThousands error:",n),"0"}},Ke=()=>{const{translations:e,currentLocale:t}=Io();return{t:(i,l)=>{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 a=typeof s=="string"?s:i;return l&&typeof a=="string"&&Object.keys(l).forEach(c=>{const d=`{{${c}}}`;a=a.replace(new RegExp(d,"g"),String(l[c]))}),a}catch(u){return console.warn(`Translation error for key "${i}":`,u),i}},translations:e,locale:t,getTranslationObject:i=>{try{const l=i.split(".");let u=e;for(const s of l)if(u&&typeof u=="object"&&s in u)u=u[s];else return{};return typeof u=="object"?u:{}}catch(l){return console.warn(`Translation object error for key "${i}":`,l),{}}},hasTranslation:i=>{try{const l=i.split(".");let u=e;for(const s of l)if(u&&typeof u=="object"&&s in u)u=u[s];else return!1;return typeof u=="string"}catch{return!1}}}},ba=()=>({openDeposit:m.useCallback(t=>{},[])}),xa=()=>({openWithdraw:m.useCallback(t=>{},[])});/**
36
36
  * @license lucide-react v0.540.0 - ISC
37
37
  *
38
38
  * This source code is licensed under the ISC license.
39
39
  * See the LICENSE file in the root directory of this source tree.
40
- */const ya=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wa=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Fo=e=>{const t=wa(e);return t.charAt(0).toUpperCase()+t.slice(1)},ko=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ea=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
40
+ */const ya=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wa=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Ro=e=>{const t=wa(e);return t.charAt(0).toUpperCase()+t.slice(1)},ko=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ea=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
41
41
  * @license lucide-react v0.540.0 - ISC
42
42
  *
43
43
  * This source code is licensed under the ISC license.
@@ -52,15 +52,15 @@ React keys must be passed directly to JSX without using spread:
52
52
  *
53
53
  * This source code is licensed under the ISC license.
54
54
  * See the LICENSE file in the root directory of this source tree.
55
- */const Oa=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(Ca,{ref:i,iconNode:t,className:ko(`lucide-${ya(Fo(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Fo(e),n};/**
55
+ */const Oa=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(Ca,{ref:i,iconNode:t,className:ko(`lucide-${ya(Ro(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Ro(e),n};/**
56
56
  * @license lucide-react v0.540.0 - ISC
57
57
  *
58
58
  * This source code is licensed under the ISC license.
59
59
  * See the LICENSE file in the root directory of this source tree.
60
- */const Ro=Oa("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class _o{constructor(){Me(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 Ta extends _o{constructor(n,r){super();Me(this,"smartWallet");Me(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 Na extends _o{constructor(n,r,o,i="0",l="0"){super();Me(this,"currentActiveAccount");Me(this,"approved");Me(this,"chainId");Me(this,"balance");Me(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=i,this.allowance=l}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 Bo(e,t,n,r,o,i){switch(e==null?void 0:e.wallet){case"mpc":return new Ta(t,e);default:return new Na(e,!1,r||1,o,i)}}const Wo=typeof document<"u"?m.useLayoutEffect:()=>{};var tr;const La=(tr=m.useInsertionEffect)!==null&&tr!==void 0?tr:Wo;function $a(e){const t=m.useRef(null);return La(()=>{t.current=e},[e]),m.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const gt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},St=e=>e&&"window"in e&&e.window===e?e:gt(e).defaultView||window;function Pa(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Aa(e){return Pa(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Da=!1;function nr(){return Da}function Uo(e,t){if(!nr())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:Aa(n)?n=n.host:n=n.parentNode}return!1}const rr=(e=document)=>{var t;if(!nr())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 Vo(e){return nr()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function fn(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 or(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 at(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ir=at(function(){return or(/^Mac/i)}),Ma=at(function(){return or(/^iPhone/i)}),Ia=at(function(){return or(/^iPad/i)||ir()&&navigator.maxTouchPoints>1}),ja=at(function(){return Ma()||Ia()});at(function(){return ir()||ja()}),at(function(){return fn(/AppleWebKit/i)&&!Fa()});const Fa=at(function(){return fn(/Chrome/i)}),ka=at(function(){return fn(/Android/i)});at(function(){return fn(/Firefox/i)});function zo(){let e=m.useRef(new Map),t=m.useCallback((o,i,l,u)=>{let s=u!=null&&u.once?(...a)=>{e.current.delete(l),l(...a)}:l;e.current.set(l,{type:i,eventTarget:o,fn:s,options:u}),o.addEventListener(i,s,u)},[]),n=m.useCallback((o,i,l,u)=>{var s;let a=((s=e.current.get(l))===null||s===void 0?void 0:s.fn)||l;o.removeEventListener(i,a,u),e.current.delete(l)},[]),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 Ra(e){return e.mozInputSource===0&&e.isTrusted?!0:ka()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ho(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function _a(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Go(e){let t=m.useRef({isFocused:!1,observer:null});Wo(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=$a(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=l=>{if(t.current.isFocused=!1,o.disabled){let u=Ho(l);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 l;(l=t.current.observer)===null||l===void 0||l.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 Ba=!1,Gt=null,sr=new Set,Yt=new Map,Ct=!1,lr=!1;const Wa={Tab:!0,Escape:!0};function ar(e,t){for(let n of sr)n(e,t)}function Ua(e){return!(e.metaKey||!ir()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function dn(e){Ct=!0,Ua(e)&&(Gt="keyboard",ar("keyboard",e))}function Re(e){Gt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ct=!0,ar("pointer",e))}function Yo(e){Ra(e)&&(Ct=!0,Gt="virtual")}function Ko(e){e.target===window||e.target===document||Ba||!e.isTrusted||(!Ct&&!lr&&(Gt="virtual",ar("virtual",e)),Ct=!1,lr=!1)}function qo(){Ct=!1,lr=!0}function ur(e){if(typeof window>"u"||typeof document>"u"||Yt.get(St(e)))return;const t=St(e),n=gt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ct=!0,r.apply(this,arguments)},n.addEventListener("keydown",dn,!0),n.addEventListener("keyup",dn,!0),n.addEventListener("click",Yo,!0),t.addEventListener("focus",Ko,!0),t.addEventListener("blur",qo,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Re,!0),n.addEventListener("pointermove",Re,!0),n.addEventListener("pointerup",Re,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Re,!0),n.addEventListener("mousemove",Re,!0),n.addEventListener("mouseup",Re,!0)),t.addEventListener("beforeunload",()=>{Xo(e)},{once:!0}),Yt.set(t,{focus:r})}const Xo=(e,t)=>{const n=St(e),r=gt(e);t&&r.removeEventListener("DOMContentLoaded",t),Yt.has(n)&&(n.HTMLElement.prototype.focus=Yt.get(n).focus,r.removeEventListener("keydown",dn,!0),r.removeEventListener("keyup",dn,!0),r.removeEventListener("click",Yo,!0),n.removeEventListener("focus",Ko,!0),n.removeEventListener("blur",qo,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Re,!0),r.removeEventListener("pointermove",Re,!0),r.removeEventListener("pointerup",Re,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Re,!0),r.removeEventListener("mousemove",Re,!0),r.removeEventListener("mouseup",Re,!0)),Yt.delete(n))};function Va(e){const t=gt(e);let n;return t.readyState!=="loading"?ur(e):(n=()=>{ur(e)},t.addEventListener("DOMContentLoaded",n)),()=>Xo(e,n)}typeof document<"u"&&Va();function Qo(){return Gt!=="pointer"}const za=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ha(e,t,n){let r=gt(n==null?void 0:n.target);const o=typeof window<"u"?St(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?St(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?St(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?St(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!za.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof l&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Wa[n.key])}function Ga(e,t,n){ur(),m.useEffect(()=>{let r=(o,i)=>{Ha(!!(n!=null&&n.isTextInput),o,i)&&e(Qo())};return sr.add(r),()=>{sr.delete(r)}},t)}function Ya(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]),l=Go(i),u=m.useCallback(s=>{const a=gt(s.target),c=a?rr(a):rr();s.target===s.currentTarget&&c===Vo(s.nativeEvent)&&(n&&n(s),o&&o(!0),l(s))},[o,n,l]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?i:void 0}}}function Ka(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=m.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:u}=zo(),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]),a=Go(s),c=m.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const p=gt(d.target),f=rr(p);if(!i.current.isFocusWithin&&f===Vo(d.nativeEvent)){r&&r(d),o&&o(!0),i.current.isFocusWithin=!0,a(d);let g=d.currentTarget;l(p,"focus",v=>{if(i.current.isFocusWithin&&!Uo(g,v.target)){let E=new p.defaultView.FocusEvent("blur",{relatedTarget:v.target});_a(E,g);let M=Ho(E);s(M)}},{capture:!0})}},[r,o,a,l,s]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:s}}}let pn=!1,mn=0;function cr(){pn=!0,setTimeout(()=>{pn=!1},50)}function Jo(e){e.pointerType==="touch"&&cr()}function qa(){if(!(typeof document>"u"))return mn===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Jo):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",cr)),mn++,()=>{mn--,!(mn>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Jo):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",cr))}}function Xa(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[i,l]=m.useState(!1),u=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(qa,[]);let{addGlobalListener:s,removeAllGlobalListeners:a}=zo(),{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 M=v.currentTarget;u.target=M,s(gt(v.target),"pointerover",y=>{u.isHovered&&u.target&&!Uo(u.target,y.target)&&f(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:M,pointerType:E}),n&&n(!0),l(!0)},f=(v,E)=>{let M=u.target;u.pointerType="",u.target=null,!(E==="touch"||!u.isHovered||!M)&&(u.isHovered=!1,a(),r&&r({type:"hoverend",target:M,pointerType:E}),n&&n(!1),l(!1))},g={};return typeof PointerEvent<"u"?(g.onPointerEnter=v=>{pn&&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&&!pn&&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,a]);return m.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:c,isHovered:i}}function Qa(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=m.useRef({isFocused:!1,isFocusVisible:t||Qo()}),[i,l]=m.useState(!1),[u,s]=m.useState(()=>o.current.isFocused&&o.current.isFocusVisible),a=m.useCallback(()=>s(o.current.isFocused&&o.current.isFocusVisible),[]),c=m.useCallback(f=>{o.current.isFocused=f,l(f),a()},[a]);Ga(f=>{o.current.isFocusVisible=f,a()},[],{isTextInput:n});let{focusProps:d}=Ya({isDisabled:r,onFocusChange:c}),{focusWithinProps:p}=Ka({isDisabled:!r,onFocusWithinChange:c});return{isFocused:i,isFocusVisible:u,focusProps:r?p:d}}var Ja=Object.defineProperty,Za=(e,t,n)=>t in e?Ja(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fr=(e,t,n)=>(Za(e,typeof t!="symbol"?t+"":t,n),n);let eu=class{constructor(){fr(this,"current",this.detect()),fr(this,"handoffState","pending"),fr(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"}},Je=new eu;function Kt(e){var t,n;return Je.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 Zo(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function qe(){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 Zo(()=>{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=qe();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function At(){let[e]=m.useState(qe);return m.useEffect(()=>()=>e.dispose(),[e]),e}let ue=(e,t)=>{Je.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function Ot(e){let t=m.useRef(e);return ue(()=>{t.current=e},[e]),t}let ne=function(e){let t=Ot(e);return m.useCallback((...n)=>t.current(...n),[t])};function tu(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 nu(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function ru({disabled:e=!1}={}){let t=m.useRef(null),[n,r]=m.useState(!1),o=At(),i=ne(()=>{t.current=null,r(!1),o.dispose()}),l=ne(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let s=Kt(u.currentTarget);o.addEventListener(s,"pointerup",i,!1),o.addEventListener(s,"pointermove",a=>{if(t.current){let c=tu(a);r(nu(c,t.current.getBoundingClientRect()))}},!1),o.addEventListener(s,"pointercancel",i,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:l,onPointerUp:i,onClick:i}}}let ou=m.createContext(void 0);function dr(){return m.useContext(ou)}function pr(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function _e(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,_e),r}var hn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(hn||{}),vt=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(vt||{});function De(){let e=su();return m.useCallback(t=>iu({mergeRefs:e,...t}),[e])}function iu({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:l,mergeRefs:u}){u=u??lu;let s=ei(t,e);if(i)return gn(s,n,r,l,u);let a=o??0;if(a&2){let{static:c=!1,...d}=s;if(c)return gn(d,n,r,l,u)}if(a&1){let{unmount:c=!0,...d}=s;return _e(c?0:1,{0(){return null},1(){return gn({...d,hidden:!0,style:{display:"none"}},n,r,l,u)}})}return gn(s,n,r,l,u)}function gn(e,t={},n,r,o){let{as:i=n,children:l,refName:u="ref",...s}=mr(e,["unmount","static"]),a=e.ref!==void 0?{[u]:e.ref}:{},c=typeof l=="function"?l(t):l;"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(bt(s)).length>0||Object.keys(bt(d)).length>0))if(!m.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(bt(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(bt(s)).concat(Object.keys(bt(d))).map(p=>` - ${p}`).join(`
60
+ */const _o=Oa("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Wo{constructor(){Ie(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 Ta extends Wo{constructor(n,r){super();Ie(this,"smartWallet");Ie(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 Na extends Wo{constructor(n,r,o,i="0",l="0"){super();Ie(this,"currentActiveAccount");Ie(this,"approved");Ie(this,"chainId");Ie(this,"balance");Ie(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=i,this.allowance=l}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 Bo(e,t,n,r,o,i){switch(e==null?void 0:e.wallet){case"mpc":return new Ta(t,e);default:return new Na(e,!1,r||1,o,i)}}const Uo=typeof document<"u"?m.useLayoutEffect:()=>{};var tr;const Aa=(tr=m.useInsertionEffect)!==null&&tr!==void 0?tr:Uo;function La(e){const t=m.useRef(null);return Aa(()=>{t.current=e},[e]),m.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const gt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},St=e=>e&&"window"in e&&e.window===e?e:gt(e).defaultView||window;function Pa(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function $a(e){return Pa(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Da=!1;function nr(){return Da}function Vo(e,t){if(!nr())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:$a(n)?n=n.host:n=n.parentNode}return!1}const rr=(e=document)=>{var t;if(!nr())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 zo(e){return nr()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function dn(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 or(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 at(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ir=at(function(){return or(/^Mac/i)}),Ma=at(function(){return or(/^iPhone/i)}),Ia=at(function(){return or(/^iPad/i)||ir()&&navigator.maxTouchPoints>1}),ja=at(function(){return Ma()||Ia()});at(function(){return ir()||ja()}),at(function(){return dn(/AppleWebKit/i)&&!Fa()});const Fa=at(function(){return dn(/Chrome/i)}),Ra=at(function(){return dn(/Android/i)});at(function(){return dn(/Firefox/i)});function Ho(){let e=m.useRef(new Map),t=m.useCallback((o,i,l,u)=>{let s=u!=null&&u.once?(...a)=>{e.current.delete(l),l(...a)}:l;e.current.set(l,{type:i,eventTarget:o,fn:s,options:u}),o.addEventListener(i,s,u)},[]),n=m.useCallback((o,i,l,u)=>{var s;let a=((s=e.current.get(l))===null||s===void 0?void 0:s.fn)||l;o.removeEventListener(i,a,u),e.current.delete(l)},[]),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 ka(e){return e.mozInputSource===0&&e.isTrusted?!0:Ra()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Go(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function _a(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Yo(e){let t=m.useRef({isFocused:!1,observer:null});Uo(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=La(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=l=>{if(t.current.isFocused=!1,o.disabled){let u=Go(l);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 l;(l=t.current.observer)===null||l===void 0||l.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 Wa=!1,Gt=null,sr=new Set,Yt=new Map,Ct=!1,lr=!1;const Ba={Tab:!0,Escape:!0};function ar(e,t){for(let n of sr)n(e,t)}function Ua(e){return!(e.metaKey||!ir()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function pn(e){Ct=!0,Ua(e)&&(Gt="keyboard",ar("keyboard",e))}function ke(e){Gt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ct=!0,ar("pointer",e))}function Ko(e){ka(e)&&(Ct=!0,Gt="virtual")}function qo(e){e.target===window||e.target===document||Wa||!e.isTrusted||(!Ct&&!lr&&(Gt="virtual",ar("virtual",e)),Ct=!1,lr=!1)}function Xo(){Ct=!1,lr=!0}function ur(e){if(typeof window>"u"||typeof document>"u"||Yt.get(St(e)))return;const t=St(e),n=gt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ct=!0,r.apply(this,arguments)},n.addEventListener("keydown",pn,!0),n.addEventListener("keyup",pn,!0),n.addEventListener("click",Ko,!0),t.addEventListener("focus",qo,!0),t.addEventListener("blur",Xo,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",ke,!0),n.addEventListener("pointermove",ke,!0),n.addEventListener("pointerup",ke,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",ke,!0),n.addEventListener("mousemove",ke,!0),n.addEventListener("mouseup",ke,!0)),t.addEventListener("beforeunload",()=>{Qo(e)},{once:!0}),Yt.set(t,{focus:r})}const Qo=(e,t)=>{const n=St(e),r=gt(e);t&&r.removeEventListener("DOMContentLoaded",t),Yt.has(n)&&(n.HTMLElement.prototype.focus=Yt.get(n).focus,r.removeEventListener("keydown",pn,!0),r.removeEventListener("keyup",pn,!0),r.removeEventListener("click",Ko,!0),n.removeEventListener("focus",qo,!0),n.removeEventListener("blur",Xo,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",ke,!0),r.removeEventListener("pointermove",ke,!0),r.removeEventListener("pointerup",ke,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",ke,!0),r.removeEventListener("mousemove",ke,!0),r.removeEventListener("mouseup",ke,!0)),Yt.delete(n))};function Va(e){const t=gt(e);let n;return t.readyState!=="loading"?ur(e):(n=()=>{ur(e)},t.addEventListener("DOMContentLoaded",n)),()=>Qo(e,n)}typeof document<"u"&&Va();function Jo(){return Gt!=="pointer"}const za=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ha(e,t,n){let r=gt(n==null?void 0:n.target);const o=typeof window<"u"?St(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?St(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?St(n==null?void 0:n.target).HTMLElement:HTMLElement,u=typeof window<"u"?St(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!za.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof l&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Ba[n.key])}function Ga(e,t,n){ur(),m.useEffect(()=>{let r=(o,i)=>{Ha(!!(n!=null&&n.isTextInput),o,i)&&e(Jo())};return sr.add(r),()=>{sr.delete(r)}},t)}function Ya(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]),l=Yo(i),u=m.useCallback(s=>{const a=gt(s.target),c=a?rr(a):rr();s.target===s.currentTarget&&c===zo(s.nativeEvent)&&(n&&n(s),o&&o(!0),l(s))},[o,n,l]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?i:void 0}}}function Ka(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=m.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:u}=Ho(),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]),a=Yo(s),c=m.useCallback(d=>{if(!d.currentTarget.contains(d.target))return;const p=gt(d.target),f=rr(p);if(!i.current.isFocusWithin&&f===zo(d.nativeEvent)){r&&r(d),o&&o(!0),i.current.isFocusWithin=!0,a(d);let g=d.currentTarget;l(p,"focus",v=>{if(i.current.isFocusWithin&&!Vo(g,v.target)){let E=new p.defaultView.FocusEvent("blur",{relatedTarget:v.target});_a(E,g);let M=Go(E);s(M)}},{capture:!0})}},[r,o,a,l,s]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:s}}}let mn=!1,hn=0;function cr(){mn=!0,setTimeout(()=>{mn=!1},50)}function Zo(e){e.pointerType==="touch"&&cr()}function qa(){if(!(typeof document>"u"))return hn===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Zo):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",cr)),hn++,()=>{hn--,!(hn>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Zo):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",cr))}}function Xa(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[i,l]=m.useState(!1),u=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(qa,[]);let{addGlobalListener:s,removeAllGlobalListeners:a}=Ho(),{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 M=v.currentTarget;u.target=M,s(gt(v.target),"pointerover",w=>{u.isHovered&&u.target&&!Vo(u.target,w.target)&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:M,pointerType:E}),n&&n(!0),l(!0)},f=(v,E)=>{let M=u.target;u.pointerType="",u.target=null,!(E==="touch"||!u.isHovered||!M)&&(u.isHovered=!1,a(),r&&r({type:"hoverend",target:M,pointerType:E}),n&&n(!1),l(!1))},g={};return typeof PointerEvent<"u"?(g.onPointerEnter=v=>{mn&&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&&!mn&&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,a]);return m.useEffect(()=>{o&&d({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:c,isHovered:i}}function Qa(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=m.useRef({isFocused:!1,isFocusVisible:t||Jo()}),[i,l]=m.useState(!1),[u,s]=m.useState(()=>o.current.isFocused&&o.current.isFocusVisible),a=m.useCallback(()=>s(o.current.isFocused&&o.current.isFocusVisible),[]),c=m.useCallback(f=>{o.current.isFocused=f,l(f),a()},[a]);Ga(f=>{o.current.isFocusVisible=f,a()},[],{isTextInput:n});let{focusProps:d}=Ya({isDisabled:r,onFocusChange:c}),{focusWithinProps:p}=Ka({isDisabled:!r,onFocusWithinChange:c});return{isFocused:i,isFocusVisible:u,focusProps:r?p:d}}var Ja=Object.defineProperty,Za=(e,t,n)=>t in e?Ja(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fr=(e,t,n)=>(Za(e,typeof t!="symbol"?t+"":t,n),n);let eu=class{constructor(){fr(this,"current",this.detect()),fr(this,"handoffState","pending"),fr(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"}},Je=new eu;function Kt(e){var t,n;return Je.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 ei(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function qe(){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 ei(()=>{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=qe();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(qe);return m.useEffect(()=>()=>e.dispose(),[e]),e}let ue=(e,t)=>{Je.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function Ot(e){let t=m.useRef(e);return ue(()=>{t.current=e},[e]),t}let ne=function(e){let t=Ot(e);return m.useCallback((...n)=>t.current(...n),[t])};function tu(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 nu(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function ru({disabled:e=!1}={}){let t=m.useRef(null),[n,r]=m.useState(!1),o=$t(),i=ne(()=>{t.current=null,r(!1),o.dispose()}),l=ne(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let s=Kt(u.currentTarget);o.addEventListener(s,"pointerup",i,!1),o.addEventListener(s,"pointermove",a=>{if(t.current){let c=tu(a);r(nu(c,t.current.getBoundingClientRect()))}},!1),o.addEventListener(s,"pointercancel",i,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:l,onPointerUp:i,onClick:i}}}let ou=m.createContext(void 0);function dr(){return m.useContext(ou)}function pr(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function _e(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,_e),r}var gn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(gn||{}),vt=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(vt||{});function Me(){let e=su();return m.useCallback(t=>iu({mergeRefs:e,...t}),[e])}function iu({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:l,mergeRefs:u}){u=u??lu;let s=ti(t,e);if(i)return vn(s,n,r,l,u);let a=o??0;if(a&2){let{static:c=!1,...d}=s;if(c)return vn(d,n,r,l,u)}if(a&1){let{unmount:c=!0,...d}=s;return _e(c?0:1,{0(){return null},1(){return vn({...d,hidden:!0,style:{display:"none"}},n,r,l,u)}})}return vn(s,n,r,l,u)}function vn(e,t={},n,r,o){let{as:i=n,children:l,refName:u="ref",...s}=mr(e,["unmount","static"]),a=e.ref!==void 0?{[u]:e.ref}:{},c=typeof l=="function"?l(t):l;"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(bt(s)).length>0||Object.keys(bt(d)).length>0))if(!m.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(bt(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(bt(s)).concat(Object.keys(bt(d))).map(p=>` - ${p}`).join(`
61
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(`
62
62
  `)].join(`
63
- `))}else{let p=c.props,f=p==null?void 0:p.className,g=typeof f=="function"?(...M)=>pr(f(...M),s.className):pr(f,s.className),v=g?{className:g}:{},E=ei(c.props,bt(mr(s,["ref"])));for(let M in d)M in E&&delete d[M];return m.cloneElement(c,Object.assign({},E,d,a,{ref:o(au(c),a.ref)},v))}return m.createElement(i,Object.assign({},mr(s,["ref"]),i!==m.Fragment&&a,i!==m.Fragment&&d),c)}function su(){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 lu(...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 ei(...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 l=n[r];for(let u of l){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...i)}}});return t}function ti(...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 l of i)l==null||l(...o)}});return t}function Oe(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function bt(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function mr(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function au(e){return m.version.split(".")[0]>="19"?e.props.ref:e.ref}function uu(e,t,n){let[r,o]=m.useState(n),i=e!==void 0,l=m.useRef(i),u=m.useRef(!1),s=m.useRef(!1);return i&&!l.current&&!u.current?(u.current=!0,l.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&&l.current&&!s.current&&(s.current=!0,l.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,ne(a=>(i||o(a),t==null?void 0:t(a)))]}function cu(e){let[t]=m.useState(e);return t}function ni(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))oi(n,ri(t,r),o);return n}function ri(e,t){return e?e+"["+t+"]":t}function oi(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())oi(e,ri(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,""]):ni(n,t,e)}function fu(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 du="span";var hr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(hr||{});function pu(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 De()({ourProps:i,theirProps:o,slot:{},defaultTag:du,name:"Hidden"})}let ii=Oe(pu),mu=m.createContext(null);function hu({children:e}){let t=m.useContext(mu);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 gu({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[i,l]=m.useState(null),u=At();return m.useEffect(()=>{if(r&&i)return u.addEventListener(i,"reset",r)},[i,t,r]),m.createElement(hu,null,m.createElement(vu,{setForm:l,formId:t}),ni(e).map(([s,a])=>m.createElement(ii,{features:hr.Hidden,...bt({key:s,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:s,value:a,...o})})))}function vu({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:m.createElement(ii,{features:hr.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let bu=m.createContext(void 0);function si(){return m.useContext(bu)}function gr(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function vn(e){return gr(e)&&"tagName"in e}function ut(e){return vn(e)&&"accessKey"in e}function Dt(e){return vn(e)&&"tabIndex"in e}function xu(e){return vn(e)&&"style"in e}function yu(e){return ut(e)&&e.nodeName==="IFRAME"}function li(e){return ut(e)&&e.nodeName==="INPUT"}function ai(e){return ut(e)&&e.nodeName==="LABEL"}function wu(e){return ut(e)&&e.nodeName==="FIELDSET"}function ui(e){return ut(e)&&e.nodeName==="LEGEND"}function Eu(e){return vn(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Su(e){let t=e.parentElement,n=null;for(;t&&!wu(t);)ui(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Cu(n)?!1:r}function Cu(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(ui(t))return!1;t=t.previousElementSibling}return!0}let ci=Symbol();function Ou(e,t=!0){return Object.assign(e,{[ci]:t})}function Be(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=ne(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[ci]))?void 0:n}let vr=m.createContext(null);vr.displayName="DescriptionContext";function fi(){let e=m.useContext(vr);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,fi),t}return e}function Tu(){var e,t;return(t=(e=m.useContext(vr))==null?void 0:e.value)!=null?t:void 0}let Nu="p";function Lu(e,t){let n=m.useId(),r=dr(),{id:o=`headlessui-description-${n}`,...i}=e,l=fi(),u=Be(t);ue(()=>l.register(o),[o,l.register]);let s=r||!1,a=m.useMemo(()=>({...l.slot,disabled:s}),[l.slot,s]),c={ref:u,...l.props,id:o};return De()({ourProps:c,theirProps:i,slot:a,defaultTag:Nu,name:l.name||"Description"})}let $u=Oe(Lu);Object.assign($u,{});var ve=(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))(ve||{});let bn=m.createContext(null);bn.displayName="LabelContext";function di(){let e=m.useContext(bn);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,di),t}return e}function pi(e){var t,n,r;let o=(n=(t=m.useContext(bn))==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 Pu({inherit:e=!1}={}){let t=pi(),[n,r]=m.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,m.useMemo(()=>function(i){let l=ne(s=>(r(a=>[...a,s]),()=>r(a=>{let c=a.slice(),d=c.indexOf(s);return d!==-1&&c.splice(d,1),c}))),u=m.useMemo(()=>({register:l,slot:i.slot,name:i.name,props:i.props,value:i.value}),[l,i.slot,i.name,i.props,i.value]);return m.createElement(bn.Provider,{value:u},i.children)},[r])]}let Au="label";function Du(e,t){var n;let r=m.useId(),o=di(),i=si(),l=dr(),{id:u=`headlessui-label-${r}`,htmlFor:s=i??((n=o.props)==null?void 0:n.htmlFor),passive:a=!1,...c}=e,d=Be(t);ue(()=>o.register(u),[u,o.register]);let p=ne(E=>{let M=E.currentTarget;if(!(E.target!==E.currentTarget&&Eu(E.target))&&(ai(M)&&E.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(E),ai(M))){let y=document.getElementById(M.htmlFor);if(y){let T=y.getAttribute("disabled");if(T==="true"||T==="")return;let j=y.getAttribute("aria-disabled");if(j==="true"||j==="")return;(li(y)&&(y.type==="file"||y.type==="radio"||y.type==="checkbox")||y.role==="radio"||y.role==="checkbox"||y.role==="switch")&&y.click(),y.focus({preventScroll:!0})}}}),f=l||!1,g=m.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),v={ref:d,...o.props,id:u,htmlFor:s,onClick:p};return a&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in c&&delete c.onClick),De()({ourProps:v,theirProps:c,slot:g,defaultTag:s?Au:"div",name:o.name||"Label"})}let Mu=Oe(Du),Iu=Object.assign(Mu,{});function ju(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 Fu(e=ju){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 ku(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ru(e,t=!1){let[n,r]=m.useReducer(()=>({}),{}),o=m.useMemo(()=>ku(e),[e,n]);return ue(()=>{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 mi=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 _u=Object.defineProperty,Bu=(e,t,n)=>t in e?_u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wu=(e,t,n)=>(Bu(e,t+"",n),n),hi=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},We=(e,t,n)=>(hi(e,t,"read from private field"),n?n.call(e):t.get(e)),br=(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)},gi=(e,t,n,r)=>(hi(e,t,"write to private field"),t.set(e,n),n),Ze,qt,Xt;let vi=class{constructor(t){br(this,Ze,{}),br(this,qt,new mi(()=>new Set)),br(this,Xt,new Set),Wu(this,"disposables",qe()),gi(this,Ze,t),Je.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return We(this,Ze)}subscribe(t,n){if(Je.isServer)return()=>{};let r={selector:t,callback:n,current:t(We(this,Ze))};return We(this,Xt).add(r),this.disposables.add(()=>{We(this,Xt).delete(r)})}on(t,n){return Je.isServer?()=>{}:(We(this,qt).get(t).add(n),this.disposables.add(()=>{We(this,qt).get(t).delete(n)}))}send(t){let n=this.reduce(We(this,Ze),t);if(n!==We(this,Ze)){gi(this,Ze,n);for(let r of We(this,Xt)){let o=r.selector(We(this,Ze));bi(r.current,o)||(r.current=o,r.callback(o))}for(let r of We(this,qt).get(t.type))r(We(this,Ze),t)}}};Ze=new WeakMap,qt=new WeakMap,Xt=new WeakMap;function bi(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:xr(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:xr(e.entries(),t.entries()):xi(e)&&xi(t)?xr(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function xr(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 xi(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function yr(e){let[t,n]=e(),r=qe();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Uu=Object.defineProperty,Vu=(e,t,n)=>t in e?Uu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yi=(e,t,n)=>(Vu(e,typeof t!="symbol"?t+"":t,n),n),wi=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(wi||{});let zu={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}}},Hu=class ra extends vi{constructor(){super(...arguments),yi(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),yi(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new ra({stack:[]})}reduce(t,n){return _e(n.type,zu,t,n)}};const wr=new mi(()=>Hu.new());var Er={exports:{}},Sr={};/**
63
+ `))}else{let p=c.props,f=p==null?void 0:p.className,g=typeof f=="function"?(...M)=>pr(f(...M),s.className):pr(f,s.className),v=g?{className:g}:{},E=ti(c.props,bt(mr(s,["ref"])));for(let M in d)M in E&&delete d[M];return m.cloneElement(c,Object.assign({},E,d,a,{ref:o(au(c),a.ref)},v))}return m.createElement(i,Object.assign({},mr(s,["ref"]),i!==m.Fragment&&a,i!==m.Fragment&&d),c)}function su(){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 lu(...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 ti(...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 l=n[r];for(let u of l){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(o,...i)}}});return t}function ni(...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 l of i)l==null||l(...o)}});return t}function Te(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function bt(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function mr(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function au(e){return m.version.split(".")[0]>="19"?e.props.ref:e.ref}function uu(e,t,n){let[r,o]=m.useState(n),i=e!==void 0,l=m.useRef(i),u=m.useRef(!1),s=m.useRef(!1);return i&&!l.current&&!u.current?(u.current=!0,l.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&&l.current&&!s.current&&(s.current=!0,l.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,ne(a=>(i||o(a),t==null?void 0:t(a)))]}function cu(e){let[t]=m.useState(e);return t}function ri(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ii(n,oi(t,r),o);return n}function oi(e,t){return e?e+"["+t+"]":t}function ii(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ii(e,oi(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,""]):ri(n,t,e)}function fu(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 du="span";var hr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(hr||{});function pu(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 Me()({ourProps:i,theirProps:o,slot:{},defaultTag:du,name:"Hidden"})}let si=Te(pu),mu=m.createContext(null);function hu({children:e}){let t=m.useContext(mu);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 gu({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[i,l]=m.useState(null),u=$t();return m.useEffect(()=>{if(r&&i)return u.addEventListener(i,"reset",r)},[i,t,r]),m.createElement(hu,null,m.createElement(vu,{setForm:l,formId:t}),ri(e).map(([s,a])=>m.createElement(si,{features:hr.Hidden,...bt({key:s,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:s,value:a,...o})})))}function vu({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:m.createElement(si,{features:hr.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let bu=m.createContext(void 0);function li(){return m.useContext(bu)}function gr(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function bn(e){return gr(e)&&"tagName"in e}function ut(e){return bn(e)&&"accessKey"in e}function Dt(e){return bn(e)&&"tabIndex"in e}function xu(e){return bn(e)&&"style"in e}function yu(e){return ut(e)&&e.nodeName==="IFRAME"}function ai(e){return ut(e)&&e.nodeName==="INPUT"}function ui(e){return ut(e)&&e.nodeName==="LABEL"}function wu(e){return ut(e)&&e.nodeName==="FIELDSET"}function ci(e){return ut(e)&&e.nodeName==="LEGEND"}function Eu(e){return bn(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Su(e){let t=e.parentElement,n=null;for(;t&&!wu(t);)ci(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Cu(n)?!1:r}function Cu(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(ci(t))return!1;t=t.previousElementSibling}return!0}let fi=Symbol();function Ou(e,t=!0){return Object.assign(e,{[fi]:t})}function We(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=ne(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[fi]))?void 0:n}let vr=m.createContext(null);vr.displayName="DescriptionContext";function di(){let e=m.useContext(vr);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,di),t}return e}function Tu(){var e,t;return(t=(e=m.useContext(vr))==null?void 0:e.value)!=null?t:void 0}let Nu="p";function Au(e,t){let n=m.useId(),r=dr(),{id:o=`headlessui-description-${n}`,...i}=e,l=di(),u=We(t);ue(()=>l.register(o),[o,l.register]);let s=r||!1,a=m.useMemo(()=>({...l.slot,disabled:s}),[l.slot,s]),c={ref:u,...l.props,id:o};return Me()({ourProps:c,theirProps:i,slot:a,defaultTag:Nu,name:l.name||"Description"})}let Lu=Te(Au);Object.assign(Lu,{});var ve=(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))(ve||{});let xn=m.createContext(null);xn.displayName="LabelContext";function pi(){let e=m.useContext(xn);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,pi),t}return e}function mi(e){var t,n,r;let o=(n=(t=m.useContext(xn))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function Pu({inherit:e=!1}={}){let t=mi(),[n,r]=m.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,m.useMemo(()=>function(i){let l=ne(s=>(r(a=>[...a,s]),()=>r(a=>{let c=a.slice(),d=c.indexOf(s);return d!==-1&&c.splice(d,1),c}))),u=m.useMemo(()=>({register:l,slot:i.slot,name:i.name,props:i.props,value:i.value}),[l,i.slot,i.name,i.props,i.value]);return m.createElement(xn.Provider,{value:u},i.children)},[r])]}let $u="label";function Du(e,t){var n;let r=m.useId(),o=pi(),i=li(),l=dr(),{id:u=`headlessui-label-${r}`,htmlFor:s=i??((n=o.props)==null?void 0:n.htmlFor),passive:a=!1,...c}=e,d=We(t);ue(()=>o.register(u),[u,o.register]);let p=ne(E=>{let M=E.currentTarget;if(!(E.target!==E.currentTarget&&Eu(E.target))&&(ui(M)&&E.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(E),ui(M))){let w=document.getElementById(M.htmlFor);if(w){let N=w.getAttribute("disabled");if(N==="true"||N==="")return;let j=w.getAttribute("aria-disabled");if(j==="true"||j==="")return;(ai(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=l||!1,g=m.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),v={ref:d,...o.props,id:u,htmlFor:s,onClick:p};return a&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in c&&delete c.onClick),Me()({ourProps:v,theirProps:c,slot:g,defaultTag:s?$u:"div",name:o.name||"Label"})}let Mu=Te(Du),Iu=Object.assign(Mu,{});function ju(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 Fu(e=ju){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 Ru(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function ku(e,t=!1){let[n,r]=m.useReducer(()=>({}),{}),o=m.useMemo(()=>Ru(e),[e,n]);return ue(()=>{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 hi=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 _u=Object.defineProperty,Wu=(e,t,n)=>t in e?_u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bu=(e,t,n)=>(Wu(e,t+"",n),n),gi=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Be=(e,t,n)=>(gi(e,t,"read from private field"),n?n.call(e):t.get(e)),br=(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)},vi=(e,t,n,r)=>(gi(e,t,"write to private field"),t.set(e,n),n),Ze,qt,Xt;let bi=class{constructor(t){br(this,Ze,{}),br(this,qt,new hi(()=>new Set)),br(this,Xt,new Set),Bu(this,"disposables",qe()),vi(this,Ze,t),Je.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Be(this,Ze)}subscribe(t,n){if(Je.isServer)return()=>{};let r={selector:t,callback:n,current:t(Be(this,Ze))};return Be(this,Xt).add(r),this.disposables.add(()=>{Be(this,Xt).delete(r)})}on(t,n){return Je.isServer?()=>{}:(Be(this,qt).get(t).add(n),this.disposables.add(()=>{Be(this,qt).get(t).delete(n)}))}send(t){let n=this.reduce(Be(this,Ze),t);if(n!==Be(this,Ze)){vi(this,Ze,n);for(let r of Be(this,Xt)){let o=r.selector(Be(this,Ze));xi(r.current,o)||(r.current=o,r.callback(o))}for(let r of Be(this,qt).get(t.type))r(Be(this,Ze),t)}}};Ze=new WeakMap,qt=new WeakMap,Xt=new WeakMap;function xi(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:xr(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:xr(e.entries(),t.entries()):yi(e)&&yi(t)?xr(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function xr(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 yi(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function yr(e){let[t,n]=e(),r=qe();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Uu=Object.defineProperty,Vu=(e,t,n)=>t in e?Uu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wi=(e,t,n)=>(Vu(e,typeof t!="symbol"?t+"":t,n),n),Ei=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Ei||{});let zu={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}}},Hu=class ra extends bi{constructor(){super(...arguments),wi(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),wi(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new ra({stack:[]})}reduce(t,n){return _e(n.type,zu,t,n)}};const wr=new hi(()=>Hu.new());var Er={exports:{}},Sr={};/**
64
64
  * @license React
65
65
  * use-sync-external-store-with-selector.production.js
66
66
  *
@@ -68,7 +68,7 @@ React keys must be passed directly to JSX without using spread:
68
68
  *
69
69
  * This source code is licensed under the MIT license found in the
70
70
  * LICENSE file in the root directory of this source tree.
71
- */var Ei;function Gu(){if(Ei)return Sr;Ei=1;var e=m;function t(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,i=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Sr.useSyncExternalStoreWithSelector=function(s,a,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=l(function(){function E(F){if(!M){if(M=!0,y=F,F=d(F),p!==void 0&&g.hasValue){var _=g.value;if(p(_,F))return T=_}return T=F}if(_=T,n(y,F))return _;var B=d(F);return p!==void 0&&p(_,B)?(y=F,_):(y=F,T=B)}var M=!1,y,T,j=c===void 0?null:c;return[function(){return E(a())},j===null?void 0:function(){return E(j())}]},[a,c,d,p]);var v=r(s,f[0],f[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),u(v),v},Sr}var Cr={};/**
71
+ */var Si;function Gu(){if(Si)return Sr;Si=1;var e=m;function t(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,i=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Sr.useSyncExternalStoreWithSelector=function(s,a,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=l(function(){function E(F){if(!M){if(M=!0,w=F,F=d(F),p!==void 0&&g.hasValue){var k=g.value;if(p(k,F))return N=k}return N=F}if(k=N,n(w,F))return k;var W=d(F);return p!==void 0&&p(k,W)?(w=F,k):(w=F,N=W)}var M=!1,w,N,j=c===void 0?null:c;return[function(){return E(a())},j===null?void 0:function(){return E(j())}]},[a,c,d,p]);var v=r(s,f[0],f[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),u(v),v},Sr}var Cr={};/**
72
72
  * @license React
73
73
  * use-sync-external-store-with-selector.development.js
74
74
  *
@@ -76,39 +76,39 @@ React keys must be passed directly to JSX without using spread:
76
76
  *
77
77
  * This source code is licensed under the MIT license found in the
78
78
  * LICENSE file in the root directory of this source tree.
79
- */var Si;function Yu(){return Si||(Si=1,process.env.NODE_ENV!=="production"&&function(){function e(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}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,l=t.useMemo,u=t.useDebugValue;Cr.useSyncExternalStoreWithSelector=function(s,a,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=l(function(){function E(F){if(!M){if(M=!0,y=F,F=d(F),p!==void 0&&g.hasValue){var _=g.value;if(p(_,F))return T=_}return T=F}if(_=T,n(y,F))return _;var B=d(F);return p!==void 0&&p(_,B)?(y=F,_):(y=F,T=B)}var M=!1,y,T,j=c===void 0?null:c;return[function(){return E(a())},j===null?void 0:function(){return E(j())}]},[a,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())}()),Cr}process.env.NODE_ENV==="production"?Er.exports=Gu():Er.exports=Yu();var Ku=Er.exports;function Ue(e,t,n=bi){return Ku.useSyncExternalStoreWithSelector(ne(r=>e.subscribe(qu,r)),ne(()=>e.state),ne(()=>e.state),ne(t),n)}function qu(e){return e}function Ci(e,t){let n=m.useId(),r=wr.get(t),[o,i]=Ue(r,m.useCallback(l=>[r.selectors.isTop(l,n),r.selectors.inStack(l,n)],[r,n]));return ue(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?i?o:!0:!1}let Or=new Map,Qt=new Map;function Oi(e){var t;let n=(t=Qt.get(e))!=null?t:0;return Qt.set(e,n+1),n!==0?()=>Ti(e):(Or.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Ti(e))}function Ti(e){var t;let n=(t=Qt.get(e))!=null?t:1;if(n===1?Qt.delete(e):Qt.set(e,n-1),n!==1)return;let r=Or.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Or.delete(e))}function Xu(e,{allowed:t,disallowed:n}={}){let r=Ci(e,"inert-others");ue(()=>{var o,i;if(!r)return;let l=qe();for(let s of(o=n==null?void 0:n())!=null?o:[])s&&l.add(Oi(s));let u=(i=t==null?void 0:t())!=null?i:[];for(let s of u){if(!s)continue;let a=Kt(s);if(!a)continue;let c=s.parentElement;for(;c&&c!==a.body;){for(let d of c.children)u.some(p=>d.contains(p))||l.add(Oi(d));c=c.parentElement}}return l.dispose},[r,t,n])}function Qu(e,t,n){let r=Ot(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:ut(t)?t:t.current;if(!o)return;let i=qe();if(typeof ResizeObserver<"u"){let l=new ResizeObserver(()=>r.current(o));l.observe(o),i.add(()=>l.disconnect())}if(typeof IntersectionObserver<"u"){let l=new IntersectionObserver(()=>r.current(o));l.observe(o),i.add(()=>l.disconnect())}return()=>i.dispose()},[t,r,e])}let Tr=["[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(","),Ju=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Nr=(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))(Nr||{}),Zu=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Zu||{}),ec=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(ec||{});function Ni(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Tr)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function tc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ju)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Lr=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Lr||{});function Li(e,t=0){var n;return e===((n=Kt(e))==null?void 0:n.body)?!1:_e(t,{0(){return e.matches(Tr)},1(){let r=e;for(;r!==null;){if(r.matches(Tr))return!0;r=r.parentElement}return!1}})}var nc=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(nc||{});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 rc=["textarea","input"].join(",");function oc(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,rc))!=null?n:!1}function $i(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 l=o.compareDocumentPosition(i);return l&Node.DOCUMENT_POSITION_FOLLOWING?-1:l&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ic(e,t){return sc(Ni(),t,{relativeTo:e})}function sc(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?$i(e):e:t&64?tc(e):Ni(e);o.length>0&&l.length>1&&(l=l.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,l.indexOf(r))-1;if(t&4)return Math.max(0,l.indexOf(r))+1;if(t&8)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=t&32?{preventScroll:!0}:{},c=0,d=l.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=l[f],p==null||p.focus(a),c+=u}while(p!==i.activeElement);return t&6&&oc(p)&&p.select(),2}function Pi(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function lc(){return/Android/gi.test(window.navigator.userAgent)}function Ai(){return Pi()||lc()}function Mt(e,t,n,r){let o=Ot(n);m.useEffect(()=>{if(!e)return;function i(l){o.current(l)}return document.addEventListener(t,i,r),()=>document.removeEventListener(t,i,r)},[e,t,r])}function ac(e,t,n,r){let o=Ot(n);m.useEffect(()=>{if(!e)return;function i(l){o.current(l)}return window.addEventListener(t,i,r),()=>window.removeEventListener(t,i,r)},[e,t,r])}const Di=30;function uc(e,t,n){let r=Ot(n),o=m.useCallback(function(u,s){if(u.defaultPrevented)return;let a=s(u);if(a===null||!a.getRootNode().contains(a)||!a.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(a)||u.composed&&u.composedPath().includes(d)))return;return!Li(a,Lr.Loose)&&a.tabIndex!==-1&&u.preventDefault(),r.current(u,a)},[r,t]),i=m.useRef(null);Mt(e,"pointerdown",u=>{var s,a;Ai()||(i.current=((a=(s=u.composedPath)==null?void 0:s.call(u))==null?void 0:a[0])||u.target)},!0),Mt(e,"pointerup",u=>{if(Ai()||!i.current)return;let s=i.current;return i.current=null,o(u,()=>s)},!0);let l=m.useRef({x:0,y:0});Mt(e,"touchstart",u=>{l.current.x=u.touches[0].clientX,l.current.y=u.touches[0].clientY},!0),Mt(e,"touchend",u=>{let s={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(s.x-l.current.x)>=Di||Math.abs(s.y-l.current.y)>=Di))return o(u,()=>Dt(u.target)?u.target:null)},!0),ac(e,"blur",u=>o(u,()=>yu(window.document.activeElement)?window.document.activeElement:null),!0)}function $r(...e){return m.useMemo(()=>Kt(...e),[...e])}var cc=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(cc||{});const xn={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},fc=200,Mi=5;function dc(e,{trigger:t,action:n,close:r,select:o}){let i=m.useRef(null),l=m.useRef(null),u=m.useRef(null);Mt(e&&t!==null,"pointerdown",s=>{gr(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(l.current=s.x,u.current=s.y,i.current=s.timeStamp)}),Mt(e&&t!==null,"pointerup",s=>{var a,c;let d=i.current;if(d===null||(i.current=null,!Dt(s.target))||Math.abs(s.x-((a=l.current)!=null?a:s.x))<Mi&&Math.abs(s.y-((c=u.current)!=null?c:s.y))<Mi)return;let p=n(s);switch(p.kind){case 0:return;case 1:{s.timeStamp-d>fc&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function pc(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 mc(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function hc(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 l=t[o].call(n,...i);l&&(n=l,r.forEach(u=>u()))}}}function gc(){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 vc(){return Pi()?{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=qe();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let i=(o=window.scrollY)!=null?o:window.pageYOffset,l=null;t.addEventListener(e,"click",u=>{if(Dt(u.target))try{let s=u.target.closest("a");if(!s)return;let{hash:a}=new URL(s.href),c=e.querySelector(a);Dt(c)&&!r(c)&&(l=c)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(Dt(u.target)&&xu(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(Dt(u.target)){if(li(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),l&&l.isConnected&&(l.scrollIntoView({block:"nearest"}),l=null)})})}}:{}}function bc(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function xc(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Tt=hc(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:qe(),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:xc(n)},o=[vc(),gc(),bc()];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)}});Tt.subscribe(()=>{let e=Tt.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)&&Tt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Tt.dispatch("TEARDOWN",n)}});function yc(e,t,n=()=>({containers:[]})){let r=mc(Tt),o=t?r.get(t):void 0,i=o?o.count>0:!1;return ue(()=>{if(!(!t||!e))return Tt.dispatch("PUSH",t,n),()=>Tt.dispatch("POP",t,n)},[e,t]),i}function wc(e,t,n=()=>[document.body]){let r=Ci(e,"scroll-lock");yc(r,t,o=>{var i;return{containers:[...(i=o.containers)!=null?i:[],n]}})}function Ii(e){return[e.screenX,e.screenY]}function Ec(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=Ii(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Ii(t)}}}function Sc(e=0){let[t,n]=m.useState(e),r=m.useCallback(s=>n(s),[t]),o=m.useCallback(s=>n(a=>a|s),[t]),i=m.useCallback(s=>(t&s)===s,[t]),l=m.useCallback(s=>n(a=>a&~s),[n]),u=m.useCallback(s=>n(a=>a^s),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:i,removeFlag:l,toggleFlag:u}}var ji,Fi;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ji=process==null?void 0:process.env)==null?void 0:ji.NODE_ENV)==="test"&&typeof((Fi=Element==null?void 0:Element.prototype)==null?void 0:Fi.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 Cc=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Cc||{});function ki(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Ri(e,t,n,r){let[o,i]=m.useState(n),{hasFlag:l,addFlag:u,removeFlag:s}=Sc(e&&o?3:0),a=m.useRef(!1),c=m.useRef(!1),d=At();return ue(()=>{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),Oc(t,{inFlight:a,prepare(){c.current?c.current=!1:c.current=a.current,a.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||(a.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:l(1),enter:l(2),leave:l(4),transition:l(2)||l(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Oc(e,{prepare:t,run:n,done:r,inFlight:o}){let i=qe();return Nc(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(Tc(e,r))})}),i.dispose}function Tc(e,t){var n,r;let o=qe();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let l=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return l.length===0?(t(),o.dispose):(Promise.allSettled(l.map(u=>u.finished)).then(()=>{i||t()}),o.dispose)}function Nc(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 yn(){return typeof window<"u"}function It(e){return Pr(e)?(e.nodeName||"").toLowerCase():"#document"}function Te(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function et(e){var t;return(t=(Pr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Pr(e){return yn()?e instanceof Node||e instanceof Te(e).Node:!1}function oe(e){return yn()?e instanceof Element||e instanceof Te(e).Element:!1}function Ee(e){return yn()?e instanceof HTMLElement||e instanceof Te(e).HTMLElement:!1}function Ar(e){return!yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Te(e).ShadowRoot}const Lc=new Set(["inline","contents"]);function Jt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Lc.has(o)}const $c=new Set(["table","td","th"]);function Pc(e){return $c.has(It(e))}const Ac=[":popover-open",":modal"];function wn(e){return Ac.some(t=>{try{return e.matches(t)}catch{return!1}})}const Dc=["transform","translate","scale","rotate","perspective"],Mc=["transform","translate","scale","rotate","perspective","filter"],Ic=["paint","layout","strict","content"];function Dr(e){const t=En(),n=oe(e)?Ve(e):e;return Dc.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)||Mc.some(r=>(n.willChange||"").includes(r))||Ic.some(r=>(n.contain||"").includes(r))}function jc(e){let t=ft(e);for(;Ee(t)&&!ct(t);){if(Dr(t))return t;if(wn(t))return null;t=ft(t)}return null}function En(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Fc=new Set(["html","body","#document"]);function ct(e){return Fc.has(It(e))}function Ve(e){return Te(e).getComputedStyle(e)}function Sn(e){return oe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(It(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ar(e)&&e.host||et(e);return Ar(t)?t.host:t}function _i(e){const t=ft(e);return ct(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ee(t)&&Jt(t)?t:_i(t)}function xt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=_i(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=Te(o);if(i){const u=Mr(l);return t.concat(l,l.visualViewport||[],Jt(o)?o:[],u&&n?xt(u):[])}return t.concat(o,xt(o,[],n))}function Mr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function kc(){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 dt=Math.min,xe=Math.max,Zt=Math.round,Cn=Math.floor,tt=e=>({x:e,y:e}),Rc={left:"right",right:"left",bottom:"top",top:"bottom"},_c={start:"end",end:"start"};function Ir(e,t,n){return xe(e,dt(t,n))}function Nt(e,t){return typeof e=="function"?e(t):e}function yt(e){return e.split("-")[0]}function jt(e){return e.split("-")[1]}function Bi(e){return e==="x"?"y":"x"}function jr(e){return e==="y"?"height":"width"}const Bc=new Set(["top","bottom"]);function pt(e){return Bc.has(yt(e))?"y":"x"}function Fr(e){return Bi(pt(e))}function Wc(e,t,n){n===void 0&&(n=!1);const r=jt(e),o=Fr(e),i=jr(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=On(l)),[l,On(l)]}function Uc(e){const t=On(e);return[kr(e),t,kr(t)]}function kr(e){return e.replace(/start|end/g,t=>_c[t])}const Wi=["left","right"],Ui=["right","left"],Vc=["top","bottom"],zc=["bottom","top"];function Hc(e,t,n){switch(e){case"top":case"bottom":return n?t?Ui:Wi:t?Wi:Ui;case"left":case"right":return t?Vc:zc;default:return[]}}function Gc(e,t,n,r){const o=jt(e);let i=Hc(yt(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(kr)))),i}function On(e){return e.replace(/left|right|bottom|top/g,t=>Rc[t])}function Yc(e){return{top:0,right:0,bottom:0,left:0,...e}}function Vi(e){return typeof e!="number"?Yc(e):{top:e,right:e,bottom:e,left:e}}function Tn(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}}/*!
79
+ */var Ci;function Yu(){return Ci||(Ci=1,process.env.NODE_ENV!=="production"&&function(){function e(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}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,l=t.useMemo,u=t.useDebugValue;Cr.useSyncExternalStoreWithSelector=function(s,a,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=l(function(){function E(F){if(!M){if(M=!0,w=F,F=d(F),p!==void 0&&g.hasValue){var k=g.value;if(p(k,F))return N=k}return N=F}if(k=N,n(w,F))return k;var W=d(F);return p!==void 0&&p(k,W)?(w=F,k):(w=F,N=W)}var M=!1,w,N,j=c===void 0?null:c;return[function(){return E(a())},j===null?void 0:function(){return E(j())}]},[a,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())}()),Cr}process.env.NODE_ENV==="production"?Er.exports=Gu():Er.exports=Yu();var Ku=Er.exports;function Ue(e,t,n=xi){return Ku.useSyncExternalStoreWithSelector(ne(r=>e.subscribe(qu,r)),ne(()=>e.state),ne(()=>e.state),ne(t),n)}function qu(e){return e}function Oi(e,t){let n=m.useId(),r=wr.get(t),[o,i]=Ue(r,m.useCallback(l=>[r.selectors.isTop(l,n),r.selectors.inStack(l,n)],[r,n]));return ue(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?i?o:!0:!1}let Or=new Map,Qt=new Map;function Ti(e){var t;let n=(t=Qt.get(e))!=null?t:0;return Qt.set(e,n+1),n!==0?()=>Ni(e):(Or.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Ni(e))}function Ni(e){var t;let n=(t=Qt.get(e))!=null?t:1;if(n===1?Qt.delete(e):Qt.set(e,n-1),n!==1)return;let r=Or.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Or.delete(e))}function Xu(e,{allowed:t,disallowed:n}={}){let r=Oi(e,"inert-others");ue(()=>{var o,i;if(!r)return;let l=qe();for(let s of(o=n==null?void 0:n())!=null?o:[])s&&l.add(Ti(s));let u=(i=t==null?void 0:t())!=null?i:[];for(let s of u){if(!s)continue;let a=Kt(s);if(!a)continue;let c=s.parentElement;for(;c&&c!==a.body;){for(let d of c.children)u.some(p=>d.contains(p))||l.add(Ti(d));c=c.parentElement}}return l.dispose},[r,t,n])}function Qu(e,t,n){let r=Ot(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:ut(t)?t:t.current;if(!o)return;let i=qe();if(typeof ResizeObserver<"u"){let l=new ResizeObserver(()=>r.current(o));l.observe(o),i.add(()=>l.disconnect())}if(typeof IntersectionObserver<"u"){let l=new IntersectionObserver(()=>r.current(o));l.observe(o),i.add(()=>l.disconnect())}return()=>i.dispose()},[t,r,e])}let Tr=["[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(","),Ju=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Nr=(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))(Nr||{}),Zu=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Zu||{}),ec=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(ec||{});function Ai(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Tr)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function tc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ju)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ar=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ar||{});function Li(e,t=0){var n;return e===((n=Kt(e))==null?void 0:n.body)?!1:_e(t,{0(){return e.matches(Tr)},1(){let r=e;for(;r!==null;){if(r.matches(Tr))return!0;r=r.parentElement}return!1}})}var nc=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(nc||{});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 rc=["textarea","input"].join(",");function oc(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,rc))!=null?n:!1}function Pi(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 l=o.compareDocumentPosition(i);return l&Node.DOCUMENT_POSITION_FOLLOWING?-1:l&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ic(e,t){return sc(Ai(),t,{relativeTo:e})}function sc(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?Pi(e):e:t&64?tc(e):Ai(e);o.length>0&&l.length>1&&(l=l.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,l.indexOf(r))-1;if(t&4)return Math.max(0,l.indexOf(r))+1;if(t&8)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=t&32?{preventScroll:!0}:{},c=0,d=l.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=l[f],p==null||p.focus(a),c+=u}while(p!==i.activeElement);return t&6&&oc(p)&&p.select(),2}function $i(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function lc(){return/Android/gi.test(window.navigator.userAgent)}function Di(){return $i()||lc()}function Mt(e,t,n,r){let o=Ot(n);m.useEffect(()=>{if(!e)return;function i(l){o.current(l)}return document.addEventListener(t,i,r),()=>document.removeEventListener(t,i,r)},[e,t,r])}function ac(e,t,n,r){let o=Ot(n);m.useEffect(()=>{if(!e)return;function i(l){o.current(l)}return window.addEventListener(t,i,r),()=>window.removeEventListener(t,i,r)},[e,t,r])}const Mi=30;function uc(e,t,n){let r=Ot(n),o=m.useCallback(function(u,s){if(u.defaultPrevented)return;let a=s(u);if(a===null||!a.getRootNode().contains(a)||!a.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(a)||u.composed&&u.composedPath().includes(d)))return;return!Li(a,Ar.Loose)&&a.tabIndex!==-1&&u.preventDefault(),r.current(u,a)},[r,t]),i=m.useRef(null);Mt(e,"pointerdown",u=>{var s,a;Di()||(i.current=((a=(s=u.composedPath)==null?void 0:s.call(u))==null?void 0:a[0])||u.target)},!0),Mt(e,"pointerup",u=>{if(Di()||!i.current)return;let s=i.current;return i.current=null,o(u,()=>s)},!0);let l=m.useRef({x:0,y:0});Mt(e,"touchstart",u=>{l.current.x=u.touches[0].clientX,l.current.y=u.touches[0].clientY},!0),Mt(e,"touchend",u=>{let s={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(s.x-l.current.x)>=Mi||Math.abs(s.y-l.current.y)>=Mi))return o(u,()=>Dt(u.target)?u.target:null)},!0),ac(e,"blur",u=>o(u,()=>yu(window.document.activeElement)?window.document.activeElement:null),!0)}function Lr(...e){return m.useMemo(()=>Kt(...e),[...e])}var cc=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(cc||{});const yn={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},fc=200,Ii=5;function dc(e,{trigger:t,action:n,close:r,select:o}){let i=m.useRef(null),l=m.useRef(null),u=m.useRef(null);Mt(e&&t!==null,"pointerdown",s=>{gr(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(l.current=s.x,u.current=s.y,i.current=s.timeStamp)}),Mt(e&&t!==null,"pointerup",s=>{var a,c;let d=i.current;if(d===null||(i.current=null,!Dt(s.target))||Math.abs(s.x-((a=l.current)!=null?a:s.x))<Ii&&Math.abs(s.y-((c=u.current)!=null?c:s.y))<Ii)return;let p=n(s);switch(p.kind){case 0:return;case 1:{s.timeStamp-d>fc&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function pc(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 mc(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function hc(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 l=t[o].call(n,...i);l&&(n=l,r.forEach(u=>u()))}}}function gc(){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 vc(){return $i()?{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=qe();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let i=(o=window.scrollY)!=null?o:window.pageYOffset,l=null;t.addEventListener(e,"click",u=>{if(Dt(u.target))try{let s=u.target.closest("a");if(!s)return;let{hash:a}=new URL(s.href),c=e.querySelector(a);Dt(c)&&!r(c)&&(l=c)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(Dt(u.target)&&xu(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(Dt(u.target)){if(ai(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),l&&l.isConnected&&(l.scrollIntoView({block:"nearest"}),l=null)})})}}:{}}function bc(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function xc(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Tt=hc(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:qe(),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:xc(n)},o=[vc(),gc(),bc()];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)}});Tt.subscribe(()=>{let e=Tt.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)&&Tt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Tt.dispatch("TEARDOWN",n)}});function yc(e,t,n=()=>({containers:[]})){let r=mc(Tt),o=t?r.get(t):void 0,i=o?o.count>0:!1;return ue(()=>{if(!(!t||!e))return Tt.dispatch("PUSH",t,n),()=>Tt.dispatch("POP",t,n)},[e,t]),i}function wc(e,t,n=()=>[document.body]){let r=Oi(e,"scroll-lock");yc(r,t,o=>{var i;return{containers:[...(i=o.containers)!=null?i:[],n]}})}function ji(e){return[e.screenX,e.screenY]}function Ec(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=ji(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=ji(t)}}}function Sc(e=0){let[t,n]=m.useState(e),r=m.useCallback(s=>n(s),[t]),o=m.useCallback(s=>n(a=>a|s),[t]),i=m.useCallback(s=>(t&s)===s,[t]),l=m.useCallback(s=>n(a=>a&~s),[n]),u=m.useCallback(s=>n(a=>a^s),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:i,removeFlag:l,toggleFlag:u}}var Fi,Ri;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Fi=process==null?void 0:process.env)==null?void 0:Fi.NODE_ENV)==="test"&&typeof((Ri=Element==null?void 0:Element.prototype)==null?void 0:Ri.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 Cc=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Cc||{});function ki(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function _i(e,t,n,r){let[o,i]=m.useState(n),{hasFlag:l,addFlag:u,removeFlag:s}=Sc(e&&o?3:0),a=m.useRef(!1),c=m.useRef(!1),d=$t();return ue(()=>{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),Oc(t,{inFlight:a,prepare(){c.current?c.current=!1:c.current=a.current,a.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||(a.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:l(1),enter:l(2),leave:l(4),transition:l(2)||l(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Oc(e,{prepare:t,run:n,done:r,inFlight:o}){let i=qe();return Nc(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(Tc(e,r))})}),i.dispose}function Tc(e,t){var n,r;let o=qe();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let l=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?r:[];return l.length===0?(t(),o.dispose):(Promise.allSettled(l.map(u=>u.finished)).then(()=>{i||t()}),o.dispose)}function Nc(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 wn(){return typeof window<"u"}function It(e){return Pr(e)?(e.nodeName||"").toLowerCase():"#document"}function Ne(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function et(e){var t;return(t=(Pr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Pr(e){return wn()?e instanceof Node||e instanceof Ne(e).Node:!1}function oe(e){return wn()?e instanceof Element||e instanceof Ne(e).Element:!1}function Ee(e){return wn()?e instanceof HTMLElement||e instanceof Ne(e).HTMLElement:!1}function $r(e){return!wn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ne(e).ShadowRoot}const Ac=new Set(["inline","contents"]);function Jt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ac.has(o)}const Lc=new Set(["table","td","th"]);function Pc(e){return Lc.has(It(e))}const $c=[":popover-open",":modal"];function En(e){return $c.some(t=>{try{return e.matches(t)}catch{return!1}})}const Dc=["transform","translate","scale","rotate","perspective"],Mc=["transform","translate","scale","rotate","perspective","filter"],Ic=["paint","layout","strict","content"];function Dr(e){const t=Sn(),n=oe(e)?Ve(e):e;return Dc.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)||Mc.some(r=>(n.willChange||"").includes(r))||Ic.some(r=>(n.contain||"").includes(r))}function jc(e){let t=ft(e);for(;Ee(t)&&!ct(t);){if(Dr(t))return t;if(En(t))return null;t=ft(t)}return null}function Sn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Fc=new Set(["html","body","#document"]);function ct(e){return Fc.has(It(e))}function Ve(e){return Ne(e).getComputedStyle(e)}function Cn(e){return oe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(It(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$r(e)&&e.host||et(e);return $r(t)?t.host:t}function Wi(e){const t=ft(e);return ct(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ee(t)&&Jt(t)?t:Wi(t)}function xt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Wi(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=Ne(o);if(i){const u=Mr(l);return t.concat(l,l.visualViewport||[],Jt(o)?o:[],u&&n?xt(u):[])}return t.concat(o,xt(o,[],n))}function Mr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Rc(){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 dt=Math.min,xe=Math.max,Zt=Math.round,On=Math.floor,tt=e=>({x:e,y:e}),kc={left:"right",right:"left",bottom:"top",top:"bottom"},_c={start:"end",end:"start"};function Ir(e,t,n){return xe(e,dt(t,n))}function Nt(e,t){return typeof e=="function"?e(t):e}function yt(e){return e.split("-")[0]}function jt(e){return e.split("-")[1]}function Bi(e){return e==="x"?"y":"x"}function jr(e){return e==="y"?"height":"width"}const Wc=new Set(["top","bottom"]);function pt(e){return Wc.has(yt(e))?"y":"x"}function Fr(e){return Bi(pt(e))}function Bc(e,t,n){n===void 0&&(n=!1);const r=jt(e),o=Fr(e),i=jr(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=Tn(l)),[l,Tn(l)]}function Uc(e){const t=Tn(e);return[Rr(e),t,Rr(t)]}function Rr(e){return e.replace(/start|end/g,t=>_c[t])}const Ui=["left","right"],Vi=["right","left"],Vc=["top","bottom"],zc=["bottom","top"];function Hc(e,t,n){switch(e){case"top":case"bottom":return n?t?Vi:Ui:t?Ui:Vi;case"left":case"right":return t?Vc:zc;default:return[]}}function Gc(e,t,n,r){const o=jt(e);let i=Hc(yt(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Rr)))),i}function Tn(e){return e.replace(/left|right|bottom|top/g,t=>kc[t])}function Yc(e){return{top:0,right:0,bottom:0,left:0,...e}}function zi(e){return typeof e!="number"?Yc(e):{top:e,right:e,bottom:e,left:e}}function Nn(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
81
  * tabbable 6.2.0
82
82
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
83
- */var Kc=["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])"],Rr=Kc.join(","),zi=typeof Element>"u",en=zi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Nn=!zi&&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},Ln=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",l=i||n&&t&&e(t.parentNode);return l},qc=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Xc=function(t,n,r){if(Ln(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Rr));return n&&en.call(t,Rr)&&o.unshift(t),o=o.filter(r),o},Qc=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!Ln(l,!1))if(l.tagName==="SLOT"){var u=l.assignedElements(),s=u.length?u:l.children,a=e(s,!0,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:l,candidates:a})}else{var c=en.call(l,Rr);c&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var d=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),p=!Ln(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(d&&p){var f=e(d===!0?l.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},Hi=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Gi=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||qc(t))&&!Hi(t)?0:t.tabIndex},Jc=function(t,n){var r=Gi(t);return r<0&&n&&!Hi(t)?0:r},Zc=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Yi=function(t){return t.tagName==="INPUT"},ef=function(t){return Yi(t)&&t.type==="hidden"},tf=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},nf=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},rf=function(t){if(!t.name)return!0;var n=t.form||Nn(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(l){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",l.message),!1}var i=nf(o,t.form);return!i||i===t},of=function(t){return Yi(t)&&t.type==="radio"},sf=function(t){return of(t)&&!rf(t)},lf=function(t){var n,r=t&&Nn(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var l,u,s;for(i=!!((l=o)!==null&&l!==void 0&&(u=l.ownerDocument)!==null&&u!==void 0&&u.contains(o)||t!=null&&(s=t.ownerDocument)!==null&&s!==void 0&&s.contains(t));!i&&o;){var a,c,d;r=Nn(o),o=(a=r)===null||a===void 0?void 0:a.host,i=!!((c=o)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Ki=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},af=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=en.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(en.call(l,"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,a=Nn(t);if(s&&!s.shadowRoot&&o(s)===!0)return Ki(t);t.assignedSlot?t=t.assignedSlot:!s&&a!==t.ownerDocument?t=a.host:t=s}t=u}if(lf(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ki(t);return!1},uf=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 en.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},cf=function(t,n){return!(n.disabled||Ln(n)||ef(n)||af(n,t)||tf(n)||uf(n))},qi=function(t,n){return!(sf(n)||Gi(n)<0||!cf(t,n))},ff=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},df=function e(t){var n=[],r=[];return t.forEach(function(o,i){var l=!!o.scopeParent,u=l?o.scopeParent:o,s=Jc(u,l),a=l?e(o.candidates):u;s===0?l?n.push.apply(n,a):n.push(u):r.push({documentOrder:i,tabIndex:s,item:o,isScope:l,content:a})}),r.sort(Zc).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Xi=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Qc([t],n.includeContainer,{filter:qi.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ff}):r=Xc(t,n.includeContainer,qi.bind(null,n)),df(r)};function Qi(e,t,n){let{reference:r,floating:o}=e;const i=pt(t),l=Fr(t),u=jr(l),s=yt(t),a=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(jt(t)){case"start":f[l]-=p*(n&&a?-1:1);break;case"end":f[l]+=p*(n&&a?-1:1);break}return f}const pf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),s=await(l.isRTL==null?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=Qi(a,r,s),p=r,f={},g=0;for(let v=0;v<u.length;v++){const{name:E,fn:M}=u[v],{x:y,y:T,data:j,reset:F}=await M({x:c,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:a,platform:l,elements:{reference:e,floating:t}});c=y??c,d=T??d,f={...f,[E]:{...f[E],...j}},F&&g<=50&&(g++,typeof F=="object"&&(F.placement&&(p=F.placement),F.rects&&(a=F.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):F.rects),{x:c,y:d}=Qi(a,p,s)),v=-1)}return{x:c,y:d,placement:p,strategy:o,middlewareData:f}};async function $n(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:u,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Nt(t,e),g=Vi(f),E=u[p?d==="floating"?"reference":"floating":d],M=Tn(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:a,rootBoundary:c,strategy:s})),y=d==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),j=await(i.isElement==null?void 0:i.isElement(T))?await(i.getScale==null?void 0:i.getScale(T))||{x:1,y:1}:{x:1,y:1},F=Tn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:y,offsetParent:T,strategy:s}):y);return{top:(M.top-F.top+g.top)/j.y,bottom:(F.bottom-M.bottom+g.bottom)/j.y,left:(M.left-F.left+g.left)/j.x,right:(F.right-M.right+g.right)/j.x}}const mf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:u,middlewareData:s}=t,{element:a,padding:c=0}=Nt(e,t)||{};if(a==null)return{};const d=Vi(c),p={x:n,y:r},f=Fr(o),g=jr(f),v=await l.getDimensions(a),E=f==="y",M=E?"top":"left",y=E?"bottom":"right",T=E?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[f]-p[f]-i.floating[g],F=p[f]-i.reference[f],_=await(l.getOffsetParent==null?void 0:l.getOffsetParent(a));let B=_?_[T]:0;(!B||!await(l.isElement==null?void 0:l.isElement(_)))&&(B=u.floating[T]||i.floating[g]);const h=j/2-F/2,b=B/2-v[g]/2-1,x=dt(d[M],b),A=dt(d[y],b),P=x,L=B-v[g]-A,S=B/2-v[g]/2+h,C=Ir(P,S,L),N=!s.arrow&&jt(o)!=null&&S!==C&&i.reference[g]/2-(S<P?x:A)-v[g]/2<0,$=N?S<P?S-P:S-L:0;return{[f]:p[f]+$,data:{[f]:C,centerOffset:S-C-$,...N&&{alignmentOffset:$}},reset:N}}}),hf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:u,platform:s,elements:a}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...E}=Nt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const M=yt(o),y=pt(u),T=yt(u)===u,j=await(s.isRTL==null?void 0:s.isRTL(a.floating)),F=p||(T||!v?[On(u)]:Uc(u)),_=g!=="none";!p&&_&&F.push(...Gc(u,v,g,j));const B=[u,...F],h=await $n(t,E),b=[];let x=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&b.push(h[M]),d){const S=Wc(o,l,j);b.push(h[S[0]],h[S[1]])}if(x=[...x,{placement:o,overflows:b}],!b.every(S=>S<=0)){var A,P;const S=(((A=i.flip)==null?void 0:A.index)||0)+1,C=B[S];if(C&&(!(d==="alignment"?y!==pt(C):!1)||x.every(w=>pt(w.placement)===y?w.overflows[0]>0:!0)))return{data:{index:S,overflows:x},reset:{placement:C}};let N=(P=x.filter($=>$.overflows[0]<=0).sort(($,w)=>$.overflows[1]-w.overflows[1])[0])==null?void 0:P.placement;if(!N)switch(f){case"bestFit":{var L;const $=(L=x.filter(w=>{if(_){const I=pt(w.placement);return I===y||I==="y"}return!0}).map(w=>[w.placement,w.overflows.filter(I=>I>0).reduce((I,R)=>I+R,0)]).sort((w,I)=>w[1]-I[1])[0])==null?void 0:L[0];$&&(N=$);break}case"initialPlacement":N=u;break}if(o!==N)return{reset:{placement:N}}}return{}}}},gf=new Set(["left","top"]);async function vf(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=yt(n),u=jt(n),s=pt(n)==="y",a=gf.has(l)?-1:1,c=i&&s?-1:1,d=Nt(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*a}:{x:p*a,y:f*c}}const bf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:u}=t,s=await vf(t,e);return l===((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:l}}}}},xf=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:l=!1,limiter:u={fn:E=>{let{x:M,y}=E;return{x:M,y}}},...s}=Nt(e,t),a={x:n,y:r},c=await $n(t,s),d=pt(yt(o)),p=Bi(d);let f=a[p],g=a[d];if(i){const E=p==="y"?"top":"left",M=p==="y"?"bottom":"right",y=f+c[E],T=f-c[M];f=Ir(y,f,T)}if(l){const E=d==="y"?"top":"left",M=d==="y"?"bottom":"right",y=g+c[E],T=g-c[M];g=Ir(y,g,T)}const v=u.fn({...t,[p]:f,[d]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[d]:l}}}}}},yf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:l,elements:u}=t,{apply:s=()=>{},...a}=Nt(e,t),c=await $n(t,a),d=yt(o),p=jt(o),f=pt(o)==="y",{width:g,height:v}=i.floating;let E,M;d==="top"||d==="bottom"?(E=d,M=p===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(M=d,E=p==="end"?"top":"bottom");const y=v-c.top-c.bottom,T=g-c.left-c.right,j=dt(v-c[E],y),F=dt(g-c[M],T),_=!t.middlewareData.shift;let B=j,h=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(h=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(B=y),_&&!p){const x=xe(c.left,0),A=xe(c.right,0),P=xe(c.top,0),L=xe(c.bottom,0);f?h=g-2*(x!==0||A!==0?x+A:xe(c.left,c.right)):B=v-2*(P!==0||L!==0?P+L:xe(c.top,c.bottom))}await s({...t,availableWidth:h,availableHeight:B});const b=await l.getDimensions(u.floating);return g!==b.width||v!==b.height?{reset:{rects:!0}}:{}}}};function Ji(e){const t=Ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ee(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=Zt(n)!==i||Zt(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function _r(e){return oe(e)?e:e.contextElement}function Ft(e){const t=_r(e);if(!Ee(t))return tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Ji(t);let l=(i?Zt(n.width):n.width)/r,u=(i?Zt(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const wf=tt(0);function Zi(e){const t=Te(e);return!En()||!t.visualViewport?wf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ef(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Te(e)?!1:t}function Lt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=_r(e);let l=tt(1);t&&(r?oe(r)&&(l=Ft(r)):l=Ft(e));const u=Ef(i,n,r)?Zi(i):tt(0);let s=(o.left+u.x)/l.x,a=(o.top+u.y)/l.y,c=o.width/l.x,d=o.height/l.y;if(i){const p=Te(i),f=r&&oe(r)?Te(r):r;let g=p,v=Mr(g);for(;v&&r&&f!==g;){const E=Ft(v),M=v.getBoundingClientRect(),y=Ve(v),T=M.left+(v.clientLeft+parseFloat(y.paddingLeft))*E.x,j=M.top+(v.clientTop+parseFloat(y.paddingTop))*E.y;s*=E.x,a*=E.y,c*=E.x,d*=E.y,s+=T,a+=j,g=Te(v),v=Mr(g)}}return Tn({width:c,height:d,x:s,y:a})}function Pn(e,t){const n=Sn(e).scrollLeft;return t?t.left+n:Lt(et(e)).left+n}function es(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Pn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Sf(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",l=et(r),u=t?wn(t.floating):!1;if(r===l||u&&i)return n;let s={scrollLeft:0,scrollTop:0},a=tt(1);const c=tt(0),d=Ee(r);if((d||!d&&!i)&&((It(r)!=="body"||Jt(l))&&(s=Sn(r)),Ee(r))){const f=Lt(r);a=Ft(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const p=l&&!d&&!i?es(l,s):tt(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-s.scrollLeft*a.x+c.x+p.x,y:n.y*a.y-s.scrollTop*a.y+c.y+p.y}}function Cf(e){return Array.from(e.getClientRects())}function Of(e){const t=et(e),n=Sn(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 l=-n.scrollLeft+Pn(e);const u=-n.scrollTop;return Ve(r).direction==="rtl"&&(l+=xe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}const ts=25;function Tf(e,t){const n=Te(e),r=et(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,s=0;if(o){i=o.width,l=o.height;const c=En();(!c||c&&t==="fixed")&&(u=o.offsetLeft,s=o.offsetTop)}const a=Pn(r);if(a<=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<=ts&&(i-=g)}else a<=ts&&(i+=a);return{width:i,height:l,x:u,y:s}}const Nf=new Set(["absolute","fixed"]);function Lf(e,t){const n=Lt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ee(e)?Ft(e):tt(1),l=e.clientWidth*i.x,u=e.clientHeight*i.y,s=o*i.x,a=r*i.y;return{width:l,height:u,x:s,y:a}}function ns(e,t,n){let r;if(t==="viewport")r=Tf(e,n);else if(t==="document")r=Of(et(e));else if(oe(t))r=Lf(t,n);else{const o=Zi(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Tn(r)}function rs(e,t){const n=ft(e);return n===t||!oe(n)||ct(n)?!1:Ve(n).position==="fixed"||rs(n,t)}function $f(e,t){const n=t.get(e);if(n)return n;let r=xt(e,[],!1).filter(u=>oe(u)&&It(u)!=="body"),o=null;const i=Ve(e).position==="fixed";let l=i?ft(e):e;for(;oe(l)&&!ct(l);){const u=Ve(l),s=Dr(l);!s&&u.position==="fixed"&&(o=null),(i?!s&&!o:!s&&u.position==="static"&&!!o&&Nf.has(o.position)||Jt(l)&&!s&&rs(e,l))?r=r.filter(c=>c!==l):o=u,l=ft(l)}return t.set(e,r),r}function Pf(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?wn(t)?[]:$f(t,this._c):[].concat(n),r],u=l[0],s=l.reduce((a,c)=>{const d=ns(t,c,o);return a.top=xe(d.top,a.top),a.right=dt(d.right,a.right),a.bottom=dt(d.bottom,a.bottom),a.left=xe(d.left,a.left),a},ns(t,u,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Af(e){const{width:t,height:n}=Ji(e);return{width:t,height:n}}function Df(e,t,n){const r=Ee(t),o=et(t),i=n==="fixed",l=Lt(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const s=tt(0);function a(){s.x=Pn(o)}if(r||!r&&!i)if((It(t)!=="body"||Jt(o))&&(u=Sn(t)),r){const f=Lt(t,!0,i,t);s.x=f.x+t.clientLeft,s.y=f.y+t.clientTop}else o&&a();i&&!r&&o&&a();const c=o&&!r&&!i?es(o,u):tt(0),d=l.left+u.scrollLeft-s.x-c.x,p=l.top+u.scrollTop-s.y-c.y;return{x:d,y:p,width:l.width,height:l.height}}function Br(e){return Ve(e).position==="static"}function os(e,t){if(!Ee(e)||Ve(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function is(e,t){const n=Te(e);if(wn(e))return n;if(!Ee(e)){let o=ft(e);for(;o&&!ct(o);){if(oe(o)&&!Br(o))return o;o=ft(o)}return n}let r=os(e,t);for(;r&&Pc(r)&&Br(r);)r=os(r,t);return r&&ct(r)&&Br(r)&&!Dr(r)?n:r||jc(e)||n}const Mf=async function(e){const t=this.getOffsetParent||is,n=this.getDimensions,r=await n(e.floating);return{reference:Df(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function If(e){return Ve(e).direction==="rtl"}const jf={convertOffsetParentRelativeRectToViewportRelativeRect:Sf,getDocumentElement:et,getClippingRect:Pf,getOffsetParent:is,getElementRects:Mf,getClientRects:Cf,getDimensions:Af,getScale:Ft,isElement:oe,isRTL:If};function ss(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ff(e,t){let n=null,r;const o=et(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,s){u===void 0&&(u=!1),s===void 0&&(s=1),i();const a=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=a;if(u||t(),!p||!f)return;const g=Cn(d),v=Cn(o.clientWidth-(c+p)),E=Cn(o.clientHeight-(d+f)),M=Cn(c),T={rootMargin:-g+"px "+-v+"px "+-E+"px "+-M+"px",threshold:xe(0,dt(1,s))||1};let j=!0;function F(_){const B=_[0].intersectionRatio;if(B!==s){if(!j)return l();B?l(!1,B):r=setTimeout(()=>{l(!1,1e-7)},1e3)}B===1&&!ss(a,e.getBoundingClientRect())&&l(),j=!1}try{n=new IntersectionObserver(F,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(F,T)}n.observe(e)}return l(!0),i}function ls(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:s=!1}=r,a=_r(e),c=o||i?[...a?xt(a):[],...xt(t)]:[];c.forEach(M=>{o&&M.addEventListener("scroll",n,{passive:!0}),i&&M.addEventListener("resize",n)});const d=a&&u?Ff(a,n):null;let p=-1,f=null;l&&(f=new ResizeObserver(M=>{let[y]=M;y&&y.target===a&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var T;(T=f)==null||T.observe(t)})),n()}),a&&!s&&f.observe(a),f.observe(t));let g,v=s?Lt(e):null;s&&E();function E(){const M=Lt(e);v&&!ss(v,M)&&n(),v=M,g=requestAnimationFrame(E)}return n(),()=>{var M;c.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),d==null||d(),(M=f)==null||M.disconnect(),f=null,s&&cancelAnimationFrame(g)}}const Wr=$n,kf=bf,Rf=xf,_f=hf,Bf=yf,as=mf,Wf=(e,t,n)=>{const r=new Map,o={platform:jf,...n},i={...o.platform,_c:r};return pf(e,t,{...o,platform:i})};var Uf=typeof document<"u",Vf=function(){},An=Uf?m.useLayoutEffect:Vf;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 i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Dn(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function us(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function cs(e,t){const n=us(e);return Math.round(t*n)/n}function Ur(e){const t=k.useRef(e);return An(()=>{t.current=e}),t}function fs(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:s,open:a}=e,[c,d]=k.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=k.useState(r);Dn(p,r)||f(r);const[g,v]=k.useState(null),[E,M]=k.useState(null),y=k.useCallback(w=>{w!==_.current&&(_.current=w,v(w))},[]),T=k.useCallback(w=>{w!==B.current&&(B.current=w,M(w))},[]),j=i||g,F=l||E,_=k.useRef(null),B=k.useRef(null),h=k.useRef(c),b=s!=null,x=Ur(s),A=Ur(o),P=Ur(a),L=k.useCallback(()=>{if(!_.current||!B.current)return;const w={placement:t,strategy:n,middleware:p};A.current&&(w.platform=A.current),Wf(_.current,B.current,w).then(I=>{const R={...I,isPositioned:P.current!==!1};S.current&&!Dn(h.current,R)&&(h.current=R,Vt.flushSync(()=>{d(R)}))})},[p,t,n,A,P]);An(()=>{a===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,d(w=>({...w,isPositioned:!1})))},[a]);const S=k.useRef(!1);An(()=>(S.current=!0,()=>{S.current=!1}),[]),An(()=>{if(j&&(_.current=j),F&&(B.current=F),j&&F){if(x.current)return x.current(j,F,L);L()}},[j,F,L,x,b]);const C=k.useMemo(()=>({reference:_,floating:B,setReference:y,setFloating:T}),[y,T]),N=k.useMemo(()=>({reference:j,floating:F}),[j,F]),$=k.useMemo(()=>{const w={position:n,left:0,top:0};if(!N.floating)return w;const I=cs(N.floating,c.x),R=cs(N.floating,c.y);return u?{...w,transform:"translate("+I+"px, "+R+"px)",...us(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:R}},[n,u,N.floating,c.x,c.y]);return k.useMemo(()=>({...c,update:L,refs:C,elements:N,floatingStyles:$}),[c,L,C,N,$])}const zf=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?as({element:r.current,padding:o}).fn(n):{}:r?as({element:r,padding:o}).fn(n):{}}}},Vr=(e,t)=>({...kf(e),options:[e,t]}),ds=(e,t)=>({...Rf(e),options:[e,t]}),ps=(e,t)=>({..._f(e),options:[e,t]}),Hf=(e,t)=>({...Bf(e),options:[e,t]}),Gf=(e,t)=>({...zf(e),options:[e,t]}),ms={...k},Yf=ms.useInsertionEffect||(e=>e());function hs(e){const t=k.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Yf(()=>{t.current=e}),k.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 zr=typeof document<"u"?m.useLayoutEffect:m.useEffect;let gs=!1,Kf=0;const vs=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Kf++;function qf(){const[e,t]=k.useState(()=>gs?vs():void 0);return zr(()=>{e==null&&t(vs())},[]),k.useEffect(()=>{gs=!0},[]),e}const Xf=ms.useId||qf;let tn;process.env.NODE_ENV!=="production"&&(tn=new Set);function Qf(){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=tn)!=null&&e.has(o))){var i;(i=tn)==null||i.add(o),console.warn(o)}}function Jf(){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=tn)!=null&&e.has(o))){var i;(i=tn)==null||i.add(o),console.error(o)}}function Zf(){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 ed=k.createContext(null),td=k.createContext(null),nd=()=>{var e;return((e=k.useContext(ed))==null?void 0:e.id)||null},rd=()=>k.useContext(td),od="data-floating-ui-focusable";function id(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Xf(),i=k.useRef({}),[l]=k.useState(()=>Zf()),u=nd()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!oe(f)&&Jf("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,a]=k.useState(r.reference),c=hs((f,g,v)=>{i.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=k.useMemo(()=>({setPositionReference:a}),[]),p=k.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return k.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:l,floatingId:o,refs:d}),[t,c,p,l,o,d])}function sd(e){e===void 0&&(e={});const{nodeId:t}=e,n=id({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,l]=k.useState(null),[u,s]=k.useState(null),c=(o==null?void 0:o.domReference)||i,d=k.useRef(null),p=rd();zr(()=>{c&&(d.current=c)},[c]);const f=fs({...e,elements:{...o,...u&&{reference:u}}}),g=k.useCallback(T=>{const j=oe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;s(j),f.refs.setReference(j)},[f.refs]),v=k.useCallback(T=>{(oe(T)||T===null)&&(d.current=T,l(T)),(oe(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!oe(T))&&f.refs.setReference(T)},[f.refs]),E=k.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),M=k.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),y=k.useMemo(()=>({...f,...r,refs:E,elements:M,nodeId:t}),[f,E,M,t,r]);return zr(()=>{r.dataRef.current.floatingContext=y;const T=p==null?void 0:p.nodesRef.current.find(j=>j.id===t);T&&(T.context=y)}),k.useMemo(()=>({...f,context:y,refs:E,elements:M}),[f,E,M,y])}const bs="active",xs="selected";function Hr(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[bs]:l,[xs]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[od]:""},...i,...t.map(l=>{const u=l?l[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((l,u)=>(u&&Object.entries(u).forEach(s=>{let[a,c]=s;if(!(o&&[bs,xs].includes(a)))if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof c=="function"){var d;(d=r.get(a))==null||d.push(c),l[a]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(a))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else l[a]=c}),l),{})}}function ld(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=k.useCallback(u=>Hr(u,e,"reference"),t),i=k.useCallback(u=>Hr(u,e,"floating"),n),l=k.useCallback(u=>Hr(u,e,"item"),r);return k.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l}),[o,i,l])}function ys(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const ad=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:l=0,minItemsVisible:u=4,referenceOverflowThreshold:s=0,scrollRef:a,...c}=Nt(e,t),{rects:d,elements:{floating:p}}=t,f=n.current[l],g=(a==null?void 0:a.current)||p,v=p.clientTop||g.clientTop,E=p.clientTop!==0,M=g.clientTop!==0,y=p===g;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Qf('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const T={...t,...await Vr(-f.offsetTop-p.clientTop-d.reference.height/2-f.offsetHeight/2-i).fn(t)},j=await Wr(ys(T,g.scrollHeight+v+p.clientTop),c),F=await Wr(T,{...c,elementContext:"reference"}),_=xe(0,j.top),B=T.y+_,x=(g.scrollHeight>g.clientHeight?A=>A:Zt)(xe(0,g.scrollHeight+(E&&y||M?v*2:0)-_-xe(0,j.bottom)));if(g.style.maxHeight=x+"px",g.scrollTop=_,o){const A=g.offsetHeight<f.offsetHeight*dt(u,n.current.length)-1||F.top>=-s||F.bottom>=-s;Vt.flushSync(()=>o(A))}return r&&(r.current=await Wr(ys({...T,y:B},g.offsetHeight+v+p.clientTop),c)),{y:B}}});function ud(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:l,onChange:u}=t,s=hs(u),a=k.useRef(!1),c=k.useRef(null),d=k.useRef(null);k.useEffect(()=>{if(!o)return;function f(v){if(v.ctrlKey||!g||i.current==null)return;const E=v.deltaY,M=i.current.top>=-.5,y=i.current.bottom>=-.5,T=g.scrollHeight-g.clientHeight,j=E<0?-1:1,F=E<0?"max":"min";g.scrollHeight<=g.clientHeight||(!M&&E>0||!y&&E<0?(v.preventDefault(),Vt.flushSync(()=>{s(_=>_+Math[F](E,T*j))})):/firefox/i.test(kc())&&(g.scrollTop+=E))}const g=(l==null?void 0:l.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,l,s]);const p=k.useMemo(()=>({onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const f=(l==null?void 0:l.current)||r.floating;if(!(!i.current||!f||!a.current)){if(c.current!==null){const g=f.scrollTop-c.current;(i.current.bottom<-.5&&g<-1||i.current.top<-.5&&g>1)&&Vt.flushSync(()=>s(v=>v+g))}requestAnimationFrame(()=>{c.current=f.scrollTop})}}}),[r.floating,s,i,l]);return k.useMemo(()=>o?{floating:p}:{},[o,p])}let kt=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});kt.displayName="FloatingContext";let Gr=m.createContext(null);Gr.displayName="PlacementContext";function cd(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function fd(){return m.useContext(kt).setReference}function dd(){return m.useContext(kt).getReferenceProps}function pd(){let{getFloatingProps:e,slot:t}=m.useContext(kt);return m.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function md(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(Gr),n=m.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var l;return(l=i==null?void 0:i.outerHTML)!=null?l:i})]);ue(()=>{t==null||t(n??null)},[t,n]);let r=m.useContext(kt);return m.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let ws=4;function hd({children:e,enabled:t=!0}){let[n,r]=m.useState(null),[o,i]=m.useState(0),l=m.useRef(null),[u,s]=m.useState(null);gd(u);let a=t&&n!==null&&u!==null,{to:c="bottom",gap:d=0,offset:p=0,padding:f=0,inner:g}=vd(n,u),[v,E="center"]=c.split(" ");ue(()=>{a&&i(0)},[a]);let{refs:M,floatingStyles:y,context:T}=sd({open:a,placement:v==="selection"?E==="center"?"bottom":`bottom-${E}`:E==="center"?`${v}`:`${v}-${E}`,strategy:"absolute",transform:!1,middleware:[Vr({mainAxis:v==="selection"?0:d,crossAxis:p}),ds({padding:f}),v!=="selection"&&ps({padding:f}),v==="selection"&&g?ad({...g,padding:f,overflowRef:l,offset:o,minItemsVisible:ws,referenceOverflowThreshold:f,onFallbackChange(A){var P,L;if(!A)return;let S=T.elements.floating;if(!S)return;let C=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,N=Math.min(ws,S.childElementCount),$=0,w=0;for(let I of(L=(P=T.elements.floating)==null?void 0:P.childNodes)!=null?L:[])if(ut(I)){let R=I.offsetTop,V=R+I.clientHeight+C,z=S.scrollTop,G=z+S.clientHeight;if(R>=z&&V<=G)N--;else{w=Math.max(0,Math.min(V,G)-Math.max(R,z)),$=I.clientHeight;break}}N>=1&&i(I=>{let R=$*N-w+C;return I>=R?I:R})}}):null,Hf({padding:f,apply({availableWidth:A,availableHeight:P,elements:L}){Object.assign(L.floating.style,{overflow:"auto",maxWidth:`${A}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${P}px)`})}})].filter(Boolean),whileElementsMounted:ls}),[j=v,F=E]=T.placement.split("-");v==="selection"&&(j="selection");let _=m.useMemo(()=>({anchor:[j,F].filter(Boolean).join(" ")}),[j,F]),B=ud(T,{overflowRef:l,onChange:i}),{getReferenceProps:h,getFloatingProps:b}=ld([B]),x=ne(A=>{s(A),M.setFloating(A)});return k.createElement(Gr.Provider,{value:r},k.createElement(kt.Provider,{value:{setFloating:x,setReference:M.setReference,styles:y,getReferenceProps:h,getFloatingProps:b,slot:_}},e))}function gd(e){ue(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function vd(e,t){var n,r,o;let i=Yr((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),l=Yr((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Yr((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:l,padding:u}}function Yr(e,t,n=void 0){let r=At(),o=ne((s,a)=>{if(s==null)return[n,null];if(typeof s=="number")return[s,null];if(typeof s=="string"){if(!a)return[n,null];let c=Ss(s,a);return[c,d=>{let p=Es(s);{let f=p.map(g=>window.getComputedStyle(a).getPropertyValue(g));r.requestAnimationFrame(function g(){r.nextFrame(g);let v=!1;for(let[M,y]of p.entries()){let T=window.getComputedStyle(a).getPropertyValue(y);if(f[M]!==T){f[M]=T,v=!0;break}}if(!v)return;let E=Ss(s,a);c!==E&&(d(E),c=E)})}return r.dispose}]}return[n,null]}),i=m.useMemo(()=>o(e,t)[0],[e,t]),[l=i,u]=m.useState();return ue(()=>{let[s,a]=o(e,t);if(u(s),!!a)return a(u)},[e,t]),l}function Es(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,...Es(o)]:[r]}return[]}function Ss(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 bd(e,t){let[n,r]=m.useState(t);return!e&&n!==t&&r(t),e?n:t}let Kr=m.createContext(null);Kr.displayName="OpenClosedContext";var Xe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Xe||{});function qr(){return m.useContext(Kr)}function Cs({value:e,children:t}){return m.createElement(Kr.Provider,{value:e},t)}function xd(e){throw new Error("Unexpected object: "+e)}var fe=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(fe||{});function Mn(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:xd(e)}}var Os=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Os||{});function Ts(e){let t=ne(e),n=m.useRef(!1);m.useEffect(()=>(n.current=!1,()=>{n.current=!0,Zo(()=>{n.current&&t()})}),[t])}function yd(){let e=typeof document>"u";return"useSyncExternalStore"in k?(t=>t.useSyncExternalStore)(k)(()=>()=>{},()=>!1,()=>!e):!1}function Xr(){let e=yd(),[t,n]=k.useState(Je.isHandoffComplete);return t&&Je.isHandoffComplete===!1&&n(!1),k.useEffect(()=>{t!==!0&&n(!0)},[t]),k.useEffect(()=>Je.handoff(),[]),e?!1:t}let wd=m.createContext(!1);function Ed(){return m.useContext(wd)}function Sd(e){let t=Ed(),n=m.useContext(Ls),[r,o]=m.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(Je.isServer)return null;let l=e==null?void 0:e.getElementById("headlessui-portal-root");if(l)return l;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 Ns=m.Fragment,Cd=Oe(function(e,t){let{ownerDocument:n=null,...r}=e,o=m.useRef(null),i=Be(Ou(f=>{o.current=f}),t),l=$r(o),u=n??l,s=Sd(u),[a]=m.useState(()=>{var f;return Je.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),c=m.useContext(Ld),d=Xr();ue(()=>{!s||!a||s.contains(a)||(a.setAttribute("data-headlessui-portal",""),s.appendChild(a))},[s,a]),ue(()=>{if(a&&c)return c.register(a)},[c,a]),Ts(()=>{var f;!s||!a||(gr(a)&&s.contains(a)&&s.removeChild(a),s.childNodes.length<=0&&((f=s.parentElement)==null||f.removeChild(s)))});let p=De();return d?!s||!a?null:we.createPortal(p({ourProps:{ref:i},theirProps:r,slot:{},defaultTag:Ns,name:"Portal"}),a):null});function Od(e,t){let n=Be(t),{enabled:r=!0,ownerDocument:o,...i}=e,l=De();return r?m.createElement(Cd,{...i,ownerDocument:o,ref:n}):l({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:Ns,name:"Portal"})}let Td=m.Fragment,Ls=m.createContext(null);function Nd(e,t){let{target:n,...r}=e,o={ref:Be(t)},i=De();return m.createElement(Ls.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:Td,name:"Popover.Group"}))}let Ld=m.createContext(null),$d=Oe(Od),Pd=Oe(Nd),Ad=Object.assign($d,{Group:Pd});function Dd(){let e=m.useRef(!1);return ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function $s(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:As)!==m.Fragment||m.Children.count(e.children)===1}let In=m.createContext(null);In.displayName="TransitionContext";var Md=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Md||{});function Id(){let e=m.useContext(In);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function jd(){let e=m.useContext(jn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let jn=m.createContext(null);jn.displayName="NestingContext";function Fn(e){return"children"in e?Fn(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Ps(e,t){let n=Ot(e),r=m.useRef([]),o=Dd(),i=At(),l=ne((f,g=vt.Hidden)=>{let v=r.current.findIndex(({el:E})=>E===f);v!==-1&&(_e(g,{[vt.Unmount](){r.current.splice(v,1)},[vt.Hidden](){r.current[v].state="hidden"}}),i.microTask(()=>{var E;!Fn(r)&&o.current&&((E=n.current)==null||E.call(n))}))}),u=ne(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"}),()=>l(f,vt.Unmount)}),s=m.useRef([]),a=m.useRef(Promise.resolve()),c=m.useRef({enter:[],leave:[]}),d=ne((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(([M,y])=>y)).then(()=>E())})]),g==="enter"?a.current=a.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(g)):v(g)}),p=ne((f,g,v)=>{Promise.all(c.current[g].splice(0).map(([E,M])=>M)).then(()=>{var E;(E=s.current.shift())==null||E()}).then(()=>v(g))});return m.useMemo(()=>({children:r,register:u,unregister:l,onStart:d,onStop:p,wait:a,chains:c}),[u,l,r,d,p,c,a])}let As=m.Fragment,Ds=hn.RenderStrategy;function Fd(e,t){var n,r;let{transition:o=!0,beforeEnter:i,afterEnter:l,beforeLeave:u,afterLeave:s,enter:a,enterFrom:c,enterTo:d,entered:p,leave:f,leaveFrom:g,leaveTo:v,...E}=e,[M,y]=m.useState(null),T=m.useRef(null),j=$s(e),F=Be(...j?[T,t,y]:t===null?[]:[t]),_=(n=E.unmount)==null||n?vt.Unmount:vt.Hidden,{show:B,appear:h,initial:b}=Id(),[x,A]=m.useState(B?"visible":"hidden"),P=jd(),{register:L,unregister:S}=P;ue(()=>L(T),[L,T]),ue(()=>{if(_===vt.Hidden&&T.current){if(B&&x!=="visible"){A("visible");return}return _e(x,{hidden:()=>S(T),visible:()=>L(T)})}},[x,T,L,S,B,_]);let C=Xr();ue(()=>{if(j&&C&&x==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,x,C,j]);let N=b&&!h,$=h&&B&&b,w=m.useRef(!1),I=Ps(()=>{w.current||(A("hidden"),S(T))},P),R=ne(H=>{w.current=!0;let Z=H?"enter":"leave";I.onStart(T,Z,ae=>{ae==="enter"?i==null||i():ae==="leave"&&(u==null||u())})}),V=ne(H=>{let Z=H?"enter":"leave";w.current=!1,I.onStop(T,Z,ae=>{ae==="enter"?l==null||l():ae==="leave"&&(s==null||s())}),Z==="leave"&&!Fn(I)&&(A("hidden"),S(T))});m.useEffect(()=>{j&&o||(R(B),V(B))},[B,j,o]);let z=!(!o||!j||!C||N),[,G]=Ri(z,M,B,{start:R,end:V}),q=bt({ref:F,className:((r=pr(E.className,$&&a,$&&c,G.enter&&a,G.enter&&G.closed&&c,G.enter&&!G.closed&&d,G.leave&&f,G.leave&&!G.closed&&g,G.leave&&G.closed&&v,!G.transition&&B&&p))==null?void 0:r.trim())||void 0,...ki(G)}),U=0;x==="visible"&&(U|=Xe.Open),x==="hidden"&&(U|=Xe.Closed),B&&x==="hidden"&&(U|=Xe.Opening),!B&&x==="visible"&&(U|=Xe.Closing);let K=De();return m.createElement(jn.Provider,{value:I},m.createElement(Cs,{value:U},K({ourProps:q,theirProps:E,defaultTag:As,features:Ds,visible:x==="visible",name:"Transition.Child"})))}function kd(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,l=m.useRef(null),u=$s(e),s=Be(...u?[l,t]:t===null?[]:[t]);Xr();let a=qr();if(n===void 0&&a!==null&&(n=(a&Xe.Open)===Xe.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=Ps(()=>{n||d("hidden")}),[f,g]=m.useState(!0),v=m.useRef([n]);ue(()=>{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]);ue(()=>{n?d("visible"):!Fn(p)&&l.current!==null&&d("hidden")},[n,p]);let M={unmount:o},y=ne(()=>{var F;f&&g(!1),(F=e.beforeEnter)==null||F.call(e)}),T=ne(()=>{var F;f&&g(!1),(F=e.beforeLeave)==null||F.call(e)}),j=De();return m.createElement(jn.Provider,{value:p},m.createElement(In.Provider,{value:E},j({ourProps:{...M,as:m.Fragment,children:m.createElement(Ms,{ref:s,...M,...i,beforeEnter:y,beforeLeave:T})},theirProps:{},defaultTag:m.Fragment,features:Ds,visible:c==="visible",name:"Transition"})))}function Rd(e,t){let n=m.useContext(In)!==null,r=qr()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(Qr,{ref:t,...e}):m.createElement(Ms,{ref:t,...e}))}let Qr=Oe(kd),Ms=Oe(Fd),_d=Oe(Rd),Is=Object.assign(Qr,{Child:_d,Root:Qr});function Bd(e,t){let n=m.useRef({left:0,top:0});if(ue(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let js=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Fs(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!ut(o))return r;let i=!1;for(let u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),i=!0;let l=i?(n=o.innerText)!=null?n:"":r;return js.test(l)&&(l=l.replace(js,"")),l}function Wd(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 l=i.getAttribute("aria-label");return typeof l=="string"?l.trim():Fs(i).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Fs(e).trim()}function Ud(e){let t=m.useRef(""),n=m.useRef("");return ne(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let i=Wd(r).trim().toLowerCase();return t.current=o,n.current=i,i})}var Vd=Object.defineProperty,zd=(e,t,n)=>t in e?Vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ks=(e,t,n)=>(zd(e,typeof t!="symbol"?t+"":t,n),n),be=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(be||{}),nt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(nt||{}),kn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(kn||{}),Rs=(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))(Rs||{});function _s(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=$i(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 Hd={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:fe.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(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,l;if(e.dataRef.current.disabled||e.listboxState===1)return e;let u={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===fe.Nothing)return{...u,activeOptionIndex:null};if(t.focus===fe.Specific)return{...u,activeOptionIndex:e.options.findIndex(c=>c.id===t.id)};if(t.focus===fe.Previous){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=Mn(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===fe.Next){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=Mn(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||((l=f.current)==null?void 0:l.nextElementSibling)===null)return{...u,activeOptionIndex:p}}}}let s=_s(e),a=Mn(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...u,...s,activeOptionIndex:a}},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(l=>{var u;return!l.dataRef.current.disabled&&((u=l.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!==fe.Nothing&&(r=Mn(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(l=>o==null?void 0:o(l.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:fe.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[i,l]of n.entries())if(o.has(l.id)&&(r.push(i),o.delete(l.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,..._s(e),pendingShouldSort:!1}:e};class Jr extends vi{constructor(t){super(t),ks(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:i,value:l}=this.state.dataRef.current;return _e(i,{0:()=>r==null?void 0:r(n),1:()=>{let u=l.slice(),s=u.findIndex(a=>o(a,n));return s===-1?u.push(n):u.splice(s,1),r==null?void 0:r(u)}})},registerOption:yr(()=>{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:yr(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:yr(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:fe.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),ks(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,l=n.options;return i!==null?((o=l[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=wr.get(null);this.disposables.add(r.on(wi.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 Jr({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:fe.Nothing},__demoMode:n})}reduce(t,n){return _e(n.type,Hd,t,n)}}const Bs=m.createContext(null);function Zr(e){let t=m.useContext(Bs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ws),n}return t}function Ws({id:e,__demoMode:t=!1}){let n=m.useMemo(()=>Jr.new({id:e,__demoMode:t}),[]);return Ts(()=>n.dispose()),n}let Rn=m.createContext(null);Rn.displayName="ListboxDataContext";function nn(e){let t=m.useContext(Rn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,nn),n}return t}let Gd=m.Fragment;function Yd(e,t){let n=m.useId(),r=dr(),{value:o,defaultValue:i,form:l,name:u,onChange:s,by:a,invalid:c=!1,disabled:d=r||!1,horizontal:p=!1,multiple:f=!1,__demoMode:g=!1,...v}=e;const E=p?"horizontal":"vertical";let M=Be(t),y=cu(i),[T=f?[]:void 0,j]=uu(o,s,y),F=Ws({id:n,__demoMode:g}),_=m.useRef({static:!1,hold:!1}),B=m.useRef(new Map),h=Fu(a),b=m.useCallback(z=>_e(x.mode,{[nt.Multi]:()=>T.some(G=>h(G,z)),[nt.Single]:()=>h(T,z)}),[T]),x=m.useMemo(()=>({value:T,disabled:d,invalid:c,mode:f?nt.Multi:nt.Single,orientation:E,onChange:j,compare:h,isSelected:b,optionsPropsRef:_,listRef:B}),[T,d,c,f,E,j,h,b,_,B]);ue(()=>{F.state.dataRef.current=x},[x]);let A=Ue(F,z=>z.listboxState),P=wr.get(null),L=Ue(P,m.useCallback(z=>P.selectors.isTop(z,n),[P,n])),[S,C]=Ue(F,z=>[z.buttonElement,z.optionsElement]);uc(L,[S,C],(z,G)=>{F.send({type:Rs.CloseListbox}),Li(G,Lr.Loose)||(z.preventDefault(),S==null||S.focus())});let N=m.useMemo(()=>({open:A===be.Open,disabled:d,invalid:c,value:T}),[A,d,c,T]),[$,w]=Pu({inherit:!0}),I={ref:M},R=m.useCallback(()=>{if(y!==void 0)return j==null?void 0:j(y)},[j,y]),V=De();return m.createElement(w,{value:$,props:{htmlFor:S==null?void 0:S.id},slot:{open:A===be.Open,disabled:d}},m.createElement(hd,null,m.createElement(Bs.Provider,{value:F},m.createElement(Rn.Provider,{value:x},m.createElement(Cs,{value:_e(A,{[be.Open]:Xe.Open,[be.Closed]:Xe.Closed})},u!=null&&T!=null&&m.createElement(gu,{disabled:d,data:{[u]:T},form:l,onReset:R}),V({ourProps:I,theirProps:v,slot:N,defaultTag:Gd,name:"Listbox"}))))))}let Kd="button";function qd(e,t){let n=m.useId(),r=si(),o=nn("Listbox.Button"),i=Zr("Listbox.Button"),{id:l=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:s=!1,...a}=e,c=Be(t,fd(),i.actions.setButtonElement),d=dd(),[p,f,g]=Ue(i,w=>[w.listboxState,w.buttonElement,w.optionsElement]),v=p===be.Open;dc(v,{trigger:f,action:m.useCallback(w=>{if(f!=null&&f.contains(w.target))return xn.Ignore;let I=w.target.closest('[role="option"]:not([data-disabled])');return ut(I)?xn.Select(I):g!=null&&g.contains(w.target)?xn.Ignore:xn.Close},[f,g]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let E=ne(w=>{switch(w.key){case ve.Enter:fu(w.currentTarget);break;case ve.Space:case ve.ArrowDown:w.preventDefault(),i.actions.openListbox({focus:o.value?fe.Nothing:fe.First});break;case ve.ArrowUp:w.preventDefault(),i.actions.openListbox({focus:o.value?fe.Nothing:fe.Last});break}}),M=ne(w=>{switch(w.key){case ve.Space:w.preventDefault();break}}),y=ne(w=>{var I;if(w.button===Os.Left){if(Su(w.currentTarget))return w.preventDefault();i.state.listboxState===be.Open?(we.flushSync(()=>i.actions.closeListbox()),(I=i.state.buttonElement)==null||I.focus({preventScroll:!0})):(w.preventDefault(),i.actions.openListbox({focus:fe.Nothing}))}}),T=m.useRef(null),j=ne(w=>{T.current=w.pointerType,w.pointerType==="mouse"&&y(w)}),F=ne(w=>{T.current!=="mouse"&&y(w)}),_=ne(w=>w.preventDefault()),B=pi([l]),h=Tu(),{isFocusVisible:b,focusProps:x}=Qa({autoFocus:s}),{isHovered:A,hoverProps:P}=Xa({isDisabled:u}),{pressed:L,pressProps:S}=ru({disabled:u}),C=m.useMemo(()=>({open:p===be.Open,active:L||p===be.Open,disabled:u,invalid:o.invalid,value:o.value,hover:A,focus:b,autofocus:s}),[p,o.value,u,A,b,L,o.invalid,s]),N=Ue(i,w=>w.listboxState===be.Open),$=ti(d(),{ref:c,id:l,type:pc(e,f),"aria-haspopup":"listbox","aria-controls":g==null?void 0:g.id,"aria-expanded":N,"aria-labelledby":B,"aria-describedby":h,disabled:u||void 0,autoFocus:s,onKeyDown:E,onKeyUp:M,onKeyPress:_,onPointerDown:j,onClick:F},x,P,S);return De()({ourProps:$,theirProps:a,slot:C,defaultTag:Kd,name:"Listbox.Button"})}let Us=m.createContext(!1),Xd="div",Qd=hn.RenderStrategy|hn.Static;function Jd(e,t){let n=m.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:i=!1,modal:l=!0,transition:u=!1,...s}=e,a=cd(o),[c,d]=m.useState(null);a&&(i=!0);let p=nn("Listbox.Options"),f=Zr("Listbox.Options"),[g,v,E,M]=Ue(f,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),y=$r(v),T=$r(E),j=qr(),[F,_]=Ri(u,c,j!==null?(j&Xe.Open)===Xe.Open:g===be.Open);Qu(F,v,f.actions.closeListbox);let B=M?!1:l&&g===be.Open;wc(B,T);let h=M?!1:l&&g===be.Open;Xu(h,{allowed:m.useCallback(()=>[v,E],[v,E])});let b=g!==be.Open,x=Bd(b,v)?!1:F,A=F&&g===be.Closed,P=bd(A,p.value),L=ne(H=>p.compare(P,H)),S=Ue(f,H=>{var Z;if(a==null||!((Z=a==null?void 0:a.to)!=null&&Z.includes("selection")))return null;let ae=H.options.findIndex($e=>L($e.dataRef.current.value));return ae===-1&&(ae=0),ae}),C=(()=>{if(a==null)return;if(S===null)return{...a,inner:void 0};let H=Array.from(p.listRef.current.values());return{...a,inner:{listRef:{current:H},index:S}}})(),[N,$]=md(C),w=pd(),I=Be(t,a?N:null,f.actions.setOptionsElement,d),R=At();m.useEffect(()=>{var H;let Z=E;Z&&g===be.Open&&Z!==((H=Kt(Z))==null?void 0:H.activeElement)&&(Z==null||Z.focus({preventScroll:!0}))},[g,E]);let V=ne(H=>{var Z,ae;switch(R.dispose(),H.key){case ve.Space:if(f.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),f.actions.search(H.key);case ve.Enter:if(H.preventDefault(),H.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:$e}=f.state.options[f.state.activeOptionIndex];f.actions.onChange($e.current.value)}p.mode===nt.Single&&(we.flushSync(()=>f.actions.closeListbox()),(Z=f.state.buttonElement)==null||Z.focus({preventScroll:!0}));break;case _e(p.orientation,{vertical:ve.ArrowDown,horizontal:ve.ArrowRight}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.Next});case _e(p.orientation,{vertical:ve.ArrowUp,horizontal:ve.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.Previous});case ve.Home:case ve.PageUp:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.First});case ve.End:case ve.PageDown:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.Last});case ve.Escape:H.preventDefault(),H.stopPropagation(),we.flushSync(()=>f.actions.closeListbox()),(ae=f.state.buttonElement)==null||ae.focus({preventScroll:!0});return;case ve.Tab:H.preventDefault(),H.stopPropagation(),we.flushSync(()=>f.actions.closeListbox()),ic(f.state.buttonElement,H.shiftKey?Nr.Previous:Nr.Next);break;default:H.key.length===1&&(f.actions.search(H.key),R.setTimeout(()=>f.actions.clearSearch(),350));break}}),z=Ue(f,H=>{var Z;return(Z=H.buttonElement)==null?void 0:Z.id}),G=m.useMemo(()=>({open:g===be.Open}),[g]),q=ti(a?w():{},{id:r,ref:I,"aria-activedescendant":Ue(f,f.selectors.activeDescendantId),"aria-multiselectable":p.mode===nt.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:V,role:"listbox",tabIndex:g===be.Open?0:void 0,style:{...s.style,...$,"--button-width":Ru(v,!0).width},...ki(_)}),U=De(),K=m.useMemo(()=>p.mode===nt.Multi?p:{...p,isSelected:L},[p,L]);return m.createElement(Ad,{enabled:i?e.static||F:!1,ownerDocument:y},m.createElement(Rn.Provider,{value:K},U({ourProps:q,theirProps:s,slot:G,defaultTag:Xd,features:Qd,visible:x,name:"Listbox.Options"})))}let Zd="div";function ep(e,t){let n=m.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:i,...l}=e,u=m.useContext(Us)===!0,s=nn("Listbox.Option"),a=Zr("Listbox.Option"),c=Ue(a,x=>a.selectors.isActive(x,r)),d=s.isSelected(i),p=m.useRef(null),f=Ud(p),g=Ot({disabled:o,value:i,domRef:p,get textValue(){return f()}}),v=Be(t,p,x=>{x?s.listRef.current.set(r,x):s.listRef.current.delete(r)}),E=Ue(a,x=>a.selectors.shouldScrollIntoView(x,r));ue(()=>{if(E)return qe().requestAnimationFrame(()=>{var x,A;(A=(x=p.current)==null?void 0:x.scrollIntoView)==null||A.call(x,{block:"nearest"})})},[E,p]),ue(()=>{if(!u)return a.actions.registerOption(r,g),()=>a.actions.unregisterOption(r)},[g,r,u]);let M=ne(x=>{var A;if(o)return x.preventDefault();a.actions.onChange(i),s.mode===nt.Single&&(we.flushSync(()=>a.actions.closeListbox()),(A=a.state.buttonElement)==null||A.focus({preventScroll:!0}))}),y=ne(()=>{if(o)return a.actions.goToOption({focus:fe.Nothing});a.actions.goToOption({focus:fe.Specific,id:r})}),T=Ec(),j=ne(x=>T.update(x)),F=ne(x=>{T.wasMoved(x)&&(o||c&&a.state.activationTrigger===kn.Pointer||a.actions.goToOption({focus:fe.Specific,id:r},kn.Pointer))}),_=ne(x=>{T.wasMoved(x)&&(o||c&&a.state.activationTrigger===kn.Pointer&&a.actions.goToOption({focus:fe.Nothing}))}),B=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:M,onFocus:y,onPointerEnter:j,onMouseEnter:j,onPointerMove:F,onMouseMove:F,onPointerLeave:_,onMouseLeave:_},b=De();return!d&&u?null:b({ourProps:h,theirProps:l,slot:B,defaultTag:Zd,name:"Listbox.Option"})}let tp=m.Fragment;function np(e,t){let{options:n,placeholder:r,...o}=e,i={ref:Be(t)},l=nn("ListboxSelectedOption"),u=m.useMemo(()=>({}),[]),s=l.value===void 0||l.value===null||l.mode===nt.Multi&&Array.isArray(l.value)&&l.value.length===0,a=De();return m.createElement(Us.Provider,{value:!0},a({ourProps:i,theirProps:{...o,children:m.createElement(m.Fragment,null,r&&s?r:n)},slot:u,defaultTag:tp,name:"ListboxSelectedOption"}))}let rp=Oe(Yd),op=Oe(qd),ip=Iu,sp=Oe(Jd),lp=Oe(ep),ap=Oe(np),wt=Object.assign(rp,{Button:op,Label:ip,Options:sp,Option:lp,SelectedOption:ap});function up({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 Vs=k.forwardRef(up),cp=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>{const{t:i}=Ke();return O.jsx("div",{className:`relative ${o}`,children:O.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:l})=>O.jsxs(O.Fragment,{children:[O.jsxs(wt.Button,{className:`
83
+ */var Kc=["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])"],kr=Kc.join(","),Hi=typeof Element>"u",en=Hi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,An=!Hi&&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},Ln=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",l=i||n&&t&&e(t.parentNode);return l},qc=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Xc=function(t,n,r){if(Ln(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(kr));return n&&en.call(t,kr)&&o.unshift(t),o=o.filter(r),o},Qc=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!Ln(l,!1))if(l.tagName==="SLOT"){var u=l.assignedElements(),s=u.length?u:l.children,a=e(s,!0,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:l,candidates:a})}else{var c=en.call(l,kr);c&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var d=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),p=!Ln(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(d&&p){var f=e(d===!0?l.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},Gi=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Yi=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||qc(t))&&!Gi(t)?0:t.tabIndex},Jc=function(t,n){var r=Yi(t);return r<0&&n&&!Gi(t)?0:r},Zc=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Ki=function(t){return t.tagName==="INPUT"},ef=function(t){return Ki(t)&&t.type==="hidden"},tf=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},nf=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},rf=function(t){if(!t.name)return!0;var n=t.form||An(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(l){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",l.message),!1}var i=nf(o,t.form);return!i||i===t},of=function(t){return Ki(t)&&t.type==="radio"},sf=function(t){return of(t)&&!rf(t)},lf=function(t){var n,r=t&&An(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var l,u,s;for(i=!!((l=o)!==null&&l!==void 0&&(u=l.ownerDocument)!==null&&u!==void 0&&u.contains(o)||t!=null&&(s=t.ownerDocument)!==null&&s!==void 0&&s.contains(t));!i&&o;){var a,c,d;r=An(o),o=(a=r)===null||a===void 0?void 0:a.host,i=!!((c=o)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},qi=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},af=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=en.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(en.call(l,"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,a=An(t);if(s&&!s.shadowRoot&&o(s)===!0)return qi(t);t.assignedSlot?t=t.assignedSlot:!s&&a!==t.ownerDocument?t=a.host:t=s}t=u}if(lf(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return qi(t);return!1},uf=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 en.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},cf=function(t,n){return!(n.disabled||Ln(n)||ef(n)||af(n,t)||tf(n)||uf(n))},Xi=function(t,n){return!(sf(n)||Yi(n)<0||!cf(t,n))},ff=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},df=function e(t){var n=[],r=[];return t.forEach(function(o,i){var l=!!o.scopeParent,u=l?o.scopeParent:o,s=Jc(u,l),a=l?e(o.candidates):u;s===0?l?n.push.apply(n,a):n.push(u):r.push({documentOrder:i,tabIndex:s,item:o,isScope:l,content:a})}),r.sort(Zc).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Qi=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Qc([t],n.includeContainer,{filter:Xi.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ff}):r=Xc(t,n.includeContainer,Xi.bind(null,n)),df(r)};function Ji(e,t,n){let{reference:r,floating:o}=e;const i=pt(t),l=Fr(t),u=jr(l),s=yt(t),a=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(jt(t)){case"start":f[l]-=p*(n&&a?-1:1);break;case"end":f[l]+=p*(n&&a?-1:1);break}return f}const pf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),s=await(l.isRTL==null?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=Ji(a,r,s),p=r,f={},g=0;for(let v=0;v<u.length;v++){const{name:E,fn:M}=u[v],{x:w,y:N,data:j,reset:F}=await M({x:c,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:a,platform:l,elements:{reference:e,floating:t}});c=w??c,d=N??d,f={...f,[E]:{...f[E],...j}},F&&g<=50&&(g++,typeof F=="object"&&(F.placement&&(p=F.placement),F.rects&&(a=F.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):F.rects),{x:c,y:d}=Ji(a,p,s)),v=-1)}return{x:c,y:d,placement:p,strategy:o,middlewareData:f}};async function Pn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:u,strategy:s}=e,{boundary:a="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Nt(t,e),g=zi(f),E=u[p?d==="floating"?"reference":"floating":d],M=Nn(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:a,rootBoundary:c,strategy:s})),w=d==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),j=await(i.isElement==null?void 0:i.isElement(N))?await(i.getScale==null?void 0:i.getScale(N))||{x:1,y:1}:{x:1,y:1},F=Nn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:w,offsetParent:N,strategy:s}):w);return{top:(M.top-F.top+g.top)/j.y,bottom:(F.bottom-M.bottom+g.bottom)/j.y,left:(M.left-F.left+g.left)/j.x,right:(F.right-M.right+g.right)/j.x}}const mf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:u,middlewareData:s}=t,{element:a,padding:c=0}=Nt(e,t)||{};if(a==null)return{};const d=zi(c),p={x:n,y:r},f=Fr(o),g=jr(f),v=await l.getDimensions(a),E=f==="y",M=E?"top":"left",w=E?"bottom":"right",N=E?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[f]-p[f]-i.floating[g],F=p[f]-i.reference[f],k=await(l.getOffsetParent==null?void 0:l.getOffsetParent(a));let W=k?k[N]:0;(!W||!await(l.isElement==null?void 0:l.isElement(k)))&&(W=u.floating[N]||i.floating[g]);const h=j/2-F/2,b=W/2-v[g]/2-1,x=dt(d[M],b),$=dt(d[w],b),P=x,A=W-v[g]-$,S=W/2-v[g]/2+h,O=Ir(P,S,A),T=!s.arrow&&jt(o)!=null&&S!==O&&i.reference[g]/2-(S<P?x:$)-v[g]/2<0,L=T?S<P?S-P:S-A:0;return{[f]:p[f]+L,data:{[f]:O,centerOffset:S-O-L,...T&&{alignmentOffset:L}},reset:T}}}),hf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:u,platform:s,elements:a}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...E}=Nt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const M=yt(o),w=pt(u),N=yt(u)===u,j=await(s.isRTL==null?void 0:s.isRTL(a.floating)),F=p||(N||!v?[Tn(u)]:Uc(u)),k=g!=="none";!p&&k&&F.push(...Gc(u,v,g,j));const W=[u,...F],h=await Pn(t,E),b=[];let x=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&b.push(h[M]),d){const S=Bc(o,l,j);b.push(h[S[0]],h[S[1]])}if(x=[...x,{placement:o,overflows:b}],!b.every(S=>S<=0)){var $,P;const S=((($=i.flip)==null?void 0:$.index)||0)+1,O=W[S];if(O&&(!(d==="alignment"?w!==pt(O):!1)||x.every(y=>pt(y.placement)===w?y.overflows[0]>0:!0)))return{data:{index:S,overflows:x},reset:{placement:O}};let T=(P=x.filter(L=>L.overflows[0]<=0).sort((L,y)=>L.overflows[1]-y.overflows[1])[0])==null?void 0:P.placement;if(!T)switch(f){case"bestFit":{var A;const L=(A=x.filter(y=>{if(k){const I=pt(y.placement);return I===w||I==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(I=>I>0).reduce((I,_)=>I+_,0)]).sort((y,I)=>y[1]-I[1])[0])==null?void 0:A[0];L&&(T=L);break}case"initialPlacement":T=u;break}if(o!==T)return{reset:{placement:T}}}return{}}}},gf=new Set(["left","top"]);async function vf(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=yt(n),u=jt(n),s=pt(n)==="y",a=gf.has(l)?-1:1,c=i&&s?-1:1,d=Nt(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*a}:{x:p*a,y:f*c}}const bf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:u}=t,s=await vf(t,e);return l===((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:l}}}}},xf=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:l=!1,limiter:u={fn:E=>{let{x:M,y:w}=E;return{x:M,y:w}}},...s}=Nt(e,t),a={x:n,y:r},c=await Pn(t,s),d=pt(yt(o)),p=Bi(d);let f=a[p],g=a[d];if(i){const E=p==="y"?"top":"left",M=p==="y"?"bottom":"right",w=f+c[E],N=f-c[M];f=Ir(w,f,N)}if(l){const E=d==="y"?"top":"left",M=d==="y"?"bottom":"right",w=g+c[E],N=g-c[M];g=Ir(w,g,N)}const v=u.fn({...t,[p]:f,[d]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[d]:l}}}}}},yf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:l,elements:u}=t,{apply:s=()=>{},...a}=Nt(e,t),c=await Pn(t,a),d=yt(o),p=jt(o),f=pt(o)==="y",{width:g,height:v}=i.floating;let E,M;d==="top"||d==="bottom"?(E=d,M=p===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(M=d,E=p==="end"?"top":"bottom");const w=v-c.top-c.bottom,N=g-c.left-c.right,j=dt(v-c[E],w),F=dt(g-c[M],N),k=!t.middlewareData.shift;let W=j,h=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(h=N),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(W=w),k&&!p){const x=xe(c.left,0),$=xe(c.right,0),P=xe(c.top,0),A=xe(c.bottom,0);f?h=g-2*(x!==0||$!==0?x+$:xe(c.left,c.right)):W=v-2*(P!==0||A!==0?P+A:xe(c.top,c.bottom))}await s({...t,availableWidth:h,availableHeight:W});const b=await l.getDimensions(u.floating);return g!==b.width||v!==b.height?{reset:{rects:!0}}:{}}}};function Zi(e){const t=Ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ee(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=Zt(n)!==i||Zt(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function _r(e){return oe(e)?e:e.contextElement}function Ft(e){const t=_r(e);if(!Ee(t))return tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Zi(t);let l=(i?Zt(n.width):n.width)/r,u=(i?Zt(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const wf=tt(0);function es(e){const t=Ne(e);return!Sn()||!t.visualViewport?wf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ef(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ne(e)?!1:t}function At(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=_r(e);let l=tt(1);t&&(r?oe(r)&&(l=Ft(r)):l=Ft(e));const u=Ef(i,n,r)?es(i):tt(0);let s=(o.left+u.x)/l.x,a=(o.top+u.y)/l.y,c=o.width/l.x,d=o.height/l.y;if(i){const p=Ne(i),f=r&&oe(r)?Ne(r):r;let g=p,v=Mr(g);for(;v&&r&&f!==g;){const E=Ft(v),M=v.getBoundingClientRect(),w=Ve(v),N=M.left+(v.clientLeft+parseFloat(w.paddingLeft))*E.x,j=M.top+(v.clientTop+parseFloat(w.paddingTop))*E.y;s*=E.x,a*=E.y,c*=E.x,d*=E.y,s+=N,a+=j,g=Ne(v),v=Mr(g)}}return Nn({width:c,height:d,x:s,y:a})}function $n(e,t){const n=Cn(e).scrollLeft;return t?t.left+n:At(et(e)).left+n}function ts(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-$n(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Sf(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",l=et(r),u=t?En(t.floating):!1;if(r===l||u&&i)return n;let s={scrollLeft:0,scrollTop:0},a=tt(1);const c=tt(0),d=Ee(r);if((d||!d&&!i)&&((It(r)!=="body"||Jt(l))&&(s=Cn(r)),Ee(r))){const f=At(r);a=Ft(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const p=l&&!d&&!i?ts(l,s):tt(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-s.scrollLeft*a.x+c.x+p.x,y:n.y*a.y-s.scrollTop*a.y+c.y+p.y}}function Cf(e){return Array.from(e.getClientRects())}function Of(e){const t=et(e),n=Cn(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 l=-n.scrollLeft+$n(e);const u=-n.scrollTop;return Ve(r).direction==="rtl"&&(l+=xe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}const ns=25;function Tf(e,t){const n=Ne(e),r=et(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,s=0;if(o){i=o.width,l=o.height;const c=Sn();(!c||c&&t==="fixed")&&(u=o.offsetLeft,s=o.offsetTop)}const a=$n(r);if(a<=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<=ns&&(i-=g)}else a<=ns&&(i+=a);return{width:i,height:l,x:u,y:s}}const Nf=new Set(["absolute","fixed"]);function Af(e,t){const n=At(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ee(e)?Ft(e):tt(1),l=e.clientWidth*i.x,u=e.clientHeight*i.y,s=o*i.x,a=r*i.y;return{width:l,height:u,x:s,y:a}}function rs(e,t,n){let r;if(t==="viewport")r=Tf(e,n);else if(t==="document")r=Of(et(e));else if(oe(t))r=Af(t,n);else{const o=es(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Nn(r)}function os(e,t){const n=ft(e);return n===t||!oe(n)||ct(n)?!1:Ve(n).position==="fixed"||os(n,t)}function Lf(e,t){const n=t.get(e);if(n)return n;let r=xt(e,[],!1).filter(u=>oe(u)&&It(u)!=="body"),o=null;const i=Ve(e).position==="fixed";let l=i?ft(e):e;for(;oe(l)&&!ct(l);){const u=Ve(l),s=Dr(l);!s&&u.position==="fixed"&&(o=null),(i?!s&&!o:!s&&u.position==="static"&&!!o&&Nf.has(o.position)||Jt(l)&&!s&&os(e,l))?r=r.filter(c=>c!==l):o=u,l=ft(l)}return t.set(e,r),r}function Pf(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?En(t)?[]:Lf(t,this._c):[].concat(n),r],u=l[0],s=l.reduce((a,c)=>{const d=rs(t,c,o);return a.top=xe(d.top,a.top),a.right=dt(d.right,a.right),a.bottom=dt(d.bottom,a.bottom),a.left=xe(d.left,a.left),a},rs(t,u,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function $f(e){const{width:t,height:n}=Zi(e);return{width:t,height:n}}function Df(e,t,n){const r=Ee(t),o=et(t),i=n==="fixed",l=At(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const s=tt(0);function a(){s.x=$n(o)}if(r||!r&&!i)if((It(t)!=="body"||Jt(o))&&(u=Cn(t)),r){const f=At(t,!0,i,t);s.x=f.x+t.clientLeft,s.y=f.y+t.clientTop}else o&&a();i&&!r&&o&&a();const c=o&&!r&&!i?ts(o,u):tt(0),d=l.left+u.scrollLeft-s.x-c.x,p=l.top+u.scrollTop-s.y-c.y;return{x:d,y:p,width:l.width,height:l.height}}function Wr(e){return Ve(e).position==="static"}function is(e,t){if(!Ee(e)||Ve(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function ss(e,t){const n=Ne(e);if(En(e))return n;if(!Ee(e)){let o=ft(e);for(;o&&!ct(o);){if(oe(o)&&!Wr(o))return o;o=ft(o)}return n}let r=is(e,t);for(;r&&Pc(r)&&Wr(r);)r=is(r,t);return r&&ct(r)&&Wr(r)&&!Dr(r)?n:r||jc(e)||n}const Mf=async function(e){const t=this.getOffsetParent||ss,n=this.getDimensions,r=await n(e.floating);return{reference:Df(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function If(e){return Ve(e).direction==="rtl"}const jf={convertOffsetParentRelativeRectToViewportRelativeRect:Sf,getDocumentElement:et,getClippingRect:Pf,getOffsetParent:ss,getElementRects:Mf,getClientRects:Cf,getDimensions:$f,getScale:Ft,isElement:oe,isRTL:If};function ls(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ff(e,t){let n=null,r;const o=et(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,s){u===void 0&&(u=!1),s===void 0&&(s=1),i();const a=e.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=a;if(u||t(),!p||!f)return;const g=On(d),v=On(o.clientWidth-(c+p)),E=On(o.clientHeight-(d+f)),M=On(c),N={rootMargin:-g+"px "+-v+"px "+-E+"px "+-M+"px",threshold:xe(0,dt(1,s))||1};let j=!0;function F(k){const W=k[0].intersectionRatio;if(W!==s){if(!j)return l();W?l(!1,W):r=setTimeout(()=>{l(!1,1e-7)},1e3)}W===1&&!ls(a,e.getBoundingClientRect())&&l(),j=!1}try{n=new IntersectionObserver(F,{...N,root:o.ownerDocument})}catch{n=new IntersectionObserver(F,N)}n.observe(e)}return l(!0),i}function as(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:s=!1}=r,a=_r(e),c=o||i?[...a?xt(a):[],...xt(t)]:[];c.forEach(M=>{o&&M.addEventListener("scroll",n,{passive:!0}),i&&M.addEventListener("resize",n)});const d=a&&u?Ff(a,n):null;let p=-1,f=null;l&&(f=new ResizeObserver(M=>{let[w]=M;w&&w.target===a&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var N;(N=f)==null||N.observe(t)})),n()}),a&&!s&&f.observe(a),f.observe(t));let g,v=s?At(e):null;s&&E();function E(){const M=At(e);v&&!ls(v,M)&&n(),v=M,g=requestAnimationFrame(E)}return n(),()=>{var M;c.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(M=f)==null||M.disconnect(),f=null,s&&cancelAnimationFrame(g)}}const Br=Pn,Rf=bf,kf=xf,_f=hf,Wf=yf,us=mf,Bf=(e,t,n)=>{const r=new Map,o={platform:jf,...n},i={...o.platform,_c:r};return pf(e,t,{...o,platform:i})};var Uf=typeof document<"u",Vf=function(){},Dn=Uf?m.useLayoutEffect:Vf;function Mn(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(!Mn(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)&&!Mn(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function cs(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fs(e,t){const n=cs(e);return Math.round(t*n)/n}function Ur(e){const t=R.useRef(e);return Dn(()=>{t.current=e}),t}function ds(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:s,open:a}=e,[c,d]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=R.useState(r);Mn(p,r)||f(r);const[g,v]=R.useState(null),[E,M]=R.useState(null),w=R.useCallback(y=>{y!==k.current&&(k.current=y,v(y))},[]),N=R.useCallback(y=>{y!==W.current&&(W.current=y,M(y))},[]),j=i||g,F=l||E,k=R.useRef(null),W=R.useRef(null),h=R.useRef(c),b=s!=null,x=Ur(s),$=Ur(o),P=Ur(a),A=R.useCallback(()=>{if(!k.current||!W.current)return;const y={placement:t,strategy:n,middleware:p};$.current&&(y.platform=$.current),Bf(k.current,W.current,y).then(I=>{const _={...I,isPositioned:P.current!==!1};S.current&&!Mn(h.current,_)&&(h.current=_,Vt.flushSync(()=>{d(_)}))})},[p,t,n,$,P]);Dn(()=>{a===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,d(y=>({...y,isPositioned:!1})))},[a]);const S=R.useRef(!1);Dn(()=>(S.current=!0,()=>{S.current=!1}),[]),Dn(()=>{if(j&&(k.current=j),F&&(W.current=F),j&&F){if(x.current)return x.current(j,F,A);A()}},[j,F,A,x,b]);const O=R.useMemo(()=>({reference:k,floating:W,setReference:w,setFloating:N}),[w,N]),T=R.useMemo(()=>({reference:j,floating:F}),[j,F]),L=R.useMemo(()=>{const y={position:n,left:0,top:0};if(!T.floating)return y;const I=fs(T.floating,c.x),_=fs(T.floating,c.y);return u?{...y,transform:"translate("+I+"px, "+_+"px)",...cs(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:_}},[n,u,T.floating,c.x,c.y]);return R.useMemo(()=>({...c,update:A,refs:O,elements:T,floatingStyles:L}),[c,A,O,T,L])}const zf=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?us({element:r.current,padding:o}).fn(n):{}:r?us({element:r,padding:o}).fn(n):{}}}},Vr=(e,t)=>({...Rf(e),options:[e,t]}),ps=(e,t)=>({...kf(e),options:[e,t]}),ms=(e,t)=>({..._f(e),options:[e,t]}),Hf=(e,t)=>({...Wf(e),options:[e,t]}),Gf=(e,t)=>({...zf(e),options:[e,t]}),hs={...R},Yf=hs.useInsertionEffect||(e=>e());function gs(e){const t=R.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Yf(()=>{t.current=e}),R.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 zr=typeof document<"u"?m.useLayoutEffect:m.useEffect;let vs=!1,Kf=0;const bs=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Kf++;function qf(){const[e,t]=R.useState(()=>vs?bs():void 0);return zr(()=>{e==null&&t(bs())},[]),R.useEffect(()=>{vs=!0},[]),e}const Xf=hs.useId||qf;let tn;process.env.NODE_ENV!=="production"&&(tn=new Set);function Qf(){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=tn)!=null&&e.has(o))){var i;(i=tn)==null||i.add(o),console.warn(o)}}function Jf(){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=tn)!=null&&e.has(o))){var i;(i=tn)==null||i.add(o),console.error(o)}}function Zf(){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 ed=R.createContext(null),td=R.createContext(null),nd=()=>{var e;return((e=R.useContext(ed))==null?void 0:e.id)||null},rd=()=>R.useContext(td),od="data-floating-ui-focusable";function id(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Xf(),i=R.useRef({}),[l]=R.useState(()=>Zf()),u=nd()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!oe(f)&&Jf("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,a]=R.useState(r.reference),c=gs((f,g,v)=>{i.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=R.useMemo(()=>({setPositionReference:a}),[]),p=R.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return R.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:l,floatingId:o,refs:d}),[t,c,p,l,o,d])}function sd(e){e===void 0&&(e={});const{nodeId:t}=e,n=id({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,l]=R.useState(null),[u,s]=R.useState(null),c=(o==null?void 0:o.domReference)||i,d=R.useRef(null),p=rd();zr(()=>{c&&(d.current=c)},[c]);const f=ds({...e,elements:{...o,...u&&{reference:u}}}),g=R.useCallback(N=>{const j=oe(N)?{getBoundingClientRect:()=>N.getBoundingClientRect(),contextElement:N}:N;s(j),f.refs.setReference(j)},[f.refs]),v=R.useCallback(N=>{(oe(N)||N===null)&&(d.current=N,l(N)),(oe(f.refs.reference.current)||f.refs.reference.current===null||N!==null&&!oe(N))&&f.refs.setReference(N)},[f.refs]),E=R.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),M=R.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=R.useMemo(()=>({...f,...r,refs:E,elements:M,nodeId:t}),[f,E,M,t,r]);return zr(()=>{r.dataRef.current.floatingContext=w;const N=p==null?void 0:p.nodesRef.current.find(j=>j.id===t);N&&(N.context=w)}),R.useMemo(()=>({...f,context:w,refs:E,elements:M}),[f,E,M,w])}const xs="active",ys="selected";function Hr(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[xs]:l,[ys]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[od]:""},...i,...t.map(l=>{const u=l?l[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((l,u)=>(u&&Object.entries(u).forEach(s=>{let[a,c]=s;if(!(o&&[xs,ys].includes(a)))if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof c=="function"){var d;(d=r.get(a))==null||d.push(c),l[a]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(a))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else l[a]=c}),l),{})}}function ld(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=R.useCallback(u=>Hr(u,e,"reference"),t),i=R.useCallback(u=>Hr(u,e,"floating"),n),l=R.useCallback(u=>Hr(u,e,"item"),r);return R.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l}),[o,i,l])}function ws(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const ad=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:l=0,minItemsVisible:u=4,referenceOverflowThreshold:s=0,scrollRef:a,...c}=Nt(e,t),{rects:d,elements:{floating:p}}=t,f=n.current[l],g=(a==null?void 0:a.current)||p,v=p.clientTop||g.clientTop,E=p.clientTop!==0,M=g.clientTop!==0,w=p===g;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Qf('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const N={...t,...await Vr(-f.offsetTop-p.clientTop-d.reference.height/2-f.offsetHeight/2-i).fn(t)},j=await Br(ws(N,g.scrollHeight+v+p.clientTop),c),F=await Br(N,{...c,elementContext:"reference"}),k=xe(0,j.top),W=N.y+k,x=(g.scrollHeight>g.clientHeight?$=>$:Zt)(xe(0,g.scrollHeight+(E&&w||M?v*2:0)-k-xe(0,j.bottom)));if(g.style.maxHeight=x+"px",g.scrollTop=k,o){const $=g.offsetHeight<f.offsetHeight*dt(u,n.current.length)-1||F.top>=-s||F.bottom>=-s;Vt.flushSync(()=>o($))}return r&&(r.current=await Br(ws({...N,y:W},g.offsetHeight+v+p.clientTop),c)),{y:W}}});function ud(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:l,onChange:u}=t,s=gs(u),a=R.useRef(!1),c=R.useRef(null),d=R.useRef(null);R.useEffect(()=>{if(!o)return;function f(v){if(v.ctrlKey||!g||i.current==null)return;const E=v.deltaY,M=i.current.top>=-.5,w=i.current.bottom>=-.5,N=g.scrollHeight-g.clientHeight,j=E<0?-1:1,F=E<0?"max":"min";g.scrollHeight<=g.clientHeight||(!M&&E>0||!w&&E<0?(v.preventDefault(),Vt.flushSync(()=>{s(k=>k+Math[F](E,N*j))})):/firefox/i.test(Rc())&&(g.scrollTop+=E))}const g=(l==null?void 0:l.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,l,s]);const p=R.useMemo(()=>({onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const f=(l==null?void 0:l.current)||r.floating;if(!(!i.current||!f||!a.current)){if(c.current!==null){const g=f.scrollTop-c.current;(i.current.bottom<-.5&&g<-1||i.current.top<-.5&&g>1)&&Vt.flushSync(()=>s(v=>v+g))}requestAnimationFrame(()=>{c.current=f.scrollTop})}}}),[r.floating,s,i,l]);return R.useMemo(()=>o?{floating:p}:{},[o,p])}let Rt=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Rt.displayName="FloatingContext";let Gr=m.createContext(null);Gr.displayName="PlacementContext";function cd(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function fd(){return m.useContext(Rt).setReference}function dd(){return m.useContext(Rt).getReferenceProps}function pd(){let{getFloatingProps:e,slot:t}=m.useContext(Rt);return m.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function md(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(Gr),n=m.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var l;return(l=i==null?void 0:i.outerHTML)!=null?l:i})]);ue(()=>{t==null||t(n??null)},[t,n]);let r=m.useContext(Rt);return m.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Es=4;function hd({children:e,enabled:t=!0}){let[n,r]=m.useState(null),[o,i]=m.useState(0),l=m.useRef(null),[u,s]=m.useState(null);gd(u);let a=t&&n!==null&&u!==null,{to:c="bottom",gap:d=0,offset:p=0,padding:f=0,inner:g}=vd(n,u),[v,E="center"]=c.split(" ");ue(()=>{a&&i(0)},[a]);let{refs:M,floatingStyles:w,context:N}=sd({open:a,placement:v==="selection"?E==="center"?"bottom":`bottom-${E}`:E==="center"?`${v}`:`${v}-${E}`,strategy:"absolute",transform:!1,middleware:[Vr({mainAxis:v==="selection"?0:d,crossAxis:p}),ps({padding:f}),v!=="selection"&&ms({padding:f}),v==="selection"&&g?ad({...g,padding:f,overflowRef:l,offset:o,minItemsVisible:Es,referenceOverflowThreshold:f,onFallbackChange($){var P,A;if(!$)return;let S=N.elements.floating;if(!S)return;let O=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,T=Math.min(Es,S.childElementCount),L=0,y=0;for(let I of(A=(P=N.elements.floating)==null?void 0:P.childNodes)!=null?A:[])if(ut(I)){let _=I.offsetTop,V=_+I.clientHeight+O,z=S.scrollTop,G=z+S.clientHeight;if(_>=z&&V<=G)T--;else{y=Math.max(0,Math.min(V,G)-Math.max(_,z)),L=I.clientHeight;break}}T>=1&&i(I=>{let _=L*T-y+O;return I>=_?I:_})}}):null,Hf({padding:f,apply({availableWidth:$,availableHeight:P,elements:A}){Object.assign(A.floating.style,{overflow:"auto",maxWidth:`${$}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${P}px)`})}})].filter(Boolean),whileElementsMounted:as}),[j=v,F=E]=N.placement.split("-");v==="selection"&&(j="selection");let k=m.useMemo(()=>({anchor:[j,F].filter(Boolean).join(" ")}),[j,F]),W=ud(N,{overflowRef:l,onChange:i}),{getReferenceProps:h,getFloatingProps:b}=ld([W]),x=ne($=>{s($),M.setFloating($)});return R.createElement(Gr.Provider,{value:r},R.createElement(Rt.Provider,{value:{setFloating:x,setReference:M.setReference,styles:w,getReferenceProps:h,getFloatingProps:b,slot:k}},e))}function gd(e){ue(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function vd(e,t){var n,r,o;let i=Yr((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),l=Yr((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),u=Yr((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:l,padding:u}}function Yr(e,t,n=void 0){let r=$t(),o=ne((s,a)=>{if(s==null)return[n,null];if(typeof s=="number")return[s,null];if(typeof s=="string"){if(!a)return[n,null];let c=Cs(s,a);return[c,d=>{let p=Ss(s);{let f=p.map(g=>window.getComputedStyle(a).getPropertyValue(g));r.requestAnimationFrame(function g(){r.nextFrame(g);let v=!1;for(let[M,w]of p.entries()){let N=window.getComputedStyle(a).getPropertyValue(w);if(f[M]!==N){f[M]=N,v=!0;break}}if(!v)return;let E=Cs(s,a);c!==E&&(d(E),c=E)})}return r.dispose}]}return[n,null]}),i=m.useMemo(()=>o(e,t)[0],[e,t]),[l=i,u]=m.useState();return ue(()=>{let[s,a]=o(e,t);if(u(s),!!a)return a(u)},[e,t]),l}function Ss(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,...Ss(o)]:[r]}return[]}function Cs(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 bd(e,t){let[n,r]=m.useState(t);return!e&&n!==t&&r(t),e?n:t}let Kr=m.createContext(null);Kr.displayName="OpenClosedContext";var Xe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Xe||{});function qr(){return m.useContext(Kr)}function Os({value:e,children:t}){return m.createElement(Kr.Provider,{value:e},t)}function xd(e){throw new Error("Unexpected object: "+e)}var fe=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(fe||{});function In(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:xd(e)}}var Ts=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Ts||{});function Ns(e){let t=ne(e),n=m.useRef(!1);m.useEffect(()=>(n.current=!1,()=>{n.current=!0,ei(()=>{n.current&&t()})}),[t])}function yd(){let e=typeof document>"u";return"useSyncExternalStore"in R?(t=>t.useSyncExternalStore)(R)(()=>()=>{},()=>!1,()=>!e):!1}function Xr(){let e=yd(),[t,n]=R.useState(Je.isHandoffComplete);return t&&Je.isHandoffComplete===!1&&n(!1),R.useEffect(()=>{t!==!0&&n(!0)},[t]),R.useEffect(()=>Je.handoff(),[]),e?!1:t}let wd=m.createContext(!1);function Ed(){return m.useContext(wd)}function Sd(e){let t=Ed(),n=m.useContext(Ls),[r,o]=m.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(Je.isServer)return null;let l=e==null?void 0:e.getElementById("headlessui-portal-root");if(l)return l;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 As=m.Fragment,Cd=Te(function(e,t){let{ownerDocument:n=null,...r}=e,o=m.useRef(null),i=We(Ou(f=>{o.current=f}),t),l=Lr(o),u=n??l,s=Sd(u),[a]=m.useState(()=>{var f;return Je.isServer?null:(f=u==null?void 0:u.createElement("div"))!=null?f:null}),c=m.useContext(Ad),d=Xr();ue(()=>{!s||!a||s.contains(a)||(a.setAttribute("data-headlessui-portal",""),s.appendChild(a))},[s,a]),ue(()=>{if(a&&c)return c.register(a)},[c,a]),Ns(()=>{var f;!s||!a||(gr(a)&&s.contains(a)&&s.removeChild(a),s.childNodes.length<=0&&((f=s.parentElement)==null||f.removeChild(s)))});let p=Me();return d?!s||!a?null:we.createPortal(p({ourProps:{ref:i},theirProps:r,slot:{},defaultTag:As,name:"Portal"}),a):null});function Od(e,t){let n=We(t),{enabled:r=!0,ownerDocument:o,...i}=e,l=Me();return r?m.createElement(Cd,{...i,ownerDocument:o,ref:n}):l({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:As,name:"Portal"})}let Td=m.Fragment,Ls=m.createContext(null);function Nd(e,t){let{target:n,...r}=e,o={ref:We(t)},i=Me();return m.createElement(Ls.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:Td,name:"Popover.Group"}))}let Ad=m.createContext(null),Ld=Te(Od),Pd=Te(Nd),$d=Object.assign(Ld,{Group:Pd});function Dd(){let e=m.useRef(!1);return ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ps(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Ds)!==m.Fragment||m.Children.count(e.children)===1}let jn=m.createContext(null);jn.displayName="TransitionContext";var Md=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Md||{});function Id(){let e=m.useContext(jn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function jd(){let e=m.useContext(Fn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Fn=m.createContext(null);Fn.displayName="NestingContext";function Rn(e){return"children"in e?Rn(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function $s(e,t){let n=Ot(e),r=m.useRef([]),o=Dd(),i=$t(),l=ne((f,g=vt.Hidden)=>{let v=r.current.findIndex(({el:E})=>E===f);v!==-1&&(_e(g,{[vt.Unmount](){r.current.splice(v,1)},[vt.Hidden](){r.current[v].state="hidden"}}),i.microTask(()=>{var E;!Rn(r)&&o.current&&((E=n.current)==null||E.call(n))}))}),u=ne(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"}),()=>l(f,vt.Unmount)}),s=m.useRef([]),a=m.useRef(Promise.resolve()),c=m.useRef({enter:[],leave:[]}),d=ne((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(([M,w])=>w)).then(()=>E())})]),g==="enter"?a.current=a.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(g)):v(g)}),p=ne((f,g,v)=>{Promise.all(c.current[g].splice(0).map(([E,M])=>M)).then(()=>{var E;(E=s.current.shift())==null||E()}).then(()=>v(g))});return m.useMemo(()=>({children:r,register:u,unregister:l,onStart:d,onStop:p,wait:a,chains:c}),[u,l,r,d,p,c,a])}let Ds=m.Fragment,Ms=gn.RenderStrategy;function Fd(e,t){var n,r;let{transition:o=!0,beforeEnter:i,afterEnter:l,beforeLeave:u,afterLeave:s,enter:a,enterFrom:c,enterTo:d,entered:p,leave:f,leaveFrom:g,leaveTo:v,...E}=e,[M,w]=m.useState(null),N=m.useRef(null),j=Ps(e),F=We(...j?[N,t,w]:t===null?[]:[t]),k=(n=E.unmount)==null||n?vt.Unmount:vt.Hidden,{show:W,appear:h,initial:b}=Id(),[x,$]=m.useState(W?"visible":"hidden"),P=jd(),{register:A,unregister:S}=P;ue(()=>A(N),[A,N]),ue(()=>{if(k===vt.Hidden&&N.current){if(W&&x!=="visible"){$("visible");return}return _e(x,{hidden:()=>S(N),visible:()=>A(N)})}},[x,N,A,S,W,k]);let O=Xr();ue(()=>{if(j&&O&&x==="visible"&&N.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[N,x,O,j]);let T=b&&!h,L=h&&W&&b,y=m.useRef(!1),I=$s(()=>{y.current||($("hidden"),S(N))},P),_=ne(H=>{y.current=!0;let Z=H?"enter":"leave";I.onStart(N,Z,ae=>{ae==="enter"?i==null||i():ae==="leave"&&(u==null||u())})}),V=ne(H=>{let Z=H?"enter":"leave";y.current=!1,I.onStop(N,Z,ae=>{ae==="enter"?l==null||l():ae==="leave"&&(s==null||s())}),Z==="leave"&&!Rn(I)&&($("hidden"),S(N))});m.useEffect(()=>{j&&o||(_(W),V(W))},[W,j,o]);let z=!(!o||!j||!O||T),[,G]=_i(z,M,W,{start:_,end:V}),q=bt({ref:F,className:((r=pr(E.className,L&&a,L&&c,G.enter&&a,G.enter&&G.closed&&c,G.enter&&!G.closed&&d,G.leave&&f,G.leave&&!G.closed&&g,G.leave&&G.closed&&v,!G.transition&&W&&p))==null?void 0:r.trim())||void 0,...ki(G)}),B=0;x==="visible"&&(B|=Xe.Open),x==="hidden"&&(B|=Xe.Closed),W&&x==="hidden"&&(B|=Xe.Opening),!W&&x==="visible"&&(B|=Xe.Closing);let K=Me();return m.createElement(Fn.Provider,{value:I},m.createElement(Os,{value:B},K({ourProps:q,theirProps:E,defaultTag:Ds,features:Ms,visible:x==="visible",name:"Transition.Child"})))}function Rd(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,l=m.useRef(null),u=Ps(e),s=We(...u?[l,t]:t===null?[]:[t]);Xr();let a=qr();if(n===void 0&&a!==null&&(n=(a&Xe.Open)===Xe.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=$s(()=>{n||d("hidden")}),[f,g]=m.useState(!0),v=m.useRef([n]);ue(()=>{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]);ue(()=>{n?d("visible"):!Rn(p)&&l.current!==null&&d("hidden")},[n,p]);let M={unmount:o},w=ne(()=>{var F;f&&g(!1),(F=e.beforeEnter)==null||F.call(e)}),N=ne(()=>{var F;f&&g(!1),(F=e.beforeLeave)==null||F.call(e)}),j=Me();return m.createElement(Fn.Provider,{value:p},m.createElement(jn.Provider,{value:E},j({ourProps:{...M,as:m.Fragment,children:m.createElement(Is,{ref:s,...M,...i,beforeEnter:w,beforeLeave:N})},theirProps:{},defaultTag:m.Fragment,features:Ms,visible:c==="visible",name:"Transition"})))}function kd(e,t){let n=m.useContext(jn)!==null,r=qr()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(Qr,{ref:t,...e}):m.createElement(Is,{ref:t,...e}))}let Qr=Te(Rd),Is=Te(Fd),_d=Te(kd),js=Object.assign(Qr,{Child:_d,Root:Qr});function Wd(e,t){let n=m.useRef({left:0,top:0});if(ue(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Fs=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Rs(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!ut(o))return r;let i=!1;for(let u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),i=!0;let l=i?(n=o.innerText)!=null?n:"":r;return Fs.test(l)&&(l=l.replace(Fs,"")),l}function Bd(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 l=i.getAttribute("aria-label");return typeof l=="string"?l.trim():Rs(i).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Rs(e).trim()}function Ud(e){let t=m.useRef(""),n=m.useRef("");return ne(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let i=Bd(r).trim().toLowerCase();return t.current=o,n.current=i,i})}var Vd=Object.defineProperty,zd=(e,t,n)=>t in e?Vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ks=(e,t,n)=>(zd(e,typeof t!="symbol"?t+"":t,n),n),be=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(be||{}),nt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(nt||{}),kn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(kn||{}),_s=(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))(_s||{});function Ws(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Pi(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 Hd={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:fe.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(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,l;if(e.dataRef.current.disabled||e.listboxState===1)return e;let u={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===fe.Nothing)return{...u,activeOptionIndex:null};if(t.focus===fe.Specific)return{...u,activeOptionIndex:e.options.findIndex(c=>c.id===t.id)};if(t.focus===fe.Previous){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=In(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===fe.Next){let c=e.activeOptionIndex;if(c!==null){let d=e.options[c].dataRef.current.domRef,p=In(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||((l=f.current)==null?void 0:l.nextElementSibling)===null)return{...u,activeOptionIndex:p}}}}let s=Ws(e),a=In(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...u,...s,activeOptionIndex:a}},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(l=>{var u;return!l.dataRef.current.disabled&&((u=l.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!==fe.Nothing&&(r=In(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(l=>o==null?void 0:o(l.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:fe.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[i,l]of n.entries())if(o.has(l.id)&&(r.push(i),o.delete(l.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,...Ws(e),pendingShouldSort:!1}:e};class Jr extends bi{constructor(t){super(t),ks(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:i,value:l}=this.state.dataRef.current;return _e(i,{0:()=>r==null?void 0:r(n),1:()=>{let u=l.slice(),s=u.findIndex(a=>o(a,n));return s===-1?u.push(n):u.splice(s,1),r==null?void 0:r(u)}})},registerOption:yr(()=>{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:yr(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:yr(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:fe.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),ks(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,l=n.options;return i!==null?((o=l[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=wr.get(null);this.disposables.add(r.on(Ei.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 Jr({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:fe.Nothing},__demoMode:n})}reduce(t,n){return _e(n.type,Hd,t,n)}}const Bs=m.createContext(null);function Zr(e){let t=m.useContext(Bs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Us),n}return t}function Us({id:e,__demoMode:t=!1}){let n=m.useMemo(()=>Jr.new({id:e,__demoMode:t}),[]);return Ns(()=>n.dispose()),n}let _n=m.createContext(null);_n.displayName="ListboxDataContext";function nn(e){let t=m.useContext(_n);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,nn),n}return t}let Gd=m.Fragment;function Yd(e,t){let n=m.useId(),r=dr(),{value:o,defaultValue:i,form:l,name:u,onChange:s,by:a,invalid:c=!1,disabled:d=r||!1,horizontal:p=!1,multiple:f=!1,__demoMode:g=!1,...v}=e;const E=p?"horizontal":"vertical";let M=We(t),w=cu(i),[N=f?[]:void 0,j]=uu(o,s,w),F=Us({id:n,__demoMode:g}),k=m.useRef({static:!1,hold:!1}),W=m.useRef(new Map),h=Fu(a),b=m.useCallback(z=>_e(x.mode,{[nt.Multi]:()=>N.some(G=>h(G,z)),[nt.Single]:()=>h(N,z)}),[N]),x=m.useMemo(()=>({value:N,disabled:d,invalid:c,mode:f?nt.Multi:nt.Single,orientation:E,onChange:j,compare:h,isSelected:b,optionsPropsRef:k,listRef:W}),[N,d,c,f,E,j,h,b,k,W]);ue(()=>{F.state.dataRef.current=x},[x]);let $=Ue(F,z=>z.listboxState),P=wr.get(null),A=Ue(P,m.useCallback(z=>P.selectors.isTop(z,n),[P,n])),[S,O]=Ue(F,z=>[z.buttonElement,z.optionsElement]);uc(A,[S,O],(z,G)=>{F.send({type:_s.CloseListbox}),Li(G,Ar.Loose)||(z.preventDefault(),S==null||S.focus())});let T=m.useMemo(()=>({open:$===be.Open,disabled:d,invalid:c,value:N}),[$,d,c,N]),[L,y]=Pu({inherit:!0}),I={ref:M},_=m.useCallback(()=>{if(w!==void 0)return j==null?void 0:j(w)},[j,w]),V=Me();return m.createElement(y,{value:L,props:{htmlFor:S==null?void 0:S.id},slot:{open:$===be.Open,disabled:d}},m.createElement(hd,null,m.createElement(Bs.Provider,{value:F},m.createElement(_n.Provider,{value:x},m.createElement(Os,{value:_e($,{[be.Open]:Xe.Open,[be.Closed]:Xe.Closed})},u!=null&&N!=null&&m.createElement(gu,{disabled:d,data:{[u]:N},form:l,onReset:_}),V({ourProps:I,theirProps:v,slot:T,defaultTag:Gd,name:"Listbox"}))))))}let Kd="button";function qd(e,t){let n=m.useId(),r=li(),o=nn("Listbox.Button"),i=Zr("Listbox.Button"),{id:l=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:s=!1,...a}=e,c=We(t,fd(),i.actions.setButtonElement),d=dd(),[p,f,g]=Ue(i,y=>[y.listboxState,y.buttonElement,y.optionsElement]),v=p===be.Open;dc(v,{trigger:f,action:m.useCallback(y=>{if(f!=null&&f.contains(y.target))return yn.Ignore;let I=y.target.closest('[role="option"]:not([data-disabled])');return ut(I)?yn.Select(I):g!=null&&g.contains(y.target)?yn.Ignore:yn.Close},[f,g]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let E=ne(y=>{switch(y.key){case ve.Enter:fu(y.currentTarget);break;case ve.Space:case ve.ArrowDown:y.preventDefault(),i.actions.openListbox({focus:o.value?fe.Nothing:fe.First});break;case ve.ArrowUp:y.preventDefault(),i.actions.openListbox({focus:o.value?fe.Nothing:fe.Last});break}}),M=ne(y=>{switch(y.key){case ve.Space:y.preventDefault();break}}),w=ne(y=>{var I;if(y.button===Ts.Left){if(Su(y.currentTarget))return y.preventDefault();i.state.listboxState===be.Open?(we.flushSync(()=>i.actions.closeListbox()),(I=i.state.buttonElement)==null||I.focus({preventScroll:!0})):(y.preventDefault(),i.actions.openListbox({focus:fe.Nothing}))}}),N=m.useRef(null),j=ne(y=>{N.current=y.pointerType,y.pointerType==="mouse"&&w(y)}),F=ne(y=>{N.current!=="mouse"&&w(y)}),k=ne(y=>y.preventDefault()),W=mi([l]),h=Tu(),{isFocusVisible:b,focusProps:x}=Qa({autoFocus:s}),{isHovered:$,hoverProps:P}=Xa({isDisabled:u}),{pressed:A,pressProps:S}=ru({disabled:u}),O=m.useMemo(()=>({open:p===be.Open,active:A||p===be.Open,disabled:u,invalid:o.invalid,value:o.value,hover:$,focus:b,autofocus:s}),[p,o.value,u,$,b,A,o.invalid,s]),T=Ue(i,y=>y.listboxState===be.Open),L=ni(d(),{ref:c,id:l,type:pc(e,f),"aria-haspopup":"listbox","aria-controls":g==null?void 0:g.id,"aria-expanded":T,"aria-labelledby":W,"aria-describedby":h,disabled:u||void 0,autoFocus:s,onKeyDown:E,onKeyUp:M,onKeyPress:k,onPointerDown:j,onClick:F},x,P,S);return Me()({ourProps:L,theirProps:a,slot:O,defaultTag:Kd,name:"Listbox.Button"})}let Vs=m.createContext(!1),Xd="div",Qd=gn.RenderStrategy|gn.Static;function Jd(e,t){let n=m.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:i=!1,modal:l=!0,transition:u=!1,...s}=e,a=cd(o),[c,d]=m.useState(null);a&&(i=!0);let p=nn("Listbox.Options"),f=Zr("Listbox.Options"),[g,v,E,M]=Ue(f,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),w=Lr(v),N=Lr(E),j=qr(),[F,k]=_i(u,c,j!==null?(j&Xe.Open)===Xe.Open:g===be.Open);Qu(F,v,f.actions.closeListbox);let W=M?!1:l&&g===be.Open;wc(W,N);let h=M?!1:l&&g===be.Open;Xu(h,{allowed:m.useCallback(()=>[v,E],[v,E])});let b=g!==be.Open,x=Wd(b,v)?!1:F,$=F&&g===be.Closed,P=bd($,p.value),A=ne(H=>p.compare(P,H)),S=Ue(f,H=>{var Z;if(a==null||!((Z=a==null?void 0:a.to)!=null&&Z.includes("selection")))return null;let ae=H.options.findIndex(Pe=>A(Pe.dataRef.current.value));return ae===-1&&(ae=0),ae}),O=(()=>{if(a==null)return;if(S===null)return{...a,inner:void 0};let H=Array.from(p.listRef.current.values());return{...a,inner:{listRef:{current:H},index:S}}})(),[T,L]=md(O),y=pd(),I=We(t,a?T:null,f.actions.setOptionsElement,d),_=$t();m.useEffect(()=>{var H;let Z=E;Z&&g===be.Open&&Z!==((H=Kt(Z))==null?void 0:H.activeElement)&&(Z==null||Z.focus({preventScroll:!0}))},[g,E]);let V=ne(H=>{var Z,ae;switch(_.dispose(),H.key){case ve.Space:if(f.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),f.actions.search(H.key);case ve.Enter:if(H.preventDefault(),H.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:Pe}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(Pe.current.value)}p.mode===nt.Single&&(we.flushSync(()=>f.actions.closeListbox()),(Z=f.state.buttonElement)==null||Z.focus({preventScroll:!0}));break;case _e(p.orientation,{vertical:ve.ArrowDown,horizontal:ve.ArrowRight}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.Next});case _e(p.orientation,{vertical:ve.ArrowUp,horizontal:ve.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.Previous});case ve.Home:case ve.PageUp:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.First});case ve.End:case ve.PageDown:return H.preventDefault(),H.stopPropagation(),f.actions.goToOption({focus:fe.Last});case ve.Escape:H.preventDefault(),H.stopPropagation(),we.flushSync(()=>f.actions.closeListbox()),(ae=f.state.buttonElement)==null||ae.focus({preventScroll:!0});return;case ve.Tab:H.preventDefault(),H.stopPropagation(),we.flushSync(()=>f.actions.closeListbox()),ic(f.state.buttonElement,H.shiftKey?Nr.Previous:Nr.Next);break;default:H.key.length===1&&(f.actions.search(H.key),_.setTimeout(()=>f.actions.clearSearch(),350));break}}),z=Ue(f,H=>{var Z;return(Z=H.buttonElement)==null?void 0:Z.id}),G=m.useMemo(()=>({open:g===be.Open}),[g]),q=ni(a?y():{},{id:r,ref:I,"aria-activedescendant":Ue(f,f.selectors.activeDescendantId),"aria-multiselectable":p.mode===nt.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:V,role:"listbox",tabIndex:g===be.Open?0:void 0,style:{...s.style,...L,"--button-width":ku(v,!0).width},...ki(k)}),B=Me(),K=m.useMemo(()=>p.mode===nt.Multi?p:{...p,isSelected:A},[p,A]);return m.createElement($d,{enabled:i?e.static||F:!1,ownerDocument:w},m.createElement(_n.Provider,{value:K},B({ourProps:q,theirProps:s,slot:G,defaultTag:Xd,features:Qd,visible:x,name:"Listbox.Options"})))}let Zd="div";function ep(e,t){let n=m.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:i,...l}=e,u=m.useContext(Vs)===!0,s=nn("Listbox.Option"),a=Zr("Listbox.Option"),c=Ue(a,x=>a.selectors.isActive(x,r)),d=s.isSelected(i),p=m.useRef(null),f=Ud(p),g=Ot({disabled:o,value:i,domRef:p,get textValue(){return f()}}),v=We(t,p,x=>{x?s.listRef.current.set(r,x):s.listRef.current.delete(r)}),E=Ue(a,x=>a.selectors.shouldScrollIntoView(x,r));ue(()=>{if(E)return qe().requestAnimationFrame(()=>{var x,$;($=(x=p.current)==null?void 0:x.scrollIntoView)==null||$.call(x,{block:"nearest"})})},[E,p]),ue(()=>{if(!u)return a.actions.registerOption(r,g),()=>a.actions.unregisterOption(r)},[g,r,u]);let M=ne(x=>{var $;if(o)return x.preventDefault();a.actions.onChange(i),s.mode===nt.Single&&(we.flushSync(()=>a.actions.closeListbox()),($=a.state.buttonElement)==null||$.focus({preventScroll:!0}))}),w=ne(()=>{if(o)return a.actions.goToOption({focus:fe.Nothing});a.actions.goToOption({focus:fe.Specific,id:r})}),N=Ec(),j=ne(x=>N.update(x)),F=ne(x=>{N.wasMoved(x)&&(o||c&&a.state.activationTrigger===kn.Pointer||a.actions.goToOption({focus:fe.Specific,id:r},kn.Pointer))}),k=ne(x=>{N.wasMoved(x)&&(o||c&&a.state.activationTrigger===kn.Pointer&&a.actions.goToOption({focus:fe.Nothing}))}),W=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:M,onFocus:w,onPointerEnter:j,onMouseEnter:j,onPointerMove:F,onMouseMove:F,onPointerLeave:k,onMouseLeave:k},b=Me();return!d&&u?null:b({ourProps:h,theirProps:l,slot:W,defaultTag:Zd,name:"Listbox.Option"})}let tp=m.Fragment;function np(e,t){let{options:n,placeholder:r,...o}=e,i={ref:We(t)},l=nn("ListboxSelectedOption"),u=m.useMemo(()=>({}),[]),s=l.value===void 0||l.value===null||l.mode===nt.Multi&&Array.isArray(l.value)&&l.value.length===0,a=Me();return m.createElement(Vs.Provider,{value:!0},a({ourProps:i,theirProps:{...o,children:m.createElement(m.Fragment,null,r&&s?r:n)},slot:u,defaultTag:tp,name:"ListboxSelectedOption"}))}let rp=Te(Yd),op=Te(qd),ip=Iu,sp=Te(Jd),lp=Te(ep),ap=Te(np),wt=Object.assign(rp,{Button:op,Label:ip,Options:sp,Option:lp,SelectedOption:ap});function up({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 zs=R.forwardRef(up),cp=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>{const{t:i}=Ke();return C.jsx("div",{className:`relative ${o}`,children:C.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:l})=>C.jsxs(C.Fragment,{children:[C.jsxs(wt.Button,{className:`
84
84
  relative w-full h-9 text-text-primary bg-fill-input-primary
85
85
  items-center justify-between flex px-3 rounded-lg
86
86
  focus:outline-none
87
87
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
88
88
  ${l?"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 ${l?"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(Is,{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(wt.Options,{className:`
89
+ `,children:[C.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.asset")}),C.jsxs("div",{className:"flex items-center",children:[t.iconUrl?C.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):C.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:C.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),C.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),C.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${l?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[C.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_12919_27745",children:C.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),C.jsx(js,{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:C.jsx(wt.Options,{className:`
90
90
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
91
91
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
92
92
  focus:outline-none
93
- `,children:e.map(u=>O.jsx(wt.Option,{value:u,className:({active:s,selected:a})=>`relative cursor-pointer select-none py-3 px-3 ${a?"bg-fill-btn-secondary":s?"bg-fill-input-secondary":""}`,children:({selected:s,active:a})=>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||a?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),s&&O.jsx(Vs,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})})},fp=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:i="mpc"})=>{const{t:l}=Ke();return O.jsx("div",{className:`relative ${o}`,children:O.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:u})=>O.jsxs(O.Fragment,{children:[O.jsxs(wt.Button,{className:`
93
+ `,children:e.map(u=>C.jsx(wt.Option,{value:u,className:({active:s,selected:a})=>`relative cursor-pointer select-none py-3 px-3 ${a?"bg-fill-btn-secondary":s?"bg-fill-input-secondary":""}`,children:({selected:s,active:a})=>C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("div",{className:"flex items-center space-x-3",children:[u.iconUrl?C.jsx("img",{src:u.iconUrl,alt:u.token,className:"w-5 h-5 rounded-full"}):C.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:C.jsx("span",{className:"text-xs text-white font-bold",children:u.token.charAt(0)})}),C.jsx("div",{className:"flex flex-col",children:C.jsx("span",{className:`text-sm font-medium ${s||a?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),s&&C.jsx(zs,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})})},fp=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:i="mpc"})=>{const{t:l}=Ke();return C.jsx("div",{className:`relative ${o}`,children:C.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:u})=>C.jsxs(C.Fragment,{children:[C.jsxs(wt.Button,{className:`
94
94
  relative w-full h-9 text-text-primary bg-fill-input-primary
95
95
  items-center justify-between flex px-3 rounded-lg
96
96
  focus:outline-none
97
97
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
98
98
  ${u?"ring-1 ring-white":""}
99
- `,children:[O.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("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(Is,{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(wt.Options,{className:`
99
+ `,children:[C.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.chain")}),C.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?C.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):C.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:C.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),C.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),C.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:[C.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_12919_27745",children:C.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),C.jsx(js,{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:C.jsx(wt.Options,{className:`
100
100
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
101
101
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
102
102
  focus:outline-none
103
- `,children:e.filter(s=>s[i==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(s=>O.jsx(wt.Option,{value:s,className:({active:a,selected:c})=>`relative cursor-pointer select-none py-3 px-3 ${c?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,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 ${a||c?"text-text-primary":"text-text-tertiary"}`,children:s.chain})})]}),a&&O.jsx(Vs,{className:"w-4 h-4 text-blue-400"})]})},s.chainId))})})]})})})},eo=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:i="mpc"})=>{const l=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)},a=m.useMemo(()=>t.map(f=>f),[t]),c=m.useMemo(()=>a.find(f=>f.chainId===e.chainId)||a[0],[a,e.chainId]),d=m.useMemo(()=>l.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[l]),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(fp,{chains:a,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(cp,{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"})})]})},dp=(e,t)=>Number(e)>Number(t),Qe=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"},to=(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 to(s,t)}const i=parseFloat(e),l=parseFloat(t);return!isNaN(i)&&!isNaN(l)&&i>l?{isValid:!0,formattedValue:Qe(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},pp=(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)},zs={ETHEREUM:1,SEPOLIA:11155111},mp=[zs.ETHEREUM,zs.SEPOLIA],hp=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!mp.includes(t)}return!0},gp=[{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}],no={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},ro={address:"0x1234567890123456789012345678901234567890"},oo={multiChain:{minDeposit:10}};var _n={},vp=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()}},bp=vp,Hs={"text/plain":"Text","text/html":"Url",default:"Text"},xp="Copy to clipboard: #{key}, Enter";function yp(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function wp(e,t){var n,r,o,i,l,u,s=!1;t||(t={}),n=t.debug||!1;try{o=bp(),i=document.createRange(),l=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=Hs[t.format]||Hs.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),l.addRange(i);var a=document.execCommand("copy");if(!a)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=yp("message"in t?t.message:xp),window.prompt(r,e)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(i):l.removeAllRanges()),u&&document.body.removeChild(u),o()}return s}var Ep=wp;function io(e){"@babel/helpers - typeof";return io=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},io(e)}Object.defineProperty(_n,"__esModule",{value:!0}),_n.CopyToClipboard=void 0;var Bn=Gs(m),Sp=Gs(Ep),Cp=["text","onCopy","options","children"];function Gs(e){return e&&e.__esModule?e:{default:e}}function Ys(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 Ks(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ys(Object(n),!0).forEach(function(r){lo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ys(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Op(e,t){if(e==null)return{};var n=Tp(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 Tp(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 Np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lp(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 $p(e,t,n){return t&&Lp(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pp(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&&so(e,t)}function so(e,t){return so=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},so(e,t)}function Ap(e){var t=Mp();return function(){var r=Wn(e),o;if(t){var i=Wn(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Dp(this,o)}}function Dp(e,t){if(t&&(io(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qs(e)}function qs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mp(){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 lo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xs=function(e){Pp(n,e);var t=Ap(n);function n(){var r;Np(this,n);for(var o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];return r=t.call.apply(t,[this].concat(i)),lo(qs(r),"onClick",function(u){var s=r.props,a=s.text,c=s.onCopy,d=s.children,p=s.options,f=Bn.default.Children.only(d),g=(0,Sp.default)(a,p);c&&c(a,g),f&&f.props&&typeof f.props.onClick=="function"&&f.props.onClick(u)}),r}return $p(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var i=o.children,l=Op(o,Cp),u=Bn.default.Children.only(i);return Bn.default.cloneElement(u,Ks(Ks({},l),{},{onClick:this.onClick}))}}]),n}(Bn.default.PureComponent);_n.CopyToClipboard=Xs,lo(Xs,"defaultProps",{onCopy:void 0,options:void 0});var Ip=_n,ao=Ip.CopyToClipboard;ao.CopyToClipboard=ao;var jp=ao;const Fp=oa(jp);var kp=Object.defineProperty,Un=Object.getOwnPropertySymbols,Qs=Object.prototype.hasOwnProperty,Js=Object.prototype.propertyIsEnumerable,Zs=(e,t,n)=>t in e?kp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uo=(e,t)=>{for(var n in t||(t={}))Qs.call(t,n)&&Zs(e,n,t[n]);if(Un)for(var n of Un(t))Js.call(t,n)&&Zs(e,n,t[n]);return e},co=(e,t)=>{var n={};for(var r in e)Qs.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Un)for(var r of Un(e))t.indexOf(r)<0&&Js.call(e,r)&&(n[r]=e[r]);return n};/**
103
+ `,children:e.filter(s=>s[i==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(s=>C.jsx(wt.Option,{value:s,className:({active:a,selected:c})=>`relative cursor-pointer select-none py-3 px-3 ${c?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,active:c})=>C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("div",{className:"flex items-center space-x-3",children:[s.chainIconUrl?C.jsx("img",{src:s.chainIconUrl,alt:s.chain,className:"w-5 h-5 rounded-full"}):C.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:C.jsx("span",{className:"text-xs text-white font-bold",children:s.chain.charAt(0)})}),C.jsx("div",{className:"flex flex-col",children:C.jsx("span",{className:`text-sm font-medium ${a||c?"text-text-primary":"text-text-tertiary"}`,children:s.chain})})]}),a&&C.jsx(zs,{className:"w-4 h-4 text-blue-400"})]})},s.chainId))})})]})})})},eo=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:i="mpc"})=>{const l=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)},a=m.useMemo(()=>t.map(f=>f),[t]),c=m.useMemo(()=>a.find(f=>f.chainId===e.chainId)||a[0],[a,e.chainId]),d=m.useMemo(()=>l.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[l]),p=m.useMemo(()=>{if(d.length!==0)return d.find(f=>f.token===r||f.symbol===r)||d[0]},[d,r]);return C.jsxs("div",{className:"space-y-4",children:[C.jsx(fp,{chains:a,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&&C.jsx(cp,{tokens:d,selectedToken:p,onTokenChange:s,className:"w-full"}):C.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:C.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},dp=(e,t)=>Number(e)>Number(t),Qe=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"},to=(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 to(s,t)}const i=parseFloat(e),l=parseFloat(t);return!isNaN(i)&&!isNaN(l)&&i>l?{isValid:!0,formattedValue:Qe(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},pp=(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)},Hs={ETHEREUM:1,SEPOLIA:11155111},mp=[Hs.ETHEREUM,Hs.SEPOLIA],hp=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!mp.includes(t)}return!0},gp=[{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}],no={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},ro={address:"0x1234567890123456789012345678901234567890"},oo={multiChain:{minDeposit:10}};var Wn={},vp=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()}},bp=vp,Gs={"text/plain":"Text","text/html":"Url",default:"Text"},xp="Copy to clipboard: #{key}, Enter";function yp(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function wp(e,t){var n,r,o,i,l,u,s=!1;t||(t={}),n=t.debug||!1;try{o=bp(),i=document.createRange(),l=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=Gs[t.format]||Gs.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),l.addRange(i);var a=document.execCommand("copy");if(!a)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=yp("message"in t?t.message:xp),window.prompt(r,e)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(i):l.removeAllRanges()),u&&document.body.removeChild(u),o()}return s}var Ep=wp;function io(e){"@babel/helpers - typeof";return io=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},io(e)}Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.CopyToClipboard=void 0;var Bn=Ys(m),Sp=Ys(Ep),Cp=["text","onCopy","options","children"];function Ys(e){return e&&e.__esModule?e:{default:e}}function Ks(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 qs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ks(Object(n),!0).forEach(function(r){lo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ks(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Op(e,t){if(e==null)return{};var n=Tp(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 Tp(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 Np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ap(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 Lp(e,t,n){return t&&Ap(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pp(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&&so(e,t)}function so(e,t){return so=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},so(e,t)}function $p(e){var t=Mp();return function(){var r=Un(e),o;if(t){var i=Un(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Dp(this,o)}}function Dp(e,t){if(t&&(io(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xs(e)}function Xs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mp(){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 Un(e){return Un=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Un(e)}function lo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qs=function(e){Pp(n,e);var t=$p(n);function n(){var r;Np(this,n);for(var o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];return r=t.call.apply(t,[this].concat(i)),lo(Xs(r),"onClick",function(u){var s=r.props,a=s.text,c=s.onCopy,d=s.children,p=s.options,f=Bn.default.Children.only(d),g=(0,Sp.default)(a,p);c&&c(a,g),f&&f.props&&typeof f.props.onClick=="function"&&f.props.onClick(u)}),r}return Lp(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var i=o.children,l=Op(o,Cp),u=Bn.default.Children.only(i);return Bn.default.cloneElement(u,qs(qs({},l),{},{onClick:this.onClick}))}}]),n}(Bn.default.PureComponent);Wn.CopyToClipboard=Qs,lo(Qs,"defaultProps",{onCopy:void 0,options:void 0});var Ip=Wn,ao=Ip.CopyToClipboard;ao.CopyToClipboard=ao;var jp=ao;const Fp=oa(jp);var Rp=Object.defineProperty,Vn=Object.getOwnPropertySymbols,Js=Object.prototype.hasOwnProperty,Zs=Object.prototype.propertyIsEnumerable,el=(e,t,n)=>t in e?Rp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uo=(e,t)=>{for(var n in t||(t={}))Js.call(t,n)&&el(e,n,t[n]);if(Vn)for(var n of Vn(t))Zs.call(t,n)&&el(e,n,t[n]);return e},co=(e,t)=>{var n={};for(var r in e)Js.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Vn)for(var r of Vn(e))t.indexOf(r)<0&&Zs.call(e,r)&&(n[r]=e[r]);return n};/**
104
104
  * @license QR Code generator library (TypeScript)
105
105
  * Copyright (c) Project Nayuki.
106
106
  * SPDX-License-Identifier: MIT
107
- */var $t;(e=>{const t=class ee{constructor(s,a,c,d){if(this.version=s,this.errorCorrectionLevel=a,this.modules=[],this.isFunction=[],s<ee.MIN_VERSION||s>ee.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=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,a){const c=e.QrSegment.makeSegments(s);return ee.encodeSegments(c,a)}static encodeBinary(s,a){const c=e.QrSegment.makeBytes(s);return ee.encodeSegments([c],a)}static encodeSegments(s,a,c=1,d=40,p=-1,f=!0){if(!(ee.MIN_VERSION<=c&&c<=d&&d<=ee.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let g,v;for(g=c;;g++){const T=ee.getNumDataCodewords(g,a)*8,j=l.getTotalBits(s,g);if(j<=T){v=j;break}if(g>=d)throw new RangeError("Data too long")}for(const T of[ee.Ecc.MEDIUM,ee.Ecc.QUARTILE,ee.Ecc.HIGH])f&&v<=ee.getNumDataCodewords(g,T)*8&&(a=T);let E=[];for(const T of s){n(T.mode.modeBits,4,E),n(T.numChars,T.mode.numCharCountBits(g),E);for(const j of T.getData())E.push(j)}o(E.length==v);const M=ee.getNumDataCodewords(g,a)*8;o(E.length<=M),n(0,Math.min(4,M-E.length),E),n(0,(8-E.length%8)%8,E),o(E.length%8==0);for(let T=236;E.length<M;T^=253)n(T,8,E);let y=[];for(;y.length*8<E.length;)y.push(0);return E.forEach((T,j)=>y[j>>>3]|=T<<7-(j&7)),new ee(g,a,y,p)}getModule(s,a){return 0<=s&&s<this.size&&0<=a&&a<this.size&&this.modules[a][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(),a=s.length;for(let c=0;c<a;c++)for(let d=0;d<a;d++)c==0&&d==0||c==0&&d==a-1||c==a-1&&d==0||this.drawAlignmentPattern(s[c],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const a=this.errorCorrectionLevel.formatBits<<3|s;let c=a;for(let p=0;p<10;p++)c=c<<1^(c>>>9)*1335;const d=(a<<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 a=this.version<<12|s;o(a>>>18==0);for(let c=0;c<18;c++){const d=r(a,c),p=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(p,f,d),this.setFunctionModule(f,p,d)}}drawFinderPattern(s,a){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=a+c;0<=f&&f<this.size&&0<=g&&g<this.size&&this.setFunctionModule(f,g,p!=2&&p!=4)}}drawAlignmentPattern(s,a){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,a+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(s,a,c){this.modules[a][s]=c,this.isFunction[a][s]=!0}addEccAndInterleave(s){const a=this.version,c=this.errorCorrectionLevel;if(s.length!=ee.getNumDataCodewords(a,c))throw new RangeError("Invalid argument");const d=ee.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a],p=ee.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a],f=Math.floor(ee.getNumRawDataModules(a)/8),g=d-f%d,v=Math.floor(f/d);let E=[];const M=ee.reedSolomonComputeDivisor(p);for(let T=0,j=0;T<d;T++){let F=s.slice(j,j+v-p+(T<g?0:1));j+=F.length;const _=ee.reedSolomonComputeRemainder(F,M);T<g&&F.push(0),E.push(F.concat(_))}let y=[];for(let T=0;T<E[0].length;T++)E.forEach((j,F)=>{(T!=v-p||F>=g)&&y.push(j[T])});return o(y.length==f),y}drawCodewords(s){if(s.length!=Math.floor(ee.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let a=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]&&a<s.length*8&&(this.modules[v][f]=r(s[a>>>3],7-(a&7)),a++)}}o(a==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let a=0;a<this.size;a++)for(let c=0;c<this.size;c++){let d;switch(s){case 0:d=(c+a)%2==0;break;case 1:d=a%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+a)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(a/2))%2==0;break;case 5:d=c*a%2+c*a%3==0;break;case 6:d=(c*a%2+c*a%3)%2==0;break;case 7:d=((c+a)%2+c*a%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[a][c]&&d&&(this.modules[a][c]=!this.modules[a][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+=ee.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[p][E],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*ee.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+=ee.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[E][p],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*ee.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+=ee.PENALTY_N2)}let a=0;for(const p of this.modules)a=p.reduce((f,g)=>f+(g?1:0),a);const c=this.size*this.size,d=Math.ceil(Math.abs(a*20-c*10)/c)-1;return o(0<=d&&d<=9),s+=d*ee.PENALTY_N4,o(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,a=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-=a)c.splice(1,0,d);return c}}static getNumRawDataModules(s){if(s<ee.MIN_VERSION||s>ee.MAX_VERSION)throw new RangeError("Version number out of range");let a=(16*s+128)*s+64;if(s>=2){const c=Math.floor(s/7)+2;a-=(25*c-10)*c-55,s>=7&&(a-=36)}return o(208<=a&&a<=29648),a}static getNumDataCodewords(s,a){return Math.floor(ee.getNumRawDataModules(s)/8)-ee.ECC_CODEWORDS_PER_BLOCK[a.ordinal][s]*ee.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let a=[];for(let d=0;d<s-1;d++)a.push(0);a.push(1);let c=1;for(let d=0;d<s;d++){for(let p=0;p<a.length;p++)a[p]=ee.reedSolomonMultiply(a[p],c),p+1<a.length&&(a[p]^=a[p+1]);c=ee.reedSolomonMultiply(c,2)}return a}static reedSolomonComputeRemainder(s,a){let c=a.map(d=>0);for(const d of s){const p=d^c.shift();c.push(0),a.forEach((f,g)=>c[g]^=ee.reedSolomonMultiply(f,p))}return c}static reedSolomonMultiply(s,a){if(s>>>8||a>>>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^=(a>>>d&1)*s;return o(c>>>8==0),c}finderPenaltyCountPatterns(s){const a=s[1];o(a<=this.size*3);const c=a>0&&s[2]==a&&s[3]==a*3&&s[4]==a&&s[5]==a;return(c&&s[0]>=a*4&&s[6]>=a?1:0)+(c&&s[6]>=a*4&&s[0]>=a?1:0)}finderPenaltyTerminateAndCount(s,a,c){return s&&(this.finderPenaltyAddHistory(a,c),a=0),a+=this.size,this.finderPenaltyAddHistory(a,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(s,a){a[0]==0&&(s+=this.size),a.pop(),a.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,a){if(s<0||s>31||u>>>s)throw new RangeError("Value out of range");for(let c=s-1;c>=0;c--)a.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,a,c){if(this.mode=s,this.numChars=a,this.bitData=c,a<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(s){let a=[];for(const c of s)n(c,8,a);return new de(de.Mode.BYTE,s.length,a)}static makeNumeric(s){if(!de.isNumeric(s))throw new RangeError("String contains non-numeric characters");let a=[];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,a),c+=d}return new de(de.Mode.NUMERIC,s.length,a)}static makeAlphanumeric(s){if(!de.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let a=[],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,a)}return c<s.length&&n(de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c)),6,a),new de(de.Mode.ALPHANUMERIC,s.length,a)}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 a=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)n(s,8,a);else if(s<16384)n(2,2,a),n(s,14,a);else if(s<1e6)n(6,3,a),n(s,21,a);else throw new RangeError("ECI assignment value out of range");return new de(de.Mode.ECI,0,a)}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,a){let c=0;for(const d of s){const p=d.mode.numCharCountBits(a);if(d.numChars>=1<<p)return 1/0;c+=4+p+d.bitData.length}return c}static toUtf8ByteArray(s){s=encodeURI(s);let a=[];for(let c=0;c<s.length;c++)s.charAt(c)!="%"?a.push(s.charCodeAt(c)):(a.push(parseInt(s.substring(c+1,c+3),16)),c+=2);return a}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let l=i;e.QrSegment=i})($t||($t={})),(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={}))})($t||($t={})),(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={}))})($t||($t={}));var Rt=$t;/**
107
+ */var Lt;(e=>{const t=class ee{constructor(s,a,c,d){if(this.version=s,this.errorCorrectionLevel=a,this.modules=[],this.isFunction=[],s<ee.MIN_VERSION||s>ee.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=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,a){const c=e.QrSegment.makeSegments(s);return ee.encodeSegments(c,a)}static encodeBinary(s,a){const c=e.QrSegment.makeBytes(s);return ee.encodeSegments([c],a)}static encodeSegments(s,a,c=1,d=40,p=-1,f=!0){if(!(ee.MIN_VERSION<=c&&c<=d&&d<=ee.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let g,v;for(g=c;;g++){const N=ee.getNumDataCodewords(g,a)*8,j=l.getTotalBits(s,g);if(j<=N){v=j;break}if(g>=d)throw new RangeError("Data too long")}for(const N of[ee.Ecc.MEDIUM,ee.Ecc.QUARTILE,ee.Ecc.HIGH])f&&v<=ee.getNumDataCodewords(g,N)*8&&(a=N);let E=[];for(const N of s){n(N.mode.modeBits,4,E),n(N.numChars,N.mode.numCharCountBits(g),E);for(const j of N.getData())E.push(j)}o(E.length==v);const M=ee.getNumDataCodewords(g,a)*8;o(E.length<=M),n(0,Math.min(4,M-E.length),E),n(0,(8-E.length%8)%8,E),o(E.length%8==0);for(let N=236;E.length<M;N^=253)n(N,8,E);let w=[];for(;w.length*8<E.length;)w.push(0);return E.forEach((N,j)=>w[j>>>3]|=N<<7-(j&7)),new ee(g,a,w,p)}getModule(s,a){return 0<=s&&s<this.size&&0<=a&&a<this.size&&this.modules[a][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(),a=s.length;for(let c=0;c<a;c++)for(let d=0;d<a;d++)c==0&&d==0||c==0&&d==a-1||c==a-1&&d==0||this.drawAlignmentPattern(s[c],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const a=this.errorCorrectionLevel.formatBits<<3|s;let c=a;for(let p=0;p<10;p++)c=c<<1^(c>>>9)*1335;const d=(a<<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 a=this.version<<12|s;o(a>>>18==0);for(let c=0;c<18;c++){const d=r(a,c),p=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(p,f,d),this.setFunctionModule(f,p,d)}}drawFinderPattern(s,a){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=a+c;0<=f&&f<this.size&&0<=g&&g<this.size&&this.setFunctionModule(f,g,p!=2&&p!=4)}}drawAlignmentPattern(s,a){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,a+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(s,a,c){this.modules[a][s]=c,this.isFunction[a][s]=!0}addEccAndInterleave(s){const a=this.version,c=this.errorCorrectionLevel;if(s.length!=ee.getNumDataCodewords(a,c))throw new RangeError("Invalid argument");const d=ee.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a],p=ee.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a],f=Math.floor(ee.getNumRawDataModules(a)/8),g=d-f%d,v=Math.floor(f/d);let E=[];const M=ee.reedSolomonComputeDivisor(p);for(let N=0,j=0;N<d;N++){let F=s.slice(j,j+v-p+(N<g?0:1));j+=F.length;const k=ee.reedSolomonComputeRemainder(F,M);N<g&&F.push(0),E.push(F.concat(k))}let w=[];for(let N=0;N<E[0].length;N++)E.forEach((j,F)=>{(N!=v-p||F>=g)&&w.push(j[N])});return o(w.length==f),w}drawCodewords(s){if(s.length!=Math.floor(ee.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let a=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]&&a<s.length*8&&(this.modules[v][f]=r(s[a>>>3],7-(a&7)),a++)}}o(a==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let a=0;a<this.size;a++)for(let c=0;c<this.size;c++){let d;switch(s){case 0:d=(c+a)%2==0;break;case 1:d=a%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+a)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(a/2))%2==0;break;case 5:d=c*a%2+c*a%3==0;break;case 6:d=(c*a%2+c*a%3)%2==0;break;case 7:d=((c+a)%2+c*a%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[a][c]&&d&&(this.modules[a][c]=!this.modules[a][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+=ee.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[p][E],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*ee.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+=ee.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),f||(s+=this.finderPenaltyCountPatterns(v)*ee.PENALTY_N3),f=this.modules[E][p],g=1);s+=this.finderPenaltyTerminateAndCount(f,g,v)*ee.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+=ee.PENALTY_N2)}let a=0;for(const p of this.modules)a=p.reduce((f,g)=>f+(g?1:0),a);const c=this.size*this.size,d=Math.ceil(Math.abs(a*20-c*10)/c)-1;return o(0<=d&&d<=9),s+=d*ee.PENALTY_N4,o(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,a=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-=a)c.splice(1,0,d);return c}}static getNumRawDataModules(s){if(s<ee.MIN_VERSION||s>ee.MAX_VERSION)throw new RangeError("Version number out of range");let a=(16*s+128)*s+64;if(s>=2){const c=Math.floor(s/7)+2;a-=(25*c-10)*c-55,s>=7&&(a-=36)}return o(208<=a&&a<=29648),a}static getNumDataCodewords(s,a){return Math.floor(ee.getNumRawDataModules(s)/8)-ee.ECC_CODEWORDS_PER_BLOCK[a.ordinal][s]*ee.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let a=[];for(let d=0;d<s-1;d++)a.push(0);a.push(1);let c=1;for(let d=0;d<s;d++){for(let p=0;p<a.length;p++)a[p]=ee.reedSolomonMultiply(a[p],c),p+1<a.length&&(a[p]^=a[p+1]);c=ee.reedSolomonMultiply(c,2)}return a}static reedSolomonComputeRemainder(s,a){let c=a.map(d=>0);for(const d of s){const p=d^c.shift();c.push(0),a.forEach((f,g)=>c[g]^=ee.reedSolomonMultiply(f,p))}return c}static reedSolomonMultiply(s,a){if(s>>>8||a>>>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^=(a>>>d&1)*s;return o(c>>>8==0),c}finderPenaltyCountPatterns(s){const a=s[1];o(a<=this.size*3);const c=a>0&&s[2]==a&&s[3]==a*3&&s[4]==a&&s[5]==a;return(c&&s[0]>=a*4&&s[6]>=a?1:0)+(c&&s[6]>=a*4&&s[0]>=a?1:0)}finderPenaltyTerminateAndCount(s,a,c){return s&&(this.finderPenaltyAddHistory(a,c),a=0),a+=this.size,this.finderPenaltyAddHistory(a,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(s,a){a[0]==0&&(s+=this.size),a.pop(),a.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,a){if(s<0||s>31||u>>>s)throw new RangeError("Value out of range");for(let c=s-1;c>=0;c--)a.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,a,c){if(this.mode=s,this.numChars=a,this.bitData=c,a<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(s){let a=[];for(const c of s)n(c,8,a);return new de(de.Mode.BYTE,s.length,a)}static makeNumeric(s){if(!de.isNumeric(s))throw new RangeError("String contains non-numeric characters");let a=[];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,a),c+=d}return new de(de.Mode.NUMERIC,s.length,a)}static makeAlphanumeric(s){if(!de.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let a=[],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,a)}return c<s.length&&n(de.ALPHANUMERIC_CHARSET.indexOf(s.charAt(c)),6,a),new de(de.Mode.ALPHANUMERIC,s.length,a)}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 a=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)n(s,8,a);else if(s<16384)n(2,2,a),n(s,14,a);else if(s<1e6)n(6,3,a),n(s,21,a);else throw new RangeError("ECI assignment value out of range");return new de(de.Mode.ECI,0,a)}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,a){let c=0;for(const d of s){const p=d.mode.numCharCountBits(a);if(d.numChars>=1<<p)return 1/0;c+=4+p+d.bitData.length}return c}static toUtf8ByteArray(s){s=encodeURI(s);let a=[];for(let c=0;c<s.length;c++)s.charAt(c)!="%"?a.push(s.charCodeAt(c)):(a.push(parseInt(s.substring(c+1,c+3),16)),c+=2);return a}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let l=i;e.QrSegment=i})(Lt||(Lt={})),(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={}))})(Lt||(Lt={})),(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={}))})(Lt||(Lt={}));var kt=Lt;/**
108
108
  * @license qrcode.react
109
109
  * Copyright (c) Paul O'Shannessy
110
110
  * SPDX-License-Identifier: ISC
111
- */var Rp={L:Rt.QrCode.Ecc.LOW,M:Rt.QrCode.Ecc.MEDIUM,Q:Rt.QrCode.Ecc.QUARTILE,H:Rt.QrCode.Ecc.HIGH},el=128,tl="L",nl="#FFFFFF",rl="#000000",ol=!1,il=1,_p=4,Bp=0,Wp=.1;function sl(e,t=0){const n=[];return e.forEach(function(r,o){let i=null;r.forEach(function(l,u){if(!l&&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(!l)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}l&&i===null&&(i=u)})}),n.join("")}function ll(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 Up(e,t,n,r){if(r==null)return null;const o=e.length+n*2,i=Math.floor(t*Wp),l=o/t,u=(r.width||i)*l,s=(r.height||i)*l,a=r.x==null?e.length/2-u/2:r.x*l,c=r.y==null?e.length/2-s/2:r.y*l,d=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let g=Math.floor(a),v=Math.floor(c),E=Math.ceil(u+a-g),M=Math.ceil(s+c-v);p={x:g,y:v,w:E,h:M}}const f=r.crossOrigin;return{x:a,y:c,h:s,w:u,excavation:p,opacity:d,crossOrigin:f}}function Vp(e,t){return t!=null?Math.max(Math.floor(t),0):e?_p:Bp}function al({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:i,size:l,boostLevel:u}){let s=m.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((v,E)=>(v.push(...Rt.QrSegment.makeSegments(E)),v),[]);return Rt.QrCode.encodeSegments(g,Rp[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:a,margin:c,numCells:d,calculatedImageSettings:p}=m.useMemo(()=>{let f=s.getModules();const g=Vp(r,o),v=f.length+g*2,E=Up(f,l,g,i);return{cells:f,margin:g,numCells:v,calculatedImageSettings:E}},[s,l,i,r,o]);return{qrcode:s,margin:c,cells:a,numCells:d,calculatedImageSettings:p}}var zp=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Hp=m.forwardRef(function(t,n){const r=t,{value:o,size:i=el,level:l=tl,bgColor:u=nl,fgColor:s=rl,includeMargin:a=ol,minVersion:c=il,boostLevel:d,marginSize:p,imageSettings:f}=r,v=co(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:E}=v,M=co(v,["style"]),y=f==null?void 0:f.src,T=m.useRef(null),j=m.useRef(null),F=m.useCallback(S=>{T.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[_,B]=m.useState(!1),{margin:h,cells:b,numCells:x,calculatedImageSettings:A}=al({value:o,level:l,minVersion:c,boostLevel:d,includeMargin:a,marginSize:p,imageSettings:f,size:i});m.useEffect(()=>{if(T.current!=null){const S=T.current,C=S.getContext("2d");if(!C)return;let N=b;const $=j.current,w=A!=null&&$!==null&&$.complete&&$.naturalHeight!==0&&$.naturalWidth!==0;w&&A.excavation!=null&&(N=ll(b,A.excavation));const I=window.devicePixelRatio||1;S.height=S.width=i*I;const R=i/x*I;C.scale(R,R),C.fillStyle=u,C.fillRect(0,0,x,x),C.fillStyle=s,zp?C.fill(new Path2D(sl(N,h))):b.forEach(function(V,z){V.forEach(function(G,q){G&&C.fillRect(q+h,z+h,1,1)})}),A&&(C.globalAlpha=A.opacity),w&&C.drawImage($,A.x+h,A.y+h,A.w,A.h)}}),m.useEffect(()=>{B(!1)},[y]);const P=uo({height:i,width:i},E);let L=null;return y!=null&&(L=m.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{B(!0)},ref:j,crossOrigin:A==null?void 0:A.crossOrigin})),m.createElement(m.Fragment,null,m.createElement("canvas",uo({style:P,height:i,width:i,ref:F,role:"img"},M)),L)});Hp.displayName="QRCodeCanvas";var ul=m.forwardRef(function(t,n){const r=t,{value:o,size:i=el,level:l=tl,bgColor:u=nl,fgColor:s=rl,includeMargin:a=ol,minVersion:c=il,boostLevel:d,title:p,marginSize:f,imageSettings:g}=r,v=co(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:E,cells:M,numCells:y,calculatedImageSettings:T}=al({value:o,level:l,minVersion:c,boostLevel:d,includeMargin:a,marginSize:f,imageSettings:g,size:i});let j=M,F=null;g!=null&&T!=null&&(T.excavation!=null&&(j=ll(M,T.excavation)),F=m.createElement("image",{href:g.src,height:T.h,width:T.w,x:T.x+E,y:T.y+E,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const _=sl(j,E);return m.createElement("svg",uo({height:i,width:i,viewBox:`0 0 ${y} ${y}`,ref:n,role:"img"},v),!!p&&m.createElement("title",null,p),m.createElement("path",{fill:u,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),m.createElement("path",{fill:s,d:_,shapeRendering:"crispEdges"}),F)});ul.displayName="QRCodeSVG";function Gp(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Yp(){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 cl(){return/apple/i.test(navigator.vendor)}function Kp(){return Gp().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function qp(){return Yp().includes("jsdom/")}const fl="data-floating-ui-focusable",Xp="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fo(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 _t(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Ar(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Bt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function po(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 Qp(e){return e.matches("html,body")}function rt(e){return(e==null?void 0:e.ownerDocument)||document}function dl(e){return Ee(e)&&e.matches(Xp)}function Jp(e){if(!e||qp())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Zp(e){return e?e.hasAttribute(fl)?e:e.querySelector("["+fl+"]")||e:null}function Vn(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,...Vn(e,o.id,n)])}function em(e){return"nativeEvent"in e}function rn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var tm=typeof document<"u",nm=function(){},ot=tm?m.useLayoutEffect:nm;const rm={...k};function zn(e){const t=k.useRef(e);return ot(()=>{t.current=e}),t}const om=rm.useInsertionEffect||(e=>e());function it(e){const t=k.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return om(()=>{t.current=e}),k.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 pl=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ml(e,t){const n=Xi(e,pl()),r=n.length;if(r===0)return;const o=fo(rt(e)),i=n.indexOf(o),l=i===-1?t===1?0:r-1:i+t;return n[l]}function im(e){return ml(rt(e).body,1)||e}function sm(e){return ml(rt(e).body,-1)||e}function mo(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!_t(n,r)}function lm(e){Xi(e,pl()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function hl(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 am="data-floating-ui-focusable",gl="active",vl="selected",um={...k};let bl=!1,cm=0;const xl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+cm++;function fm(){const[e,t]=k.useState(()=>bl?xl():void 0);return ot(()=>{e==null&&t(xl())},[]),k.useEffect(()=>{bl=!0},[]),e}const ho=um.useId||fm;let go;process.env.NODE_ENV!=="production"&&(go=new Set);function dm(){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=go)!=null&&e.has(o))){var i;(i=go)==null||i.add(o),console.error(o)}}function pm(){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 mm=k.createContext(null),hm=k.createContext(null),vo=()=>{var e;return((e=k.useContext(mm))==null?void 0:e.id)||null},bo=()=>k.useContext(hm);function on(e){return"data-floating-ui-"+e}function ze(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const yl=on("safe-polygon");function xo(e,t,n){if(n&&!rn(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 yo(e){return typeof e=="function"?e():e}function gm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:l}=e,{enabled:u=!0,delay:s=0,handleClose:a=null,mouseOnly:c=!1,restMs:d=0,move:p=!0}=t,f=bo(),g=vo(),v=zn(a),E=zn(s),M=zn(n),y=zn(d),T=k.useRef(),j=k.useRef(-1),F=k.useRef(),_=k.useRef(-1),B=k.useRef(!0),h=k.useRef(!1),b=k.useRef(()=>{}),x=k.useRef(!1),A=it(()=>{var $;const w=($=o.current.openEvent)==null?void 0:$.type;return(w==null?void 0:w.includes("mouse"))&&w!=="mousedown"});k.useEffect(()=>{if(!u)return;function $(w){let{open:I}=w;I||(ze(j),ze(_),B.current=!0,x.current=!1)}return i.on("openchange",$),()=>{i.off("openchange",$)}},[u,i]),k.useEffect(()=>{if(!u||!v.current||!n)return;function $(I){A()&&r(!1,I,"hover")}const w=rt(l.floating).documentElement;return w.addEventListener("mouseleave",$),()=>{w.removeEventListener("mouseleave",$)}},[l.floating,n,r,u,v,A]);const P=k.useCallback(function($,w,I){w===void 0&&(w=!0),I===void 0&&(I="hover");const R=xo(E.current,"close",T.current);R&&!F.current?(ze(j),j.current=window.setTimeout(()=>r(!1,$,I),R)):w&&(ze(j),r(!1,$,I))},[E,r]),L=it(()=>{b.current(),F.current=void 0}),S=it(()=>{if(h.current){const $=rt(l.floating).body;$.style.pointerEvents="",$.removeAttribute(yl),h.current=!1}}),C=it(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);k.useEffect(()=>{if(!u)return;function $(z){if(ze(j),B.current=!1,c&&!rn(T.current)||yo(y.current)>0&&!xo(E.current,"open"))return;const G=xo(E.current,"open",T.current);G?j.current=window.setTimeout(()=>{M.current||r(!0,z,"hover")},G):n||r(!0,z,"hover")}function w(z){if(C()){S();return}b.current();const G=rt(l.floating);if(ze(_),x.current=!1,v.current&&o.current.floatingContext){n||ze(j),F.current=v.current({...o.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){S(),L(),C()||P(z,!0,"safe-polygon")}});const U=F.current;G.addEventListener("mousemove",U),b.current=()=>{G.removeEventListener("mousemove",U)};return}(T.current==="touch"?!_t(l.floating,z.relatedTarget):!0)&&P(z)}function I(z){C()||o.current.floatingContext&&(v.current==null||v.current({...o.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){S(),L(),C()||P(z)}})(z))}function R(){ze(j)}function V(z){C()||P(z,!1)}if(oe(l.domReference)){const z=l.domReference,G=l.floating;return n&&z.addEventListener("mouseleave",I),p&&z.addEventListener("mousemove",$,{once:!0}),z.addEventListener("mouseenter",$),z.addEventListener("mouseleave",w),G&&(G.addEventListener("mouseleave",I),G.addEventListener("mouseenter",R),G.addEventListener("mouseleave",V)),()=>{n&&z.removeEventListener("mouseleave",I),p&&z.removeEventListener("mousemove",$),z.removeEventListener("mouseenter",$),z.removeEventListener("mouseleave",w),G&&(G.removeEventListener("mouseleave",I),G.removeEventListener("mouseenter",R),G.removeEventListener("mouseleave",V))}}},[l,u,e,c,p,P,L,S,r,n,M,f,E,v,o,C,y]),ot(()=>{var $;if(u&&n&&($=v.current)!=null&&($=$.__options)!=null&&$.blockPointerEvents&&A()){h.current=!0;const I=l.floating;if(oe(l.domReference)&&I){var w;const R=rt(l.floating).body;R.setAttribute(yl,"");const V=l.domReference,z=f==null||(w=f.nodesRef.current.find(G=>G.id===g))==null||(w=w.context)==null?void 0:w.elements.floating;return z&&(z.style.pointerEvents=""),R.style.pointerEvents="none",V.style.pointerEvents="auto",I.style.pointerEvents="auto",()=>{R.style.pointerEvents="",V.style.pointerEvents="",I.style.pointerEvents=""}}}},[u,n,g,l,f,v,A]),ot(()=>{n||(T.current=void 0,x.current=!1,L(),S())},[n,L,S]),k.useEffect(()=>()=>{L(),ze(j),ze(_),S()},[u,l.domReference,L,S]);const N=k.useMemo(()=>{function $(w){T.current=w.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(w){const{nativeEvent:I}=w;function R(){!B.current&&!M.current&&r(!0,I,"hover")}c&&!rn(T.current)||n||yo(y.current)===0||x.current&&w.movementX**2+w.movementY**2<2||(ze(_),T.current==="touch"?R():(x.current=!0,_.current=window.setTimeout(R,yo(y.current))))}}},[c,r,n,M,y]);return k.useMemo(()=>u?{reference:N}:{},[u,N])}const wl={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},El=k.forwardRef(function(t,n){const[r,o]=k.useState();ot(()=>{cl()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[on("focus-guard")]:"",style:wl};return O.jsx("span",{...t,...i})}),Sl=k.createContext(null),Cl=on("portal");function vm(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ho(),o=xm(),[i,l]=k.useState(null),u=k.useRef(null);return ot(()=>()=>{i==null||i.remove(),queueMicrotask(()=>{u.current=null})},[i]),ot(()=>{if(!r||u.current)return;const s=t?document.getElementById(t):null;if(!s)return;const a=document.createElement("div");a.id=r,a.setAttribute(Cl,""),s.appendChild(a),u.current=a,l(a)},[t,r]),ot(()=>{if(n===null||!r||u.current)return;let s=n||(o==null?void 0:o.portalNode);s&&!Pr(s)&&(s=s.current),s=s||document.body;let a=null;t&&(a=document.createElement("div"),a.id=t,s.appendChild(a));const c=document.createElement("div");c.id=r,c.setAttribute(Cl,""),s=a||s,s.appendChild(c),u.current=c,l(c)},[t,n,r,o]),i}function bm(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=vm({id:n,root:r}),[l,u]=k.useState(null),s=k.useRef(null),a=k.useRef(null),c=k.useRef(null),d=k.useRef(null),p=l==null?void 0:l.modal,f=l==null?void 0:l.open,g=!!l&&!l.modal&&l.open&&o&&!!(r||i);return k.useEffect(()=>{if(!i||!o||p)return;function v(E){i&&mo(E)&&(E.type==="focusin"?hl:lm)(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]),k.useEffect(()=>{i&&(f||hl(i))},[f,i]),O.jsxs(Sl.Provider,{value:k.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:a,beforeInsideRef:c,afterInsideRef:d,portalNode:i,setFocusManagerState:u}),[o,i]),children:[g&&i&&O.jsx(El,{"data-type":"outside",ref:s,onFocus:v=>{if(mo(v,i)){var E;(E=c.current)==null||E.focus()}else{const M=l?l.domReference:null,y=sm(M);y==null||y.focus()}}}),g&&i&&O.jsx("span",{"aria-owns":i.id,style:wl}),i&&Vt.createPortal(t,i),g&&i&&O.jsx(El,{"data-type":"outside",ref:a,onFocus:v=>{if(mo(v,i)){var E;(E=d.current)==null||E.focus()}else{const M=l?l.domReference:null,y=im(M);y==null||y.focus(),l!=null&&l.closeOnFocusOut&&(l==null||l.onOpenChange(!1,v.nativeEvent,"focus-out"))}}})]})}const xm=()=>k.useContext(Sl);function Ol(e){return Ee(e.target)&&e.target.tagName==="BUTTON"}function ym(e){return Ee(e.target)&&e.target.tagName==="A"}function Tl(e){return dl(e)}function wm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:l=!0,event:u="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:c=!0,stickIfOpen:d=!0}=t,p=k.useRef(),f=k.useRef(!1),g=k.useMemo(()=>({onPointerDown(v){p.current=v.pointerType},onMouseDown(v){const E=p.current;v.button===0&&u!=="click"&&(rn(E,!0)&&a||(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}rn(E,!0)&&a||(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||Ol(v))&&(v.key===" "&&!Tl(i)&&(v.preventDefault(),f.current=!0),!ym(v)&&v.key==="Enter"&&r(!(n&&s),v.nativeEvent,"click"))},onKeyUp(v){v.defaultPrevented||!c||Ol(v)||Tl(i)||v.key===" "&&f.current&&(f.current=!1,r(!(n&&s),v.nativeEvent,"click"))}}),[o,i,u,a,c,r,n,d,s]);return k.useMemo(()=>l?{reference:g}:{},[l,g])}const Em={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Sm={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Nl=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 Cm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:l=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:a="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:g}=t,v=bo(),E=it(typeof s=="function"?s:()=>!1),M=typeof s=="function"?E:s,y=k.useRef(!1),{escapeKey:T,outsidePress:j}=Nl(f),{escapeKey:F,outsidePress:_}=Nl(g),B=k.useRef(!1),h=it(S=>{var C;if(!n||!l||!u||S.key!=="Escape"||B.current)return;const N=(C=i.current.floatingContext)==null?void 0:C.nodeId,$=v?Vn(v.nodesRef.current,N):[];if(!T&&(S.stopPropagation(),$.length>0)){let w=!0;if($.forEach(I=>{var R;if((R=I.context)!=null&&R.open&&!I.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}r(!1,em(S)?S.nativeEvent:S,"escape-key")}),b=it(S=>{var C;const N=()=>{var $;h(S),($=Bt(S))==null||$.removeEventListener("keydown",N)};(C=Bt(S))==null||C.addEventListener("keydown",N)}),x=it(S=>{var C;const N=i.current.insideReactTree;i.current.insideReactTree=!1;const $=y.current;if(y.current=!1,a==="click"&&$||N||typeof M=="function"&&!M(S))return;const w=Bt(S),I="["+on("inert")+"]",R=rt(o.floating).querySelectorAll(I);let V=oe(w)?w:null;for(;V&&!ct(V);){const U=ft(V);if(ct(U)||!oe(U))break;V=U}if(R.length&&oe(w)&&!Qp(w)&&!_t(w,o.floating)&&Array.from(R).every(U=>!_t(V,U)))return;if(Ee(w)&&L){const U=ct(w),K=Ve(w),H=/auto|scroll/,Z=U||H.test(K.overflowX),ae=U||H.test(K.overflowY),$e=Z&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Pe=ae&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,st=K.direction==="rtl",ye=Pe&&(st?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),he=$e&&S.offsetY>w.clientHeight;if(ye||he)return}const z=(C=i.current.floatingContext)==null?void 0:C.nodeId,G=v&&Vn(v.nodesRef.current,z).some(U=>{var K;return po(S,(K=U.context)==null?void 0:K.elements.floating)});if(po(S,o.floating)||po(S,o.domReference)||G)return;const q=v?Vn(v.nodesRef.current,z):[];if(q.length>0){let U=!0;if(q.forEach(K=>{var H;if((H=K.context)!=null&&H.open&&!K.context.dataRef.current.__outsidePressBubbles){U=!1;return}}),!U)return}r(!1,S,"outside-press")}),A=it(S=>{var C;const N=()=>{var $;x(S),($=Bt(S))==null||$.removeEventListener(a,N)};(C=Bt(S))==null||C.addEventListener(a,N)});k.useEffect(()=>{if(!n||!l)return;i.current.__escapeKeyBubbles=T,i.current.__outsidePressBubbles=j;let S=-1;function C(R){r(!1,R,"ancestor-scroll")}function N(){window.clearTimeout(S),B.current=!0}function $(){S=window.setTimeout(()=>{B.current=!1},En()?5:0)}const w=rt(o.floating);u&&(w.addEventListener("keydown",F?b:h,F),w.addEventListener("compositionstart",N),w.addEventListener("compositionend",$)),M&&w.addEventListener(a,_?A:x,_);let I=[];return p&&(oe(o.domReference)&&(I=xt(o.domReference)),oe(o.floating)&&(I=I.concat(xt(o.floating))),!oe(o.reference)&&o.reference&&o.reference.contextElement&&(I=I.concat(xt(o.reference.contextElement)))),I=I.filter(R=>{var V;return R!==((V=w.defaultView)==null?void 0:V.visualViewport)}),I.forEach(R=>{R.addEventListener("scroll",C,{passive:!0})}),()=>{u&&(w.removeEventListener("keydown",F?b:h,F),w.removeEventListener("compositionstart",N),w.removeEventListener("compositionend",$)),M&&w.removeEventListener(a,_?A:x,_),I.forEach(R=>{R.removeEventListener("scroll",C)}),window.clearTimeout(S)}},[i,o,u,M,a,n,r,p,l,T,j,h,F,b,x,_,A]),k.useEffect(()=>{i.current.insideReactTree=!1},[i,M,a]);const P=k.useMemo(()=>({onKeyDown:h,...c&&{[Em[d]]:S=>{r(!1,S.nativeEvent,"reference-press")},...d!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[h,r,c,d]),L=k.useMemo(()=>({onKeyDown:h,onMouseDown(){y.current=!0},onMouseUp(){y.current=!0},[Sm[a]]:()=>{i.current.insideReactTree=!0}}),[h,a,i]);return k.useMemo(()=>l?{reference:P,floating:L}:{},[l,P,L])}function Om(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ho(),i=k.useRef({}),[l]=k.useState(()=>pm()),u=vo()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!oe(f)&&dm("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,a]=k.useState(r.reference),c=it((f,g,v)=>{i.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=k.useMemo(()=>({setPositionReference:a}),[]),p=k.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return k.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:l,floatingId:o,refs:d}),[t,c,p,l,o,d])}function Tm(e){e===void 0&&(e={});const{nodeId:t}=e,n=Om({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,l]=k.useState(null),[u,s]=k.useState(null),c=(o==null?void 0:o.domReference)||i,d=k.useRef(null),p=bo();ot(()=>{c&&(d.current=c)},[c]);const f=fs({...e,elements:{...o,...u&&{reference:u}}}),g=k.useCallback(T=>{const j=oe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;s(j),f.refs.setReference(j)},[f.refs]),v=k.useCallback(T=>{(oe(T)||T===null)&&(d.current=T,l(T)),(oe(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!oe(T))&&f.refs.setReference(T)},[f.refs]),E=k.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),M=k.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),y=k.useMemo(()=>({...f,...r,refs:E,elements:M,nodeId:t}),[f,E,M,t,r]);return ot(()=>{r.dataRef.current.floatingContext=y;const T=p==null?void 0:p.nodesRef.current.find(j=>j.id===t);T&&(T.context=y)}),k.useMemo(()=>({...f,context:y,refs:E,elements:M}),[f,E,M,y])}function wo(){return Kp()&&cl()}function Nm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:l}=e,{enabled:u=!0,visibleOnly:s=!0}=t,a=k.useRef(!1),c=k.useRef(-1),d=k.useRef(!0);k.useEffect(()=>{if(!u)return;const f=Te(l.domReference);function g(){!n&&Ee(l.domReference)&&l.domReference===fo(rt(l.domReference))&&(a.current=!0)}function v(){d.current=!0}function E(){d.current=!1}return f.addEventListener("blur",g),wo()&&(f.addEventListener("keydown",v,!0),f.addEventListener("pointerdown",E,!0)),()=>{f.removeEventListener("blur",g),wo()&&(f.removeEventListener("keydown",v,!0),f.removeEventListener("pointerdown",E,!0))}},[l.domReference,n,u]),k.useEffect(()=>{if(!u)return;function f(g){let{reason:v}=g;(v==="reference-press"||v==="escape-key")&&(a.current=!0)}return o.on("openchange",f),()=>{o.off("openchange",f)}},[o,u]),k.useEffect(()=>()=>{ze(c)},[]);const p=k.useMemo(()=>({onMouseLeave(){a.current=!1},onFocus(f){if(a.current)return;const g=Bt(f.nativeEvent);if(s&&oe(g)){if(wo()&&!f.relatedTarget){if(!d.current&&!dl(g))return}else if(!Jp(g))return}r(!0,f.nativeEvent,"focus")},onBlur(f){a.current=!1;const g=f.relatedTarget,v=f.nativeEvent,E=oe(g)&&g.hasAttribute(on("focus-guard"))&&g.getAttribute("data-type")==="outside";c.current=window.setTimeout(()=>{var M;const y=fo(l.domReference?l.domReference.ownerDocument:document);!g&&y===l.domReference||_t((M=i.current.floatingContext)==null?void 0:M.refs.floating.current,y)||_t(l.domReference,y)||E||r(!1,v,"focus")})}}),[i,l.domReference,r,s]);return k.useMemo(()=>u?{reference:p}:{},[u,p])}function Eo(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[gl]:l,[vl]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[am]:""},...i,...t.map(l=>{const u=l?l[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((l,u)=>(u&&Object.entries(u).forEach(s=>{let[a,c]=s;if(!(o&&[gl,vl].includes(a)))if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof c=="function"){var d;(d=r.get(a))==null||d.push(c),l[a]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(a))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else l[a]=c}),l),{})}}function Lm(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=k.useCallback(u=>Eo(u,e,"reference"),t),i=k.useCallback(u=>Eo(u,e,"floating"),n),l=k.useCallback(u=>Eo(u,e,"item"),r);return k.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l}),[o,i,l])}const $m=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Pm(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:i,floatingId:l}=e,{enabled:u=!0,role:s="dialog"}=t,a=ho(),c=((n=i.domReference)==null?void 0:n.id)||a,d=k.useMemo(()=>{var y;return((y=Zp(i.floating))==null?void 0:y.id)||l},[i.floating,l]),p=(r=$m.get(s))!=null?r:s,g=vo()!=null,v=k.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=k.useMemo(()=>{const y={id:d,...p&&{role:p}};return p==="tooltip"||s==="label"?y:{...y,...p==="menu"&&{"aria-labelledby":c}}},[p,d,c,s]),M=k.useCallback(y=>{let{active:T,selected:j}=y;const F={role:"option",...T&&{id:d+"-fui-option"}};switch(s){case"select":case"combobox":return{...F,"aria-selected":j}}return{}},[d,s]);return k.useMemo(()=>u?{reference:v,floating:E,item:M}:{},[u,v,E,M])}const Ll=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})});Ll.displayName="TooltipArrow";const sn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:i="",disabled:l=!1,maxWidth:u="max-w-xs",trigger:s=["hover","focus"]})=>{const[a,c]=m.useState(!1),d=m.useRef(null),{refs:p,floatingStyles:f,context:g}=Tm({open:a&&!l,onOpenChange:c,placement:n,whileElementsMounted:ls,middleware:[Vr(o?12:8),ps({fallbackAxisSideDirection:"start",padding:8}),ds({padding:8}),...o?[Gf({element:d})]:[]]}),v=gm(g,{enabled:s.includes("hover"),delay:{open:r,close:150}}),E=Nm(g,{enabled:s.includes("focus")}),M=wm(g,{enabled:s.includes("click")}),y=Cm(g),T=Pm(g,{role:"tooltip"}),{getReferenceProps:j,getFloatingProps:F}=Lm([v,E,M,y,T]);return l?O.jsx(O.Fragment,{children:e}):O.jsxs(O.Fragment,{children:[O.jsx("div",{ref:p.setReference,...j(),children:e}),a&&O.jsx(bm,{children:O.jsxs("div",{ref:p.setFloating,...F(),style:f,className:`
111
+ */var kp={L:kt.QrCode.Ecc.LOW,M:kt.QrCode.Ecc.MEDIUM,Q:kt.QrCode.Ecc.QUARTILE,H:kt.QrCode.Ecc.HIGH},tl=128,nl="L",rl="#FFFFFF",ol="#000000",il=!1,sl=1,_p=4,Wp=0,Bp=.1;function ll(e,t=0){const n=[];return e.forEach(function(r,o){let i=null;r.forEach(function(l,u){if(!l&&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(!l)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}l&&i===null&&(i=u)})}),n.join("")}function al(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 Up(e,t,n,r){if(r==null)return null;const o=e.length+n*2,i=Math.floor(t*Bp),l=o/t,u=(r.width||i)*l,s=(r.height||i)*l,a=r.x==null?e.length/2-u/2:r.x*l,c=r.y==null?e.length/2-s/2:r.y*l,d=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let g=Math.floor(a),v=Math.floor(c),E=Math.ceil(u+a-g),M=Math.ceil(s+c-v);p={x:g,y:v,w:E,h:M}}const f=r.crossOrigin;return{x:a,y:c,h:s,w:u,excavation:p,opacity:d,crossOrigin:f}}function Vp(e,t){return t!=null?Math.max(Math.floor(t),0):e?_p:Wp}function ul({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:i,size:l,boostLevel:u}){let s=m.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((v,E)=>(v.push(...kt.QrSegment.makeSegments(E)),v),[]);return kt.QrCode.encodeSegments(g,kp[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:a,margin:c,numCells:d,calculatedImageSettings:p}=m.useMemo(()=>{let f=s.getModules();const g=Vp(r,o),v=f.length+g*2,E=Up(f,l,g,i);return{cells:f,margin:g,numCells:v,calculatedImageSettings:E}},[s,l,i,r,o]);return{qrcode:s,margin:c,cells:a,numCells:d,calculatedImageSettings:p}}var zp=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Hp=m.forwardRef(function(t,n){const r=t,{value:o,size:i=tl,level:l=nl,bgColor:u=rl,fgColor:s=ol,includeMargin:a=il,minVersion:c=sl,boostLevel:d,marginSize:p,imageSettings:f}=r,v=co(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:E}=v,M=co(v,["style"]),w=f==null?void 0:f.src,N=m.useRef(null),j=m.useRef(null),F=m.useCallback(S=>{N.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[k,W]=m.useState(!1),{margin:h,cells:b,numCells:x,calculatedImageSettings:$}=ul({value:o,level:l,minVersion:c,boostLevel:d,includeMargin:a,marginSize:p,imageSettings:f,size:i});m.useEffect(()=>{if(N.current!=null){const S=N.current,O=S.getContext("2d");if(!O)return;let T=b;const L=j.current,y=$!=null&&L!==null&&L.complete&&L.naturalHeight!==0&&L.naturalWidth!==0;y&&$.excavation!=null&&(T=al(b,$.excavation));const I=window.devicePixelRatio||1;S.height=S.width=i*I;const _=i/x*I;O.scale(_,_),O.fillStyle=u,O.fillRect(0,0,x,x),O.fillStyle=s,zp?O.fill(new Path2D(ll(T,h))):b.forEach(function(V,z){V.forEach(function(G,q){G&&O.fillRect(q+h,z+h,1,1)})}),$&&(O.globalAlpha=$.opacity),y&&O.drawImage(L,$.x+h,$.y+h,$.w,$.h)}}),m.useEffect(()=>{W(!1)},[w]);const P=uo({height:i,width:i},E);let A=null;return w!=null&&(A=m.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{W(!0)},ref:j,crossOrigin:$==null?void 0:$.crossOrigin})),m.createElement(m.Fragment,null,m.createElement("canvas",uo({style:P,height:i,width:i,ref:F,role:"img"},M)),A)});Hp.displayName="QRCodeCanvas";var cl=m.forwardRef(function(t,n){const r=t,{value:o,size:i=tl,level:l=nl,bgColor:u=rl,fgColor:s=ol,includeMargin:a=il,minVersion:c=sl,boostLevel:d,title:p,marginSize:f,imageSettings:g}=r,v=co(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:E,cells:M,numCells:w,calculatedImageSettings:N}=ul({value:o,level:l,minVersion:c,boostLevel:d,includeMargin:a,marginSize:f,imageSettings:g,size:i});let j=M,F=null;g!=null&&N!=null&&(N.excavation!=null&&(j=al(M,N.excavation)),F=m.createElement("image",{href:g.src,height:N.h,width:N.w,x:N.x+E,y:N.y+E,preserveAspectRatio:"none",opacity:N.opacity,crossOrigin:N.crossOrigin}));const k=ll(j,E);return m.createElement("svg",uo({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:k,shapeRendering:"crispEdges"}),F)});cl.displayName="QRCodeSVG";function Gp(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Yp(){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 fl(){return/apple/i.test(navigator.vendor)}function Kp(){return Gp().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function qp(){return Yp().includes("jsdom/")}const dl="data-floating-ui-focusable",Xp="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fo(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 _t(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&$r(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Wt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function po(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 Qp(e){return e.matches("html,body")}function rt(e){return(e==null?void 0:e.ownerDocument)||document}function pl(e){return Ee(e)&&e.matches(Xp)}function Jp(e){if(!e||qp())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Zp(e){return e?e.hasAttribute(dl)?e:e.querySelector("["+dl+"]")||e:null}function zn(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,...zn(e,o.id,n)])}function em(e){return"nativeEvent"in e}function rn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var tm=typeof document<"u",nm=function(){},ot=tm?m.useLayoutEffect:nm;const rm={...R};function Hn(e){const t=R.useRef(e);return ot(()=>{t.current=e}),t}const om=rm.useInsertionEffect||(e=>e());function it(e){const t=R.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return om(()=>{t.current=e}),R.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 ml=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function hl(e,t){const n=Qi(e,ml()),r=n.length;if(r===0)return;const o=fo(rt(e)),i=n.indexOf(o),l=i===-1?t===1?0:r-1:i+t;return n[l]}function im(e){return hl(rt(e).body,1)||e}function sm(e){return hl(rt(e).body,-1)||e}function mo(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!_t(n,r)}function lm(e){Qi(e,ml()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function gl(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 am="data-floating-ui-focusable",vl="active",bl="selected",um={...R};let xl=!1,cm=0;const yl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+cm++;function fm(){const[e,t]=R.useState(()=>xl?yl():void 0);return ot(()=>{e==null&&t(yl())},[]),R.useEffect(()=>{xl=!0},[]),e}const ho=um.useId||fm;let go;process.env.NODE_ENV!=="production"&&(go=new Set);function dm(){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=go)!=null&&e.has(o))){var i;(i=go)==null||i.add(o),console.error(o)}}function pm(){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 mm=R.createContext(null),hm=R.createContext(null),vo=()=>{var e;return((e=R.useContext(mm))==null?void 0:e.id)||null},bo=()=>R.useContext(hm);function on(e){return"data-floating-ui-"+e}function ze(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const wl=on("safe-polygon");function xo(e,t,n){if(n&&!rn(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 yo(e){return typeof e=="function"?e():e}function gm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:l}=e,{enabled:u=!0,delay:s=0,handleClose:a=null,mouseOnly:c=!1,restMs:d=0,move:p=!0}=t,f=bo(),g=vo(),v=Hn(a),E=Hn(s),M=Hn(n),w=Hn(d),N=R.useRef(),j=R.useRef(-1),F=R.useRef(),k=R.useRef(-1),W=R.useRef(!0),h=R.useRef(!1),b=R.useRef(()=>{}),x=R.useRef(!1),$=it(()=>{var L;const y=(L=o.current.openEvent)==null?void 0:L.type;return(y==null?void 0:y.includes("mouse"))&&y!=="mousedown"});R.useEffect(()=>{if(!u)return;function L(y){let{open:I}=y;I||(ze(j),ze(k),W.current=!0,x.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[u,i]),R.useEffect(()=>{if(!u||!v.current||!n)return;function L(I){$()&&r(!1,I,"hover")}const y=rt(l.floating).documentElement;return y.addEventListener("mouseleave",L),()=>{y.removeEventListener("mouseleave",L)}},[l.floating,n,r,u,v,$]);const P=R.useCallback(function(L,y,I){y===void 0&&(y=!0),I===void 0&&(I="hover");const _=xo(E.current,"close",N.current);_&&!F.current?(ze(j),j.current=window.setTimeout(()=>r(!1,L,I),_)):y&&(ze(j),r(!1,L,I))},[E,r]),A=it(()=>{b.current(),F.current=void 0}),S=it(()=>{if(h.current){const L=rt(l.floating).body;L.style.pointerEvents="",L.removeAttribute(wl),h.current=!1}}),O=it(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);R.useEffect(()=>{if(!u)return;function L(z){if(ze(j),W.current=!1,c&&!rn(N.current)||yo(w.current)>0&&!xo(E.current,"open"))return;const G=xo(E.current,"open",N.current);G?j.current=window.setTimeout(()=>{M.current||r(!0,z,"hover")},G):n||r(!0,z,"hover")}function y(z){if(O()){S();return}b.current();const G=rt(l.floating);if(ze(k),x.current=!1,v.current&&o.current.floatingContext){n||ze(j),F.current=v.current({...o.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){S(),A(),O()||P(z,!0,"safe-polygon")}});const B=F.current;G.addEventListener("mousemove",B),b.current=()=>{G.removeEventListener("mousemove",B)};return}(N.current==="touch"?!_t(l.floating,z.relatedTarget):!0)&&P(z)}function I(z){O()||o.current.floatingContext&&(v.current==null||v.current({...o.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){S(),A(),O()||P(z)}})(z))}function _(){ze(j)}function V(z){O()||P(z,!1)}if(oe(l.domReference)){const z=l.domReference,G=l.floating;return n&&z.addEventListener("mouseleave",I),p&&z.addEventListener("mousemove",L,{once:!0}),z.addEventListener("mouseenter",L),z.addEventListener("mouseleave",y),G&&(G.addEventListener("mouseleave",I),G.addEventListener("mouseenter",_),G.addEventListener("mouseleave",V)),()=>{n&&z.removeEventListener("mouseleave",I),p&&z.removeEventListener("mousemove",L),z.removeEventListener("mouseenter",L),z.removeEventListener("mouseleave",y),G&&(G.removeEventListener("mouseleave",I),G.removeEventListener("mouseenter",_),G.removeEventListener("mouseleave",V))}}},[l,u,e,c,p,P,A,S,r,n,M,f,E,v,o,O,w]),ot(()=>{var L;if(u&&n&&(L=v.current)!=null&&(L=L.__options)!=null&&L.blockPointerEvents&&$()){h.current=!0;const I=l.floating;if(oe(l.domReference)&&I){var y;const _=rt(l.floating).body;_.setAttribute(wl,"");const V=l.domReference,z=f==null||(y=f.nodesRef.current.find(G=>G.id===g))==null||(y=y.context)==null?void 0:y.elements.floating;return z&&(z.style.pointerEvents=""),_.style.pointerEvents="none",V.style.pointerEvents="auto",I.style.pointerEvents="auto",()=>{_.style.pointerEvents="",V.style.pointerEvents="",I.style.pointerEvents=""}}}},[u,n,g,l,f,v,$]),ot(()=>{n||(N.current=void 0,x.current=!1,A(),S())},[n,A,S]),R.useEffect(()=>()=>{A(),ze(j),ze(k),S()},[u,l.domReference,A,S]);const T=R.useMemo(()=>{function L(y){N.current=y.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(y){const{nativeEvent:I}=y;function _(){!W.current&&!M.current&&r(!0,I,"hover")}c&&!rn(N.current)||n||yo(w.current)===0||x.current&&y.movementX**2+y.movementY**2<2||(ze(k),N.current==="touch"?_():(x.current=!0,k.current=window.setTimeout(_,yo(w.current))))}}},[c,r,n,M,w]);return R.useMemo(()=>u?{reference:T}:{},[u,T])}const El={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},Sl=R.forwardRef(function(t,n){const[r,o]=R.useState();ot(()=>{fl()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[on("focus-guard")]:"",style:El};return C.jsx("span",{...t,...i})}),Cl=R.createContext(null),Ol=on("portal");function vm(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ho(),o=xm(),[i,l]=R.useState(null),u=R.useRef(null);return ot(()=>()=>{i==null||i.remove(),queueMicrotask(()=>{u.current=null})},[i]),ot(()=>{if(!r||u.current)return;const s=t?document.getElementById(t):null;if(!s)return;const a=document.createElement("div");a.id=r,a.setAttribute(Ol,""),s.appendChild(a),u.current=a,l(a)},[t,r]),ot(()=>{if(n===null||!r||u.current)return;let s=n||(o==null?void 0:o.portalNode);s&&!Pr(s)&&(s=s.current),s=s||document.body;let a=null;t&&(a=document.createElement("div"),a.id=t,s.appendChild(a));const c=document.createElement("div");c.id=r,c.setAttribute(Ol,""),s=a||s,s.appendChild(c),u.current=c,l(c)},[t,n,r,o]),i}function bm(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=vm({id:n,root:r}),[l,u]=R.useState(null),s=R.useRef(null),a=R.useRef(null),c=R.useRef(null),d=R.useRef(null),p=l==null?void 0:l.modal,f=l==null?void 0:l.open,g=!!l&&!l.modal&&l.open&&o&&!!(r||i);return R.useEffect(()=>{if(!i||!o||p)return;function v(E){i&&mo(E)&&(E.type==="focusin"?gl:lm)(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]),R.useEffect(()=>{i&&(f||gl(i))},[f,i]),C.jsxs(Cl.Provider,{value:R.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:a,beforeInsideRef:c,afterInsideRef:d,portalNode:i,setFocusManagerState:u}),[o,i]),children:[g&&i&&C.jsx(Sl,{"data-type":"outside",ref:s,onFocus:v=>{if(mo(v,i)){var E;(E=c.current)==null||E.focus()}else{const M=l?l.domReference:null,w=sm(M);w==null||w.focus()}}}),g&&i&&C.jsx("span",{"aria-owns":i.id,style:El}),i&&Vt.createPortal(t,i),g&&i&&C.jsx(Sl,{"data-type":"outside",ref:a,onFocus:v=>{if(mo(v,i)){var E;(E=d.current)==null||E.focus()}else{const M=l?l.domReference:null,w=im(M);w==null||w.focus(),l!=null&&l.closeOnFocusOut&&(l==null||l.onOpenChange(!1,v.nativeEvent,"focus-out"))}}})]})}const xm=()=>R.useContext(Cl);function Tl(e){return Ee(e.target)&&e.target.tagName==="BUTTON"}function ym(e){return Ee(e.target)&&e.target.tagName==="A"}function Nl(e){return pl(e)}function wm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:l=!0,event:u="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:c=!0,stickIfOpen:d=!0}=t,p=R.useRef(),f=R.useRef(!1),g=R.useMemo(()=>({onPointerDown(v){p.current=v.pointerType},onMouseDown(v){const E=p.current;v.button===0&&u!=="click"&&(rn(E,!0)&&a||(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}rn(E,!0)&&a||(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||Tl(v))&&(v.key===" "&&!Nl(i)&&(v.preventDefault(),f.current=!0),!ym(v)&&v.key==="Enter"&&r(!(n&&s),v.nativeEvent,"click"))},onKeyUp(v){v.defaultPrevented||!c||Tl(v)||Nl(i)||v.key===" "&&f.current&&(f.current=!1,r(!(n&&s),v.nativeEvent,"click"))}}),[o,i,u,a,c,r,n,d,s]);return R.useMemo(()=>l?{reference:g}:{},[l,g])}const Em={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Sm={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Al=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 Cm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:l=!0,escapeKey:u=!0,outsidePress:s=!0,outsidePressEvent:a="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:g}=t,v=bo(),E=it(typeof s=="function"?s:()=>!1),M=typeof s=="function"?E:s,w=R.useRef(!1),{escapeKey:N,outsidePress:j}=Al(f),{escapeKey:F,outsidePress:k}=Al(g),W=R.useRef(!1),h=it(S=>{var O;if(!n||!l||!u||S.key!=="Escape"||W.current)return;const T=(O=i.current.floatingContext)==null?void 0:O.nodeId,L=v?zn(v.nodesRef.current,T):[];if(!N&&(S.stopPropagation(),L.length>0)){let y=!0;if(L.forEach(I=>{var _;if((_=I.context)!=null&&_.open&&!I.context.dataRef.current.__escapeKeyBubbles){y=!1;return}}),!y)return}r(!1,em(S)?S.nativeEvent:S,"escape-key")}),b=it(S=>{var O;const T=()=>{var L;h(S),(L=Wt(S))==null||L.removeEventListener("keydown",T)};(O=Wt(S))==null||O.addEventListener("keydown",T)}),x=it(S=>{var O;const T=i.current.insideReactTree;i.current.insideReactTree=!1;const L=w.current;if(w.current=!1,a==="click"&&L||T||typeof M=="function"&&!M(S))return;const y=Wt(S),I="["+on("inert")+"]",_=rt(o.floating).querySelectorAll(I);let V=oe(y)?y:null;for(;V&&!ct(V);){const B=ft(V);if(ct(B)||!oe(B))break;V=B}if(_.length&&oe(y)&&!Qp(y)&&!_t(y,o.floating)&&Array.from(_).every(B=>!_t(V,B)))return;if(Ee(y)&&A){const B=ct(y),K=Ve(y),H=/auto|scroll/,Z=B||H.test(K.overflowX),ae=B||H.test(K.overflowY),Pe=Z&&y.clientWidth>0&&y.scrollWidth>y.clientWidth,$e=ae&&y.clientHeight>0&&y.scrollHeight>y.clientHeight,st=K.direction==="rtl",ye=$e&&(st?S.offsetX<=y.offsetWidth-y.clientWidth:S.offsetX>y.clientWidth),he=Pe&&S.offsetY>y.clientHeight;if(ye||he)return}const z=(O=i.current.floatingContext)==null?void 0:O.nodeId,G=v&&zn(v.nodesRef.current,z).some(B=>{var K;return po(S,(K=B.context)==null?void 0:K.elements.floating)});if(po(S,o.floating)||po(S,o.domReference)||G)return;const q=v?zn(v.nodesRef.current,z):[];if(q.length>0){let B=!0;if(q.forEach(K=>{var H;if((H=K.context)!=null&&H.open&&!K.context.dataRef.current.__outsidePressBubbles){B=!1;return}}),!B)return}r(!1,S,"outside-press")}),$=it(S=>{var O;const T=()=>{var L;x(S),(L=Wt(S))==null||L.removeEventListener(a,T)};(O=Wt(S))==null||O.addEventListener(a,T)});R.useEffect(()=>{if(!n||!l)return;i.current.__escapeKeyBubbles=N,i.current.__outsidePressBubbles=j;let S=-1;function O(_){r(!1,_,"ancestor-scroll")}function T(){window.clearTimeout(S),W.current=!0}function L(){S=window.setTimeout(()=>{W.current=!1},Sn()?5:0)}const y=rt(o.floating);u&&(y.addEventListener("keydown",F?b:h,F),y.addEventListener("compositionstart",T),y.addEventListener("compositionend",L)),M&&y.addEventListener(a,k?$:x,k);let I=[];return p&&(oe(o.domReference)&&(I=xt(o.domReference)),oe(o.floating)&&(I=I.concat(xt(o.floating))),!oe(o.reference)&&o.reference&&o.reference.contextElement&&(I=I.concat(xt(o.reference.contextElement)))),I=I.filter(_=>{var V;return _!==((V=y.defaultView)==null?void 0:V.visualViewport)}),I.forEach(_=>{_.addEventListener("scroll",O,{passive:!0})}),()=>{u&&(y.removeEventListener("keydown",F?b:h,F),y.removeEventListener("compositionstart",T),y.removeEventListener("compositionend",L)),M&&y.removeEventListener(a,k?$:x,k),I.forEach(_=>{_.removeEventListener("scroll",O)}),window.clearTimeout(S)}},[i,o,u,M,a,n,r,p,l,N,j,h,F,b,x,k,$]),R.useEffect(()=>{i.current.insideReactTree=!1},[i,M,a]);const P=R.useMemo(()=>({onKeyDown:h,...c&&{[Em[d]]:S=>{r(!1,S.nativeEvent,"reference-press")},...d!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[h,r,c,d]),A=R.useMemo(()=>({onKeyDown:h,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[Sm[a]]:()=>{i.current.insideReactTree=!0}}),[h,a,i]);return R.useMemo(()=>l?{reference:P,floating:A}:{},[l,P,A])}function Om(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ho(),i=R.useRef({}),[l]=R.useState(()=>pm()),u=vo()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!oe(f)&&dm("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[s,a]=R.useState(r.reference),c=it((f,g,v)=>{i.current.openEvent=f?g:void 0,l.emit("openchange",{open:f,event:g,reason:v,nested:u}),n==null||n(f,g,v)}),d=R.useMemo(()=>({setPositionReference:a}),[]),p=R.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return R.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:p,events:l,floatingId:o,refs:d}),[t,c,p,l,o,d])}function Tm(e){e===void 0&&(e={});const{nodeId:t}=e,n=Om({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,l]=R.useState(null),[u,s]=R.useState(null),c=(o==null?void 0:o.domReference)||i,d=R.useRef(null),p=bo();ot(()=>{c&&(d.current=c)},[c]);const f=ds({...e,elements:{...o,...u&&{reference:u}}}),g=R.useCallback(N=>{const j=oe(N)?{getBoundingClientRect:()=>N.getBoundingClientRect(),getClientRects:()=>N.getClientRects(),contextElement:N}:N;s(j),f.refs.setReference(j)},[f.refs]),v=R.useCallback(N=>{(oe(N)||N===null)&&(d.current=N,l(N)),(oe(f.refs.reference.current)||f.refs.reference.current===null||N!==null&&!oe(N))&&f.refs.setReference(N)},[f.refs]),E=R.useMemo(()=>({...f.refs,setReference:v,setPositionReference:g,domReference:d}),[f.refs,v,g]),M=R.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=R.useMemo(()=>({...f,...r,refs:E,elements:M,nodeId:t}),[f,E,M,t,r]);return ot(()=>{r.dataRef.current.floatingContext=w;const N=p==null?void 0:p.nodesRef.current.find(j=>j.id===t);N&&(N.context=w)}),R.useMemo(()=>({...f,context:w,refs:E,elements:M}),[f,E,M,w])}function wo(){return Kp()&&fl()}function Nm(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:l}=e,{enabled:u=!0,visibleOnly:s=!0}=t,a=R.useRef(!1),c=R.useRef(-1),d=R.useRef(!0);R.useEffect(()=>{if(!u)return;const f=Ne(l.domReference);function g(){!n&&Ee(l.domReference)&&l.domReference===fo(rt(l.domReference))&&(a.current=!0)}function v(){d.current=!0}function E(){d.current=!1}return f.addEventListener("blur",g),wo()&&(f.addEventListener("keydown",v,!0),f.addEventListener("pointerdown",E,!0)),()=>{f.removeEventListener("blur",g),wo()&&(f.removeEventListener("keydown",v,!0),f.removeEventListener("pointerdown",E,!0))}},[l.domReference,n,u]),R.useEffect(()=>{if(!u)return;function f(g){let{reason:v}=g;(v==="reference-press"||v==="escape-key")&&(a.current=!0)}return o.on("openchange",f),()=>{o.off("openchange",f)}},[o,u]),R.useEffect(()=>()=>{ze(c)},[]);const p=R.useMemo(()=>({onMouseLeave(){a.current=!1},onFocus(f){if(a.current)return;const g=Wt(f.nativeEvent);if(s&&oe(g)){if(wo()&&!f.relatedTarget){if(!d.current&&!pl(g))return}else if(!Jp(g))return}r(!0,f.nativeEvent,"focus")},onBlur(f){a.current=!1;const g=f.relatedTarget,v=f.nativeEvent,E=oe(g)&&g.hasAttribute(on("focus-guard"))&&g.getAttribute("data-type")==="outside";c.current=window.setTimeout(()=>{var M;const w=fo(l.domReference?l.domReference.ownerDocument:document);!g&&w===l.domReference||_t((M=i.current.floatingContext)==null?void 0:M.refs.floating.current,w)||_t(l.domReference,w)||E||r(!1,v,"focus")})}}),[i,l.domReference,r,s]);return R.useMemo(()=>u?{reference:p}:{},[u,p])}function Eo(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[vl]:l,[bl]:u,...s}=e;i=s}return{...n==="floating"&&{tabIndex:-1,[am]:""},...i,...t.map(l=>{const u=l?l[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((l,u)=>(u&&Object.entries(u).forEach(s=>{let[a,c]=s;if(!(o&&[vl,bl].includes(a)))if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof c=="function"){var d;(d=r.get(a))==null||d.push(c),l[a]=function(){for(var p,f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];return(p=r.get(a))==null?void 0:p.map(E=>E(...g)).find(E=>E!==void 0)}}}else l[a]=c}),l),{})}}function Am(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=R.useCallback(u=>Eo(u,e,"reference"),t),i=R.useCallback(u=>Eo(u,e,"floating"),n),l=R.useCallback(u=>Eo(u,e,"item"),r);return R.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l}),[o,i,l])}const Lm=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Pm(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:i,floatingId:l}=e,{enabled:u=!0,role:s="dialog"}=t,a=ho(),c=((n=i.domReference)==null?void 0:n.id)||a,d=R.useMemo(()=>{var w;return((w=Zp(i.floating))==null?void 0:w.id)||l},[i.floating,l]),p=(r=Lm.get(s))!=null?r:s,g=vo()!=null,v=R.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=R.useMemo(()=>{const w={id:d,...p&&{role:p}};return p==="tooltip"||s==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":c}}},[p,d,c,s]),M=R.useCallback(w=>{let{active:N,selected:j}=w;const F={role:"option",...N&&{id:d+"-fui-option"}};switch(s){case"select":case"combobox":return{...F,"aria-selected":j}}return{}},[d,s]);return R.useMemo(()=>u?{reference:v,floating:E,item:M}:{},[u,v,E,M])}const Ll=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 C.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});Ll.displayName="TooltipArrow";const sn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:i="",disabled:l=!1,maxWidth:u="max-w-xs",trigger:s=["hover","focus"]})=>{const[a,c]=m.useState(!1),d=m.useRef(null),{refs:p,floatingStyles:f,context:g}=Tm({open:a&&!l,onOpenChange:c,placement:n,whileElementsMounted:as,middleware:[Vr(o?12:8),ms({fallbackAxisSideDirection:"start",padding:8}),ps({padding:8}),...o?[Gf({element:d})]:[]]}),v=gm(g,{enabled:s.includes("hover"),delay:{open:r,close:150}}),E=Nm(g,{enabled:s.includes("focus")}),M=wm(g,{enabled:s.includes("click")}),w=Cm(g),N=Pm(g,{role:"tooltip"}),{getReferenceProps:j,getFloatingProps:F}=Am([v,E,M,w,N]);return l?C.jsx(C.Fragment,{children:e}):C.jsxs(C.Fragment,{children:[C.jsx("div",{ref:p.setReference,...j(),children:e}),a&&C.jsx(bm,{children:C.jsxs("div",{ref:p.setFloating,...F(),style:f,className:`
112
112
  z-50 px-3 py-2
113
113
  bg-fill-page-secondary
114
114
  text-text-primary text-sm font-medium
@@ -116,5 +116,5 @@ React keys must be passed directly to JSX without using spread:
116
116
  relative
117
117
  ${u}
118
118
  ${i}
119
- `,children:[t,o&&O.jsx(Ll,{ref:d,placement:g.placement||n})]})})]})},$l="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=",Am=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var u;const{t:i}=Ke(),l=m.useMemo(()=>hp(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(ul,{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(Fp,{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:$l,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."]})})]}),l&&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(sn,{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]})]})]})]})},Dm=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:i,onCopy:l,onClose:u})=>{var v;const{t:s}=Ke(),[a,c]=m.useState(()=>{var E;return!e||e.length===0?1:t||((E=e[0])==null?void 0:E.chainId)||1}),[d,p]=m.useState(()=>{var T;if(!e||e.length===0)return"";const E=t||((T=e[0])==null?void 0:T.chainId),M=e.find(j=>j.chainId===E);if(!M||!M.tokenList||M.tokenList.length===0)return"";const y=M.tokenList.find(j=>j.tokenAddress===n)||M.tokenList[0];return(y==null?void 0:y.token)||""}),f=e&&e.length>0?e.find(E=>E.chainId===a)||e[0]:null,g=(v=f==null?void 0:f.tokenList)==null?void 0:v.find(E=>E.token===d);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"})}):f?O.jsxs(O.Fragment,{children:[O.jsx(eo,{currentActiveChain:f,chainList:e,onChainChange:c,curSelectToken:d,onTokenChange:p,walletType:"mpc"}),O.jsx(Am,{walletAdapter:r,curSelectToken:d,currentActiveChain:f,metadata:o,onCopy:l}),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:a,tokenAddress:(g==null?void 0:g.tokenAddress)||"",tokenSymbol:d}),u()},children:s("deposit.title")})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Mm=Object.values({MAINNET:1,SEPOLIA:11155111}),He=e=>Mm.includes(+e),Im=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:i,amount:l,decimals:u,tokenBalance:s,platformBalance:a="0",onDepositAmountChange:c,onApprove:d})=>{const{t:p}=Ke(),f=m.useCallback(()=>{let M=s||"0";if(!He(o==null?void 0:o.chainId))try{const y=new ke(M),T=new ke("250000");y.gt(T)&&(M="250000")}catch(y){console.warn("Error calculating max amount limit:",y)}return M},[s,o==null?void 0:o.chainId]),g=m.useMemo(()=>{if(He(o==null?void 0:o.chainId))return!1;try{const M=new ke(e||"0"),y=new ke("250000");return M.isNaN()||y.isNaN()?!1:M.gte(y)}catch{return!1}},[o,e]);m.useMemo(()=>{if(He(o==null?void 0:o.chainId))return!1;try{const M=new ke(s||"0"),y=new ke("250000");return M.gt(y)}catch{return!1}},[o==null?void 0:o.chainId,s]);const v=M=>{const y=M.target.value,T=f(),j=to(y,T);if(j.isValid)c(j.formattedValue),j.errorType;else return j.errorType==="exceed_balance",void 0},E=()=>{const M=parseFloat(s||"0"),y=parseFloat(e||"0");if(y>0){const T=M-y,j=Qe(Math.max(0,T).toString());return O.jsxs("span",{className:"flex items-center gap-1",children:[Qe(s||"0"),O.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),j," ",t]})}return`${Qe(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:v,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),O.jsx("button",{onClick:()=>{const M=f();c(M)},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(sn,{content:p("deposit.availableDesc"),children:O.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:p("deposit.available")})}),O.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:E()})]})]}),!r&&dp(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})})]}),g&&O.jsxs("div",{className:"flex mb-4",children:[O.jsx("div",{className:"w-5",children:O.jsx("img",{src:$l,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:[Qe(a),O.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Qe((parseFloat(a)+parseFloat(e)).toString())," ",t]}):`${Qe(a)} ${t}`})]})})]})},jm=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:i})=>{var s,a;const l=(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=(a=o==null?void 0:o.useReadContract)==null?void 0:a.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:l,allowance:u})},[l,u,e.tokenAddress,i]),null},Pl=({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]),[l,u]=m.useState({}),s=m.useCallback((v,E)=>{u(M=>({...M,[v]:E}))},[]),a=(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(jm,{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=a!=null&&a.data?{value:a.data.value,formatted:a.data.formatted,decimals:a.data.decimals,symbol:a.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},E=i.map(T=>{const j=l[T.tokenAddress],F=j==null?void 0:j.balance,_=F==null?void 0:F.data;return{address:T.tokenAddress,value:(_==null?void 0:_.value)||BigInt(0),formatted:(_==null?void 0:_.formatted)||"0",decimals:(_==null?void 0:_.decimals)||T.decimals}}).filter(T=>T.address),M=i.map(T=>{const j=l[T.tokenAddress],F=j==null?void 0:j.allowance,_=F==null?void 0:F.data,B=BigInt(_?_.toString():0);return{address:T.tokenAddress,value:B,formatted:(B/BigInt(10)**BigInt(T.decimals)).toString(),decimals:T.decimals}}).filter(T=>T.address),y=E.reduce((T,j)=>{const F=M.find(_=>_.address===j.address);return{...T,[j.address]:{balance:j,allowance:F||{address:j.address,value:BigInt(0),formatted:"0",decimals:j.decimals}}}},{});return{balanceList:E,allowanceList:M,baseTokenBalance:v,combinedData:y}},[a,l,i,o==null?void 0:o.useBalance]),p=m.useCallback(async()=>d,[d]),f=m.useMemo(()=>{const v=(a==null?void 0:a.isLoading)||!1,E=Object.values(l).some(M=>{var y,T;return((y=M.balance)==null?void 0:y.isLoading)||((T=M.allowance)==null?void 0:T.isLoading)});return v||E},[a==null?void 0:a.isLoading,l]);return{multicallRun:p,multicallResult:d,validErcTokens:i,isLoading:f,queryComponents:c}};let Ne=null;const Fm={symbol:"USDT"},Al=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState(!1),[l,u]=m.useState({chains:[]}),s=m.useCallback(g=>{u(g),r(!0)},[]),a=m.useCallback(g=>{u(v=>({...v,...g}))},[]),c=m.useCallback(()=>{r(!1),i(!1),l.onClose&&l.onClose()},[l.onClose]),d=m.useCallback(g=>{i(g)},[]),p=m.useCallback(()=>n,[n]),f=m.useCallback(()=>o,[o]);return m.useImperativeHandle(t,()=>({openDeposit:s,closeDeposit:c,updateDepositOptions:a,setDepositLoading:d,isOpen:p,isLoading:f}),[s,c,a,d,p,f]),m.useEffect(()=>(Ne={openDeposit:s,closeDeposit:c,updateDepositOptions:a,setDepositLoading:d,isOpen:p,isLoading:f},()=>{Ne=null}),[s,c,a,d,p,f]),O.jsx(Fl,{isOpen:n,isLoading:o,onClose:c,config:l.config||Fm,currentActiveAccount:l.currentActiveAccount||no,smartWallet:l.smartWallet||ro,chains:l.chains||gp,defaultChainId:l.defaultChainId,defaultTokenAddress:l.defaultTokenAddress,defaultAmount:l.defaultAmount,metadata:l.metadata||oo,currentEquity:l.currentEquity??5e3,platformBalance:l.platformBalance||"0",wagmiHooks:l.wagmiHooks,approved:l.approved,onApproved:l.onApproved,onDeposit:l.onDeposit,onCopy:l.onCopy,onChainChange:l.onChainChange,onTokenChange:l.onTokenChange})});Al.displayName="DepositManager";const Dl=e=>{if(!Ne){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ne.openDeposit(e||{chains:[]})},Ml=()=>{if(!Ne){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ne.closeDeposit()},Il=e=>{Ne&&Ne.updateDepositOptions(e)},Hn=e=>{if(!Ne){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ne.setDepositLoading(e)},km=()=>Ne?Ne.isOpen():!1,jl=()=>Ne?Ne.isLoading():!1,Rm=()=>({openDeposit:Dl,closeDeposit:Ml,updateDepositOptions:Il,setDepositLoading:Hn,isOpen:km,isLoading:jl}),Gn=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const i=t?`loading-${t}`:"",l=o?"loading-inline":"";return O.jsx("span",{className:`loading loading-${e} loading-spinner ${i} ${l} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},_m=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:l,platformBalance:u="0",isLoading:s=!1,wagmiHooks:a,approved:c,onApproved:d,onDeposit:p,onClose:f,onChainChange:g,onTokenChange:v})=>{var q;const{t:E}=Ke(),M=a==null?void 0:a.useAccount(),[y,T]=m.useState(()=>{var U;return!e||e.length===0?1:t||((U=e[0])==null?void 0:U.chainId)||1}),[j,F]=m.useState(()=>{var Z;if(!e||e.length===0)return"";const U=t||((Z=e[0])==null?void 0:Z.chainId),K=e.find(ae=>ae.chainId===U);if(!K||!K.tokenList||K.tokenList.length===0)return"";const H=K.tokenList.find(ae=>ae.tokenAddress===n)||K.tokenList[0];return(H==null?void 0:H.token)||""}),[_,B]=m.useState(r),h=m.useCallback(U=>{T(U),g==null||g(U)},[g]),b=m.useCallback(U=>{F(U),v==null||v(U)},[v]),x=m.useRef(!0),A=m.useRef(j),P=m.useRef(y);m.useEffect(()=>{if(x.current){x.current=!1,A.current=j,P.current=y;return}(A.current!==j||P.current!==y)&&(B(""),A.current=j,P.current=y)},[j,y]);const L=e&&e.length>0?e.find(U=>U.chainId===y)||e[0]:null,S=(q=L==null?void 0:L.tokenList)==null?void 0:q.find(U=>U.token===j),C=o==null?void 0:o.getDisplayAddress(),{multicallResult:N,queryComponents:$}=Pl({account:C,chainId:y,contractAddress:void 0,tokens:(L==null?void 0:L.tokenList)||[],wagmiHooks:a}),w=m.useMemo(()=>{var K;if(!S)return;if(!S.tokenAddress||S.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return N.baseTokenBalance.formatted;const U=N.combinedData[S.tokenAddress];return((K=U==null?void 0:U.balance)==null?void 0:K.formatted)||"0"},[S,N]),I=c??!1,R=m.useMemo(()=>+M.chainId!=+y,[M.chainId,y]),V=m.useMemo(()=>{if(R)return{text:E("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const U=parseFloat(_||"0"),K=10,H=w||"0",Z=pp(_,H,I);return!_||U===0||!I?{text:E("deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:U>parseFloat(H)?{text:"Insufficient Balance",disabled:!0,isNetworkSwitch:!1}:U<K?{text:`Min Deposit ${K} ${j}`,disabled:!0,isNetworkSwitch:!1}:{text:E("deposit.confirmDeposit"),disabled:!Z,isNetworkSwitch:!1}},[_,j,w,I,R,E]),z=m.useCallback(async()=>{h&&h(y)},[h,y]),G=m.useCallback(async()=>{Hn(!0);try{p&&p({amount:_,chainId:y,tokenAddress:(S==null?void 0:S.tokenAddress)||"",tokenSymbol:j})}catch(U){console.error("Deposit error:",U),Hn(!1)}},[p,_,y,S==null?void 0:S.tokenAddress,j]);return!(a!=null&&a.useBalance)||!(a!=null&&a.useReadContract)||!(a!=null&&a.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"})}):L?O.jsxs(O.Fragment,{children:[$,O.jsx(eo,{currentActiveChain:L,chainList:e,onChainChange:h,curSelectToken:j,onTokenChange:b,walletType:"evm"}),O.jsx(Im,{depositAmount:_,curSelectToken:j,curSelectTokenData:{balance:S==null?void 0:S.balance,allowance:S==null?void 0:S.allowance},approved:I,currentActiveChain:L,currentEquity:l||0,amount:_,decimals:(S==null?void 0:S.decimals)||6,tokenBalance:w,platformBalance:u,onDepositAmountChange:B,onApprove:async()=>{d&&await d()}}),O.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${V.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:V.isNetworkSwitch?z:G,disabled:V.disabled||s,children:[s&&O.jsx(Gn,{size:"xs"}),V.text]})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Fl=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=no,smartWallet:i=ro,chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a="",metadata:c=oo,currentEquity:d=5e3,platformBalance:p="0",wagmiHooks:f,approved:g,onApproved:v,onDeposit:E,onCopy:M,onChainChange:y,onTokenChange:T})=>{const{t:j}=Ke(),F=m.useMemo(()=>{var B;return o?Bo(o,i,!1,(B=l[0])==null?void 0:B.chainId,"0","0"):null},[o,i,l]),_=(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:()=>{n()},"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:j("deposit.title")}),O.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:O.jsx(Ro,{className:"h-4 w-4"})})]}),_?O.jsx(Dm,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:F,metadata:c,currentEquity:d,onDeposit:E,onCopy:M,onClose:n}):O.jsx(_m,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:F,metadata:c,currentEquity:d,platformBalance:p,isLoading:t,wagmiHooks:f,approved:g,onApproved:v,onDeposit:E,onClose:n,onChainChange:y,onTokenChange:T})]})})}),document.body):null};m.createContext(null);const Bm=()=>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)"})})})]}),Wm=()=>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)"})})})]}),Yn=({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(Bm,{}):O.jsx(Wm,{})},o))})};class mt{}Me(mt,"FAST",3),Me(mt,"Medium",2),Me(mt,"SLOW",1),Me(mt,"NONE",0);const Um=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:i="evm",receiverAddress:l="",onWithdrawAmountChange:u,onReceiverAddressChange:s,onAmountChanged:a})=>{const{t:c}=Ke(),d=m.useMemo(()=>{if(!He(n==null?void 0:n.chainId)){const E=new ke(e||"0").minus(o||"0").decimalPlaces(2,ke.ROUND_DOWN);return E.isNegative()?"0.00":E.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=m.useMemo(()=>He(n==null?void 0:n.chainId)?r||"0":new ke(r||"0").minus(o||"0").decimalPlaces(2,ke.ROUND_DOWN).toString(),[r,o,n==null?void 0:n.chainId]),f=E=>{const M=E.target.value,T=to(M,p||"0");if(T.isValid)u(T.formattedValue),T.errorType;else return T.errorType==="exceed_balance",void 0;a==null||a(T.formattedValue)},g=()=>{u(p)},v=()=>{const E=parseFloat(r||"0"),M=parseFloat(e||"0"),y=parseFloat(o||"0");if(M>0){let T=E-M;He(n==null?void 0:n.chainId)||(T=T-y);const j=Qe(Math.max(0,T).toString());return O.jsxs("span",{className:"flex items-center gap-1",children:[Qe(r||"0"),O.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),j," ",t]})}return`${Qe(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:c("deposit.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"}),O.jsx("button",{onClick:g,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:c("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(sn,{content:c("deposit.availableDesc"),children:O.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:c("deposit.available")})}),O.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:v()})]})]}),i==="mpc"&&!He(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:c("withdraw.receiverAddress"),value:l,onChange:E=>s==null?void 0:s(E.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:He(n==null?void 0:n.chainId)?O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:c("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:c("withdraw.commonWithdraw")})]}):O.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:c("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:c("withdraw.speed")}),O.jsx("div",{className:"flex items-center",children:O.jsx(sn,{content:O.jsxs("div",{children:[O.jsx("div",{children:c("withdraw.speedNote")}),O.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[O.jsx(Yn,{selectedLevel:mt.FAST,maxLevel:3}),O.jsx("span",{children:c("withdraw.speedNoteSpeed1")})]}),O.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[O.jsx(Yn,{selectedLevel:mt.Medium,maxLevel:3}),O.jsx("span",{children:c("withdraw.speedNoteSpeed2")})]}),O.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[O.jsx(Yn,{selectedLevel:mt.SLOW,maxLevel:3}),O.jsx("span",{children:c("withdraw.speedNoteSpeed3")})]})]}),children:O.jsx(Yn,{selectedLevel:He(n==null?void 0:n.chainId)?mt.SLOW:mt.FAST,maxLevel:3})})})]}),!He(n==null?void 0:n.chainId)&&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:c("withdraw.fee")}),O.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),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:[Qe(d)," ",t]})]})]})]})},Vm=[],zm={};let Le=null;const kl=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState(!1),[l,u]=m.useState({chains:[]}),s=m.useCallback(g=>{u(g||{chains:[]}),r(!0)},[]),a=m.useCallback(g=>{u(v=>({...v,...g}))},[]),c=m.useCallback(()=>{r(!1),i(!1),l.onClose&&l.onClose()},[l.onClose]),d=m.useCallback(g=>{i(g)},[]),p=m.useCallback(()=>n,[n]),f=m.useCallback(()=>o,[o]);return m.useImperativeHandle(t,()=>({openWithdraw:s,closeWithdraw:c,updateWithdrawOptions:a,setWithdrawLoading:d,isOpen:p,isLoading:f}),[s,c,a,d,p,f]),m.useEffect(()=>(Le={openWithdraw:s,closeWithdraw:c,updateWithdrawOptions:a,setWithdrawLoading:d,isOpen:p,isLoading:f},()=>{Le=null}),[s,c,a,d,p,f]),O.jsx(Ul,{isOpen:n,isLoading:o,onClose:c,config:l.config||{symbol:"USDT"},currentActiveAccount:l.currentActiveAccount,smartWallet:l.smartWallet,chains:l.chains||Vm,defaultChainId:l.defaultChainId,defaultTokenAddress:l.defaultTokenAddress,defaultAmount:l.defaultAmount,metadata:l.metadata||zm,currentEquity:l.currentEquity??5e3,platformBalance:l.platformBalance||"0",fee:l.fee,wagmiHooks:l.wagmiHooks,onWithdraw:l.onWithdraw,onChainChange:l.onChainChange,onTokenChange:l.onTokenChange,onAmountChanged:l.onAmountChanged})});kl.displayName="WithdrawManager";const Rl=e=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.openWithdraw(e||{chains:[]})},_l=()=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.closeWithdraw()},Bl=e=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.updateWithdrawOptions(e)},Kn=e=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.setWithdrawLoading(e)},Hm=()=>Le?Le.isOpen():!1,Wl=()=>Le?Le.isLoading():!1,Gm=()=>({openWithdraw:Rl,closeWithdraw:_l,updateWithdrawOptions:Bl,setWithdrawLoading:Kn,isOpen:Hm,isLoading:Wl}),Ym=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:l,platformBalance:u="0",fee:s="0.00",isLoading:a=!1,wagmiHooks:c,onWithdraw:d,onClose:p,onChainChange:f,onTokenChange:g,onAmountChanged:v})=>{var G;const{t:E}=Ke(),[M,y]=m.useState(()=>{var q;return!e||e.length===0?1:t||((q=e[0])==null?void 0:q.chainId)||1}),[T,j]=m.useState(()=>{var H;if(!e||e.length===0)return"";const q=t||((H=e[0])==null?void 0:H.chainId),U=e.find(Z=>Z.chainId===q);if(!U||!U.tokenList||U.tokenList.length===0)return"";const K=U.tokenList.find(Z=>Z.tokenAddress===n)||U.tokenList[0];return(K==null?void 0:K.token)||""}),[F,_]=m.useState(r),[B,h]=m.useState(""),b=(o==null?void 0:o.getWalletType())||"evm",x=m.useCallback(q=>{y(q),f==null||f(q)},[f]),A=m.useCallback(q=>{j(q),g==null||g(q)},[g]),P=m.useRef(!0),L=m.useRef(T),S=m.useRef(M);m.useEffect(()=>{if(P.current){P.current=!1,L.current=T,S.current=M;return}(L.current!==T||S.current!==M)&&(_(""),L.current=T,S.current=M)},[T,M]);const C=e&&e.length>0?e.find(q=>q.chainId===M)||e[0]:null,N=(G=C==null?void 0:C.tokenList)==null?void 0:G.find(q=>q.token===T),$=o==null?void 0:o.getDisplayAddress(),{multicallResult:w,queryComponents:I}=Pl({account:$,chainId:M,contractAddress:void 0,tokens:(C==null?void 0:C.tokenList)||[],wagmiHooks:c}),R=m.useMemo(()=>{var U;if(!N)return;if(!N.tokenAddress||N.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return w.baseTokenBalance.formatted;const q=w.combinedData[N.tokenAddress];return((U=q==null?void 0:q.balance)==null?void 0:U.formatted)||"0"},[N,w]),V=m.useMemo(()=>{const q=parseFloat(F||"0");return!F||q===0?{text:E("withdraw.confirmWithdraw"),disabled:!0}:b==="mpc"&&!He(M)&&!B.trim()?{text:"Enter Receiver Address",disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,M,F,b,B]),z=m.useCallback(async()=>{Kn(!0);try{if(d){const q={amount:F,chainId:M,tokenAddress:(N==null?void 0:N.tokenAddress)||"",tokenSymbol:T};b==="mpc"&&!He(M)&&(q.receiverAddress=B),d(q)}}catch(q){console.error("Withdraw error:",q),Kn(!1)}},[d,F,M,N==null?void 0:N.tokenAddress,T,b,B]);return!(c!=null&&c.useBalance)||!(c!=null&&c.useReadContract)||!(c!=null&&c.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:[I,O.jsx(eo,{currentActiveChain:C,chainList:e,onChainChange:x,curSelectToken:T,onTokenChange:A,walletType:"evm"}),O.jsx(Um,{withdrawAmount:F,curSelectToken:T,curSelectTokenData:{balance:N==null?void 0:N.balance,allowance:N==null?void 0:N.allowance},currentActiveChain:C,currentEquity:l||0,amount:F,decimals:(N==null?void 0:N.decimals)||6,tokenBalance:R,platformBalance:u,fee:s,walletType:b,receiverAddress:B,onWithdrawAmountChange:_,onReceiverAddressChange:h,onAmountChanged:v}),O.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${V.disabled||a?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:V.disabled||a,children:[a&&O.jsx(Gn,{size:"xs"}),V.text]})]}):O.jsx("div",{className:"text-center py-8",children:O.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Ul=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=no,smartWallet:i=ro,chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a="",metadata:c=oo,currentEquity:d=5e3,platformBalance:p="0",fee:f,wagmiHooks:g,onWithdraw:v,onChainChange:E,onTokenChange:M,onAmountChanged:y})=>{const{t:T}=Ke(),j=m.useMemo(()=>{var F;return o?Bo(o,i,!1,(F=l[0])==null?void 0:F.chainId,"0","0"):null},[o,i,l]);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:()=>{n()},"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:F=>{F.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:T("withdraw.withdraw")}),O.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:O.jsx(Ro,{className:"h-4 w-4"})})]}),O.jsx(Ym,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:j,metadata:c,currentEquity:d,platformBalance:p,fee:f,isLoading:t,wagmiHooks:g,onWithdraw:v,onClose:n,onChainChange:E,onTokenChange:M,onAmountChanged:y})]})})}),document.body):null};J.ChromeLoader=Gn,J.ComponentProvider=ha,J.DEFAULT_LOCALE=an,J.Deposit=Fl,J.DepositManager=Al,J.LOCALE_NAMES=da,J.LoadingSpinner=Gn,J.SUPPORTED_LOCALES=Qn,J.Tooltip=sn,J.Withdraw=Ul,J.WithdrawManager=kl,J.closeDeposit=Ml,J.closeWithdraw=_l,J.formatThousands=va,J.isDepositLoading=jl,J.isWithdrawLoading=Wl,J.openDeposit=Dl,J.openWithdraw=Rl,J.setDepositLoading=Hn,J.setWithdrawLoading=Kn,J.updateDepositOptions=Il,J.updateWithdrawOptions=Bl,J.useComponentConfig=Mo,J.useDeposit=ba,J.useDepositManager=Rm,J.useTranslation=Ke,J.useWithdraw=xa,J.useWithdrawManager=Gm,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
119
+ `,children:[t,o&&C.jsx(Ll,{ref:d,placement:g.placement||n})]})})]})},So="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=",$m=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var u;const{t:i}=Ke(),l=m.useMemo(()=>hp(n||{}),[n]);return C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"flex justify-center mt-4 mb-3",children:C.jsx("div",{className:"bg-white rounded-lg",children:C.jsx(cl,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),C.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[C.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),C.jsx(Fp,{onCopy:()=>{const s=(e==null?void 0:e.getDisplayAddress())||"";o&&o(s)},text:e==null?void 0:e.getDisplayAddress(),children:C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[C.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),C.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")]}),C.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[C.jsxs("div",{className:"flex items-start",children:[C.jsx("div",{className:"w-5",children:C.jsx("img",{src:So,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1",children:C.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:n==null?void 0:n.chain})})})]}),l&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),C.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),C.jsxs("div",{className:"text-sm",children:[C.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[C.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),C.jsx(sn,{content:C.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[C.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60,v1:n==null?void 0:n.txConfirm})}),C.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:C.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})})})]}),C.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[C.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),C.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]})]}),C.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[C.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),C.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},Dm=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:i,onCopy:l,onClose:u})=>{var v;const{t:s}=Ke(),[a,c]=m.useState(()=>{var E;return!e||e.length===0?1:t||((E=e[0])==null?void 0:E.chainId)||1}),[d,p]=m.useState(()=>{var N;if(!e||e.length===0)return"";const E=t||((N=e[0])==null?void 0:N.chainId),M=e.find(j=>j.chainId===E);if(!M||!M.tokenList||M.tokenList.length===0)return"";const w=M.tokenList.find(j=>j.tokenAddress===n)||M.tokenList[0];return(w==null?void 0:w.token)||""}),f=e&&e.length>0?e.find(E=>E.chainId===a)||e[0]:null,g=(v=f==null?void 0:f.tokenList)==null?void 0:v.find(E=>E.token===d);return!e||e.length===0?C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"No chains available"})}):f?C.jsxs(C.Fragment,{children:[C.jsx(eo,{currentActiveChain:f,chainList:e,onChainChange:c,curSelectToken:d,onTokenChange:p,walletType:"mpc"}),C.jsx($m,{walletAdapter:r,curSelectToken:d,currentActiveChain:f,metadata:o,onCopy:l}),C.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:a,tokenAddress:(g==null?void 0:g.tokenAddress)||"",tokenSymbol:d}),u()},children:s("deposit.title")})]}):C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Mm=Object.values({MAINNET:1,SEPOLIA:11155111}),He=e=>Mm.includes(+e),ln=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const i=t?`loading-${t}`:"",l=o?"loading-inline":"";return C.jsx("span",{className:`loading loading-${e} loading-spinner ${i} ${l} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},Im=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:i,amount:l,decimals:u,tokenBalance:s,platformBalance:a="0",onDepositAmountChange:c,onApproved:d})=>{const{t:p}=Ke(),[f,g]=m.useState(!1);m.useEffect(()=>{r&&f&&g(!1)},[r,f]);const v=m.useCallback(async()=>{if(!f)try{g(!0),await d()}catch(j){g(!1),console.error("Approve failed:",j)}},[d,f]),E=m.useCallback(()=>{let j=s||"0";if(!He(o==null?void 0:o.chainId))try{const F=new Oe(j),k=new Oe("250000");F.gt(k)&&(j="250000")}catch(F){console.warn("Error calculating max amount limit:",F)}return j},[s,o==null?void 0:o.chainId]),M=m.useMemo(()=>{if(He(o==null?void 0:o.chainId))return!1;try{const j=new Oe(e||"0"),F=new Oe("250000");return j.isNaN()||F.isNaN()?!1:j.gte(F)}catch{return!1}},[o,e]);m.useMemo(()=>{if(He(o==null?void 0:o.chainId))return!1;try{const j=new Oe(s||"0"),F=new Oe("250000");return j.gt(F)}catch{return!1}},[o==null?void 0:o.chainId,s]);const w=j=>{const F=j.target.value,k=E(),W=to(F,k);if(W.isValid)c(W.formattedValue),W.errorType;else return W.errorType==="exceed_balance",void 0},N=()=>{const j=parseFloat(s||"0"),F=parseFloat(e||"0");if(F>0){const k=j-F,W=Qe(Math.max(0,k).toString());return C.jsxs("span",{className:"flex items-center gap-1",children:[Qe(s||"0"),C.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),W," ",t]})}return`${Qe(s||"0")} ${t}`};return C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[C.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[C.jsx("input",{type:"text",placeholder:p("deposit.amount"),value:e,onChange:w,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"}),C.jsx("button",{onClick:()=>{const j=E();c(j)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:p("deposit.max")})]}),C.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),C.jsxs("div",{className:"flex justify-between items-center",children:[C.jsx(sn,{content:p("deposit.availableDesc"),children:C.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:p("deposit.available")})}),C.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:N()})]})]}),!r&&dp(e||"0",0)&&C.jsxs("div",{className:"flex justify-center flex-col items-center",children:[C.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})}),C.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})}),C.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:v,disabled:f,children:f?C.jsx(ln,{size:"xs",inline:!0}):p("deposit.enableWithToken",{token:t})})]}),M&&C.jsxs("div",{className:"flex mb-4",children:[C.jsx("div",{className:"w-5",children:C.jsx("img",{src:So,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:p("deposit.depositTipFor25w")})]}),M&&C.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),C.jsxs("div",{className:"flex mb-4",children:[C.jsx("div",{className:"w-5",children:!M&&C.jsx("img",{src:So,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:p("deposit.noPrivateKeyWalletWarning")})]}),C.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:C.jsxs("div",{className:"flex justify-between items-center",children:[C.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:p("deposit.equity")}),C.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?C.jsxs("span",{className:"flex items-center gap-1",children:[Qe(a),C.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Qe((parseFloat(a)+parseFloat(e)).toString())," ",t]}):`${Qe(a)} ${t}`})]})})]})},jm=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:i})=>{var s,a;const l=(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=(a=o==null?void 0:o.useReadContract)==null?void 0:a.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:l,allowance:u})},[l,u,e.tokenAddress,i]),null},Pl=({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]),[l,u]=m.useState({}),s=m.useCallback((v,E)=>{u(M=>({...M,[v]:E}))},[]),a=(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(jm,{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=a!=null&&a.data?{value:a.data.value,formatted:a.data.formatted,decimals:a.data.decimals,symbol:a.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},E=i.map(N=>{const j=l[N.tokenAddress],F=j==null?void 0:j.balance,k=F==null?void 0:F.data;return{address:N.tokenAddress,value:(k==null?void 0:k.value)||BigInt(0),formatted:(k==null?void 0:k.formatted)||"0",decimals:(k==null?void 0:k.decimals)||N.decimals}}).filter(N=>N.address),M=i.map(N=>{const j=l[N.tokenAddress],F=j==null?void 0:j.allowance,k=F==null?void 0:F.data,W=BigInt(k?k.toString():0);return{address:N.tokenAddress,value:W,formatted:(W/BigInt(10)**BigInt(N.decimals)).toString(),decimals:N.decimals}}).filter(N=>N.address),w=E.reduce((N,j)=>{const F=M.find(k=>k.address===j.address);return{...N,[j.address]:{balance:j,allowance:F||{address:j.address,value:BigInt(0),formatted:"0",decimals:j.decimals}}}},{});return{balanceList:E,allowanceList:M,baseTokenBalance:v,combinedData:w}},[a,l,i,o==null?void 0:o.useBalance]),p=m.useCallback(async()=>d,[d]),f=m.useMemo(()=>{const v=(a==null?void 0:a.isLoading)||!1,E=Object.values(l).some(M=>{var w,N;return((w=M.balance)==null?void 0:w.isLoading)||((N=M.allowance)==null?void 0:N.isLoading)});return v||E},[a==null?void 0:a.isLoading,l]);return{multicallRun:p,multicallResult:d,validErcTokens:i,isLoading:f,queryComponents:c}};let Ae=null;const Fm={symbol:"USDT"},$l=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState(!1),[l,u]=m.useState({chains:[]}),s=m.useCallback(g=>{u(g),r(!0)},[]),a=m.useCallback(g=>{u(v=>({...v,...g}))},[]),c=m.useCallback(()=>{r(!1),i(!1),l.onClose&&l.onClose()},[l.onClose]),d=m.useCallback(g=>{i(g)},[]),p=m.useCallback(()=>n,[n]),f=m.useCallback(()=>o,[o]);return m.useImperativeHandle(t,()=>({openDeposit:s,closeDeposit:c,updateDepositOptions:a,setDepositLoading:d,isOpen:p,isLoading:f}),[s,c,a,d,p,f]),m.useEffect(()=>(Ae={openDeposit:s,closeDeposit:c,updateDepositOptions:a,setDepositLoading:d,isOpen:p,isLoading:f},()=>{Ae=null}),[s,c,a,d,p,f]),C.jsx(Fl,{isOpen:n,isLoading:o,onClose:c,config:l.config||Fm,currentActiveAccount:l.currentActiveAccount||no,smartWallet:l.smartWallet||ro,chains:l.chains||gp,defaultChainId:l.defaultChainId,defaultTokenAddress:l.defaultTokenAddress,defaultAmount:l.defaultAmount,metadata:l.metadata||oo,currentEquity:l.currentEquity??5e3,platformBalance:l.platformBalance||"0",wagmiHooks:l.wagmiHooks,approved:l.approved,onApproved:l.onApproved,onDeposit:l.onDeposit,onCopy:l.onCopy,onChainChange:l.onChainChange,onTokenChange:l.onTokenChange})});$l.displayName="DepositManager";const Dl=e=>{if(!Ae){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ae.openDeposit(e||{chains:[]})},Ml=()=>{if(!Ae){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ae.closeDeposit()},Il=e=>{Ae&&Ae.updateDepositOptions(e)},Gn=e=>{if(!Ae){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ae.setDepositLoading(e)},Rm=()=>Ae?Ae.isOpen():!1,jl=()=>Ae?Ae.isLoading():!1,km=()=>({openDeposit:Dl,closeDeposit:Ml,updateDepositOptions:Il,setDepositLoading:Gn,isOpen:Rm,isLoading:jl}),_m=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:l,platformBalance:u="0",isLoading:s=!1,wagmiHooks:a,approved:c,onApproved:d,onDeposit:p,onClose:f,onChainChange:g,onTokenChange:v})=>{var q;const{t:E}=Ke(),M=a==null?void 0:a.useAccount(),[w,N]=m.useState(()=>{var B;return!e||e.length===0?1:t||((B=e[0])==null?void 0:B.chainId)||1}),[j,F]=m.useState(()=>{var Z;if(!e||e.length===0)return"";const B=t||((Z=e[0])==null?void 0:Z.chainId),K=e.find(ae=>ae.chainId===B);if(!K||!K.tokenList||K.tokenList.length===0)return"";const H=K.tokenList.find(ae=>ae.tokenAddress===n)||K.tokenList[0];return(H==null?void 0:H.token)||""}),[k,W]=m.useState(r),h=m.useCallback(B=>{N(B),g==null||g(B)},[g]),b=m.useCallback(B=>{F(B),v==null||v(B)},[v]),x=m.useRef(!0),$=m.useRef(j),P=m.useRef(w);m.useEffect(()=>{if(x.current){x.current=!1,$.current=j,P.current=w;return}($.current!==j||P.current!==w)&&(W(""),$.current=j,P.current=w)},[j,w]);const A=e&&e.length>0?e.find(B=>B.chainId===w)||e[0]:null,S=(q=A==null?void 0:A.tokenList)==null?void 0:q.find(B=>B.token===j),O=o==null?void 0:o.getDisplayAddress(),{multicallResult:T,queryComponents:L}=Pl({account:O,chainId:w,contractAddress:void 0,tokens:(A==null?void 0:A.tokenList)||[],wagmiHooks:a}),y=m.useMemo(()=>{var K;if(!S)return;if(!S.tokenAddress||S.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return T.baseTokenBalance.formatted;const B=T.combinedData[S.tokenAddress];return((K=B==null?void 0:B.balance)==null?void 0:K.formatted)||"0"},[S,T]),I=c??!1,_=m.useMemo(()=>+M.chainId!=+w,[M.chainId,w]),V=m.useMemo(()=>{if(_)return{text:E("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const B=parseFloat(k||"0"),K=10,H=y||"0",Z=pp(k,H,I);return!k||B===0||!I?{text:E("deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:B>parseFloat(H)?{text:"Insufficient Balance",disabled:!0,isNetworkSwitch:!1}:B<K?{text:`Min Deposit ${K} ${j}`,disabled:!0,isNetworkSwitch:!1}:{text:E("deposit.confirmDeposit"),disabled:!Z,isNetworkSwitch:!1}},[k,j,y,I,_,E]),z=m.useCallback(async()=>{h&&h(w)},[h,w]),G=m.useCallback(async()=>{Gn(!0);try{p&&p({amount:k,chainId:w,tokenAddress:(S==null?void 0:S.tokenAddress)||"",tokenSymbol:j})}catch(B){console.error("Deposit error:",B),Gn(!1)}},[p,k,w,S==null?void 0:S.tokenAddress,j]);return!(a!=null&&a.useBalance)||!(a!=null&&a.useReadContract)||!(a!=null&&a.useAccount)?C.jsxs("div",{className:"p-6 text-center",children:[C.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),C.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"No chains available"})}):A?C.jsxs(C.Fragment,{children:[L,C.jsx(eo,{currentActiveChain:A,chainList:e,onChainChange:h,curSelectToken:j,onTokenChange:b,walletType:"evm"}),C.jsx(Im,{depositAmount:k,curSelectToken:j,curSelectTokenData:{balance:S==null?void 0:S.balance,allowance:S==null?void 0:S.allowance},approved:I,currentActiveChain:A,currentEquity:l||0,amount:k,decimals:(S==null?void 0:S.decimals)||6,tokenBalance:y,platformBalance:u,onDepositAmountChange:W,onApproved:async()=>{d&&await d()}}),C.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${V.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:V.isNetworkSwitch?z:G,disabled:V.disabled||s,children:[s&&C.jsx(ln,{size:"xs"}),V.text]})]}):C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Fl=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=no,smartWallet:i=ro,chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a="",metadata:c=oo,currentEquity:d=5e3,platformBalance:p="0",wagmiHooks:f,approved:g,onApproved:v,onDeposit:E,onCopy:M,onChainChange:w,onTokenChange:N})=>{const{t:j}=Ke(),F=m.useMemo(()=>{var W;return o?Bo(o,i,!1,(W=l[0])==null?void 0:W.chainId,"0","0"):null},[o,i,l]),k=(F==null?void 0:F.getWalletType())==="mpc";return e?we.createPortal(C.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:C.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:C.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:[C.jsxs("div",{className:"flex items-center justify-between mb-4",children:[C.jsx("h2",{className:"text-lg font-semibold text-white",children:j("deposit.title")}),C.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:C.jsx(_o,{className:"h-4 w-4"})})]}),k?C.jsx(Dm,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:F,metadata:c,currentEquity:d,onDeposit:E,onCopy:M,onClose:n}):C.jsx(_m,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:F,metadata:c,currentEquity:d,platformBalance:p,isLoading:t,wagmiHooks:f,approved:g,onApproved:v,onDeposit:E,onClose:n,onChainChange:w,onTokenChange:N})]})})}),document.body):null};m.createContext(null);const Wm=()=>C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[C.jsx("g",{clipPath:"url(#clip0_active)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_active",children:C.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Bm=()=>C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[C.jsx("g",{clipPath:"url(#clip0_inactive)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_inactive",children:C.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Yn=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,i)=>i+1);return C.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>C.jsx("div",{className:"flex items-center justify-center",children:o<=e?C.jsx(Wm,{}):C.jsx(Bm,{})},o))})};class mt{}Ie(mt,"FAST",3),Ie(mt,"Medium",2),Ie(mt,"SLOW",1),Ie(mt,"NONE",0);const Um=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:i="evm",receiverAddress:l="",onWithdrawAmountChange:u,onReceiverAddressChange:s,onAmountChanged:a})=>{const{t:c}=Ke(),d=m.useMemo(()=>{if(!He(n==null?void 0:n.chainId)){const E=new Oe(e||"0").minus(o||"0").decimalPlaces(2,Oe.ROUND_DOWN);return E.isNegative()?"0.00":E.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=m.useMemo(()=>r||"0",[r]),f=E=>{const M=E.target.value,N=to(M,p||"0");if(N.isValid)u(N.formattedValue),N.errorType;else return N.errorType==="exceed_balance",void 0;a==null||a(N.formattedValue)},g=()=>{u(p),a==null||a(p)},v=()=>{const E=parseFloat(r||"0"),M=parseFloat(e||"0");if(M>0){const w=E-M,N=Qe(Math.max(0,w).toString());return C.jsxs("span",{className:"flex items-center gap-1",children:[Qe(r||"0"),C.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),N," ",t]})}return`${Qe(r||"0")} ${t}`};return C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[C.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[C.jsx("input",{type:"text",placeholder:c("deposit.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"}),C.jsx("button",{onClick:g,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:c("deposit.max")})]}),C.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),C.jsxs("div",{className:"flex justify-between items-center",children:[C.jsx(sn,{content:c("deposit.availableDesc"),children:C.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:c("deposit.available")})}),C.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:v()})]})]}),i==="mpc"&&!He(n==null?void 0:n.chainId)&&C.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:C.jsx("input",{type:"text",placeholder:c("withdraw.receiverAddress"),value:l,onChange:E=>s==null?void 0:s(E.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"})}),C.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:He(n==null?void 0:n.chainId)?C.jsxs(C.Fragment,{children:[C.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:c("withdraw.noticeDesc")}),C.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:c("withdraw.commonWithdraw")})]}):C.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:c("withdraw.crossChainTips")})}),C.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("span",{className:"text-text-tertiary text-xs",children:c("withdraw.speed")}),C.jsx("div",{className:"flex items-center",children:C.jsx(sn,{content:C.jsxs("div",{children:[C.jsx("div",{children:c("withdraw.speedNote")}),C.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[C.jsx(Yn,{selectedLevel:mt.FAST,maxLevel:3}),C.jsx("span",{children:c("withdraw.speedNoteSpeed1")})]}),C.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[C.jsx(Yn,{selectedLevel:mt.Medium,maxLevel:3}),C.jsx("span",{children:c("withdraw.speedNoteSpeed2")})]}),C.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[C.jsx(Yn,{selectedLevel:mt.SLOW,maxLevel:3}),C.jsx("span",{children:c("withdraw.speedNoteSpeed3")})]})]}),children:C.jsx(Yn,{selectedLevel:He(n==null?void 0:n.chainId)?mt.SLOW:mt.FAST,maxLevel:3})})})]}),!He(n==null?void 0:n.chainId)&&C.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[C.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:c("withdraw.fee")}),C.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),C.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[C.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:c(He(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),C.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Qe(d)," ",t]})]})]})]})},Vm=[],zm={};let Le=null;const Rl=m.forwardRef((e,t)=>{const[n,r]=m.useState(!1),[o,i]=m.useState(!1),[l,u]=m.useState({chains:[]}),s=m.useCallback(g=>{u(g||{chains:[]}),r(!0)},[]),a=m.useCallback(g=>{u(v=>({...v,...g}))},[]),c=m.useCallback(()=>{r(!1),i(!1),l.onClose&&l.onClose()},[l.onClose]),d=m.useCallback(g=>{i(g)},[]),p=m.useCallback(()=>n,[n]),f=m.useCallback(()=>o,[o]);return m.useImperativeHandle(t,()=>({openWithdraw:s,closeWithdraw:c,updateWithdrawOptions:a,setWithdrawLoading:d,isOpen:p,isLoading:f}),[s,c,a,d,p,f]),m.useEffect(()=>(Le={openWithdraw:s,closeWithdraw:c,updateWithdrawOptions:a,setWithdrawLoading:d,isOpen:p,isLoading:f},()=>{Le=null}),[s,c,a,d,p,f]),C.jsx(Ul,{isOpen:n,isLoading:o,onClose:c,config:l.config||{symbol:"USDT"},currentActiveAccount:l.currentActiveAccount,smartWallet:l.smartWallet,chains:l.chains||Vm,defaultChainId:l.defaultChainId,defaultTokenAddress:l.defaultTokenAddress,defaultAmount:l.defaultAmount,metadata:l.metadata||zm,currentEquity:l.currentEquity??5e3,platformBalance:l.platformBalance||"0",fee:l.fee,wagmiHooks:l.wagmiHooks,onWithdraw:l.onWithdraw,onChainChange:l.onChainChange,onTokenChange:l.onTokenChange,onAmountChanged:l.onAmountChanged})});Rl.displayName="WithdrawManager";const kl=e=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.openWithdraw(e||{chains:[]})},_l=()=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.closeWithdraw()},Wl=e=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.updateWithdrawOptions(e)},Kn=e=>{if(!Le){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Le.setWithdrawLoading(e)},Hm=()=>Le?Le.isOpen():!1,Bl=()=>Le?Le.isLoading():!1,Gm=()=>({openWithdraw:kl,closeWithdraw:_l,updateWithdrawOptions:Wl,setWithdrawLoading:Kn,isOpen:Hm,isLoading:Bl}),Ym=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:i,currentEquity:l,platformBalance:u="0",fee:s="0.00",isLoading:a=!1,wagmiHooks:c,onWithdraw:d,onClose:p,onChainChange:f,onTokenChange:g,onAmountChanged:v})=>{var G;const{t:E}=Ke(),[M,w]=m.useState(()=>{var q;return!e||e.length===0?1:t||((q=e[0])==null?void 0:q.chainId)||1}),[N,j]=m.useState(()=>{var H;if(!e||e.length===0)return"";const q=t||((H=e[0])==null?void 0:H.chainId),B=e.find(Z=>Z.chainId===q);if(!B||!B.tokenList||B.tokenList.length===0)return"";const K=B.tokenList.find(Z=>Z.tokenAddress===n)||B.tokenList[0];return(K==null?void 0:K.token)||""}),[F,k]=m.useState(r),[W,h]=m.useState(""),b=(o==null?void 0:o.getWalletType())||"evm",x=m.useCallback(q=>{w(q),f==null||f(q)},[f]),$=m.useCallback(q=>{j(q),g==null||g(q)},[g]),P=m.useRef(!0),A=m.useRef(N),S=m.useRef(M);m.useEffect(()=>{if(P.current){P.current=!1,A.current=N,S.current=M;return}(A.current!==N||S.current!==M)&&(k(""),A.current=N,S.current=M)},[N,M]);const O=e&&e.length>0?e.find(q=>q.chainId===M)||e[0]:null,T=(G=O==null?void 0:O.tokenList)==null?void 0:G.find(q=>q.token===N),L=o==null?void 0:o.getDisplayAddress(),{multicallResult:y,queryComponents:I}=Pl({account:L,chainId:M,contractAddress:void 0,tokens:(O==null?void 0:O.tokenList)||[],wagmiHooks:c}),_=m.useMemo(()=>{var B;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return y.baseTokenBalance.formatted;const q=y.combinedData[T.tokenAddress];return((B=q==null?void 0:q.balance)==null?void 0:B.formatted)||"0"},[T,y]),V=m.useMemo(()=>{const q=new Oe(F||"0"),B=new Oe(s||"0"),K=He(M);return!F||q.isZero()||!K&&q.isLessThan(B)?{text:E("withdraw.confirmWithdraw"),disabled:!0}:b==="mpc"&&!K&&!W.trim()?{text:E("withdraw.invalidReceiverAddress"),disabled:!0}:{text:E("withdraw.confirmWithdraw"),disabled:!1}},[E,M,F,b,W,s]),z=m.useCallback(async()=>{Kn(!0);try{if(d){const q=new Oe(F||"0"),B=new Oe(s||"0"),H={amount:(He(M)?q:q.minus(B)).toString(),chainId:M,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:N};b==="mpc"&&!He(M)&&(H.receiverAddress=W),d(H)}}catch{Kn(!1)}},[d,F,s,M,T==null?void 0:T.tokenAddress,N,b,W]);return!(c!=null&&c.useBalance)||!(c!=null&&c.useReadContract)||!(c!=null&&c.useAccount)?C.jsxs("div",{className:"p-6 text-center",children:[C.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),C.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"No chains available"})}):O?C.jsxs(C.Fragment,{children:[I,C.jsx(eo,{currentActiveChain:O,chainList:e,onChainChange:x,curSelectToken:N,onTokenChange:$,walletType:"evm"}),C.jsx(Um,{withdrawAmount:F,curSelectToken:N,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},currentActiveChain:O,currentEquity:l||0,amount:F,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:_,platformBalance:u,fee:s,walletType:b,receiverAddress:W,onWithdrawAmountChange:k,onReceiverAddressChange:h,onAmountChanged:v}),C.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${V.disabled||a?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:V.disabled||a,children:[a&&C.jsx(ln,{size:"xs"}),V.text]})]}):C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Ul=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=no,smartWallet:i=ro,chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a="",metadata:c=oo,currentEquity:d=5e3,platformBalance:p="0",fee:f,wagmiHooks:g,onWithdraw:v,onChainChange:E,onTokenChange:M,onAmountChanged:w})=>{const{t:N}=Ke(),j=m.useMemo(()=>{var F;return o?Bo(o,i,!1,(F=l[0])==null?void 0:F.chainId,"0","0"):null},[o,i,l]);return e?we.createPortal(C.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:C.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:C.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:F=>{F.stopPropagation()},children:[C.jsxs("div",{className:"flex items-center justify-between mb-4",children:[C.jsx("h2",{className:"text-lg font-semibold text-white",children:N("withdraw.withdraw")}),C.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:C.jsx(_o,{className:"h-4 w-4"})})]}),C.jsx(Ym,{chains:l,defaultChainId:u,defaultTokenAddress:s,defaultAmount:a,walletAdapter:j,metadata:c,currentEquity:d,platformBalance:p,fee:f,isLoading:t,wagmiHooks:g,onWithdraw:v,onClose:n,onChainChange:E,onTokenChange:M,onAmountChanged:w})]})})}),document.body):null};J.ChromeLoader=ln,J.ComponentProvider=ha,J.DEFAULT_LOCALE=un,J.Deposit=Fl,J.DepositManager=$l,J.LOCALE_NAMES=da,J.LoadingSpinner=ln,J.SUPPORTED_LOCALES=Qn,J.Tooltip=sn,J.Withdraw=Ul,J.WithdrawManager=Rl,J.closeDeposit=Ml,J.closeWithdraw=_l,J.formatThousands=va,J.isDepositLoading=jl,J.isWithdrawLoading=Bl,J.openDeposit=Dl,J.openWithdraw=kl,J.setDepositLoading=Gn,J.setWithdrawLoading=Kn,J.updateDepositOptions=Il,J.updateWithdrawOptions=Wl,J.useComponentConfig=Io,J.useDeposit=ba,J.useDepositManager=km,J.useTranslation=Ke,J.useWithdraw=xa,J.useWithdrawManager=Gm,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
120
120
  //# sourceMappingURL=index.umd.js.map