@cetusprotocol/terminal 0.0.17 → 0.1.0
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/cetus-swap.cjs.js +24 -24
- package/dist/cetus-swap.cjs.js.gz +0 -0
- package/dist/cetus-swap.es.js +4682 -4814
- package/dist/cetus-swap.es.js.gz +0 -0
- package/dist/cetus-swap.umd.js +25 -25
- package/dist/cetus-swap.umd.js.gz +0 -0
- package/dist/components/common/wallet/TriggerButton.d.ts +3 -2
- package/dist/hooks/swap/usePriceImpact.d.ts +4 -0
- package/dist/stores/token.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/style.css.gz +0 -0
- package/package.json +1 -1
package/dist/cetus-swap.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(Vt,te){typeof exports=="object"&&typeof module<"u"?te(exports,require("react"),require("react-dom"),require("@mysten/dapp-kit")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","@mysten/dapp-kit"],te):(Vt=typeof globalThis<"u"?globalThis:Vt||self,te(Vt.CetusSwap={},Vt.React,Vt.ReactDOM,Vt.dappKit))})(this,function(Vt,te,Bn,
|
|
1
|
+
(function(Vt,te){typeof exports=="object"&&typeof module<"u"?te(exports,require("react"),require("react-dom"),require("@mysten/dapp-kit")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","@mysten/dapp-kit"],te):(Vt=typeof globalThis<"u"?globalThis:Vt||self,te(Vt.CetusSwap={},Vt.React,Vt.ReactDOM,Vt.dappKit))})(this,function(Vt,te,Bn,Ur){"use strict";var gX=Object.defineProperty;var vX=(Vt,te,Bn)=>te in Vt?gX(Vt,te,{enumerable:!0,configurable:!0,writable:!0,value:Bn}):Vt[te]=Bn;var vt=(Vt,te,Bn)=>(vX(Vt,typeof te!="symbol"?te+"":te,Bn),Bn);function Q0(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const I=Q0(te),em=Q0(Bn);function B3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tm={exports:{}},sr=tm.exports={},Ln,Un;function lf(){throw new Error("setTimeout has not been defined")}function ff(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Ln=setTimeout:Ln=lf}catch{Ln=lf}try{typeof clearTimeout=="function"?Un=clearTimeout:Un=ff}catch{Un=ff}})();function rm(e){if(Ln===setTimeout)return setTimeout(e,0);if((Ln===lf||!Ln)&&setTimeout)return Ln=setTimeout,setTimeout(e,0);try{return Ln(e,0)}catch{try{return Ln.call(null,e,0)}catch{return Ln.call(this,e,0)}}}function L3(e){if(Un===clearTimeout)return clearTimeout(e);if((Un===ff||!Un)&&clearTimeout)return Un=clearTimeout,clearTimeout(e);try{return Un(e)}catch{try{return Un.call(null,e)}catch{return Un.call(this,e)}}}var fi=[],so=!1,xs,kc=-1;function U3(){!so||!xs||(so=!1,xs.length?fi=xs.concat(fi):kc=-1,fi.length&&nm())}function nm(){if(!so){var e=rm(U3);so=!0;for(var t=fi.length;t;){for(xs=fi,fi=[];++kc<t;)xs&&xs[kc].run();kc=-1,t=fi.length}xs=null,so=!1,L3(e)}}sr.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];fi.push(new im(e,t)),fi.length===1&&!so&&rm(nm)};function im(e,t){this.fun=e,this.array=t}im.prototype.run=function(){this.fun.apply(null,this.array)},sr.title="browser",sr.browser=!0,sr.env={},sr.argv=[],sr.version="",sr.versions={};function di(){}sr.on=di,sr.addListener=di,sr.once=di,sr.off=di,sr.removeListener=di,sr.removeAllListeners=di,sr.emit=di,sr.prependListener=di,sr.prependOnceListener=di,sr.listeners=function(e){return[]},sr.binding=function(e){throw new Error("process.binding is not supported")},sr.cwd=function(){return"/"},sr.chdir=function(e){throw new Error("process.chdir is not supported")},sr.umask=function(){return 0};var F3=tm.exports;const mn=B3(F3);var kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Nc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var df={exports:{}},ma={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,56 +6,56 @@
|
|
|
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 sm;function z3(){if(sm)return
|
|
10
|
-
`+he+z}}var Ee=!1,Se;{var
|
|
11
|
-
`),Jt=
|
|
12
|
-
`),
|
|
13
|
-
`+ut[
|
|
9
|
+
*/var sm;function z3(){if(sm)return ma;sm=1;var e=te,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,u){var l,f={},h=null,y=null;u!==void 0&&(h=""+u),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(y=c.ref);for(l in c)n.call(c,l)&&!s.hasOwnProperty(l)&&(f[l]=c[l]);if(a&&a.defaultProps)for(l in c=a.defaultProps,c)f[l]===void 0&&(f[l]=c[l]);return{$$typeof:t,type:a,key:h,ref:y,props:f,_owner:i.current}}return ma.Fragment=r,ma.jsx=o,ma.jsxs=o,ma}var ga={},om;function V3(){return om||(om=1,mn.env.NODE_ENV!=="production"&&function(){var e=te,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),b=Symbol.iterator,w="@@iterator";function A(z){if(z===null||typeof z!="object")return null;var oe=b&&z[b]||z[w];return typeof oe=="function"?oe:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function N(z){{for(var oe=arguments.length,pe=new Array(oe>1?oe-1:0),ke=1;ke<oe;ke++)pe[ke-1]=arguments[ke];R("error",z,pe)}}function R(z,oe,pe){{var ke=P.ReactDebugCurrentFrame,Ke=ke.getStackAddendum();Ke!==""&&(oe+="%s",pe=pe.concat([Ke]));var Ne=pe.map(function(ze){return String(ze)});Ne.unshift("Warning: "+oe),Function.prototype.apply.call(console[z],console,Ne)}}var U=!1,L=!1,G=!1,q=!1,X=!1,ie;ie=Symbol.for("react.module.reference");function ae(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===s||X||z===i||z===u||z===l||q||z===y||U||L||G||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===f||z.$$typeof===o||z.$$typeof===a||z.$$typeof===c||z.$$typeof===ie||z.getModuleId!==void 0))}function ce(z,oe,pe){var ke=z.displayName;if(ke)return ke;var Ke=oe.displayName||oe.name||"";return Ke!==""?pe+"("+Ke+")":pe}function V(z){return z.displayName||"Context"}function D(z){if(z==null)return null;if(typeof z.tag=="number"&&N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof z=="function")return z.displayName||z.name||null;if(typeof z=="string")return z;switch(z){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof z=="object")switch(z.$$typeof){case a:var oe=z;return V(oe)+".Consumer";case o:var pe=z;return V(pe._context)+".Provider";case c:return ce(z,z.render,"ForwardRef");case f:var ke=z.displayName||null;return ke!==null?ke:D(z.type)||"Memo";case h:{var Ke=z,Ne=Ke._payload,ze=Ke._init;try{return D(ze(Ne))}catch{return null}}}return null}var p=Object.assign,d=0,m,x,M,E,O,C,g;function v(){}v.__reactDisabledLog=!0;function j(){{if(d===0){m=console.log,x=console.info,M=console.warn,E=console.error,O=console.group,C=console.groupCollapsed,g=console.groupEnd;var z={configurable:!0,enumerable:!0,value:v,writable:!0};Object.defineProperties(console,{info:z,log:z,warn:z,error:z,group:z,groupCollapsed:z,groupEnd:z})}d++}}function ee(){{if(d--,d===0){var z={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:p({},z,{value:m}),info:p({},z,{value:x}),warn:p({},z,{value:M}),error:p({},z,{value:E}),group:p({},z,{value:O}),groupCollapsed:p({},z,{value:C}),groupEnd:p({},z,{value:g})})}d<0&&N("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=P.ReactCurrentDispatcher,he;function ye(z,oe,pe){{if(he===void 0)try{throw Error()}catch(Ke){var ke=Ke.stack.trim().match(/\n( *(at )?)/);he=ke&&ke[1]||""}return`
|
|
10
|
+
`+he+z}}var Ee=!1,Se;{var We=typeof WeakMap=="function"?WeakMap:Map;Se=new We}function Fe(z,oe){if(!z||Ee)return"";{var pe=Se.get(z);if(pe!==void 0)return pe}var ke;Ee=!0;var Ke=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ne;Ne=se.current,se.current=null,j();try{if(oe){var ze=function(){throw Error()};if(Object.defineProperty(ze.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ze,[])}catch(Yt){ke=Yt}Reflect.construct(z,[],ze)}else{try{ze.call()}catch(Yt){ke=Yt}z.call(ze.prototype)}}else{try{throw Error()}catch(Yt){ke=Yt}z()}}catch(Yt){if(Yt&&ke&&typeof Yt.stack=="string"){for(var ut=Yt.stack.split(`
|
|
11
|
+
`),Jt=ke.stack.split(`
|
|
12
|
+
`),Nt=ut.length-1,Bt=Jt.length-1;Nt>=1&&Bt>=0&&ut[Nt]!==Jt[Bt];)Bt--;for(;Nt>=1&&Bt>=0;Nt--,Bt--)if(ut[Nt]!==Jt[Bt]){if(Nt!==1||Bt!==1)do if(Nt--,Bt--,Bt<0||ut[Nt]!==Jt[Bt]){var ir=`
|
|
13
|
+
`+ut[Nt].replace(" at new "," at ");return z.displayName&&ir.includes("<anonymous>")&&(ir=ir.replace("<anonymous>",z.displayName)),typeof z=="function"&&Se.set(z,ir),ir}while(Nt>=1&&Bt>=0);break}}}finally{Ee=!1,se.current=Ne,ee(),Error.prepareStackTrace=Ke}var Sr=z?z.displayName||z.name:"",or=Sr?ye(Sr):"";return typeof z=="function"&&Se.set(z,or),or}function lt(z,oe,pe){return Fe(z,!1)}function ht(z){var oe=z.prototype;return!!(oe&&oe.isReactComponent)}function $e(z,oe,pe){if(z==null)return"";if(typeof z=="function")return Fe(z,ht(z));if(typeof z=="string")return ye(z);switch(z){case u:return ye("Suspense");case l:return ye("SuspenseList")}if(typeof z=="object")switch(z.$$typeof){case c:return lt(z.render);case f:return $e(z.type,oe,pe);case h:{var ke=z,Ke=ke._payload,Ne=ke._init;try{return $e(Ne(Ke),oe,pe)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,_e={},ge=P.ReactDebugCurrentFrame;function Ae(z){if(z){var oe=z._owner,pe=$e(z.type,z._source,oe?oe.type:null);ge.setExtraStackFrame(pe)}else ge.setExtraStackFrame(null)}function Ge(z,oe,pe,ke,Ke){{var Ne=Function.call.bind(mt);for(var ze in z)if(Ne(z,ze)){var ut=void 0;try{if(typeof z[ze]!="function"){var Jt=Error((ke||"React class")+": "+pe+" type `"+ze+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof z[ze]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Jt.name="Invariant Violation",Jt}ut=z[ze](oe,ze,ke,pe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Nt){ut=Nt}ut&&!(ut instanceof Error)&&(Ae(Ke),N("%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).",ke||"React class",pe,ze,typeof ut),Ae(null)),ut instanceof Error&&!(ut.message in _e)&&(_e[ut.message]=!0,Ae(Ke),N("Failed %s type: %s",pe,ut.message),Ae(null))}}}var De=Array.isArray;function Oe(z){return De(z)}function Ie(z){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,pe=oe&&z[Symbol.toStringTag]||z.constructor.name||"Object";return pe}}function Ue(z){try{return ft(z),!1}catch{return!0}}function ft(z){return""+z}function dt(z){if(Ue(z))return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ie(z)),ft(z)}var He=P.ReactCurrentOwner,jt={key:!0,ref:!0,__self:!0,__source:!0},St,et,At;At={};function $t(z){if(mt.call(z,"ref")){var oe=Object.getOwnPropertyDescriptor(z,"ref").get;if(oe&&oe.isReactWarning)return!1}return z.ref!==void 0}function nt(z){if(mt.call(z,"key")){var oe=Object.getOwnPropertyDescriptor(z,"key").get;if(oe&&oe.isReactWarning)return!1}return z.key!==void 0}function Et(z,oe){if(typeof z.ref=="string"&&He.current&&oe&&He.current.stateNode!==oe){var pe=D(He.current.type);At[pe]||(N('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(He.current.type),z.ref),At[pe]=!0)}}function Ot(z,oe){{var pe=function(){St||(St=!0,N("%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)",oe))};pe.isReactWarning=!0,Object.defineProperty(z,"key",{get:pe,configurable:!0})}}function st(z,oe){{var pe=function(){et||(et=!0,N("%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)",oe))};pe.isReactWarning=!0,Object.defineProperty(z,"ref",{get:pe,configurable:!0})}}var kt=function(z,oe,pe,ke,Ke,Ne,ze){var ut={$$typeof:t,type:z,key:oe,ref:pe,props:ze,_owner:Ne};return ut._store={},Object.defineProperty(ut._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ut,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.defineProperty(ut,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ke}),Object.freeze&&(Object.freeze(ut.props),Object.freeze(ut)),ut};function It(z,oe,pe,ke,Ke){{var Ne,ze={},ut=null,Jt=null;pe!==void 0&&(dt(pe),ut=""+pe),nt(oe)&&(dt(oe.key),ut=""+oe.key),$t(oe)&&(Jt=oe.ref,Et(oe,Ke));for(Ne in oe)mt.call(oe,Ne)&&!jt.hasOwnProperty(Ne)&&(ze[Ne]=oe[Ne]);if(z&&z.defaultProps){var Nt=z.defaultProps;for(Ne in Nt)ze[Ne]===void 0&&(ze[Ne]=Nt[Ne])}if(ut||Jt){var Bt=typeof z=="function"?z.displayName||z.name||"Unknown":z;ut&&Ot(ze,Bt),Jt&&st(ze,Bt)}return kt(z,ut,Jt,Ke,ke,He.current,ze)}}var it=P.ReactCurrentOwner,wt=P.ReactDebugCurrentFrame;function Mt(z){if(z){var oe=z._owner,pe=$e(z.type,z._source,oe?oe.type:null);wt.setExtraStackFrame(pe)}else wt.setExtraStackFrame(null)}var Ye;Ye=!1;function gt(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function Pt(){{if(it.current){var z=D(it.current.type);if(z)return`
|
|
14
14
|
|
|
15
15
|
Check the render method of \``+z+"`."}return""}}function ot(z){{if(z!==void 0){var oe=z.fileName.replace(/^.*[\\\/]/,""),pe=z.lineNumber;return`
|
|
16
16
|
|
|
17
|
-
Check your code at `+oe+":"+pe+"."}return""}}var _t={};function
|
|
17
|
+
Check your code at `+oe+":"+pe+"."}return""}}var _t={};function Ft(z){{var oe=Pt();if(!oe){var pe=typeof z=="string"?z:z.displayName||z.name;pe&&(oe=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+pe+">.")}return oe}}function
|
|
19
|
+
Check the top-level render call using <`+pe+">.")}return oe}}function k(z,oe){{if(!z._store||z._store.validated||z.key!=null)return;z._store.validated=!0;var pe=Ft(oe);if(_t[pe])return;_t[pe]=!0;var ke="";z&&z._owner&&z._owner!==it.current&&(ke=" It was passed a child from "+D(z._owner.type)+"."),Mt(z),N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pe,ke),Mt(null)}}function S(z,oe){{if(typeof z!="object")return;if(Oe(z))for(var pe=0;pe<z.length;pe++){var ke=z[pe];gt(ke)&&k(ke,oe)}else if(gt(z))z._store&&(z._store.validated=!0);else if(z){var Ke=A(z);if(typeof Ke=="function"&&Ke!==z.entries)for(var Ne=Ke.call(z),ze;!(ze=Ne.next()).done;)gt(ze.value)&&k(ze.value,oe)}}}function T(z){{var oe=z.type;if(oe==null||typeof oe=="string")return;var pe;if(typeof oe=="function")pe=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===c||oe.$$typeof===f))pe=oe.propTypes;else return;if(pe){var ke=D(oe);Ge(pe,z.props,"prop",ke,z)}else if(oe.PropTypes!==void 0&&!Ye){Ye=!0;var Ke=D(oe);N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ke||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function B(z){{for(var oe=Object.keys(z.props),pe=0;pe<oe.length;pe++){var ke=oe[pe];if(ke!=="children"&&ke!=="key"){Mt(z),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),Mt(null);break}}z.ref!==null&&(Mt(z),N("Invalid attribute `ref` supplied to `React.Fragment`."),Mt(null))}}var K={};function Z(z,oe,pe,ke,Ke,Ne){{var ze=ae(z);if(!ze){var ut="";(z===void 0||typeof z=="object"&&z!==null&&Object.keys(z).length===0)&&(ut+=" 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 Jt=ot(Ke);Jt?ut+=Jt:ut+=Pt();var Nt;z===null?Nt="null":Oe(z)?Nt="array":z!==void 0&&z.$$typeof===t?(Nt="<"+(D(z.type)||"Unknown")+" />",ut=" Did you accidentally export a JSX literal instead of a component?"):Nt=typeof z,N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Nt,ut)}var Bt=It(z,oe,pe,Ke,Ne);if(Bt==null)return Bt;if(ze){var ir=oe.children;if(ir!==void 0)if(ke)if(Oe(ir)){for(var Sr=0;Sr<ir.length;Sr++)S(ir[Sr],z);Object.freeze&&Object.freeze(ir)}else N("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 S(ir,z)}if(mt.call(oe,"key")){var or=D(z),Yt=Object.keys(oe).filter(function(Hr){return Hr!=="key"}),yr=Yt.length>0?"{key: someKey, "+Yt.join(": ..., ")+": ...}":"{key: someKey}";if(!K[or+yr]){var Rn=Yt.length>0?"{"+Yt.join(": ..., ")+": ...}":"{}";N(`A props object containing a "key" prop is being spread into JSX:
|
|
20
20
|
let props = %s;
|
|
21
21
|
<%s {...props} />
|
|
22
22
|
React keys must be passed directly to JSX without using spread:
|
|
23
23
|
let props = %s;
|
|
24
|
-
<%s key={someKey} {...props} />`,yr,or,Nn,or),K[or+yr]=!0}}return z===n?B(Bt):M(Bt),Bt}}function re(z,oe,pe){return Z(z,oe,pe,!0)}function Be(z,oe,pe){return Z(z,oe,pe,!1)}var rt=Be,Ne=re;ma.Fragment=n,ma.jsx=rt,ma.jsxs=Ne}()),ma}mn.env.NODE_ENV==="production"?df.exports=z3():df.exports=V3();var _=df.exports;const wX="",_X="",xX="";window._iconfont_svg_string_4776227='<svg><symbol id="icon-more" viewBox="0 0 1024 1024"><path d="M499.2 217.6m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 524.8m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 832m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path></symbol><symbol id="icon-docs" viewBox="0 0 1024 1024"><path d="M665.6 41.728c65.9456 0 121.2928 45.312 136.6016 106.496 5.0688-2.6624 10.8544-4.096 16.9984-4.096a140.8 140.8 0 0 1 140.8 140.8v563.2a140.8 140.8 0 0 1-140.8 140.8H358.4a140.8512 140.8512 0 0 1-135.4752-102.4H204.8a140.8 140.8 0 0 1-140.8-140.8v-563.2A140.8 140.8 0 0 1 204.8 41.728h460.8z m140.8 177.0496v526.9504a140.8 140.8 0 0 1-140.8 140.8l-358.4 0.1024c11.7248 15.5136 30.3104 25.4976 51.2 25.4976h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64a38.3488 38.3488 0 0 1-12.8-2.1504zM665.6 118.528H204.8c-35.328 0-64 28.672-64 64v563.2c0 35.328 28.672 64 64 64h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64z m-153.6 281.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h256z m102.4-153.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h358.4z" ></path></symbol><symbol id="icon-link1" viewBox="0 0 1024 1024"><path d="M719.872 268.8l3.738 0.205 0.768 0.051-4.506-0.256a38.502 38.502 0 0 1 28.416 12.544l0.973 1.126a38.554 38.554 0 0 1 1.74 2.253l-2.713-3.379a38.605 38.605 0 0 1 9.984 25.549V563.2a38.4 38.4 0 1 1-76.8 0V394.086L281.856 758.221a38.4 38.4 0 0 1-51.712-56.832L620.646 345.6H463.872a38.4 38.4 0 0 1-38.042-33.178l-0.358-5.222a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-icon-kfckfc" viewBox="0 0 1024 1024"><path d="M53.504 102.912c-0.41 0.563 30.208 42.086 67.84 92.006L299.008 430.9 408.32 576l-7.014 7.885c-3.943 4.352-84.327 90.521-178.432 191.488C128.717 876.595 51.354 960 51.2 960.87c-0.358 0.922 16.077 1.69 39.731 1.536l40.243-0.204 13.21-14.49A217385.626 217385.626 0 0 0 440.32 629.914l4.71-5.479 37.837 50.33L610.048 843.93l89.6 118.63H836.71c114.023 0 136.858-0.358 136.141-2.458-0.563-1.484-35.328-48.025-77.312-103.782-41.984-55.603-90.01-119.398-106.65-141.568-16.793-22.17-66.15-88.064-110.028-146.074-43.879-58.163-79.821-106.598-79.821-107.366 0-1.331 231.782-251.187 310.58-334.746l22.527-23.808h-41.42l-41.217 0.154-48.179 51.814a48197.632 48197.632 0 0 1-144.23 154.88l-95.847 102.912L445.03 258.202 328.55 103.68l-137.062-0.922c-75.418-0.563-137.626-0.41-137.984 0.154z m324.762 166.4c44.8 59.7 113.97 151.5 153.65 204.288 39.732 52.531 127.796 169.677 195.892 259.994 68.045 90.47 124.365 165.376 125.286 166.707 1.178 1.69-12.288 2.253-61.235 2.253h-62.566L605.286 737.69c-286.208-379.802-430.592-571.7-432.332-574.516-1.127-1.69 11.724-2.252 61.081-2.252h62.567l81.664 108.39z" ></path></symbol><symbol id="icon-icon_telegram" viewBox="0 0 1024 1024"><path d="M824.87808 503.6032c55.8592 0 100.096 12.544 133.4272 37.5296 34.2016 26.7264 55.9104 66.7136 64.2048 120.9344h-94.208c-5.8368-27.4944-17.5104-47.5136-34.2016-60.8768-17.5104-13.312-40.8576-19.968-69.2224-19.968-35.0208 0-62.5664 12.4928-82.5856 39.168-19.968 25.856-30.0032 62.5152-30.0032 109.2608 0 47.5136 9.216 85.0432 29.184 111.7184 18.3296 25.856 45.8752 39.2192 82.5856 39.2192 63.3856 0 98.4064-31.6928 105.8816-94.208H1024.19968c-9.984 58.368-32.512 101.7344-66.7136 130.048-33.3824 27.5456-78.3872 41.728-134.2976 41.728-66.7136 0-118.4256-21.7088-155.136-65.024-35.84-41.728-53.3504-95.9488-53.3504-162.6624 0-65.024 17.5104-118.4256 52.5312-159.2832 37.5296-45.056 90.112-67.584 157.6448-67.584z m75.7248-333.6704l-53.76 245.4528a353.792 353.792 0 0 0-12.6464-0.256c-164.096 0-316.3648 113.7664-357.0176 266.752L381.63968 771.9424c-11.6224 10.9056-20.7872 20.1216-41.5744 20.1216l14.1824-205.2608 385.1776-336.7424c16.896-14.5408-3.6352-21.6576-26.112-8.3968L237.76768 532.2752 32.35328 470.1696c-44.288-13.1584-44.544-42.7008 10.0352-64l800.3072-298.9568c36.5568-15.9744 71.8336 8.5504 57.856 62.72z" ></path></symbol><symbol id="icon-icon_medium" viewBox="0 0 1024 1024"><path d="M576.819712 497.6128c-0.7168 169.6768-139.5712 294.7584-293.376 292.3008C127.795712 787.4048-0.357888 656.1792 0.000512 495.2064 0.358912 334.9504 130.611712 204.032 288.819712 204.8c159.9488 0.768 288.2048 131.1744 288 292.8128m27.904-1.536c0.9216-72.9088 12.3904-143.3088 50.1248-207.0528 7.168-12.1856 15.872-23.8592 25.6512-33.9968 44.4928-46.08 99.4816-44.0832 141.312 4.5056 28.8768 33.5872 45.8752 73.216 56.064 115.8656 24.576 102.5536 21.2992 203.5712-19.968 301.6704-11.9808 28.416-28.5184 54.2208-52.9408 73.728-36.2496 29.1328-76.8 29.3888-112.5376-0.3072-39.2704-32.6656-59.4944-77.5168-70.7584-125.696-9.8304-41.984-14.2848-85.248-21.0944-128l4.1472-0.7168M1024.000512 470.5792c-3.1744 93.952-4.9152 159.8976-22.1696 224.0512-3.0208 11.264-6.656 22.7328-12.4928 32.6656-3.8912 6.656-11.776 14.3872-18.3296 14.8992-5.3248 0.4096-14.08-8.192-16.6912-14.6944-7.5776-18.7392-14.848-38.0928-18.6368-57.9584-16.384-86.3744-18.4832-173.7216-10.496-261.0176 3.584-39.424 11.9296-78.4896 19.1488-117.5552 1.792-9.728 6.7584-19.2512 11.776-27.9552 9.728-16.4864 22.3744-16.896 30.9248 0 7.68 15.2576 15.0528 31.744 17.408 48.4864 8.8064 62.0544 15.4112 124.416 19.5584 159.0784" ></path></symbol><symbol id="icon-icon_discord" viewBox="0 0 1024 1024"><path d="M831.8976 213.6064A748.032 748.032 0 0 0 641.7408 153.6c-8.192 14.848-17.7664 34.8672-24.3712 50.7904a694.8864 694.8864 0 0 0-210.688 0c-6.6048-15.872-16.384-35.8912-24.6272-50.7904a745.5744 745.5744 0 0 0-190.3104 60.16C71.424 396.4928 38.8096 574.6176 55.0912 750.2848a758.784 758.784 0 0 0 233.216 120.064c18.7904-26.0096 35.5328-53.6064 49.92-82.688a490.0864 490.0864 0 0 1-78.6432-38.4c6.656-4.9664 13.056-10.0864 19.3024-15.36 151.6544 71.2704 316.416 71.2704 466.2272 0 6.2976 5.2736 12.8 10.3936 19.3024 15.36a488.8576 488.8576 0 0 1-78.848 38.5024c14.4384 28.9792 31.1296 56.6784 49.9712 82.6368a757.2992 757.2992 0 0 0 233.3184-120.1152c19.1488-203.6224-32.6656-380.16-136.96-536.6784zM358.912 642.2528c-45.568 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0.1024 52.0192-36.5056 94.72-82.8416 94.72z m306.176 0c-45.5168 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0 52.0192-36.5056 94.72-82.8416 94.72z" ></path></symbol><symbol id="icon-icon_del" viewBox="0 0 1024 1024"><path d="M512 64a243.2512 243.2512 0 0 1 240.1792 204.8h-1.3312a140.8 140.8 0 0 1 139.1104 162.4576l-63.6928 409.6a140.8 140.8 0 0 1-139.1616 119.1424H336.896a140.8 140.8 0 0 1-139.1616-119.1424l-63.6928-409.6A140.8 140.8 0 0 1 271.8208 268.8a243.2 243.2 0 0 1 240.1792-204.8z m238.848 281.6h-477.696A64 64 0 0 0 209.92 419.4304l63.6928 409.6A64 64 0 0 0 336.896 883.2h350.208a64 64 0 0 0 63.2832-54.1696l63.6928-409.6a64 64 0 0 0-63.232-73.8304zM409.6 473.6a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8A38.4 38.4 0 0 1 409.6 473.6z m204.8 0a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8a38.4 38.4 0 0 1 38.4-38.4z m-102.4-332.8a166.4512 166.4512 0 0 0-160.0512 120.7296l-1.8944 7.2704h323.84l-1.8432-7.2704a166.5024 166.5024 0 0 0-150.6304-120.4736L512 140.8z" ></path></symbol><symbol id="icon-plorer" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0zM726.886 324.3L577.741 764.11c-11.776 34.713-60.826 34.816-72.704 0.051L440.73 575.59l-197.94-71.987c-31.744-11.622-33.536-54.63-5.427-69.785l5.632-2.458 434.586-155.546a38.4 38.4 0 0 1 49.305 48.487z m-98.252 50.586L369.05 467.763l115.2 41.984a38.4 38.4 0 0 1 20.992 18.381l2.252 5.325 33.792 98.97 87.348-257.537z" ></path></symbol><symbol id="icon-disconnect" viewBox="0 0 1024 1024"><path d="M575.357 738.274a38.4 38.4 0 0 1 0 54.306l-72.408 72.408A243.2 243.2 0 1 1 159.012 521.05l72.408-72.408a38.4 38.4 0 1 1 54.306 54.306l-72.408 72.408a166.4 166.4 0 0 0 235.325 235.325l72.408-72.408a38.4 38.4 0 0 1 54.306 0z m-108.612-181.02a38.4 38.4 0 0 1 0 54.307L358.134 720.172a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0zM756.376 702.07a38.4 38.4 0 1 1-54.306 54.306L267.624 321.93a38.4 38.4 0 1 1 54.306-54.306L756.376 702.07z m-36.204-398.242a38.4 38.4 0 0 1 0 54.306L611.561 466.745a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0z m144.816-144.816a243.2 243.2 0 0 1 0 343.937l-72.408 72.408a38.4 38.4 0 1 1-54.306-54.306l72.408-72.408a166.4 166.4 0 0 0-235.325-235.325l-72.408 72.408a38.4 38.4 0 0 1-54.306-54.306l72.408-72.408a243.2 243.2 0 0 1 343.937 0z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M665.6 396.8a140.8 140.8 0 0 1 140.8 140.8v128a140.8 140.8 0 0 1-140.8 140.8h-128a140.8 140.8 0 0 1-140.8-140.8v-128a140.8 140.8 0 0 1 140.8-140.8h128z m0 76.8h-128c-35.328 0-64 28.672-64 64v128c0 35.328 28.672 64 64 64h128c35.328 0 64-28.672 64-64v-128c0-35.328-28.672-64-64-64z" ></path><path d="M537.6 217.6c49.46 0 89.6 40.14 89.6 89.6v25.6a38.4 38.4 0 0 1-76.8 0v-25.6a12.8 12.8 0 0 0-12.8-12.8H307.2a12.8 12.8 0 0 0-12.8 12.8v230.4c0 7.066 5.734 12.8 12.8 12.8h25.6a38.4 38.4 0 0 1 0 76.8h-25.6a89.6 89.6 0 0 1-89.6-89.6V307.2c0-49.46 40.14-89.6 89.6-89.6h230.4z" ></path></symbol><symbol id="icon-link" viewBox="0 0 1024 1024"><path d="M436.992 281.6a38.4 38.4 0 0 1 0 76.8 217.6 217.6 0 1 0 217.6 217.6 38.4 38.4 0 1 1 76.8 0 294.4 294.4 0 1 1-294.4-294.4z m385.28-102.4l3.8912 0.2048 0.6144 0.0512-4.5056-0.256a38.2464 38.2464 0 0 1 28.416 12.544l0.8704 1.024a38.5536 38.5536 0 0 1 2.0992 2.7136l-2.9696-3.7376a38.656 38.656 0 0 1 9.984 25.5488V473.6a38.4 38.4 0 1 1-76.8 0V304.4864l-399.616 364.1344a38.4 38.4 0 0 1-51.712-56.832L723.0464 256H566.272a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-unfold" viewBox="0 0 2048 1024"><path d="M565.248 78.131a76.8 76.8 0 0 1 108.544 0l362.086 361.984a25.6 25.6 0 0 0 36.25 0l361.984-361.984a76.8 76.8 0 0 1 108.544 108.544l-361.984 362.189a179.2 179.2 0 0 1-253.44 0L565.248 186.675a76.8 76.8 0 0 1 0-108.544z" ></path></symbol><symbol id="icon-rpc" viewBox="0 0 1024 1024"><path d="M204.8 678.4a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m168.96-573.44a268.8 268.8 0 0 1 207.872 439.245l38.144 38.144a192 192 0 1 1-55.603 53.094l-39.27-39.373A268.8 268.8 0 1 1 373.76 104.96zM204.8 755.2a64 64 0 1 0 0 128 64 64 0 0 0 0-128z m517.12-125.44a115.2 115.2 0 1 0 0 230.4 115.2 115.2 0 0 0 0-230.4z m-348.16-448a192 192 0 1 0 0 384 192 192 0 0 0 0-384zM819.2 64a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m0 76.8a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" ></path></symbol><symbol id="icon-mev" viewBox="0 0 1024 1024"><path d="M651.162 95.488c53.401 56.422 131.84 113.818 235.212 171.674a38.4 38.4 0 0 1 19.456 29.9c12.032 129.024-12.544 251.75-73.625 367.156-60.211 113.817-158.976 226.457-295.936 338.33a38.4 38.4 0 0 1-48.589 0C356.608 895.436 259.328 782.181 196.045 662.681c-64.103-121.19-90.266-243.405-77.824-365.876a38.4 38.4 0 0 1 20.531-30.259C239.923 214.323 319.846 156.98 378.624 94.925c104.96-110.95 169.37-108.442 272.538 0.512z m126.464 196.506l-1.178 0.819a41.933 41.933 0 0 1-10.035 3.84c-4.25 1.024-5.427 1.28-14.695 3.328a122.368 122.368 0 0 0-16.896 4.403c-43.878 16.384-71.168 47.411-83.097 96.666-2.304 9.625-3.328 20.838-3.687 38.4l-0.204 13.516v15.872l0.05 9.728v2.048l0.052 3.482c0.256 35.328 0.154 51.2-1.024 71.424-4.506 79.36-42.291 140.39-108.954 178.483-29.542 16.896-61.9 23.962-99.328 23.91h-8.704a9243.136 9243.136 0 0 0-29.286-0.153h-17.46l-10.034-0.051h-22.938c40.448 50.841 88.371 100.71 143.77 149.504l17.97 15.513 17.511-14.899c101.018-88.064 176.077-175.513 225.28-262.144l9.523-17.408c50.893-96.205 73.063-197.273 66.56-303.974l-3.584-2.407a1479.786 1479.786 0 0 1-49.664-29.9z m-171.52 5.12h-1.127c-15.155 0.102-30.054 3.584-45.107 10.598-46.285 21.504-77.056 71.373-76.39 128.051 0.307 25.703 0.256 51.354 0 87.603l-0.103 10.445c-0.102 14.49-0.512 24.371-1.74 34.816-4.865 42.803-19.661 79.77-43.674 110.285l-1.792 2.15 1.331 0.052h1.331c24.832 0 44.288-4.199 61.03-13.824 44.033-25.19 67.38-62.72 70.4-116.122 1.025-18.022 1.127-32.768 0.871-66.56v-5.478l-0.051-5.223v-21.504c0-5.12 0.051-9.728 0.153-14.49 0.512-22.681 1.895-38.604 5.837-54.937a225.075 225.075 0 0 1 35.687-79.514l4.71-6.246h-11.366z m1.484-136.295l-12.236-12.544c-73.728-77.926-87.245-78.438-160.973-0.563-60.467 63.898-139.674 122.112-237.466 174.95l-3.942 2.048-0.768 17.562c-2.407 88.064 18.176 176.384 61.952 265.42l9.779 19.047c9.267 17.51 19.354 34.919 30.26 52.224l-0.871 0.154c2.406-0.512 2.406-0.512 6.144-0.973 15.104-1.536 29.593-6.86 43.776-15.974 36.454-23.552 56.883-56.576 62.105-102.247 0.82-7.168 1.127-14.848 1.23-26.726l0.102-10.343c0.256-35.84 0.307-61.132 0-86.22-1.024-86.58 46.899-164.199 120.78-198.554a183.552 183.552 0 0 1 77.312-17.766h1.536l53.044 0.256h16.076a775.117 775.117 0 0 1-67.84-59.75z" ></path></symbol><symbol id="icon-caution" viewBox="0 0 1024 1024"><path d="M512 682.666667c-47.146667 0-85.333333-42.112-85.333333-94.037334V94.037333C426.666667 42.112 464.853333 0 512 0s85.333333 42.112 85.333333 94.037333v494.592C597.333333 640.554667 559.146667 682.666667 512 682.666667zM512 1024c-47.146667 0-85.333333-35.2-85.333333-78.592v-98.816C426.666667 803.2 464.853333 768 512 768s85.333333 35.2 85.333333 78.592v98.816C597.333333 988.8 559.146667 1024 512 1024z" ></path></symbol><symbol id="icon-settings" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0z m104.858 211.762a89.6 89.6 0 0 1 77.568 44.8l47.257 81.818a89.6 89.6 0 0 1 0 89.6l-47.257 81.818a89.6 89.6 0 0 1-77.568 44.8h-94.516a89.6 89.6 0 0 1-77.568-44.8L339.917 556.8a89.6 89.6 0 0 1 0-89.6l47.257-81.818a89.6 89.6 0 0 1 77.568-44.8h94.516z m0 76.8h-94.516a12.8 12.8 0 0 0-11.059 6.4L406.426 505.6a12.8 12.8 0 0 0 0 12.8l47.257 81.818a12.8 12.8 0 0 0 11.06 6.4h94.515a12.8 12.8 0 0 0 11.059-6.4l47.257-81.818a12.8 12.8 0 0 0 0-12.8l-47.257-81.818a12.8 12.8 0 0 0-11.06-6.4z" ></path></symbol><symbol id="icon-back" viewBox="0 0 1024 1024"><path d="M67.738 495.616l36.3 32.358 220.468 194.868c13.926 12.236 14.438 33.792 1.024 46.796l-0.41 0.41a31.898 31.898 0 0 1-44.288 0L20.736 518.554a31.744 31.744 0 0 1 0-45.773l260.096-251.597a31.898 31.898 0 0 1 44.288 0l0.46 0.41a31.846 31.846 0 0 1-1.023 46.848l-220.57 194.816-36.352 32.358z" ></path></symbol><symbol id="icon-wallet" viewBox="0 0 1024 1024"><path d="M825.6 115.2A134.4 134.4 0 0 1 960 249.6v384c0 60.877-40.448 112.282-95.949 128.82L864 785.868a140.8 140.8 0 0 1-179.456 135.373l-467.2-133.479A140.8 140.8 0 0 1 115.2 652.288V249.6a134.4 134.4 0 0 1 134.4-134.4h576zM256 225.331c-35.328 0-64 28.672-64 64V652.34c0 28.57 18.944 53.709 46.438 61.543l467.2 133.478a64 64 0 0 0 81.562-61.491v-47.616a38.502 38.502 0 0 1 0-17.306V422.861a64 64 0 0 0-46.438-61.543l-467.2-133.478A64 64 0 0 0 256 225.28zM825.6 192H427.827l334.029 95.437A140.8 140.8 0 0 1 864 422.86v253.645c11.776-10.548 19.2-25.856 19.2-42.906v-384c0-31.795-25.805-57.6-57.6-57.6z m-192 259.226a38.4 38.4 0 0 1 38.4 38.4V633.6a38.4 38.4 0 1 1-76.8 0V489.574a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-star" viewBox="0 0 1024 1024"><path d="M474.778 72.653a84.992 84.992 0 0 1 113.1 37.683l90.727 179.712c1.024 2.15 3.277 3.686 5.939 4.096l202.906 29.082c18.278 2.56 35.174 11.059 48.128 24.064a83.302 83.302 0 0 1-1.23 119.09l-148.12 142.542a6.605 6.605 0 0 0-2.049 5.939l34.765 195.584c3.277 18.483 0.154 37.58-8.806 54.17a85.043 85.043 0 0 1-114.176 34.457L515.84 804.659a8.55 8.55 0 0 0-7.885 0l-179.968 94.31c-16.589 8.705-35.635 11.674-54.118 8.5a83.968 83.968 0 0 1-68.813-97.28l34.97-195.328a6.605 6.605 0 0 0-2.048-5.94L89.702 466.484a83.61 83.61 0 0 1-24.832-48.128 83.968 83.968 0 0 1 71.732-95.078l204.339-29.184a7.834 7.834 0 0 0 5.939-4.096l89.395-179.251c8.192-16.59 21.76-29.952 38.503-38.093z m36.198 68.25l-2.56 0.767a7.475 7.475 0 0 0-3.43 3.328l-89.344 179.303c-12.39 24.832-36.301 41.933-63.847 45.875l-204.339 29.133c-4.352 0.614-7.168 4.198-6.605 7.885a6.81 6.81 0 0 0 2.048 3.89l148.275 142.49c20.173 19.354 29.338 47.36 24.423 74.804l-34.919 195.379c-0.665 3.584 1.946 7.27 6.247 8.038 1.894 0.307 3.789 0 5.427-0.819l179.968-94.31a85.35 85.35 0 0 1 79.155 0l180.173 94.361c3.994 2.1 9.011 0.615 10.957-3.02a6.4 6.4 0 0 0 0.717-4.199l-34.714-195.533a83.354 83.354 0 0 1 24.371-74.65l148.122-142.591a6.502 6.502 0 0 0 0.102-9.524 8.14 8.14 0 0 0-4.608-2.252l-202.957-29.082c-27.392-3.942-51.2-20.89-63.59-45.517l-90.726-179.712c-1.844-3.635-6.81-5.273-10.906-3.277l2.56-0.768z" ></path></symbol><symbol id="icon-trade" viewBox="0 0 1024 1024"><path d="M1002.93153 563.627l-433.237 432.64a67.243 67.243 0 0 1-29.696 21.93c-0.853 0.171-1.45 0.342-1.963 0.342a61.27 61.27 0 0 1-22.442 4.608c-1.11 0-2.304 0.853-3.414 0.853-2.048 0-3.84-1.365-5.973-1.365a54.87 54.87 0 0 1-13.653-2.987 77.312 77.312 0 0 1-15.275-6.144c-2.987-1.621-5.803-3.67-8.533-5.803-2.56-1.962-5.718-2.816-7.936-5.461L21.34153 563.627a71.68 71.68 0 0 1 0-102.059 72.704 72.704 0 0 1 102.57 0l316.16 315.477V73.472C440.07353 33.109 472.92753 0 513.29053 0a73.387 73.387 0 0 1 73.216 73.472v701.355L900.53153 461.653a72.363 72.363 0 0 1 102.4 102.059z" ></path></symbol><symbol id="icon-verticalslider" viewBox="0 0 1024 1024"><path d="M310.426 441.6a166.4 166.4 0 0 1 38.4 328.346V870.4a38.4 38.4 0 1 1-76.8 0V769.946a166.451 166.451 0 0 1 38.4-328.346z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z m403.2-403.2a38.4 38.4 0 0 1 38.4 38.4v55.654a166.451 166.451 0 0 1-38.4 328.346 166.4 166.4 0 0 1-38.4-328.346V153.6a38.4 38.4 0 0 1 38.4-38.4z m0 166.4a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2zM310.323 115.2a38.4 38.4 0 0 1 38.4 38.4v146.534a38.4 38.4 0 0 1-76.8 0V153.6a38.4 38.4 0 0 1 38.4-38.4z m403.2 525.26a38.4 38.4 0 0 1 38.4 38.4V870.4a38.4 38.4 0 1 1-76.8 0V678.86a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-swap" viewBox="0 0 1024 1024"><path d="M321.434 116.224a51.2 51.2 0 0 1 69.888 74.752c-47.77 44.646-87.04 81.818-117.658 111.462l-1.997 1.844h289.229a51.2 51.2 0 0 1 50.842 45.26l0.358 5.94a51.2 51.2 0 0 1-51.2 51.2H154.47a51.763 51.763 0 0 1-52.07-52.839c0.205-11.52 3.123-19.097 7.782-27.136 3.226-5.53 7.22-10.752 12.8-17.203 8.192-9.626 20.992-23.04 38.656-40.704a7171.584 7171.584 0 0 1 159.744-152.576z m509.593 188.058a51.2 51.2 0 0 1 0 102.4h-93.593a51.2 51.2 0 0 1 0-102.4h93.593zM663.194 853.709a51.2 51.2 0 0 1-69.888-74.803c47.77-44.647 87.04-81.818 117.657-111.412l2.048-1.894H153.6a51.2 51.2 0 0 1-50.842-45.21l-0.358-5.99a51.2 51.2 0 0 1 51.2-51.2h676.557c27.904 0 52.582 22.272 52.07 52.838a51.456 51.456 0 0 1-7.782 27.136c-3.226 5.53-7.22 10.752-12.8 17.204-8.192 9.625-20.992 23.04-38.656 40.704a7171.584 7171.584 0 0 1-159.744 152.627z" ></path></symbol><symbol id="icon-star_sel" viewBox="0 0 1024 1024"><path d="M470.63 127.846L381.286 307.2a46.182 46.182 0 0 1-34.918 24.986l-204.34 29.184a45.568 45.568 0 0 0-39.167 51.456 45.344 45.344 0 0 0 13.465 26.01l148.276 142.438c10.905 10.496 15.872 25.6 13.21 40.448l-34.97 195.328a45.568 45.568 0 0 0 37.58 52.633 46.95 46.95 0 0 0 29.748-4.659l179.968-94.31a46.95 46.95 0 0 1 43.52 0l180.121 94.361c22.528 11.827 50.586 3.43 62.618-18.688a44.8 44.8 0 0 0 4.71-29.184L746.394 621.62a45.005 45.005 0 0 1 13.21-40.294l148.12-142.592a44.902 44.902 0 0 0 0.666-64.256 46.54 46.54 0 0 0-26.368-13.21l-202.956-29.081a46.182 46.182 0 0 1-34.765-24.781l-90.727-179.712a46.592 46.592 0 0 0-82.944 0.205z" ></path></symbol><symbol id="icon-tips" viewBox="0 0 1024 1024"><path d="M512 166.4a345.6 345.6 0 1 1 0 691.2 345.6 345.6 0 0 1 0-691.2z m0 76.8a268.8 268.8 0 1 0 0 537.6 268.8 268.8 0 0 0 0-537.6z m0 196.3a38.4 38.4 0 0 1 38.4 38.4v219.29a38.4 38.4 0 1 1-76.8 0V477.9a38.4 38.4 0 0 1 38.4-38.4z m0-153.087a38.4 38.4 0 0 1 38.4 38.4v45.414a38.4 38.4 0 1 1-76.8 0v-45.363a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-sel" viewBox="0 0 1024 1024"><path d="M783.36 281.2416a51.2 51.2 0 0 1 71.68 73.0624l-407.9616 400.384a51.2 51.2 0 0 1-67.8912 3.4304l-206.3872-165.376a51.2 51.2 0 1 1 64-79.9232l170.9568 137.0112 375.6032-368.64z" ></path></symbol><symbol id="icon-spread" viewBox="0 0 1024 1024"><path d="M143.36 678.4a38.4 38.4 0 0 1 38.4 38.4v112.64c0 7.066 5.734 12.8 12.8 12.8H307.2a38.4 38.4 0 1 1 0 76.8H194.56a89.6 89.6 0 0 1-89.6-89.6V716.8a38.4 38.4 0 0 1 38.4-38.4z m327.68-573.44a38.4 38.4 0 0 1 0 76.8H234.342L842.24 790.477v-242.33a38.4 38.4 0 1 1 76.8 0V829.44a89.6 89.6 0 0 1-89.6 89.6H552.96a38.4 38.4 0 1 1 0-76.8l232.346-0.051L181.76 237.773V471.04a38.4 38.4 0 0 1-76.8 0V194.56c0-49.46 40.14-89.6 89.6-89.6h276.48z m358.4 0c49.46 0 89.6 40.14 89.6 89.6V307.2a38.4 38.4 0 1 1-76.8 0V194.56a12.8 12.8 0 0 0-12.8-12.8H716.8a38.4 38.4 0 1 1 0-76.8h112.64z" ></path></symbol><symbol id="icon-refresh" viewBox="0 0 1024 1024"><path d="M601.446 178.176a344.576 344.576 0 0 1 124.621 62.413 38.4 38.4 0 0 1 5.12 55.45l-94.566 107.878a38.4 38.4 0 1 1-57.754-50.586l65.741-75.11-4.915-2.816a268.646 268.646 0 0 0-43.008-18.535l-15.104-4.505A268.8 268.8 0 1 0 771.635 581.58a38.4 38.4 0 1 1 74.189 19.865 345.6 345.6 0 1 1-244.378-423.27z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M763.392 256.512a51.2 51.2 0 0 1 0 72.3968L582.2464 509.952l183.1424 183.1424a51.2 51.2 0 0 1-72.3968 72.3968l-183.1424-183.1424-180.992 181.0432a51.2 51.2 0 0 1-72.3968-72.3968L437.504 509.952 258.56 330.9568A51.2 51.2 0 0 1 330.9568 258.56L509.952 437.504l181.0432-180.992a51.2 51.2 0 0 1 72.3968 0z" ></path></symbol><symbol id="icon-alert" viewBox="0 0 1024 1024"><path d="M558.08 125.0816c12.6464 7.5776 23.1936 18.1248 30.72 30.72L959.232 773.12a89.6 89.6 0 0 1-76.8 135.68H141.6192a89.6 89.6 0 0 1-76.8-135.68L435.1488 155.8016a89.6 89.6 0 0 1 122.9312-30.72zM501.0432 195.328L130.6624 812.5952a12.8 12.8 0 0 0 10.9568 19.4048h740.7616a12.8 12.8 0 0 0 10.9568-19.4048L522.9568 195.328a12.8 12.8 0 0 0-21.9136 0zM512 524.8a38.4 38.4 0 0 1 38.4 38.4v153.6a38.4 38.4 0 1 1-76.8 0v-153.6a38.4 38.4 0 0 1 38.4-38.4z m0-204.8a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 1 1-76.8 0V358.4a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M572.33 707.67l220.673-220.673a85.333 85.333 0 0 0-60.331-145.664H291.328a85.333 85.333 0 0 0-60.33 145.664L451.668 707.67a85.333 85.333 0 0 0 120.662 0z" ></path></symbol></svg>',(e=>{var t=(r=(r=document.getElementsByTagName("script"))[r.length-1]).getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,s,o,a,c=function(f,h){h.parentNode.insertBefore(f,h)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch(f){console&&console.log(f)}}n=function(){var f,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_4776227,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(f=document.body).firstChild?c(h,f.firstChild):f.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(s=n,o=e.document,a=!1,l(),o.onreadystatechange=function(){o.readyState=="complete"&&(o.onreadystatechange=null,u())})}function u(){a||(a=!0,s())}function l(){try{o.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);const SX="",EX="",CX="",TX="";function Un(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const q3="1.18.0",W3="1.40.0",G3={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"};class hf extends Error{}class pf extends hf{constructor(t,r){super(t),this.code=r,this.type=G3[r]??"ServerError"}}class am extends hf{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var cm=e=>{throw TypeError(e)},mf=(e,t,r)=>t.has(e)||cm("Cannot "+r),tr=(e,t,r)=>(mf(e,t,"read from private field"),r?r.call(e):t.get(e)),xs=(e,t,r)=>t.has(e)?cm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),oo=(e,t,r,n)=>(mf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),um=(e,t,r)=>(mf(e,t,"access private method"),r),H3=(e,t,r,n)=>({set _(i){oo(e,t,i,r)},get _(){return tr(e,t,n)}}),Ss,ga,hi,Es,va,ao,Nc,lm,fm;function K3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const X3={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class J3{constructor(t,r={}){if(xs(this,Nc),xs(this,Ss,0),xs(this,ga,0),xs(this,hi,null),xs(this,Es,null),xs(this,va,new Set),xs(this,ao,new Map),this.endpoint=t,this.options={...X3,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=K3(this.endpoint))}async makeRequest(t,r){const n=await um(this,Nc,lm).call(this);return new Promise((i,s)=>{oo(this,Ss,tr(this,Ss)+1),tr(this,ao).set(tr(this,Ss),{resolve:i,reject:s,timeout:setTimeout(()=>{tr(this,ao).delete(tr(this,Ss)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:tr(this,Ss),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new pf(i.message,i.code);return s})}async subscribe(t){const r=new Y3(t);return tr(this,va).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}Ss=new WeakMap,ga=new WeakMap,hi=new WeakMap,Es=new WeakMap,va=new WeakMap,ao=new WeakMap,Nc=new WeakSet,lm=function(){return tr(this,Es)?tr(this,Es):(oo(this,Es,new Promise(e=>{var t;(t=tr(this,hi))==null||t.close(),oo(this,hi,new this.options.WebSocketConstructor(this.endpoint)),tr(this,hi).addEventListener("open",()=>{oo(this,ga,0),e(tr(this,hi))}),tr(this,hi).addEventListener("close",()=>{H3(this,ga)._++,tr(this,ga)<=this.options.maxReconnects&&setTimeout(()=>{um(this,Nc,fm).call(this)},this.options.reconnectTimeout)}),tr(this,hi).addEventListener("message",({data:r})=>{let n;try{n=JSON.parse(r)}catch(i){console.error(new Error(`Failed to parse RPC message: ${r}`,{cause:i}));return}if("id"in n&&n.id!=null&&tr(this,ao).has(n.id)){const{resolve:i,timeout:s}=tr(this,ao).get(n.id);clearTimeout(s),i(n)}else if("params"in n){const{params:i}=n;tr(this,va).forEach(s=>{s.subscriptionId===i.subscription&&i.subscription===s.subscriptionId&&s.onMessage(i.result)})}})})),tr(this,Es))},fm=async function(){var e;return(e=tr(this,hi))==null||e.close(),oo(this,Es,null),Promise.allSettled([...tr(this,va)].map(t=>t.subscribe(this)))};class Y3{constructor(t){this.subscriptionId=null,this.subscribed=!1,this.input=t}onMessage(t){this.subscribed&&this.input.onMessage(t)}async unsubscribe(t){const{subscriptionId:r}=this;return this.subscribed=!1,r==null?!1:(this.subscriptionId=null,t.makeRequest(this.input.unsubscribe,[r]))}async subscribe(t){this.subscriptionId=null,this.subscribed=!0;const r=await t.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=r)}}var dm=e=>{throw TypeError(e)},gf=(e,t,r)=>t.has(e)||dm("Cannot "+r),Zr=(e,t,r)=>(gf(e,t,"read from private field"),r?r.call(e):t.get(e)),Dc=(e,t,r)=>t.has(e)?dm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),vf=(e,t,r,n)=>(gf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Z3=(e,t,r)=>(gf(e,t,"access private method"),r),ya,gn,ba,yf,hm;class pm{constructor(t){Dc(this,yf),Dc(this,ya,0),Dc(this,gn),Dc(this,ba),vf(this,gn,t)}fetch(t,r){const n=Zr(this,gn).fetch??fetch;if(!n)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return n(t,r)}async request(t){var i,s;vf(this,ya,Zr(this,ya)+1);const r=await this.fetch(((i=Zr(this,gn).rpc)==null?void 0:i.url)??Zr(this,gn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":q3,"Client-Target-Api-Version":W3,"Client-Request-Method":t.method,...(s=Zr(this,gn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:Zr(this,ya),method:t.method,params:t.params})});if(!r.ok)throw new am(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new pf(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await Z3(this,yf,hm).call(this).subscribe(t);return async()=>!!await r()}}ya=new WeakMap,gn=new WeakMap,ba=new WeakMap,yf=new WeakSet,hm=function(){var e;if(!Zr(this,ba)){const t=Zr(this,gn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");vf(this,ba,new J3(((e=Zr(this,gn).websocket)==null?void 0:e.url)??Zr(this,gn).url,{WebSocketConstructor:t,...Zr(this,gn).websocket}))}return Zr(this,ba)};function mm(e){switch(e){case"mainnet":return"https://fullnode.mainnet.sui.io:443";case"testnet":return"https://fullnode.testnet.sui.io:443";case"devnet":return"https://fullnode.devnet.sui.io:443";case"localnet":return"http://127.0.0.1:9000";default:throw new Error(`Unknown network: ${e}`)}}function Q3(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<e.length;u++){const l=e.charAt(u),f=l.charCodeAt(0);if(t[f]!==255)throw new TypeError(l+" is ambiguous");t[f]=u}const r=e.length,n=e.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let l=0,f=0,h=0;const y=u.length;for(;h!==y&&u[h]===0;)h++,l++;const b=(y-h)*s+1>>>0,w=new Uint8Array(b);for(;h!==y;){let R=u[h],N=0;for(let F=b-1;(R!==0||N<f)&&F!==-1;F--,N++)R+=256*w[F]>>>0,w[F]=R%r>>>0,R=R/r>>>0;if(R!==0)throw new Error("Non-zero carry");f=N,h++}let A=b-f;for(;A!==b&&w[A]===0;)A++;let P=n.repeat(l);for(;A<b;++A)P+=e.charAt(w[A]);return P}function a(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let l=0,f=0,h=0;for(;u[l]===n;)f++,l++;const y=(u.length-l)*i+1>>>0,b=new Uint8Array(y);for(;u[l];){let R=t[u.charCodeAt(l)];if(R===255)return;let N=0;for(let F=y-1;(R!==0||N<h)&&F!==-1;F--,N++)R+=r*b[F]>>>0,b[F]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");h=N,l++}let w=y-h;for(;w!==y&&b[w]===0;)w++;const A=new Uint8Array(f+(y-w));let P=f;for(;w!==y;)A[P++]=b[w++];return A}function c(u){const l=a(u);if(l)return l;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var eE="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const gm=Q3(eE),co=e=>gm.encode(e),pi=e=>gm.decode(e),tE=co,rE=pi;function vn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const bf=8192;function Gr(e){if(e.length<bf)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=bf){const n=e.slice(r,r+bf);t+=String.fromCharCode(...n)}return btoa(t)}const vm=Gr,ym=vn;function uo(e){var i;const t=e.startsWith("0x")?e.slice(2):e,r=t.length%2===0?t:`0${t}`,n=((i=r.match(/[0-9a-fA-F]{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];if(n.length!==r.length/2)throw new Error(`Invalid hex string ${e}`);return Uint8Array.from(n)}function mi(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const bm=mi,wm=uo;function wf(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function nE(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}class _m{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=nE(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function xm(e,t){switch(t){case"base58":return co(e);case"base64":return Gr(e);case"hex":return mi(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function iE(e,t){switch(t){case"base58":return pi(e);case"base64":return vn(e);case"hex":return uo(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function _f(e,t=["<",">"]){const[r,n]=t,i=[];let s="",o=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&o++,c===n&&o--,o===0&&c===","){i.push(s.trim()),s="";continue}s+=c}return i.push(s.trim()),i}class Sm{constructor({initialSize:t=1024,maxSize:r=1/0,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return xf(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return xf(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return xf(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return wf(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return xm(this.toBytes(),t)}}function xf(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var Em=e=>{throw TypeError(e)},Cm=(e,t,r)=>t.has(e)||Em("Cannot "+r),yn=(e,t,r)=>(Cm(e,t,"read from private field"),r?r.call(e):t.get(e)),$c=(e,t,r)=>t.has(e)?Em("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Bc=(e,t,r,n)=>(Cm(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),lo,wa,Lc,Vi;const sE=class D3{constructor(t){$c(this,lo),$c(this,wa),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Bc(this,lo,t.write),Bc(this,wa,t.serialize??((r,n)=>{const i=new Sm({initialSize:this.serializedSize(r)??void 0,...n});return yn(this,lo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),yn(this,lo).call(this,t,r)}serialize(t,r){return this.validate(t),new Mm(this,yn(this,wa).call(this,t,r))}parse(t){const r=new _m(t);return this.read(r)}fromHex(t){return this.parse(uo(t))}fromBase58(t){return this.parse(pi(t))}fromBase64(t){return this.parse(vn(t))}transform({name:t,input:r,output:n,validate:i}){return new D3({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>yn(this,lo).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>yn(this,wa).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};lo=new WeakMap,wa=new WeakMap;let zn=sE;const Tm=Symbol.for("@mysten/serialized-bcs");function oE(e){return!!e&&typeof e=="object"&&e[Tm]===!0}class Mm{constructor(t,r){$c(this,Lc),$c(this,Vi),Bc(this,Lc,t),Bc(this,Vi,r)}get[Tm](){return!0}toBytes(){return yn(this,Vi)}toHex(){return mi(yn(this,Vi))}toBase64(){return Gr(yn(this,Vi))}toBase58(){return co(yn(this,Vi))}parse(){return yn(this,Lc).parse(yn(this,Vi))}}Lc=new WeakMap,Vi=new WeakMap;function Fc({size:e,...t}){return new zn({...t,serializedSize:()=>e})}function Sf({readMethod:e,writeMethod:t,...r}){return Fc({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function Ef({readMethod:e,writeMethod:t,...r}){return Fc({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function aE({serialize:e,...t}){const r=new zn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function cE({toBytes:e,fromBytes:t,...r}){return new zn({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return t(s)},write:(n,i)=>{const s=e(n);i.writeULEB(s.length);for(let o=0;o<s.length;o++)i.write8(s[o])},serialize:n=>{const i=e(n),s=wf(i.length),o=new Uint8Array(s.length+i.length);return o.set(s,0),o.set(i,s.length),o},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function uE(e){let t=null;function r(){return t||(t=e()),t}return new zn({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const W={u8(e){return Sf({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Sf({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Sf({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Ef({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Ef({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Ef({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Fc({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return aE({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(wf(t)),...e})},bytes(e,t){return Fc({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{const i=new Uint8Array(r);for(let s=0;s<e;s++)n.write8(i[s]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},string(e){return cE({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new zn({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let s=0;s<e;s++)i[s]=t.read(n);return i},write:(n,i)=>{for(const s of n)t.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!n||typeof n!="object"||!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return W.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>t.$kind==="Some"?t.Some:null})},vector(e,t){return new zn({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new zn({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const s=e[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new zn({name:e,serializedSize:i=>{let s=0;for(const[o,a]of n){const c=a.serializedSize(i[o]);if(c==null)return null;s+=c}return s},read:i=>{const s={};for(const[o,a]of n)s[o]=a.read(i);return s},write:(i,s)=>{for(const[o,a]of n)a.write(i[o],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new zn({name:e,read:i=>{const s=i.readULEB(),o=n[s];if(!o)throw new TypeError(`Unknown value ${s} for enum ${e}`);const[a,c]=o;return{[a]:(c==null?void 0:c.read(i))??!0,$kind:a}},write:(i,s)=>{const[o,a]=Object.entries(i).filter(([c])=>Object.hasOwn(t,c))[0];for(let c=0;c<n.length;c++){const[u,l]=n[c];if(u===o){s.writeULEB(c),l==null||l.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i).filter(c=>i[c]!==void 0&&Object.hasOwn(t,c));if(s.length!==1)throw new TypeError(`Expected object with one key, but found ${s.length} for type ${e}}`);const[o]=s;if(!Object.hasOwn(t,o))throw new TypeError(`Invalid enum variant ${o}`)}})},map(e,t){return W.vector(W.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},lazy(e){return uE(e)}},lE=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:_m,BcsType:zn,BcsWriter:Sm,SerializedBcs:Mm,bcs:W,decodeStr:iE,encodeStr:xm,fromB58:rE,fromB64:ym,fromBase58:pi,fromBase64:vn,fromHEX:wm,fromHex:uo,isSerializedBcs:oE,splitGenericParameters:_f,toB58:tE,toB64:vm,toBase58:co,toBase64:Gr,toHEX:bm,toHex:mi},Symbol.toStringTag,{value:"Module"})),fE=32;function Cf(e){try{return pi(e).length===fE}catch{return!1}}const Uc=32;function gi(e){return hE(e)&&pE(e)===Uc}function _a(e){return gi(e)}function dE(e){return e.includes("::")?Tf(e):e}function Tf(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,s=n.includes("<")?_f(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>dE(o.trim())):[];return{address:Lr(t),module:r,name:i,typeParams:s}}function Am(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Tf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Am(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Lr(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Uc*2,"0")}`}function vi(e,t=!1){return Lr(e,t)}function hE(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function pE(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const mE=/^vector<(.+)>$/,gE=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let Om=class da{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(mE);if(n)return{vector:da.parseFromStr(n[1],r)};const i=t.match(gE);if(i)return{struct:{address:r?Lr(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:da.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return _f(t).map(n=>da.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${da.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(da.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function vE(e){return W.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function yE(e){return W.enum("Option",{None:null,Some:e})}const er=W.bytes(Uc).transform({validate:e=>{const t=typeof e=="string"?e:mi(e);if(!t||!gi(Lr(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?uo(Lr(e)):e,output:e=>Lr(mi(e))}),bn=W.vector(W.u8()).transform({name:"ObjectDigest",input:e=>pi(e),output:e=>co(new Uint8Array(e)),validate:e=>{if(pi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Qr=W.struct("SuiObjectRef",{objectId:er,version:W.u64(),digest:bn}),Im=W.struct("SharedObjectRef",{objectId:er,initialSharedVersion:W.u64(),mutable:W.bool()}),Pm=W.enum("ObjectArg",{ImmOrOwnedObject:Qr,SharedObject:Im,Receiving:Qr}),km=W.enum("CallArg",{Pure:W.struct("Pure",{bytes:W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Gr(new Uint8Array(e))})}),Object:Pm}),Mf=W.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:W.lazy(()=>Mf),struct:W.lazy(()=>Bm),u16:null,u32:null,u256:null}),Af=Mf.transform({input:e=>typeof e=="string"?Om.parseFromStr(e,!0):e,output:e=>Om.tagToString(e)}),Vn=W.enum("Argument",{GasCoin:null,Input:W.u16(),Result:W.u16(),NestedResult:W.tuple([W.u16(),W.u16()])}),jm=W.struct("ProgrammableMoveCall",{package:er,module:W.string(),function:W.string(),typeArguments:W.vector(Af),arguments:W.vector(Vn)}),Rm=W.enum("Command",{MoveCall:jm,TransferObjects:W.struct("TransferObjects",{objects:W.vector(Vn),address:Vn}),SplitCoins:W.struct("SplitCoins",{coin:Vn,amounts:W.vector(Vn)}),MergeCoins:W.struct("MergeCoins",{destination:Vn,sources:W.vector(Vn)}),Publish:W.struct("Publish",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Gr(new Uint8Array(e))})),dependencies:W.vector(er)}),MakeMoveVec:W.struct("MakeMoveVec",{type:yE(Af).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:W.vector(Vn)}),Upgrade:W.struct("Upgrade",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Gr(new Uint8Array(e))})),dependencies:W.vector(er),package:er,ticket:Vn})}),Nm=W.struct("ProgrammableTransaction",{inputs:W.vector(km),commands:W.vector(Rm)}),Dm=W.enum("TransactionKind",{ProgrammableTransaction:Nm,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),$m=W.enum("TransactionExpiration",{None:null,Epoch:vE()}),Bm=W.struct("StructTag",{address:er,module:W.string(),name:W.string(),typeParams:W.vector(Mf)}),Lm=W.struct("GasData",{payment:W.vector(Qr),owner:er,price:W.u64(),budget:W.u64()}),Fm=W.struct("TransactionDataV1",{kind:Dm,sender:er,gasData:Lm,expiration:$m}),Um=W.enum("TransactionData",{V1:Fm}),zm=W.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Vm=W.enum("IntentVersion",{V0:null}),qm=W.enum("AppId",{Sui:null}),Wm=W.struct("Intent",{scope:zm,version:Vm,appId:qm});function Gm(e){return W.struct(`IntentMessage<${e.name}>`,{intent:Wm,value:e})}const Hm=W.enum("CompressedSignature",{ED25519:W.fixedArray(64,W.u8()),Secp256k1:W.fixedArray(64,W.u8()),Secp256r1:W.fixedArray(64,W.u8()),ZkLogin:W.vector(W.u8())}),Km=W.enum("PublicKey",{ED25519:W.fixedArray(32,W.u8()),Secp256k1:W.fixedArray(33,W.u8()),Secp256r1:W.fixedArray(33,W.u8()),ZkLogin:W.vector(W.u8())}),Xm=W.struct("MultiSigPkMap",{pubKey:Km,weight:W.u8()}),Jm=W.struct("MultiSigPublicKey",{pk_map:W.vector(Xm),threshold:W.u16()}),bE=W.struct("MultiSig",{sigs:W.vector(Hm),bitmap:W.u16(),multisig_pk:Jm}),wE=W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Gr(new Uint8Array(e))}),Ym=W.struct("SenderSignedTransaction",{intentMessage:Gm(Um),txSignatures:W.vector(wE)}),_E=W.vector(Ym,{name:"SenderSignedData"}),xE=W.struct("PasskeyAuthenticator",{authenticatorData:W.vector(W.u8()),clientDataJson:W.string(),userSignature:W.vector(W.u8())}),SE=W.enum("PackageUpgradeError",{UnableToFetchPackage:W.struct("UnableToFetchPackage",{packageId:er}),NotAPackage:W.struct("NotAPackage",{objectId:er}),IncompatibleUpgrade:null,DigestDoesNotMatch:W.struct("DigestDoesNotMatch",{digest:W.vector(W.u8())}),UnknownUpgradePolicy:W.struct("UnknownUpgradePolicy",{policy:W.u8()}),PackageIDDoesNotMatch:W.struct("PackageIDDoesNotMatch",{packageId:er,ticketId:er})}),EE=W.struct("ModuleId",{address:er,name:W.string()}),Zm=W.struct("MoveLocation",{module:EE,function:W.u16(),instruction:W.u16(),functionName:W.option(W.string())}),CE=W.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:W.struct("IndexOutOfBounds",{idx:W.u16()}),SecondaryIndexOutOfBounds:W.struct("SecondaryIndexOutOfBounds",{resultIdx:W.u16(),secondaryIdx:W.u16()}),InvalidResultArity:W.struct("InvalidResultArity",{resultIdx:W.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),TE=W.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),ME=W.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:W.struct("MoveObjectTooBig",{objectSize:W.u64(),maxObjectSize:W.u64()}),MovePackageTooBig:W.struct("MovePackageTooBig",{objectSize:W.u64(),maxObjectSize:W.u64()}),CircularObjectOwnership:W.struct("CircularObjectOwnership",{object:er}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:W.option(Zm),MoveAbort:W.tuple([Zm,W.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:W.struct("CommandArgumentError",{argIdx:W.u16(),kind:CE}),TypeArgumentError:W.struct("TypeArgumentError",{argumentIdx:W.u16(),kind:TE}),UnusedValueWithoutDrop:W.struct("UnusedValueWithoutDrop",{resultIdx:W.u16(),secondaryIdx:W.u16()}),InvalidPublicFunctionReturnType:W.struct("InvalidPublicFunctionReturnType",{idx:W.u16()}),InvalidTransferObject:null,EffectsTooLarge:W.struct("EffectsTooLarge",{currentSize:W.u64(),maxSize:W.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:W.struct("PackageUpgradeError",{upgradeError:SE}),WrittenObjectsTooLarge:W.struct("WrittenObjectsTooLarge",{currentSize:W.u64(),maxSize:W.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:W.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:W.vector(er)}),AddressDeniedForCoin:W.struct("AddressDeniedForCoin",{address:er,coinType:W.string()}),CoinTypeGlobalPause:W.struct("CoinTypeGlobalPause",{coinType:W.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Qm=W.enum("ExecutionStatus",{Success:null,Failed:W.struct("ExecutionFailed",{error:ME,command:W.option(W.u64())})}),eg=W.struct("GasCostSummary",{computationCost:W.u64(),storageCost:W.u64(),storageRebate:W.u64(),nonRefundableStorageFee:W.u64()}),fo=W.enum("Owner",{AddressOwner:er,ObjectOwner:er,Shared:W.struct("Shared",{initialSharedVersion:W.u64()}),Immutable:null}),AE=W.struct("TransactionEffectsV1",{status:Qm,executedEpoch:W.u64(),gasUsed:eg,modifiedAtVersions:W.vector(W.tuple([er,W.u64()])),sharedObjects:W.vector(Qr),transactionDigest:bn,created:W.vector(W.tuple([Qr,fo])),mutated:W.vector(W.tuple([Qr,fo])),unwrapped:W.vector(W.tuple([Qr,fo])),deleted:W.vector(Qr),unwrappedThenDeleted:W.vector(Qr),wrapped:W.vector(Qr),gasObject:W.tuple([Qr,fo]),eventsDigest:W.option(bn),dependencies:W.vector(bn)}),Of=W.tuple([W.u64(),bn]),OE=W.enum("ObjectIn",{NotExist:null,Exist:W.tuple([Of,fo])}),IE=W.enum("ObjectOut",{NotExist:null,ObjectWrite:W.tuple([bn,fo]),PackageWrite:Of}),PE=W.enum("IDOperation",{None:null,Created:null,Deleted:null}),kE=W.struct("EffectsObjectChange",{inputState:OE,outputState:IE,idOperation:PE}),jE=W.enum("UnchangedSharedKind",{ReadOnlyRoot:Of,MutateDeleted:W.u64(),ReadDeleted:W.u64(),Cancelled:W.u64(),PerEpochConfig:null}),RE=W.struct("TransactionEffectsV2",{status:Qm,executedEpoch:W.u64(),gasUsed:eg,transactionDigest:bn,gasObjectIndex:W.option(W.u32()),eventsDigest:W.option(bn),dependencies:W.vector(bn),lamportVersion:W.u64(),changedObjects:W.vector(W.tuple([er,kE])),unchangedSharedObjects:W.vector(W.tuple([er,jE])),auxDataDigest:W.option(bn)}),NE=W.enum("TransactionEffects",{V1:AE,V2:RE}),If={...W,U8:W.u8(),U16:W.u16(),U32:W.u32(),U64:W.u64(),U128:W.u128(),U256:W.u256(),ULEB128:W.uleb128(),Bool:W.bool(),String:W.string(),Address:er,AppId:qm,Argument:Vn,CallArg:km,CompressedSignature:Hm,GasData:Lm,Intent:Wm,IntentMessage:Gm,IntentScope:zm,IntentVersion:Vm,MultiSig:bE,MultiSigPkMap:Xm,MultiSigPublicKey:Jm,ObjectArg:Pm,ObjectDigest:bn,ProgrammableMoveCall:jm,ProgrammableTransaction:Nm,PublicKey:Km,SenderSignedData:_E,SenderSignedTransaction:Ym,SharedObjectRef:Im,StructTag:Bm,SuiObjectRef:Qr,Command:Rm,TransactionData:Um,TransactionDataV1:Fm,TransactionExpiration:$m,TransactionKind:Dm,TypeTag:Af,TransactionEffects:NE,PasskeyAuthenticator:xE},tg="…";function DE(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${tg}${e.slice(-4)}`}function $E(e){return`${e.slice(0,10)}${tg}`}const rg=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,ng=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,BE=235;function ig(e){return e.length>BE?!1:e.includes("@")?rg.test(e):ng.test(e)}function sg(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!rg.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!ng.test(r))throw new Error(`Invalid SuiNS name ${e}`);n=r.split(".").slice(0,-1)}return t==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}const LE=9,FE=BigInt(1e9),UE="0x1",og="0x2",zE="0x3",VE=vi("0x6"),qE="sui_system",Pf=`${og}::sui::SUI`,WE=vi("0x5"),GE=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,HE=/^\d+$/,KE=64,ag="/",cg=e=>{const t=e.split(ag);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!HE.test(i)||!ig(r)?!1:GE.test(n)&&n.length<KE},XE=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(ag)&&!cg(r))return!1;return!0};function kf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function JE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ug(e,...t){if(!JE(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function lg(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function YE(e,t){ug(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zc=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Cs=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),fg=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,yi=Cs?e=>e:e=>fg(e);function ho(e){for(let t=0;t<e.length;t++)e[t]=fg(e[t])}function ZE(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function xa(e){return typeof e=="string"&&(e=ZE(e)),ug(e),e}let QE=class{clone(){return this._cloneInto()}};function eC(e){const t=(n,i)=>e(i).update(xa(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const tC=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class rC extends QE{constructor(t,r,n={},i,s,o){if(super(),this.blockLen=t,this.outputLen=r,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,kf(t),kf(r),kf(i),r<0||r>i)throw new Error("outputLen bigger than keyLen");if(n.key!==void 0&&(n.key.length<1||n.key.length>i))throw new Error("key length must be undefined or 1.."+i);if(n.salt!==void 0&&n.salt.length!==s)throw new Error("salt must be undefined or "+s);if(n.personalization!==void 0&&n.personalization.length!==o)throw new Error("personalization must be undefined or "+o);this.buffer=new Uint8Array(t),this.buffer32=zc(this.buffer)}update(t){lg(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=xa(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(Cs||ho(i),this.compress(i,0,!1),Cs||ho(i),this.pos=0);const u=Math.min(r-this.pos,s-c),l=o+c;if(u===r&&!(l%4)&&c+u<s){const f=new Uint32Array(a,l,Math.floor((s-c)/4));Cs||ho(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);Cs||ho(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){lg(this),YE(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),Cs||ho(n),this.compress(n,0,!0),Cs||ho(n);const i=zc(t);this.get().forEach((s,o)=>i[o]=yi(s))}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){const{buffer:r,length:n,finished:i,destroyed:s,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.length=n,t.finished=i,t.destroyed=s,t.outputLen=o,t.buffer.set(r),t.pos=a,t}}const Vc=BigInt(2**32-1),jf=BigInt(32);function dg(e,t=!1){return t?{h:Number(e&Vc),l:Number(e>>jf&Vc)}:{h:Number(e>>jf&Vc)|0,l:Number(e&Vc)|0}}function nC(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=dg(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const iC=(e,t)=>BigInt(e>>>0)<<jf|BigInt(t>>>0),sC=(e,t,r)=>e>>>r,oC=(e,t,r)=>e<<32-r|t>>>r,aC=(e,t,r)=>e>>>r|t<<32-r,cC=(e,t,r)=>e<<32-r|t>>>r,uC=(e,t,r)=>e<<64-r|t>>>r-32,lC=(e,t,r)=>e>>>r-32|t<<64-r,fC=(e,t)=>t,dC=(e,t)=>e,hC=(e,t,r)=>e<<r|t>>>32-r,pC=(e,t,r)=>t<<r|e>>>32-r,mC=(e,t,r)=>t<<r-32|e>>>64-r,gC=(e,t,r)=>e<<r-32|t>>>64-r;function vC(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const jr={fromBig:dg,split:nC,toBig:iC,shrSH:sC,shrSL:oC,rotrSH:aC,rotrSL:cC,rotrBH:uC,rotrBL:lC,rotr32H:fC,rotr32L:dC,rotlSH:hC,rotlSL:pC,rotlBH:mC,rotlBL:gC,add:vC,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},fr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Pe=new Uint32Array(32);function qi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],w=Pe[2*n+1],A=jr.add3L(c,l,o);u=jr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:jr.rotr32H(w,b),Dl:jr.rotr32L(w,b)},{h:y,l:h}=jr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:jr.rotrSH(f,l,24),Bl:jr.rotrSL(f,l,24)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=w}function Wi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],w=Pe[2*n+1],A=jr.add3L(c,l,o);u=jr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:jr.rotrSH(w,b,16),Dl:jr.rotrSL(w,b,16)},{h:y,l:h}=jr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:jr.rotrBH(f,l,63),Bl:jr.rotrBL(f,l,63)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=w}class hg extends rC{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=fr[0]|0,this.v0h=fr[1]|0,this.v1l=fr[2]|0,this.v1h=fr[3]|0,this.v2l=fr[4]|0,this.v2h=fr[5]|0,this.v3l=fr[6]|0,this.v3h=fr[7]|0,this.v4l=fr[8]|0,this.v4h=fr[9]|0,this.v5l=fr[10]|0,this.v5h=fr[11]|0,this.v6l=fr[12]|0,this.v6h=fr[13]|0,this.v7l=fr[14]|0,this.v7h=fr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=zc(xa(t.salt));this.v4l^=yi(n[0]),this.v4h^=yi(n[1]),this.v5l^=yi(n[2]),this.v5h^=yi(n[3])}if(t.personalization){const n=zc(xa(t.personalization));this.v6l^=yi(n[0]),this.v6h^=yi(n[1]),this.v7l^=yi(n[2]),this.v7h^=yi(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(xa(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:s,v2h:o,v3l:a,v3h:c,v4l:u,v4h:l,v5l:f,v5h:h,v6l:y,v6h:b,v7l:w,v7h:A}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A){this.v0l=t|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=f|0,this.v5h=h|0,this.v6l=y|0,this.v6h=b|0,this.v7l=w|0,this.v7h=A|0}compress(t,r,n){this.get().forEach((c,u)=>Pe[u]=c),Pe.set(fr,16);let{h:i,l:s}=jr.fromBig(BigInt(this.length));Pe[24]=fr[8]^s,Pe[25]=fr[9]^i,n&&(Pe[28]=~Pe[28],Pe[29]=~Pe[29]);let o=0;const a=tC;for(let c=0;c<12;c++)qi(0,4,8,12,t,r+2*a[o++]),Wi(0,4,8,12,t,r+2*a[o++]),qi(1,5,9,13,t,r+2*a[o++]),Wi(1,5,9,13,t,r+2*a[o++]),qi(2,6,10,14,t,r+2*a[o++]),Wi(2,6,10,14,t,r+2*a[o++]),qi(3,7,11,15,t,r+2*a[o++]),Wi(3,7,11,15,t,r+2*a[o++]),qi(0,5,10,15,t,r+2*a[o++]),Wi(0,5,10,15,t,r+2*a[o++]),qi(1,6,11,12,t,r+2*a[o++]),Wi(1,6,11,12,t,r+2*a[o++]),qi(2,7,8,13,t,r+2*a[o++]),Wi(2,7,8,13,t,r+2*a[o++]),qi(3,4,9,14,t,r+2*a[o++]),Wi(3,4,9,14,t,r+2*a[o++]);this.v0l^=Pe[0]^Pe[16],this.v0h^=Pe[1]^Pe[17],this.v1l^=Pe[2]^Pe[18],this.v1h^=Pe[3]^Pe[19],this.v2l^=Pe[4]^Pe[20],this.v2h^=Pe[5]^Pe[21],this.v3l^=Pe[6]^Pe[22],this.v3h^=Pe[7]^Pe[23],this.v4l^=Pe[8]^Pe[24],this.v4h^=Pe[9]^Pe[25],this.v5l^=Pe[10]^Pe[26],this.v5h^=Pe[11]^Pe[27],this.v6l^=Pe[12]^Pe[28],this.v6h^=Pe[13]^Pe[29],this.v7l^=Pe[14]^Pe[30],this.v7h^=Pe[15]^Pe[31],Pe.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const pg=eC(e=>new hg(e)),yC=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:hg,blake2b:pg},Symbol.toStringTag,{value:"Module"}));function bC(e,t,r){const n=If.Address.serialize(e).toBytes(),i=If.TypeTag.serialize(t).toBytes(),s=If.u64().serialize(r.length).toBytes(),o=pg.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${mi(o.digest().slice(0,32))}`}const wC=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:FE,MOVE_STDLIB_ADDRESS:UE,SUI_ADDRESS_LENGTH:Uc,SUI_CLOCK_OBJECT_ID:VE,SUI_DECIMALS:LE,SUI_FRAMEWORK_ADDRESS:og,SUI_SYSTEM_ADDRESS:zE,SUI_SYSTEM_MODULE_NAME:qE,SUI_SYSTEM_STATE_OBJECT_ID:WE,SUI_TYPE_ARG:Pf,deriveDynamicFieldID:bC,formatAddress:DE,formatDigest:$E,fromB64:ym,fromBase58:pi,fromBase64:vn,fromHEX:wm,fromHex:uo,isValidNamedPackage:cg,isValidNamedType:XE,isValidSuiAddress:gi,isValidSuiNSName:ig,isValidSuiObjectId:_a,isValidTransactionDigest:Cf,normalizeStructTag:Am,normalizeSuiAddress:Lr,normalizeSuiNSName:sg,normalizeSuiObjectId:vi,parseStructTag:Tf,toB64:vm,toBase58:co,toBase64:Gr,toHEX:bm,toHex:mi},Symbol.toStringTag,{value:"Module"}));var Rf=Object.defineProperty,_C=Object.getOwnPropertyDescriptor,xC=Object.getOwnPropertyNames,SC=Object.prototype.hasOwnProperty,EC=(e,t)=>{for(var r in t)Rf(e,r,{get:t[r],enumerable:!0})},CC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xC(t))!SC.call(e,i)&&i!==r&&Rf(e,i,{get:()=>t[i],enumerable:!(n=_C(t,i))||n.enumerable});return e},TC=e=>CC(Rf({},"__esModule",{value:!0}),e),mg={};EC(mg,{BIC_REGEX:()=>vg,CUID2_REGEX:()=>yg,DECIMAL_REGEX:()=>bg,EMAIL_REGEX:()=>wg,EMOJI_REGEX:()=>_g,HEXADECIMAL_REGEX:()=>xg,HEX_COLOR_REGEX:()=>Sg,IMEI_REGEX:()=>Eg,IPV4_REGEX:()=>Cg,IPV6_REGEX:()=>Tg,IP_REGEX:()=>Mg,ISO_DATE_REGEX:()=>Ag,ISO_DATE_TIME_REGEX:()=>Og,ISO_TIMESTAMP_REGEX:()=>kg,ISO_TIME_REGEX:()=>Ig,ISO_TIME_SECOND_REGEX:()=>Pg,ISO_WEEK_REGEX:()=>jg,MAC48_REGEX:()=>Rg,MAC64_REGEX:()=>Ng,MAC_REGEX:()=>Dg,OCTAL_REGEX:()=>$g,ULID_REGEX:()=>Bg,UUID_REGEX:()=>Lg,ValiError:()=>qc,_addIssue:()=>le,_isLuhnAlgo:()=>Nf,_isValidObjectKey:()=>Ts,_stringify:()=>Rr,any:()=>b1,array:()=>w1,arrayAsync:()=>_1,awaitAsync:()=>gg,bic:()=>qg,bigint:()=>x1,blob:()=>S1,boolean:()=>E1,brand:()=>Wg,bytes:()=>Gg,check:()=>Hg,checkAsync:()=>Kg,checkItems:()=>Xg,config:()=>qC,creditCard:()=>Jg,cuid2:()=>Yg,custom:()=>C1,customAsync:()=>T1,date:()=>M1,decimal:()=>Zg,deleteGlobalConfig:()=>AC,deleteGlobalMessage:()=>IC,deleteSchemaMessage:()=>kC,deleteSpecificMessage:()=>RC,email:()=>Qg,emoji:()=>ev,empty:()=>tv,endsWith:()=>rv,entriesFromList:()=>DC,enum:()=>Ff,enum_:()=>Ff,everyItem:()=>nv,excludes:()=>iv,fallback:()=>WC,fallbackAsync:()=>GC,file:()=>A1,filterItems:()=>sv,findItem:()=>ov,finite:()=>av,flatten:()=>HC,forward:()=>KC,forwardAsync:()=>XC,function:()=>Uf,function_:()=>Uf,getDefault:()=>_i,getDefaults:()=>Df,getDefaultsAsync:()=>$f,getDotPath:()=>Vg,getFallback:()=>Ea,getFallbacks:()=>Bf,getFallbacksAsync:()=>Lf,getGlobalConfig:()=>Sa,getGlobalMessage:()=>Fg,getSchemaMessage:()=>Ug,getSpecificMessage:()=>zg,hash:()=>cv,hexColor:()=>lv,hexadecimal:()=>uv,imei:()=>fv,includes:()=>dv,instance:()=>O1,integer:()=>hv,intersect:()=>I1,intersectAsync:()=>P1,ip:()=>pv,ipv4:()=>mv,ipv6:()=>gv,is:()=>JC,isOfKind:()=>$C,isOfType:()=>BC,isValiError:()=>LC,isoDate:()=>vv,isoDateTime:()=>yv,isoTime:()=>bv,isoTimeSecond:()=>wv,isoTimestamp:()=>_v,isoWeek:()=>xv,keyof:()=>YC,lazy:()=>k1,lazyAsync:()=>j1,length:()=>Sv,literal:()=>R1,looseObject:()=>N1,looseObjectAsync:()=>D1,looseTuple:()=>$1,looseTupleAsync:()=>B1,mac:()=>Ev,mac48:()=>Cv,mac64:()=>Tv,map:()=>L1,mapAsync:()=>F1,mapItems:()=>Mv,maxBytes:()=>Av,maxLength:()=>Ov,maxSize:()=>Iv,maxValue:()=>Pv,mimeType:()=>kv,minBytes:()=>jv,minLength:()=>Rv,minSize:()=>Nv,minValue:()=>Dv,multipleOf:()=>$v,nan:()=>U1,never:()=>z1,nonEmpty:()=>Bv,nonNullable:()=>V1,nonNullableAsync:()=>q1,nonNullish:()=>W1,nonNullishAsync:()=>G1,nonOptional:()=>zf,nonOptionalAsync:()=>Vf,normalize:()=>Lv,notBytes:()=>Fv,notLength:()=>Uv,notSize:()=>zv,notValue:()=>Vv,null:()=>qf,null_:()=>qf,nullable:()=>H1,nullableAsync:()=>K1,nullish:()=>X1,nullishAsync:()=>J1,number:()=>Y1,object:()=>Z1,objectAsync:()=>Q1,objectWithRest:()=>ey,objectWithRestAsync:()=>ty,octal:()=>qv,omit:()=>ZC,optional:()=>Wf,optionalAsync:()=>Gf,parse:()=>xy,parseAsync:()=>Sy,parser:()=>QC,parserAsync:()=>eT,partial:()=>tT,partialAsync:()=>rT,partialCheck:()=>Gv,partialCheckAsync:()=>Hv,pick:()=>nT,picklist:()=>Hf,pipe:()=>iT,pipeAsync:()=>sT,promise:()=>ry,rawCheck:()=>Kv,rawCheckAsync:()=>Xv,rawTransform:()=>Jv,rawTransformAsync:()=>Yv,readonly:()=>Zv,record:()=>ny,recordAsync:()=>iy,reduceItems:()=>Qv,regex:()=>e1,required:()=>oT,requiredAsync:()=>aT,safeInteger:()=>t1,safeParse:()=>Ey,safeParseAsync:()=>Cy,safeParser:()=>cT,safeParserAsync:()=>uT,set:()=>sy,setAsync:()=>oy,setGlobalConfig:()=>MC,setGlobalMessage:()=>OC,setSchemaMessage:()=>PC,setSpecificMessage:()=>jC,size:()=>r1,someItem:()=>n1,sortItems:()=>i1,startsWith:()=>s1,strictObject:()=>ay,strictObjectAsync:()=>cy,strictTuple:()=>uy,strictTupleAsync:()=>ly,string:()=>fy,symbol:()=>dy,toLowerCase:()=>o1,toMaxValue:()=>a1,toMinValue:()=>c1,toUpperCase:()=>u1,transform:()=>l1,transformAsync:()=>f1,trim:()=>d1,trimEnd:()=>h1,trimStart:()=>p1,tuple:()=>hy,tupleAsync:()=>py,tupleWithRest:()=>my,tupleWithRestAsync:()=>gy,ulid:()=>m1,undefined:()=>Kf,undefined_:()=>Kf,union:()=>vy,unionAsync:()=>yy,unknown:()=>by,unwrap:()=>lT,url:()=>g1,uuid:()=>v1,value:()=>y1,variant:()=>wy,variantAsync:()=>_y,void:()=>Jf,void_:()=>Jf});var Gi=TC(mg);function gg(){return{kind:"transformation",type:"await",reference:gg,async:!0,async _run(e){return e.value=await e.value,e}}}var vg=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,yg=/^[a-z][\da-z]*$/u,bg=/^\d+$/u,wg=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_g=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,xg=/^(?:0h|0x)?[\da-f]+$/iu,Sg=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,Eg=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,Cg=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,Tg=/^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu,Mg=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$|^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu,Ag=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,Og=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3]):[0-5]\d$/u,Ig=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,Pg=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,kg=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z|[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u,jg=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,Rg=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,Ng=/^(?:[\da-f]{2}:){7}[\da-f]{2}$|^(?:[\da-f]{2}-){7}[\da-f]{2}$|^(?:[\da-f]{4}\.){3}[\da-f]{4}$|^(?:[\da-f]{4}:){3}[\da-f]{4}$/iu,Dg=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$|^(?:[\da-f]{2}:){7}[\da-f]{2}$|^(?:[\da-f]{2}-){7}[\da-f]{2}$|^(?:[\da-f]{4}\.){3}[\da-f]{4}$|^(?:[\da-f]{4}:){3}[\da-f]{4}$/iu,$g=/^(?:0o)?[0-7]+$/iu,Bg=/^[\da-hjkmnp-tv-z]{26}$/iu,Lg=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,en;function MC(e){en={...en,...e}}function Sa(e){return{lang:(e==null?void 0:e.lang)??(en==null?void 0:en.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(en==null?void 0:en.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(en==null?void 0:en.abortPipeEarly)}}function AC(){en=void 0}var bi;function OC(e,t){bi||(bi=new Map),bi.set(t,e)}function Fg(e){return bi==null?void 0:bi.get(e)}function IC(e){bi==null||bi.delete(e)}var wi;function PC(e,t){wi||(wi=new Map),wi.set(t,e)}function Ug(e){return wi==null?void 0:wi.get(e)}function kC(e){wi==null||wi.delete(e)}var wn;function jC(e,t,r){wn||(wn=new Map),wn.get(e)||wn.set(e,new Map),wn.get(e).set(r,t)}function zg(e,t){var r;return(r=wn==null?void 0:wn.get(e))==null?void 0:r.get(t)}function RC(e,t){var r;(r=wn==null?void 0:wn.get(e))==null||r.delete(t)}function Rr(e){var r,n;const t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&((n=(r=Object.getPrototypeOf(e))==null?void 0:r.constructor)==null?void 0:n.name))??"null":t}function le(e,t,r,n,i){const s=i&&"input"in i?i.input:r.value,o=(i==null?void 0:i.expected)??e.expects??null,a=(i==null?void 0:i.received)??Rr(s),c={kind:e.kind,type:e.type,input:s,expected:o,received:a,message:`Invalid ${t}: ${o?`Expected ${o} but r`:"R"}eceived ${a}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},u=e.kind==="schema",l=(i==null?void 0:i.message)??e.message??zg(e.reference,c.lang)??(u?Ug(c.lang):null)??n.message??Fg(c.lang);l&&(c.message=typeof l=="function"?l(c):l),u&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}var NC=/\D/gu;function Nf(e){const t=e.replace(NC,"");let r=t.length,n=1,i=0;for(;r;){const s=+t[--r];n^=1,i+=n?[0,2,4,6,8,1,3,5,7,9][s]:s}return i%10===0}function Ts(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function DC(e,t){const r={};for(const n of e)r[n]=t;return r}function Vg(e){if(e.path){let t="";for(const r of e.path)if(typeof r.key=="string"||typeof r.key=="number")t?t+=`.${r.key}`:t+=r.key;else return null;return t}return null}function $C(e,t){return t.kind===e}function BC(e,t){return t.type===e}function LC(e){return e instanceof qc}var qc=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function qg(e){return{kind:"validation",type:"bic",reference:qg,async:!1,expects:null,requirement:vg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function Wg(e){return{kind:"transformation",type:"brand",reference:Wg,async:!1,name:e,_run(t){return t}}}function Gg(e,t){return{kind:"validation",type:"bytes",reference:Gg,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i!==this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Hg(e,t){return{kind:"validation",type:"check",reference:Hg,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&le(this,"input",r,n),r}}}function Kg(e,t){return{kind:"validation",type:"check",reference:Kg,async:!0,expects:null,requirement:e,message:t,async _run(r,n){return r.typed&&!await this.requirement(r.value)&&le(this,"input",r,n),r}}}function Xg(e,t){return{kind:"validation",type:"check_items",reference:Xg,async:!1,expects:null,requirement:e,message:t,_run(r,n){if(r.typed)for(let i=0;i<r.value.length;i++){const s=r.value[i];this.requirement(s,i,r.value)||le(this,"item",r,n,{input:s,path:[{type:"array",origin:"value",input:r.value,key:i,value:s}]})}return r}}}var FC=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,UC=/[- ]/gu,zC=[/^3[47]\d{13}$/u,/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,/^6(?:011|5\d{2})\d{12,15}$/u,/^(?:2131|1800|35\d{3})\d{11}$/u,/^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,/^(?:6[27]\d{14,17}|81\d{14,17})$/u,/^4\d{12}(?:\d{3,6})?$/u];function Jg(e){return{kind:"validation",type:"credit_card",reference:Jg,async:!1,expects:null,requirement(t){let r;return FC.test(t)&&(r=t.replace(UC,""))&&zC.some(n=>n.test(r))&&Nf(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function Yg(e){return{kind:"validation",type:"cuid2",reference:Yg,async:!1,expects:null,requirement:yg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function Zg(e){return{kind:"validation",type:"decimal",reference:Zg,async:!1,expects:null,requirement:bg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function Qg(e){return{kind:"validation",type:"email",reference:Qg,expects:null,async:!1,requirement:wg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function ev(e){return{kind:"validation",type:"emoji",reference:ev,async:!1,expects:null,requirement:_g,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function tv(e){return{kind:"validation",type:"empty",reference:tv,async:!1,expects:"0",message:e,_run(t,r){return t.typed&&t.value.length>0&&le(this,"length",t,r,{received:`${t.value.length}`}),t}}}function rv(e,t){return{kind:"validation",type:"ends_with",reference:rv,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.endsWith(this.requirement)&&le(this,"end",r,n,{received:`"${r.value.slice(-this.requirement.length)}"`}),r}}}function nv(e,t){return{kind:"validation",type:"every_item",reference:nv,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.every(this.requirement)&&le(this,"item",r,n),r}}}function iv(e,t){const r=Rr(e);return{kind:"validation",type:"excludes",reference:iv,async:!1,expects:`!${r}`,requirement:e,message:t,_run(n,i){return n.typed&&n.value.includes(this.requirement)&&le(this,"content",n,i,{received:r}),n}}}function sv(e){return{kind:"transformation",type:"filter_items",reference:sv,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function ov(e){return{kind:"transformation",type:"find_item",reference:ov,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function av(e){return{kind:"validation",type:"finite",reference:av,async:!1,expects:null,requirement:Number.isFinite,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"finite",t,r),t}}}var VC={md4:32,md5:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8,adler32:8};function cv(e,t){return{kind:"validation",type:"hash",reference:cv,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${VC[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function uv(e){return{kind:"validation",type:"hexadecimal",reference:uv,async:!1,expects:null,requirement:xg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function lv(e){return{kind:"validation",type:"hex_color",reference:lv,async:!1,expects:null,requirement:Sg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function fv(e){return{kind:"validation",type:"imei",reference:fv,async:!1,expects:null,requirement(t){return Eg.test(t)&&Nf(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function dv(e,t){const r=Rr(e);return{kind:"validation",type:"includes",reference:dv,async:!1,expects:r,requirement:e,message:t,_run(n,i){return n.typed&&!n.value.includes(this.requirement)&&le(this,"content",n,i,{received:`!${r}`}),n}}}function hv(e){return{kind:"validation",type:"integer",reference:hv,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"integer",t,r),t}}}function pv(e){return{kind:"validation",type:"ip",reference:pv,async:!1,expects:null,requirement:Mg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function mv(e){return{kind:"validation",type:"ipv4",reference:mv,async:!1,expects:null,requirement:Cg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function gv(e){return{kind:"validation",type:"ipv6",reference:gv,async:!1,expects:null,requirement:Tg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function vv(e){return{kind:"validation",type:"iso_date",reference:vv,async:!1,expects:null,requirement:Ag,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function yv(e){return{kind:"validation",type:"iso_date_time",reference:yv,async:!1,expects:null,requirement:Og,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function bv(e){return{kind:"validation",type:"iso_time",reference:bv,async:!1,expects:null,requirement:Ig,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function wv(e){return{kind:"validation",type:"iso_time_second",reference:wv,async:!1,expects:null,requirement:Pg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function _v(e){return{kind:"validation",type:"iso_timestamp",reference:_v,async:!1,expects:null,requirement:kg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function xv(e){return{kind:"validation",type:"iso_week",reference:xv,async:!1,expects:null,requirement:jg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function Sv(e,t){return{kind:"validation",type:"length",reference:Sv,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length!==this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Ev(e){return{kind:"validation",type:"mac",reference:Ev,async:!1,expects:null,requirement:Dg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function Cv(e){return{kind:"validation",type:"mac48",reference:Cv,async:!1,expects:null,requirement:Rg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function Tv(e){return{kind:"validation",type:"mac64",reference:Tv,async:!1,expects:null,requirement:Ng,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function Mv(e){return{kind:"transformation",type:"map_items",reference:Mv,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function Av(e,t){return{kind:"validation",type:"max_bytes",reference:Av,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i>this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Ov(e,t){return{kind:"validation",type:"max_length",reference:Ov,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length>this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Iv(e,t){return{kind:"validation",type:"max_size",reference:Iv,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size>this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Pv(e,t){return{kind:"validation",type:"max_value",reference:Pv,async:!1,expects:`<=${e instanceof Date?e.toJSON():Rr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value>this.requirement&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function kv(e,t){return{kind:"validation",type:"mime_type",reference:kv,async:!1,expects:e.map(r=>`"${r}"`).join(" | ")||"never",requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.includes(r.value.type)&&le(this,"MIME type",r,n,{received:`"${r.value.type}"`}),r}}}function jv(e,t){return{kind:"validation",type:"min_bytes",reference:jv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i<this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Rv(e,t){return{kind:"validation",type:"min_length",reference:Rv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length<this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Nv(e,t){return{kind:"validation",type:"min_size",reference:Nv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size<this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Dv(e,t){return{kind:"validation",type:"min_value",reference:Dv,async:!1,expects:`>=${e instanceof Date?e.toJSON():Rr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value<this.requirement&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function $v(e,t){return{kind:"validation",type:"multiple_of",reference:$v,async:!1,expects:`%${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value%this.requirement!==0&&le(this,"multiple",r,n),r}}}function Bv(e){return{kind:"validation",type:"non_empty",reference:Bv,async:!1,expects:"!0",message:e,_run(t,r){return t.typed&&t.value.length===0&&le(this,"length",t,r,{received:"0"}),t}}}function Lv(e){return{kind:"transformation",type:"normalize",reference:Lv,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function Fv(e,t){return{kind:"validation",type:"not_bytes",reference:Fv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i===this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Uv(e,t){return{kind:"validation",type:"not_length",reference:Uv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length===this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function zv(e,t){return{kind:"validation",type:"not_size",reference:zv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size===this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Vv(e,t){return{kind:"validation",type:"not_value",reference:Vv,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Rr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&this.requirement<=r.value&&this.requirement>=r.value&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function qv(e){return{kind:"validation",type:"octal",reference:qv,async:!1,expects:null,requirement:$g,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function Wv(e,t){var r;if(e.issues)for(const n of t)for(const i of e.issues){let s=!1;const o=Math.min(n.length,((r=i.path)==null?void 0:r.length)??0);for(let a=0;a<o;a++)if(n[a]!==i.path[a].key){s=!0;break}if(!s)return!1}return!0}function Gv(e,t,r){return{kind:"validation",type:"partial_check",reference:Gv,async:!1,expects:null,requirement:t,message:r,_run(n,i){return Wv(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function Hv(e,t,r){return{kind:"validation",type:"partial_check",reference:Hv,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return Wv(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Kv(e){return{kind:"validation",type:"raw_check",reference:Kv,async:!1,expects:null,_run(t,r){return e({dataset:t,config:r,addIssue:n=>le(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function Xv(e){return{kind:"validation",type:"raw_check",reference:Xv,async:!0,expects:null,async _run(t,r){return await e({dataset:t,config:r,addIssue:n=>le(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function Jv(e){return{kind:"transformation",type:"raw_transform",reference:Jv,async:!1,_run(t,r){const n=e({dataset:t,config:r,addIssue:i=>le(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function Yv(e){return{kind:"transformation",type:"raw_transform",reference:Yv,async:!0,async _run(t,r){const n=await e({dataset:t,config:r,addIssue:i=>le(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function Zv(){return{kind:"transformation",type:"readonly",reference:Zv,async:!1,_run(e){return e}}}function Qv(e,t){return{kind:"transformation",type:"reduce_items",reference:Qv,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function e1(e,t){return{kind:"validation",type:"regex",reference:e1,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"format",r,n),r}}}function t1(e){return{kind:"validation",type:"safe_integer",reference:t1,async:!1,expects:null,requirement:Number.isSafeInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"safe integer",t,r),t}}}function r1(e,t){return{kind:"validation",type:"size",reference:r1,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size!==this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function n1(e,t){return{kind:"validation",type:"some_item",reference:n1,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.some(this.requirement)&&le(this,"item",r,n),r}}}function i1(e){return{kind:"transformation",type:"sort_items",reference:i1,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function s1(e,t){return{kind:"validation",type:"starts_with",reference:s1,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.startsWith(this.requirement)&&le(this,"start",r,n,{received:`"${r.value.slice(0,this.requirement.length)}"`}),r}}}function o1(){return{kind:"transformation",type:"to_lower_case",reference:o1,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function a1(e){return{kind:"transformation",type:"to_max_value",reference:a1,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function c1(e){return{kind:"transformation",type:"to_min_value",reference:c1,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function u1(){return{kind:"transformation",type:"to_upper_case",reference:u1,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function l1(e){return{kind:"transformation",type:"transform",reference:l1,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function f1(e){return{kind:"transformation",type:"transform",reference:f1,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function d1(){return{kind:"transformation",type:"trim",reference:d1,async:!1,_run(e){return e.value=e.value.trim(),e}}}function h1(){return{kind:"transformation",type:"trim_end",reference:h1,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function p1(){return{kind:"transformation",type:"trim_start",reference:p1,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function m1(e){return{kind:"validation",type:"ulid",reference:m1,async:!1,expects:null,requirement:Bg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function g1(e){return{kind:"validation",type:"url",reference:g1,async:!1,expects:null,requirement(t){try{return new URL(t),!0}catch{return!1}},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"URL",t,r),t}}}function v1(e){return{kind:"validation",type:"uuid",reference:v1,async:!1,expects:null,requirement:Lg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function y1(e,t){return{kind:"validation",type:"value",reference:y1,async:!1,expects:e instanceof Date?e.toJSON():Rr(e),requirement:e,message:t,_run(r,n){return r.typed&&!(this.requirement<=r.value&&this.requirement>=r.value)&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function qC(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function Ea(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function WC(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:Ea(this,r,n)}:r}}}function GC(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await Ea(this,r,n)}:r}}}function HC(e){const t={};for(const r of e)if(r.path){const n=Vg(r);n?(t.nested||(t.nested={}),t.nested[n]?t.nested[n].push(r.message):t.nested[n]=[r.message]):t.other?t.other.push(r.message):t.other=[r.message]}else t.root?t.root.push(r.message):t.root=[r.message];return t}function KC(e,t){return{...e,_run(r,n){const i=r.issues&&[...r.issues];if(e._run(r,n),r.issues){for(const s of r.issues)if(!(i!=null&&i.includes(s))){let o=r.value;for(const a of t){const c=o[a],u={type:"unknown",origin:"value",input:o,key:a,value:c};if(s.path?s.path.push(u):s.path=[u],!c)break;o=c}}}return r}}}function XC(e,t){return{...e,async:!0,async _run(r,n){const i=r.issues&&[...r.issues];if(await e._run(r,n),r.issues){for(const s of r.issues)if(!(i!=null&&i.includes(s))){let o=r.value;for(const a of t){const c=o[a],u={type:"unknown",origin:"value",input:o,key:a,value:c};if(s.path?s.path.push(u):s.path=[u],!c)break;o=c}}}return r}}}function _i(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Df(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Df(e.entries[r]);return t}return"items"in e?e.items.map(Df):_i(e)}async function $f(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await $f(r)]))):"items"in e?Promise.all(e.items.map($f)):_i(e)}function Bf(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Bf(e.entries[r]);return t}return"items"in e?e.items.map(Bf):Ea(e)}async function Lf(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Lf(r)]))):"items"in e?Promise.all(e.items.map(Lf)):Ea(e)}function JC(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function b1(){return{kind:"schema",type:"any",reference:b1,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function w1(e,t){return{kind:"schema",type:"array",reference:w1,expects:"Array",async:!1,item:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<i.length;o++){const a=i[o],c=this.item._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else le(this,"type",r,n);return r}}}function _1(e,t){return{kind:"schema",type:"array",reference:_1,expects:"Array",async:!0,item:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(i.map(a=>this.item._run({typed:!1,value:a},n)));for(let a=0;a<o.length;a++){const c=o[a];if(c.issues){const u={type:"array",origin:"value",input:i,key:a,value:i[a]};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else le(this,"type",r,n);return r}}}function x1(e){return{kind:"schema",type:"bigint",reference:x1,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function S1(e){return{kind:"schema",type:"blob",reference:S1,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function E1(e){return{kind:"schema",type:"boolean",reference:E1,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function C1(e,t){return{kind:"schema",type:"custom",reference:C1,expects:"unknown",async:!1,check:e,message:t,_run(r,n){return this.check(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function T1(e,t){return{kind:"schema",type:"custom",reference:T1,expects:"unknown",async:!0,check:e,message:t,async _run(r,n){return await this.check(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function M1(e){return{kind:"schema",type:"date",reference:M1,expects:"Date",async:!1,message:e,_run(t,r){return t.value instanceof Date?isNaN(t.value)?le(this,"type",t,r,{received:'"Invalid Date"'}):t.typed=!0:le(this,"type",t,r),t}}}function Ff(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:Ff,expects:r.map(Rr).join(" | ")||"never",async:!1,enum:e,options:r,message:t,_run(n,i){return this.options.includes(n.value)?n.typed=!0:le(this,"type",n,i),n}}}function A1(e){return{kind:"schema",type:"file",reference:A1,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function Uf(e){return{kind:"schema",type:"function",reference:Uf,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function O1(e,t){return{kind:"schema",type:"instance",reference:O1,expects:e.name,async:!1,class:e,message:t,_run(r,n){return r.value instanceof this.class?r.typed=!0:le(this,"type",r,n),r}}}function Wc(e,t){if(typeof e==typeof t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{value:e};if(e&&t&&e.constructor===Object&&t.constructor===Object){for(const r in t)if(r in e){const n=Wc(e[r],t[r]);if(n.issue)return n;e[r]=n.value}else e[r]=t[r];return{value:e}}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let r=0;r<e.length;r++){const n=Wc(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function I1(e,t){return{kind:"schema",type:"intersect",reference:I1,expects:[...new Set(e.map(r=>r.expects))].join(" & ")||"never",async:!1,options:e,message:t,_run(r,n){if(this.options.length){const i=r.value;let s;r.typed=!0;for(const o of this.options){const a=o._run({typed:!1,value:i},n);if(a.issues&&(r.issues?r.issues.push(...a.issues):r.issues=a.issues,n.abortEarly)){r.typed=!1;break}a.typed||(r.typed=!1),r.typed&&(s?s.push(a.value):s=[a.value])}if(r.typed){r.value=s[0];for(let o=1;o<s.length;o++){const a=Wc(r.value,s[o]);if(a.issue){le(this,"type",r,n,{received:"unknown"});break}r.value=a.value}}}else le(this,"type",r,n);return r}}}function P1(e,t){return{kind:"schema",type:"intersect",reference:P1,expects:[...new Set(e.map(r=>r.expects))].join(" & ")||"never",async:!0,options:e,message:t,async _run(r,n){if(this.options.length){const i=r.value;let s;r.typed=!0;const o=await Promise.all(this.options.map(a=>a._run({typed:!1,value:i},n)));for(const a of o){if(a.issues&&(r.issues?r.issues.push(...a.issues):r.issues=a.issues,n.abortEarly)){r.typed=!1;break}a.typed||(r.typed=!1),r.typed&&(s?s.push(a.value):s=[a.value])}if(r.typed){r.value=s[0];for(let a=1;a<s.length;a++){const c=Wc(r.value,s[a]);if(c.issue){le(this,"type",r,n,{received:"unknown"});break}r.value=c.value}}}else le(this,"type",r,n);return r}}}function k1(e){return{kind:"schema",type:"lazy",reference:k1,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function j1(e){return{kind:"schema",type:"lazy",reference:j1,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function R1(e,t){return{kind:"schema",type:"literal",reference:R1,expects:Rr(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:le(this,"type",r,n),r}}}function N1(e,t){return{kind:"schema",type:"loose_object",reference:N1,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}if(!r.issues||!n.abortEarly)for(const o in i)Ts(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function D1(e,t){return{kind:"schema",type:"loose_object",reference:D1,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}if(!r.issues||!n.abortEarly)for(const a in i)Ts(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function $1(e,t){return{kind:"schema",type:"loose_tuple",reference:$1,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}if(!r.issues||!n.abortEarly)for(let o=this.items.length;o<i.length;o++)r.value.push(i[o])}else le(this,"type",r,n);return r}}}function B1(e,t){return{kind:"schema",type:"loose_tuple",reference:B1,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!r.issues||!n.abortEarly)for(let a=this.items.length;a<i.length;a++)r.value.push(i[a])}else le(this,"type",r,n);return r}}}function L1(e,t,r){return{kind:"schema",type:"map",reference:L1,expects:"Map",async:!1,key:e,value:t,message:r,_run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;for(const[c,u]of s){const l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"map",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path?y.path.unshift(h):y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"map",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),n.value.set(l.value,f.value)}}else le(this,"type",n,i);return n}}}function F1(e,t,r){return{kind:"schema",type:"map",reference:F1,expects:"Map",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;const c=await Promise.all([...s].map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"map",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"map",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),n.value.set(f.value,h.value)}}else le(this,"type",n,i);return n}}}function U1(e){return{kind:"schema",type:"nan",reference:U1,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function z1(e){return{kind:"schema",type:"never",reference:z1,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function V1(e,t){return{kind:"schema",type:"non_nullable",reference:V1,expects:"!null",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function q1(e,t){return{kind:"schema",type:"non_nullable",reference:q1,expects:"!null",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function W1(e,t){return{kind:"schema",type:"non_nullish",reference:W1,expects:"!null & !undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null||r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function G1(e,t){return{kind:"schema",type:"non_nullish",reference:G1,expects:"!null & !undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null||r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function zf(e,t){return{kind:"schema",type:"non_optional",reference:zf,expects:"!undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function Vf(e,t){return{kind:"schema",type:"non_optional",reference:Vf,expects:"!undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function qf(e){return{kind:"schema",type:"null",reference:qf,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:le(this,"type",t,r),t}}}function H1(e,...t){const r={kind:"schema",type:"nullable",reference:H1,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=_i(this,n,i)),n.value===null)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function K1(e,...t){const r={kind:"schema",type:"nullable",reference:K1,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await _i(this,n,i)),n.value===null)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function X1(e,...t){const r={kind:"schema",type:"nullish",reference:X1,expects:`${e.expects} | null | undefined`,async:!1,wrapped:e,_run(n,i){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=_i(this,n,i)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function J1(e,...t){const r={kind:"schema",type:"nullish",reference:J1,expects:`${e.expects} | null | undefined`,async:!0,wrapped:e,async _run(n,i){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=await _i(this,n,i)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Y1(e){return{kind:"schema",type:"number",reference:Y1,expects:"number",async:!1,message:e,_run(t,r){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function Z1(e,t){return{kind:"schema",type:"object",reference:Z1,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}}else le(this,"type",r,n);return r}}}function Q1(e,t){return{kind:"schema",type:"object",reference:Q1,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}}else le(this,"type",r,n);return r}}}function ey(e,t,r){return{kind:"schema",type:"object_with_rest",reference:ey,expects:"Object",async:!1,entries:e,rest:t,message:r,_run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(const c in this.entries){const u=s[c],l=this.entries[c]._run({typed:!1,value:u},i);if(l.issues){const f={type:"object",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),(l.value!==void 0||c in s)&&(n.value[c]=l.value)}if(!n.issues||!i.abortEarly){for(const c in s)if(Ts(s,c)&&!(c in this.entries)){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"object",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value[c]=l.value}}}else le(this,"type",n,i);return n}}}function ty(e,t,r){return{kind:"schema",type:"object_with_rest",reference:ty,expects:"Object",async:!0,entries:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};const[c,u]=await Promise.all([Promise.all(Object.entries(this.entries).map(async([l,f])=>{const h=s[l];return[l,h,await f._run({typed:!1,value:h},i)]})),Promise.all(Object.entries(s).filter(([l])=>Ts(s,l)&&!(l in this.entries)).map(async([l,f])=>[l,f,await this.rest._run({typed:!1,value:f},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),(h.value!==void 0||l in s)&&(n.value[l]=h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value[l]=h.value}}else le(this,"type",n,i);return n}}}function Wf(e,...t){const r={kind:"schema",type:"optional",reference:Wf,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=_i(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Gf(e,...t){const r={kind:"schema",type:"optional",reference:Gf,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await _i(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Hf(e,t){return{kind:"schema",type:"picklist",reference:Hf,expects:e.map(Rr).join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){return this.options.includes(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function ry(e){return{kind:"schema",type:"promise",reference:ry,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function ny(e,t,r){return{kind:"schema",type:"record",reference:ny,expects:"Object",async:!1,key:e,value:t,message:r,_run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(const c in s)if(Ts(s,c)){const u=s[c],l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"object",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"object",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),l.typed&&(n.value[l.value]=f.value)}}else le(this,"type",n,i);return n}}}function iy(e,t,r){return{kind:"schema",type:"record",reference:iy,expects:"Object",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};const c=await Promise.all(Object.entries(s).filter(([u])=>Ts(s,u)).map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"object",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"object",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),f.typed&&(n.value[f.value]=h.value)}}else le(this,"type",n,i);return n}}}function sy(e,t){return{kind:"schema",type:"set",reference:sy,expects:"Set",async:!1,value:e,message:t,_run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;for(const o of i){const a=this.value._run({typed:!1,value:o},n);if(a.issues){const c={type:"set",origin:"value",input:i,key:null,value:o};for(const u of a.issues)u.path?u.path.unshift(c):u.path=[c],(s=r.issues)==null||s.push(u);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}a.typed||(r.typed=!1),r.value.add(a.value)}}else le(this,"type",r,n);return r}}}function oy(e,t){return{kind:"schema",type:"set",reference:oy,expects:"Set",async:!0,value:e,message:t,async _run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;const o=await Promise.all([...i].map(async a=>[a,await this.value._run({typed:!1,value:a},n)]));for(const[a,c]of o){if(c.issues){const u={type:"set",origin:"value",input:i,key:null,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.add(c.value)}}else le(this,"type",r,n);return r}}}function ay(e,t){return{kind:"schema",type:"strict_object",reference:ay,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}if(!r.issues||!n.abortEarly){for(const o in i)if(!(o in this.entries)){const a=i[o];le(this,"type",r,n,{input:a,expected:"never",path:[{type:"object",origin:"value",input:i,key:o,value:a}]});break}}}else le(this,"type",r,n);return r}}}function cy(e,t){return{kind:"schema",type:"strict_object",reference:cy,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}if(!r.issues||!n.abortEarly){for(const a in i)if(!(a in this.entries)){const c=i[a];le(this,"type",r,n,{input:c,expected:"never",path:[{type:"object",origin:"value",input:i,key:a,value:c}]});break}}}else le(this,"type",r,n);return r}}}function uy(e,t){return{kind:"schema",type:"strict_tuple",reference:uy,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const o=i[e.length];le(this,"type",r,n,{input:o,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:o}]})}}else le(this,"type",r,n);return r}}}function ly(e,t){return{kind:"schema",type:"strict_tuple",reference:ly,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const a=i[e.length];le(this,"type",r,n,{input:a,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:a}]})}}else le(this,"type",r,n);return r}}}function fy(e){return{kind:"schema",type:"string",reference:fy,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function dy(e){return{kind:"schema",type:"symbol",reference:dy,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function hy(e,t){return{kind:"schema",type:"tuple",reference:hy,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else le(this,"type",r,n);return r}}}function py(e,t){return{kind:"schema",type:"tuple",reference:py,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}}else le(this,"type",r,n);return r}}}function my(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:my,expects:"Array",async:!1,items:e,rest:t,message:r,_run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let c=0;c<this.items.length;c++){const u=s[c],l=this.items[c]._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}if(!n.issues||!i.abortEarly)for(let c=this.items.length;c<s.length;c++){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else le(this,"type",n,i);return n}}}function gy(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:gy,expects:"Array",async:!0,items:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];const[c,u]=await Promise.all([Promise.all(this.items.map(async(l,f)=>{const h=s[f];return[f,h,await l._run({typed:!1,value:h},i)]})),Promise.all(s.slice(this.items.length).map(async(l,f)=>[f+this.items.length,l,await this.rest._run({typed:!1,value:l},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}}else le(this,"type",n,i);return n}}}function Kf(e){return{kind:"schema",type:"undefined",reference:Kf,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function Gc(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function vy(e,t){return{kind:"schema",type:"union",reference:vy,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){let i,s,o;for(const a of this.options){const c=a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Gc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Gc(o)})}return r}}}function yy(e,t){return{kind:"schema",type:"union",reference:yy,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!0,options:e,message:t,async _run(r,n){let i,s,o;for(const a of this.options){const c=await a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Gc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Gc(o)})}return r}}}function by(){return{kind:"schema",type:"unknown",reference:by,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function Xf(e,t,r=new Set){for(const n of t)n.type==="variant"?Xf(e,n.options,r):r.add(n.entries[e].expects);return r}function wy(e,t,r){let n;return{kind:"schema",type:"variant",reference:wy,expects:"Object",async:!1,key:e,options:t,message:r,_run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!u.entries[this.key]._run({typed:!1,value:a},s).issues){const l=u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...Xf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function _y(e,t,r){let n;return{kind:"schema",type:"variant",reference:_y,expects:"Object",async:!0,key:e,options:t,message:r,async _run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!(await u.entries[this.key]._run({typed:!1,value:a},s)).issues){const l=await u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...Xf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function Jf(e){return{kind:"schema",type:"void",reference:Jf,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function YC(e,t){return Hf(Object.keys(e.entries),t)}function ZC(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function xy(e,t,r){const n=e._run({typed:!1,value:t},Sa(r));if(n.issues)throw new qc(n.issues);return n.value}async function Sy(e,t,r){const n=await e._run({typed:!1,value:t},Sa(r));if(n.issues)throw new qc(n.issues);return n.value}function QC(e,t){const r=n=>xy(e,n,t);return r.schema=e,r.config=t,r}function eT(e,t){const r=n=>Sy(e,n,t);return r.schema=e,r.config=t,r}function tT(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Wf(e.entries[n]):e.entries[n];return{...e,entries:r}}function rT(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Gf(e.entries[n]):e.entries[n];return{...e,entries:r}}function nT(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function iT(...e){return{...e[0],pipe:e,_run(t,r){for(let n=0;n<e.length;n++){if(t.issues&&(e[n].kind==="schema"||e[n].kind==="transformation")){t.typed=!1;break}(!t.issues||!r.abortEarly&&!r.abortPipeEarly)&&(t=e[n]._run(t,r))}return t}}}function sT(...e){return{...e[0],pipe:e,async:!0,async _run(t,r){for(let n=0;n<e.length;n++){if(t.issues&&(e[n].kind==="schema"||e[n].kind==="transformation")){t.typed=!1;break}(!t.issues||!r.abortEarly&&!r.abortPipeEarly)&&(t=await e[n]._run(t,r))}return t}}}function oT(e,t,r){const n=Array.isArray(t)?t:void 0,i=Array.isArray(t)?r:t,s={};for(const o in e.entries)s[o]=!n||n.includes(o)?zf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function aT(e,t,r){const n=Array.isArray(t)?t:void 0,i=Array.isArray(t)?r:t,s={};for(const o in e.entries)s[o]=!n||n.includes(o)?Vf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function Ey(e,t,r){const n=e._run({typed:!1,value:t},Sa(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function Cy(e,t,r){const n=await e._run({typed:!1,value:t},Sa(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function cT(e,t){const r=n=>Ey(e,n,t);return r.schema=e,r.config=t,r}function uT(e,t){const r=n=>Cy(e,n,t);return r.schema=e,r.config=t,r}function lT(e){return e.wrapped}const fT=Symbol.for("@mysten/transaction");function dT(e){return!!e&&typeof e=="object"&&e[fT]===!0}const Ty=Symbol.for("@mysten/SuiClient");function hT(e){return typeof e=="object"&&e!==null&&e[Ty]===!0}class Ca{get[Ty](){return!0}constructor(t){this.transport=t.transport??new pm({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!gi(Lr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[t.owner,t.coinType,t.cursor,t.limit]})}async getAllCoins(t){if(!t.owner||!gi(Lr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[t.owner,t.cursor,t.limit]})}async getBalance(t){if(!t.owner||!gi(Lr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[t.owner,t.coinType]})}async getAllBalances(t){if(!t.owner||!gi(Lr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[t.owner]})}async getCoinMetadata(t){return await this.transport.request({method:"suix_getCoinMetadata",params:[t.coinType]})}async getTotalSupply(t){return await this.transport.request({method:"suix_getTotalSupply",params:[t.coinType]})}async call(t,r){return await this.transport.request({method:t,params:r})}async getMoveFunctionArgTypes(t){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[t.package,t.module,t.function]})}async getNormalizedMoveModulesByPackage(t){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[t.package]})}async getNormalizedMoveModule(t){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[t.package,t.module]})}async getNormalizedMoveFunction(t){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[t.package,t.module,t.function]})}async getNormalizedMoveStruct(t){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[t.package,t.module,t.struct]})}async getOwnedObjects(t){if(!t.owner||!gi(Lr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[t.owner,{filter:t.filter,options:t.options},t.cursor,t.limit]})}async getObject(t){if(!t.id||!_a(vi(t.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[t.id,t.options]})}async tryGetPastObject(t){return await this.transport.request({method:"sui_tryGetPastObject",params:[t.id,t.version,t.options]})}async multiGetObjects(t){if(t.ids.forEach(n=>{if(!n||!_a(vi(n)))throw new Error(`Invalid Sui Object id ${n}`)}),t.ids.length!==new Set(t.ids).size)throw new Error(`Duplicate object ids in batch call ${t.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[t.ids,t.options]})}async queryTransactionBlocks(t){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:t.filter,options:t.options},t.cursor,t.limit,(t.order||"descending")==="descending"]})}async getTransactionBlock(t){if(!Cf(t.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[t.digest,t.options]})}async multiGetTransactionBlocks(t){if(t.digests.forEach(n=>{if(!Cf(n))throw new Error(`Invalid Transaction digest ${n}`)}),t.digests.length!==new Set(t.digests).size)throw new Error(`Duplicate digests in batch call ${t.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[t.digests,t.options]})}async executeTransactionBlock({transactionBlock:t,signature:r,options:n,requestType:i}){const s=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof t=="string"?t:Gr(t),Array.isArray(r)?r:[r],n]});if(i==="WaitForLocalExecution")try{await this.waitForTransaction({digest:s.digest})}catch{}return s}async signAndExecuteTransaction({transaction:t,signer:r,...n}){let i;t instanceof Uint8Array?i=t:(t.setSenderIfNotSet(r.toSuiAddress()),i=await t.build({client:this}));const{signature:s,bytes:o}=await r.signTransaction(i);return this.executeTransactionBlock({transactionBlock:o,signature:s,...n})}async getTotalTransactionBlocks(){const t=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(t)}async getReferenceGasPrice(){const t=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(t)}async getStakes(t){if(!t.owner||!gi(Lr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[t.owner]})}async getStakesByIds(t){return t.stakedSuiIds.forEach(r=>{if(!r||!_a(vi(r)))throw new Error(`Invalid Sui Stake id ${r}`)}),await this.transport.request({method:"suix_getStakesByIds",params:[t.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(t){return await this.transport.request({method:"suix_queryEvents",params:[t.query,t.cursor,t.limit,(t.order||"descending")==="descending"]})}async subscribeEvent(t){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[t.filter],onMessage:t.onMessage})}async subscribeTransaction(t){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[t.filter],onMessage:t.onMessage})}async devInspectTransactionBlock(t){var n;let r;if(dT(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=Gr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=Gr(t.transactionBlock);else throw new Error("Unknown transaction block format.");return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[t.sender,r,(n=t.gasPrice)==null?void 0:n.toString(),t.epoch]})}async dryRunTransactionBlock(t){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:[typeof t.transactionBlock=="string"?t.transactionBlock:Gr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!_a(vi(t.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[t.parentId,t.cursor,t.limit]})}async getDynamicFieldObject(t){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[t.parentId,t.name]})}async getLatestCheckpointSequenceNumber(){const t=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(t)}async getCheckpoint(t){return await this.transport.request({method:"sui_getCheckpoint",params:[t.id]})}async getCheckpoints(t){return await this.transport.request({method:"sui_getCheckpoints",params:[t.cursor,t==null?void 0:t.limit,t.descendingOrder]})}async getCommitteeInfo(t){return await this.transport.request({method:"suix_getCommitteeInfo",params:[t==null?void 0:t.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(t){return await this.transport.request({method:"suix_getEpochMetrics",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getAllEpochAddressMetrics(t){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[t==null?void 0:t.descendingOrder]})}async getEpochs(t){return await this.transport.request({method:"suix_getEpochs",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){const t=await this.getCheckpoint({id:"0"}),r=pi(t.digest);return mi(r.slice(0,4))}async resolveNameServiceAddress(t){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[t.name]})}async resolveNameServiceNames({format:t="dot",...r}){const{nextCursor:n,hasNextPage:i,data:s}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[r.address,r.cursor,r.limit]});return{hasNextPage:i,nextCursor:n,data:s.map(o=>sg(o,t))}}async getProtocolConfig(t){return await this.transport.request({method:"sui_getProtocolConfig",params:[t==null?void 0:t.version]})}async waitForTransaction({signal:t,timeout:r=60*1e3,pollInterval:n=2*1e3,...i}){const s=AbortSignal.timeout(r),o=new Promise((a,c)=>{s.addEventListener("abort",()=>c(s.reason))});for(o.catch(()=>{});!s.aborted;){t==null||t.throwIfAborted();try{return await this.getTransactionBlock(i)}catch{await Promise.race([new Promise(c=>setTimeout(c,n)),o])}}throw s.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}}const pT=Rc(Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:pf,SuiClient:Ca,SuiHTTPStatusError:am,SuiHTTPTransport:pm,SuiHTTPTransportError:hf,getFullnodeUrl:mm,isSuiClient:hT},Symbol.toStringTag,{value:"Module"}))),My=Rc(wC),Er=Rc(lE);var Yf=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,gT=Object.getOwnPropertyNames,vT=Object.prototype.hasOwnProperty,yT=(e,t)=>{for(var r in t)Yf(e,r,{get:t[r],enumerable:!0})},bT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gT(t))!vT.call(e,i)&&i!==r&&Yf(e,i,{get:()=>t[i],enumerable:!(n=mT(t,i))||n.enumerable});return e},wT=e=>bT(Yf({},"__esModule",{value:!0}),e),Ay={};yT(Ay,{SUI_ADDRESS_LENGTH:()=>Zf,isValidSuiAddress:()=>Iy,isValidSuiObjectId:()=>ST,isValidTransactionDigest:()=>xT,normalizeStructTag:()=>Py,normalizeSuiAddress:()=>ed,normalizeSuiObjectId:()=>CT,parseStructTag:()=>Qf});var Hr=wT(Ay),Oy=Er;const _T=32;function xT(e){try{return(0,Oy.fromBase58)(e).length===_T}catch{return!1}}const Zf=32;function Iy(e){return TT(e)&&MT(e)===Zf}function ST(e){return Iy(e)}function ET(e){return e.includes("::")?Qf(e):e}function Qf(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,s=n.includes("<")?(0,Oy.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>ET(o.trim())):[];return{address:ed(t),module:r,name:i,typeParams:s}}function Py(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Qf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Py(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function ed(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Zf*2,"0")}`}function CT(e,t=!1){return ed(e,t)}function TT(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function MT(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var td=Object.defineProperty,AT=Object.getOwnPropertyDescriptor,OT=Object.getOwnPropertyNames,IT=Object.prototype.hasOwnProperty,PT=(e,t)=>{for(var r in t)td(e,r,{get:t[r],enumerable:!0})},kT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OT(t))!IT.call(e,i)&&i!==r&&td(e,i,{get:()=>t[i],enumerable:!(n=AT(t,i))||n.enumerable});return e},jT=e=>kT(td({},"__esModule",{value:!0}),e),ky={};PT(ky,{TypeTagSerializer:()=>Ms});var jy=jT(ky),RT=Er,NT=Hr;const DT=/^vector<(.+)>$/,$T=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Ms{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(DT);if(n)return{vector:Ms.parseFromStr(n[1],r)};const i=t.match($T);if(i)return{struct:{address:r?(0,NT.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Ms.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,RT.splitGenericParameters)(t).map(n=>Ms.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${Ms.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Ms.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var rd=Object.defineProperty,BT=Object.getOwnPropertyDescriptor,LT=Object.getOwnPropertyNames,FT=Object.prototype.hasOwnProperty,UT=(e,t)=>{for(var r in t)rd(e,r,{get:t[r],enumerable:!0})},zT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LT(t))!FT.call(e,i)&&i!==r&&rd(e,i,{get:()=>t[i],enumerable:!(n=BT(t,i))||n.enumerable});return e},VT=e=>zT(rd({},"__esModule",{value:!0}),e),Ry={};UT(Ry,{Address:()=>qn,AppId:()=>Zy,Argument:()=>Wn,CallArg:()=>Fy,Command:()=>zy,CompressedSignature:()=>tb,GasData:()=>Hy,Intent:()=>Qy,IntentMessage:()=>eb,IntentScope:()=>Jy,IntentVersion:()=>Yy,MultiSig:()=>GT,MultiSigPkMap:()=>nb,MultiSigPublicKey:()=>ib,ObjectArg:()=>Ly,ObjectDigest:()=>$y,PasskeyAuthenticator:()=>KT,ProgrammableMoveCall:()=>Uy,ProgrammableTransaction:()=>Vy,PublicKey:()=>rb,SenderSignedData:()=>HT,SenderSignedTransaction:()=>ob,SharedObjectRef:()=>By,StructTag:()=>Gy,SuiObjectRef:()=>Hc,TransactionData:()=>Xy,TransactionDataV1:()=>Ky,TransactionExpiration:()=>Wy,TransactionKind:()=>qy,TypeTag:()=>id,base64String:()=>sb});var Ny=VT(Ry),de=Er,Ta=Hr,Dy=jy;function qT(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function WT(e){return de.bcs.enum("Option",{None:null,Some:e})}const qn=de.bcs.bytes(Ta.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,Ta.isValidSuiAddress)((0,Ta.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,Ta.normalizeSuiAddress)(e)):e,output:e=>(0,Ta.normalizeSuiAddress)((0,de.toHex)(e))}),$y=de.bcs.vector(de.bcs.u8()).transform({name:"ObjectDigest",input:e=>(0,de.fromBase58)(e),output:e=>(0,de.toBase58)(new Uint8Array(e)),validate:e=>{if((0,de.fromBase58)(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Hc=de.bcs.struct("SuiObjectRef",{objectId:qn,version:de.bcs.u64(),digest:$y}),By=de.bcs.struct("SharedObjectRef",{objectId:qn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),Ly=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:Hc,SharedObject:By,Receiving:Hc}),Fy=de.bcs.enum("CallArg",{Pure:de.bcs.struct("Pure",{bytes:de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})}),Object:Ly}),nd=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>nd),struct:de.bcs.lazy(()=>Gy),u16:null,u32:null,u256:null}),id=nd.transform({input:e=>typeof e=="string"?Dy.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>Dy.TypeTagSerializer.tagToString(e)}),Wn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),Uy=de.bcs.struct("ProgrammableMoveCall",{package:qn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(id),arguments:de.bcs.vector(Wn)}),zy=de.bcs.enum("Command",{MoveCall:Uy,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Wn),address:Wn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Wn,amounts:de.bcs.vector(Wn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Wn,sources:de.bcs.vector(Wn)}),Publish:de.bcs.struct("Publish",{modules:de.bcs.vector(de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})),dependencies:de.bcs.vector(qn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:WT(id).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Wn)}),Upgrade:de.bcs.struct("Upgrade",{modules:de.bcs.vector(de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})),dependencies:de.bcs.vector(qn),package:qn,ticket:Wn})}),Vy=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(Fy),commands:de.bcs.vector(zy)}),qy=de.bcs.enum("TransactionKind",{ProgrammableTransaction:Vy,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Wy=de.bcs.enum("TransactionExpiration",{None:null,Epoch:qT()}),Gy=de.bcs.struct("StructTag",{address:qn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(nd)}),Hy=de.bcs.struct("GasData",{payment:de.bcs.vector(Hc),owner:qn,price:de.bcs.u64(),budget:de.bcs.u64()}),Ky=de.bcs.struct("TransactionDataV1",{kind:qy,sender:qn,gasData:Hy,expiration:Wy}),Xy=de.bcs.enum("TransactionData",{V1:Ky}),Jy=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Yy=de.bcs.enum("IntentVersion",{V0:null}),Zy=de.bcs.enum("AppId",{Sui:null}),Qy=de.bcs.struct("Intent",{scope:Jy,version:Yy,appId:Zy});function eb(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:Qy,value:e})}const tb=de.bcs.enum("CompressedSignature",{ED25519:de.bcs.fixedArray(64,de.bcs.u8()),Secp256k1:de.bcs.fixedArray(64,de.bcs.u8()),Secp256r1:de.bcs.fixedArray(64,de.bcs.u8()),ZkLogin:de.bcs.vector(de.bcs.u8())}),rb=de.bcs.enum("PublicKey",{ED25519:de.bcs.fixedArray(32,de.bcs.u8()),Secp256k1:de.bcs.fixedArray(33,de.bcs.u8()),Secp256r1:de.bcs.fixedArray(33,de.bcs.u8()),ZkLogin:de.bcs.vector(de.bcs.u8())}),nb=de.bcs.struct("MultiSigPkMap",{pubKey:rb,weight:de.bcs.u8()}),ib=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector(nb),threshold:de.bcs.u16()}),GT=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(tb),bitmap:de.bcs.u16(),multisig_pk:ib}),sb=de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))}),ob=de.bcs.struct("SenderSignedTransaction",{intentMessage:eb(Xy),txSignatures:de.bcs.vector(sb)}),HT=de.bcs.vector(ob,{name:"SenderSignedData"}),KT=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var sd=Object.defineProperty,XT=Object.getOwnPropertyDescriptor,JT=Object.getOwnPropertyNames,YT=Object.prototype.hasOwnProperty,ZT=(e,t)=>{for(var r in t)sd(e,r,{get:t[r],enumerable:!0})},QT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JT(t))!YT.call(e,i)&&i!==r&&sd(e,i,{get:()=>t[i],enumerable:!(n=XT(t,i))||n.enumerable});return e},eM=e=>QT(sd({},"__esModule",{value:!0}),e),ab={};ZT(ab,{TransactionEffects:()=>pM});var tM=eM(ab),ve=Er,Nt=Ny;const rM=ve.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ve.bcs.struct("UnableToFetchPackage",{packageId:Nt.Address}),NotAPackage:ve.bcs.struct("NotAPackage",{objectId:Nt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:ve.bcs.struct("DigestDoesNotMatch",{digest:ve.bcs.vector(ve.bcs.u8())}),UnknownUpgradePolicy:ve.bcs.struct("UnknownUpgradePolicy",{policy:ve.bcs.u8()}),PackageIDDoesNotMatch:ve.bcs.struct("PackageIDDoesNotMatch",{packageId:Nt.Address,ticketId:Nt.Address})}),nM=ve.bcs.struct("ModuleId",{address:Nt.Address,name:ve.bcs.string()}),cb=ve.bcs.struct("MoveLocation",{module:nM,function:ve.bcs.u16(),instruction:ve.bcs.u16(),functionName:ve.bcs.option(ve.bcs.string())}),iM=ve.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:ve.bcs.struct("IndexOutOfBounds",{idx:ve.bcs.u16()}),SecondaryIndexOutOfBounds:ve.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidResultArity:ve.bcs.struct("InvalidResultArity",{resultIdx:ve.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),sM=ve.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),oM=ve.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:ve.bcs.struct("MoveObjectTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),MovePackageTooBig:ve.bcs.struct("MovePackageTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),CircularObjectOwnership:ve.bcs.struct("CircularObjectOwnership",{object:Nt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ve.bcs.option(cb),MoveAbort:ve.bcs.tuple([cb,ve.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:ve.bcs.struct("CommandArgumentError",{argIdx:ve.bcs.u16(),kind:iM}),TypeArgumentError:ve.bcs.struct("TypeArgumentError",{argumentIdx:ve.bcs.u16(),kind:sM}),UnusedValueWithoutDrop:ve.bcs.struct("UnusedValueWithoutDrop",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidPublicFunctionReturnType:ve.bcs.struct("InvalidPublicFunctionReturnType",{idx:ve.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:ve.bcs.struct("EffectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:ve.bcs.struct("PackageUpgradeError",{upgradeError:rM}),WrittenObjectsTooLarge:ve.bcs.struct("WrittenObjectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:ve.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:ve.bcs.vector(Nt.Address)}),AddressDeniedForCoin:ve.bcs.struct("AddressDeniedForCoin",{address:Nt.Address,coinType:ve.bcs.string()}),CoinTypeGlobalPause:ve.bcs.struct("CoinTypeGlobalPause",{coinType:ve.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),ub=ve.bcs.enum("ExecutionStatus",{Success:null,Failed:ve.bcs.struct("ExecutionFailed",{error:oM,command:ve.bcs.option(ve.bcs.u64())})}),lb=ve.bcs.struct("GasCostSummary",{computationCost:ve.bcs.u64(),storageCost:ve.bcs.u64(),storageRebate:ve.bcs.u64(),nonRefundableStorageFee:ve.bcs.u64()}),po=ve.bcs.enum("Owner",{AddressOwner:Nt.Address,ObjectOwner:Nt.Address,Shared:ve.bcs.struct("Shared",{initialSharedVersion:ve.bcs.u64()}),Immutable:null}),aM=ve.bcs.struct("TransactionEffectsV1",{status:ub,executedEpoch:ve.bcs.u64(),gasUsed:lb,modifiedAtVersions:ve.bcs.vector(ve.bcs.tuple([Nt.Address,ve.bcs.u64()])),sharedObjects:ve.bcs.vector(Nt.SuiObjectRef),transactionDigest:Nt.ObjectDigest,created:ve.bcs.vector(ve.bcs.tuple([Nt.SuiObjectRef,po])),mutated:ve.bcs.vector(ve.bcs.tuple([Nt.SuiObjectRef,po])),unwrapped:ve.bcs.vector(ve.bcs.tuple([Nt.SuiObjectRef,po])),deleted:ve.bcs.vector(Nt.SuiObjectRef),unwrappedThenDeleted:ve.bcs.vector(Nt.SuiObjectRef),wrapped:ve.bcs.vector(Nt.SuiObjectRef),gasObject:ve.bcs.tuple([Nt.SuiObjectRef,po]),eventsDigest:ve.bcs.option(Nt.ObjectDigest),dependencies:ve.bcs.vector(Nt.ObjectDigest)}),od=ve.bcs.tuple([ve.bcs.u64(),Nt.ObjectDigest]),cM=ve.bcs.enum("ObjectIn",{NotExist:null,Exist:ve.bcs.tuple([od,po])}),uM=ve.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ve.bcs.tuple([Nt.ObjectDigest,po]),PackageWrite:od}),lM=ve.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),fM=ve.bcs.struct("EffectsObjectChange",{inputState:cM,outputState:uM,idOperation:lM}),dM=ve.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:od,MutateDeleted:ve.bcs.u64(),ReadDeleted:ve.bcs.u64(),Cancelled:ve.bcs.u64(),PerEpochConfig:null}),hM=ve.bcs.struct("TransactionEffectsV2",{status:ub,executedEpoch:ve.bcs.u64(),gasUsed:lb,transactionDigest:Nt.ObjectDigest,gasObjectIndex:ve.bcs.option(ve.bcs.u32()),eventsDigest:ve.bcs.option(Nt.ObjectDigest),dependencies:ve.bcs.vector(Nt.ObjectDigest),lamportVersion:ve.bcs.u64(),changedObjects:ve.bcs.vector(ve.bcs.tuple([Nt.Address,fM])),unchangedSharedObjects:ve.bcs.vector(ve.bcs.tuple([Nt.Address,dM])),auxDataDigest:ve.bcs.option(Nt.ObjectDigest)}),pM=ve.bcs.enum("TransactionEffects",{V1:aM,V2:hM});var ad=Object.defineProperty,mM=Object.getOwnPropertyDescriptor,gM=Object.getOwnPropertyNames,vM=Object.prototype.hasOwnProperty,yM=(e,t)=>{for(var r in t)ad(e,r,{get:t[r],enumerable:!0})},bM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gM(t))!vM.call(e,i)&&i!==r&&ad(e,i,{get:()=>t[i],enumerable:!(n=mM(t,i))||n.enumerable});return e},wM=e=>bM(ad({},"__esModule",{value:!0}),e),fb={};yM(fb,{BcsType:()=>SM.BcsType,TypeTagSerializer:()=>xM.TypeTagSerializer,bcs:()=>EM});var Gn=wM(fb),Hn=Er,Dt=Ny,_M=tM,xM=jy,SM=Er;const EM={...Hn.bcs,U8:Hn.bcs.u8(),U16:Hn.bcs.u16(),U32:Hn.bcs.u32(),U64:Hn.bcs.u64(),U128:Hn.bcs.u128(),U256:Hn.bcs.u256(),ULEB128:Hn.bcs.uleb128(),Bool:Hn.bcs.bool(),String:Hn.bcs.string(),Address:Dt.Address,AppId:Dt.AppId,Argument:Dt.Argument,CallArg:Dt.CallArg,CompressedSignature:Dt.CompressedSignature,GasData:Dt.GasData,Intent:Dt.Intent,IntentMessage:Dt.IntentMessage,IntentScope:Dt.IntentScope,IntentVersion:Dt.IntentVersion,MultiSig:Dt.MultiSig,MultiSigPkMap:Dt.MultiSigPkMap,MultiSigPublicKey:Dt.MultiSigPublicKey,ObjectArg:Dt.ObjectArg,ObjectDigest:Dt.ObjectDigest,ProgrammableMoveCall:Dt.ProgrammableMoveCall,ProgrammableTransaction:Dt.ProgrammableTransaction,PublicKey:Dt.PublicKey,SenderSignedData:Dt.SenderSignedData,SenderSignedTransaction:Dt.SenderSignedTransaction,SharedObjectRef:Dt.SharedObjectRef,StructTag:Dt.StructTag,SuiObjectRef:Dt.SuiObjectRef,Command:Dt.Command,TransactionData:Dt.TransactionData,TransactionDataV1:Dt.TransactionDataV1,TransactionExpiration:Dt.TransactionExpiration,TransactionKind:Dt.TransactionKind,TypeTag:Dt.TypeTag,TransactionEffects:_M.TransactionEffects,PasskeyAuthenticator:Dt.PasskeyAuthenticator};var cd=Object.defineProperty,CM=Object.getOwnPropertyDescriptor,TM=Object.getOwnPropertyNames,MM=Object.prototype.hasOwnProperty,AM=(e,t)=>{for(var r in t)cd(e,r,{get:t[r],enumerable:!0})},OM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of TM(t))!MM.call(e,i)&&i!==r&&cd(e,i,{get:()=>t[i],enumerable:!(n=CM(t,i))||n.enumerable});return e},IM=e=>OM(cd({},"__esModule",{value:!0}),e),db={};AM(db,{formatAddress:()=>kM,formatDigest:()=>jM});var PM=IM(db);const hb="…";function kM(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${hb}${e.slice(-4)}`}function jM(e){return`${e.slice(0,10)}${hb}`}var ud=Object.defineProperty,RM=Object.getOwnPropertyDescriptor,NM=Object.getOwnPropertyNames,DM=Object.prototype.hasOwnProperty,$M=(e,t)=>{for(var r in t)ud(e,r,{get:t[r],enumerable:!0})},BM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NM(t))!DM.call(e,i)&&i!==r&&ud(e,i,{get:()=>t[i],enumerable:!(n=RM(t,i))||n.enumerable});return e},LM=e=>BM(ud({},"__esModule",{value:!0}),e),pb={};$M(pb,{isValidSuiNSName:()=>UM,normalizeSuiNSName:()=>zM});var mb=LM(pb);const gb=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,vb=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,FM=235;function UM(e){return e.length>FM?!1:e.includes("@")?gb.test(e):vb.test(e)}function zM(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!gb.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!vb.test(r))throw new Error(`Invalid SuiNS name ${e}`);n=r.split(".").slice(0,-1)}return t==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}var ld=Object.defineProperty,VM=Object.getOwnPropertyDescriptor,qM=Object.getOwnPropertyNames,WM=Object.prototype.hasOwnProperty,GM=(e,t)=>{for(var r in t)ld(e,r,{get:t[r],enumerable:!0})},HM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qM(t))!WM.call(e,i)&&i!==r&&ld(e,i,{get:()=>t[i],enumerable:!(n=VM(t,i))||n.enumerable});return e},KM=e=>HM(ld({},"__esModule",{value:!0}),e),yb={};GM(yb,{MIST_PER_SUI:()=>YM,MOVE_STDLIB_ADDRESS:()=>ZM,SUI_CLOCK_OBJECT_ID:()=>eA,SUI_DECIMALS:()=>JM,SUI_FRAMEWORK_ADDRESS:()=>wb,SUI_SYSTEM_ADDRESS:()=>QM,SUI_SYSTEM_MODULE_NAME:()=>tA,SUI_SYSTEM_STATE_OBJECT_ID:()=>nA,SUI_TYPE_ARG:()=>rA});var XM=KM(yb),bb=Hr;const JM=9,YM=BigInt(1e9),ZM="0x1",wb="0x2",QM="0x3",eA=(0,bb.normalizeSuiObjectId)("0x6"),tA="sui_system",rA=`${wb}::sui::SUI`,nA=(0,bb.normalizeSuiObjectId)("0x5");var fd=Object.defineProperty,iA=Object.getOwnPropertyDescriptor,sA=Object.getOwnPropertyNames,oA=Object.prototype.hasOwnProperty,aA=(e,t)=>{for(var r in t)fd(e,r,{get:t[r],enumerable:!0})},cA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sA(t))!oA.call(e,i)&&i!==r&&fd(e,i,{get:()=>t[i],enumerable:!(n=iA(t,i))||n.enumerable});return e},uA=e=>cA(fd({},"__esModule",{value:!0}),e),_b={};aA(_b,{isValidNamedPackage:()=>Eb,isValidNamedType:()=>pA});var xb=uA(_b),lA=mb;const fA=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,dA=/^\d+$/,hA=64,Sb="/",Eb=e=>{const t=e.split(Sb);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!dA.test(i)||!(0,lA.isValidSuiNSName)(r)?!1:fA.test(n)&&n.length<hA},pA=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Sb)&&!Eb(r))return!1;return!0},Cb=Rc(yC);var dd=Object.defineProperty,mA=Object.getOwnPropertyDescriptor,gA=Object.getOwnPropertyNames,vA=Object.prototype.hasOwnProperty,yA=(e,t)=>{for(var r in t)dd(e,r,{get:t[r],enumerable:!0})},bA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gA(t))!vA.call(e,i)&&i!==r&&dd(e,i,{get:()=>t[i],enumerable:!(n=mA(t,i))||n.enumerable});return e},wA=e=>bA(dd({},"__esModule",{value:!0}),e),Tb={};yA(Tb,{deriveDynamicFieldID:()=>EA});var _A=wA(Tb),xA=Er,SA=Cb,hd=Gn;function EA(e,t,r){const n=hd.bcs.Address.serialize(e).toBytes(),i=hd.bcs.TypeTag.serialize(t).toBytes(),s=hd.bcs.u64().serialize(r.length).toBytes(),o=SA.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,xA.toHex)(o.digest().slice(0,32))}`}var pd=Object.defineProperty,CA=Object.getOwnPropertyDescriptor,TA=Object.getOwnPropertyNames,MA=Object.prototype.hasOwnProperty,AA=(e,t)=>{for(var r in t)pd(e,r,{get:t[r],enumerable:!0})},OA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of TA(t))!MA.call(e,i)&&i!==r&&pd(e,i,{get:()=>t[i],enumerable:!(n=CA(t,i))||n.enumerable});return e},IA=e=>OA(pd({},"__esModule",{value:!0}),e),Mb={};AA(Mb,{MIST_PER_SUI:()=>xi.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>xi.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Hi.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>xi.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>xi.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>xi.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>xi.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>xi.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>xi.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>xi.SUI_TYPE_ARG,deriveDynamicFieldID:()=>PA.deriveDynamicFieldID,formatAddress:()=>Ob.formatAddress,formatDigest:()=>Ob.formatDigest,fromB64:()=>Kn.fromB64,fromBase58:()=>Kn.fromBase58,fromBase64:()=>Kn.fromBase64,fromHEX:()=>Kn.fromHEX,fromHex:()=>Kn.fromHex,isValidNamedPackage:()=>Pb.isValidNamedPackage,isValidNamedType:()=>Pb.isValidNamedType,isValidSuiAddress:()=>Hi.isValidSuiAddress,isValidSuiNSName:()=>Ib.isValidSuiNSName,isValidSuiObjectId:()=>Hi.isValidSuiObjectId,isValidTransactionDigest:()=>Hi.isValidTransactionDigest,normalizeStructTag:()=>Hi.normalizeStructTag,normalizeSuiAddress:()=>Hi.normalizeSuiAddress,normalizeSuiNSName:()=>Ib.normalizeSuiNSName,normalizeSuiObjectId:()=>Hi.normalizeSuiObjectId,parseStructTag:()=>Hi.parseStructTag,toB64:()=>Kn.toB64,toBase58:()=>Kn.toBase58,toBase64:()=>Kn.toBase64,toHEX:()=>Kn.toHEX,toHex:()=>Kn.toHex});var Ab=IA(Mb),Ob=PM,Hi=Hr,Kn=Er,Ib=mb,xi=XM,Pb=xb,PA=_A,md=Object.defineProperty,kA=Object.getOwnPropertyDescriptor,jA=Object.getOwnPropertyNames,RA=Object.prototype.hasOwnProperty,NA=(e,t)=>{for(var r in t)md(e,r,{get:t[r],enumerable:!0})},DA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jA(t))!RA.call(e,i)&&i!==r&&md(e,i,{get:()=>t[i],enumerable:!(n=kA(t,i))||n.enumerable});return e},$A=e=>DA(md({},"__esModule",{value:!0}),e),kb={};NA(kb,{getPureBcsSchema:()=>gd,isTxContext:()=>GA,normalizedTypeToMoveTypeSignature:()=>HA,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>Nb});var jb=$A(kb),Zt=Gn,Rb=Ab,Ma=Hr;const BA="object",LA="ID",FA="ascii",UA="String",zA="string",VA="String",qA="option",WA="Option";function GA(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Ma.normalizeSuiAddress)(t.package)===(0,Ma.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function gd(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Zt.bcs.vector(Zt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=gd(e.vector);return t?Zt.bcs.vector(t):null}if("datatype"in e){const t=(0,Ma.normalizeSuiAddress)(e.datatype.package);if(t===(0,Ma.normalizeSuiAddress)(Rb.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===FA&&e.datatype.type===UA||e.datatype.module===zA&&e.datatype.type===VA)return Zt.bcs.String;if(e.datatype.module===qA&&e.datatype.type===WA){const r=gd(e.datatype.typeParameters[0]);return r?Zt.bcs.vector(r):null}}if(t===(0,Ma.normalizeSuiAddress)(Rb.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===BA&&e.datatype.type===LA)return Zt.bcs.Address}return null}function HA(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Aa(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Aa(e.MutableReference)}:{ref:null,body:Aa(e)}}function Aa(e){if(typeof e=="string")switch(e){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${e}`)}if("Vector"in e)return{vector:Aa(e.Vector)};if("Struct"in e)return{datatype:{package:e.Struct.address,module:e.Struct.module,type:e.Struct.name,typeParameters:e.Struct.typeArguments.map(Aa)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function Nb(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Zt.bcs.vector(Nb(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var vd=Object.defineProperty,KA=Object.getOwnPropertyDescriptor,XA=Object.getOwnPropertyNames,JA=Object.prototype.hasOwnProperty,YA=(e,t)=>{for(var r in t)vd(e,r,{get:t[r],enumerable:!0})},ZA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XA(t))!JA.call(e,i)&&i!==r&&vd(e,i,{get:()=>t[i],enumerable:!(n=KA(t,i))||n.enumerable});return e},QA=e=>ZA(vd({},"__esModule",{value:!0}),e),Db={};YA(Db,{Inputs:()=>r5});var Kc=QA(Db),e5=Er,yd=Hr;function t5(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,e5.toBase64)(e):e.toBase64()}}}const r5={Pure:t5,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,yd.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,yd.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,yd.normalizeSuiAddress)(e)}}}}};var bd=Object.defineProperty,n5=Object.getOwnPropertyDescriptor,i5=Object.getOwnPropertyNames,s5=Object.prototype.hasOwnProperty,o5=(e,t)=>{for(var r in t)bd(e,r,{get:t[r],enumerable:!0})},a5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of i5(t))!s5.call(e,i)&&i!==r&&bd(e,i,{get:()=>t[i],enumerable:!(n=n5(t,i))||n.enumerable});return e},c5=e=>a5(bd({},"__esModule",{value:!0}),e),$b={};o5($b,{$Intent:()=>Ub,Argument:()=>tn,BCSBytes:()=>Ia,Command:()=>zb,GasData:()=>Lb,JsonU64:()=>Ki,NormalizedCallArg:()=>d5,ObjectArg:()=>wd,ObjectID:()=>As,ObjectRef:()=>Xc,OpenMoveTypeSignature:()=>Fb,OpenMoveTypeSignatureBody:()=>Jc,StructTag:()=>u5,SuiAddress:()=>Oa,TransactionData:()=>h5,TransactionExpiration:()=>Vb,safeEnum:()=>go});var mo=c5($b),ue=Gi,Bb=Hr;function go(e){const t=Object.entries(e).map(([r,n])=>(0,ue.object)({[r]:n}));return(0,ue.pipe)((0,ue.union)(t),(0,ue.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const Oa=(0,ue.pipe)((0,ue.string)(),(0,ue.transform)(e=>(0,Bb.normalizeSuiAddress)(e)),(0,ue.check)(Bb.isValidSuiAddress)),As=Oa,Ia=(0,ue.string)(),Ki=(0,ue.pipe)((0,ue.union)([(0,ue.string)(),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())]),(0,ue.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Xc=(0,ue.object)({objectId:Oa,version:Ki,digest:(0,ue.string)()}),tn=(0,ue.pipe)((0,ue.union)([(0,ue.object)({GasCoin:(0,ue.literal)(!0)}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("pure"))}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("object"))}),(0,ue.object)({Result:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())}),(0,ue.object)({NestedResult:(0,ue.tuple)([(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())])})]),(0,ue.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),Lb=(0,ue.object)({budget:(0,ue.nullable)(Ki),price:(0,ue.nullable)(Ki),owner:(0,ue.nullable)(Oa),payment:(0,ue.nullable)((0,ue.array)(Xc))}),u5=(0,ue.object)({address:(0,ue.string)(),module:(0,ue.string)(),name:(0,ue.string)(),typeParams:(0,ue.array)((0,ue.string)())}),Jc=(0,ue.union)([(0,ue.literal)("address"),(0,ue.literal)("bool"),(0,ue.literal)("u8"),(0,ue.literal)("u16"),(0,ue.literal)("u32"),(0,ue.literal)("u64"),(0,ue.literal)("u128"),(0,ue.literal)("u256"),(0,ue.object)({vector:(0,ue.lazy)(()=>Jc)}),(0,ue.object)({datatype:(0,ue.object)({package:(0,ue.string)(),module:(0,ue.string)(),type:(0,ue.string)(),typeParameters:(0,ue.array)((0,ue.lazy)(()=>Jc))})}),(0,ue.object)({typeParameter:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())})]),Fb=(0,ue.object)({ref:(0,ue.nullable)((0,ue.union)([(0,ue.literal)("&"),(0,ue.literal)("&mut")])),body:Jc}),l5=(0,ue.object)({package:As,module:(0,ue.string)(),function:(0,ue.string)(),typeArguments:(0,ue.array)((0,ue.string)()),arguments:(0,ue.array)(tn),_argumentTypes:(0,ue.optional)((0,ue.nullable)((0,ue.array)(Fb)))}),Ub=(0,ue.object)({name:(0,ue.string)(),inputs:(0,ue.record)((0,ue.string)(),(0,ue.union)([tn,(0,ue.array)(tn)])),data:(0,ue.record)((0,ue.string)(),(0,ue.unknown)())}),zb=go({MoveCall:l5,TransferObjects:(0,ue.object)({objects:(0,ue.array)(tn),address:tn}),SplitCoins:(0,ue.object)({coin:tn,amounts:(0,ue.array)(tn)}),MergeCoins:(0,ue.object)({destination:tn,sources:(0,ue.array)(tn)}),Publish:(0,ue.object)({modules:(0,ue.array)(Ia),dependencies:(0,ue.array)(As)}),MakeMoveVec:(0,ue.object)({type:(0,ue.nullable)((0,ue.string)()),elements:(0,ue.array)(tn)}),Upgrade:(0,ue.object)({modules:(0,ue.array)(Ia),dependencies:(0,ue.array)(As),package:As,ticket:tn}),$Intent:Ub}),wd=go({ImmOrOwnedObject:Xc,SharedObject:(0,ue.object)({objectId:As,initialSharedVersion:Ki,mutable:(0,ue.boolean)()}),Receiving:Xc}),f5=go({Object:wd,Pure:(0,ue.object)({bytes:Ia}),UnresolvedPure:(0,ue.object)({value:(0,ue.unknown)()}),UnresolvedObject:(0,ue.object)({objectId:As,version:(0,ue.optional)((0,ue.nullable)(Ki)),digest:(0,ue.optional)((0,ue.nullable)((0,ue.string)())),initialSharedVersion:(0,ue.optional)((0,ue.nullable)(Ki))})}),d5=go({Object:wd,Pure:(0,ue.object)({bytes:Ia})}),Vb=go({None:(0,ue.literal)(!0),Epoch:Ki}),h5=(0,ue.object)({version:(0,ue.literal)(2),sender:(0,ue.nullish)(Oa),expiration:(0,ue.nullish)(Vb),gasData:Lb,inputs:(0,ue.array)(f5),commands:(0,ue.array)(zb)});var _d=Object.defineProperty,p5=Object.getOwnPropertyDescriptor,m5=Object.getOwnPropertyNames,g5=Object.prototype.hasOwnProperty,v5=(e,t)=>{for(var r in t)_d(e,r,{get:t[r],enumerable:!0})},y5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of m5(t))!g5.call(e,i)&&i!==r&&_d(e,i,{get:()=>t[i],enumerable:!(n=p5(t,i))||n.enumerable});return e},b5=e=>y5(_d({},"__esModule",{value:!0}),e),qb={};v5(qb,{Commands:()=>w5,UpgradePolicy:()=>Hb});var xd=b5(qb),Wb=Er,Xn=Gi,Gb=Hr,Jn=mo,Hb=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(Hb||{});const w5={MoveCall(e){const[t,r="",n=""]="target"in e?e.target.split("::"):[e.package,e.module,e.function];return{$kind:"MoveCall",MoveCall:{package:t,module:r,function:n,typeArguments:e.typeArguments??[],arguments:e.arguments??[]}}},TransferObjects(e,t){return{$kind:"TransferObjects",TransferObjects:{objects:e.map(r=>(0,Xn.parse)(Jn.Argument,r)),address:(0,Xn.parse)(Jn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Xn.parse)(Jn.Argument,e),amounts:t.map(r=>(0,Xn.parse)(Jn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Xn.parse)(Jn.Argument,e),sources:t.map(r=>(0,Xn.parse)(Jn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,Wb.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,Gb.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,Wb.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,Gb.normalizeSuiObjectId)(i)),package:r,ticket:(0,Xn.parse)(Jn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Xn.parse)(Jn.Argument,r))}}},Intent({name:e,inputs:t={},data:r={}}){return{$kind:"$Intent",$Intent:{name:e,inputs:Object.fromEntries(Object.entries(t).map(([n,i])=>[n,Array.isArray(i)?i.map(s=>(0,Xn.parse)(Jn.Argument,s)):(0,Xn.parse)(Jn.Argument,i)])),data:r}}}};var Sd=Object.defineProperty,_5=Object.getOwnPropertyDescriptor,x5=Object.getOwnPropertyNames,S5=Object.prototype.hasOwnProperty,E5=(e,t)=>{for(var r in t)Sd(e,r,{get:t[r],enumerable:!0})},C5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of x5(t))!S5.call(e,i)&&i!==r&&Sd(e,i,{get:()=>t[i],enumerable:!(n=_5(t,i))||n.enumerable});return e},T5=e=>C5(Sd({},"__esModule",{value:!0}),e),Kb={};E5(Kb,{NormalizedCallArg:()=>Ed,ObjectRef:()=>Yc,SerializedTransactionDataV1:()=>F5,StructTag:()=>Qb,TransactionArgument:()=>Yn,TypeTag:()=>Zc,serializeV1TransactionData:()=>U5,transactionDataFromV1:()=>z5});var Xb=T5(Kb),vo=Er,ne=Gi,Jb=Gn,Pa=mo;const Yc=(0,ne.object)({digest:(0,ne.string)(),objectId:(0,ne.string)(),version:(0,ne.union)([(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),(0,ne.string)(),(0,ne.bigint)()])}),M5=(0,Pa.safeEnum)({ImmOrOwned:Yc,Shared:(0,ne.object)({objectId:Pa.ObjectID,initialSharedVersion:Pa.JsonU64,mutable:(0,ne.boolean)()}),Receiving:Yc}),Ed=(0,Pa.safeEnum)({Object:M5,Pure:(0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))}),Yb=(0,ne.union)([(0,ne.object)({kind:(0,ne.literal)("Input"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),value:(0,ne.unknown)(),type:(0,ne.optional)((0,ne.literal)("object"))}),(0,ne.object)({kind:(0,ne.literal)("Input"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),value:(0,ne.unknown)(),type:(0,ne.literal)("pure")})]),A5=(0,ne.union)([(0,ne.object)({Epoch:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),Zb=(0,ne.pipe)((0,ne.union)([(0,ne.number)(),(0,ne.string)(),(0,ne.bigint)()]),(0,ne.check)(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),Zc=(0,ne.union)([(0,ne.object)({bool:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u8:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u64:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u128:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({address:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({signer:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({vector:(0,ne.lazy)(()=>Zc)}),(0,ne.object)({struct:(0,ne.lazy)(()=>Qb)}),(0,ne.object)({u16:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u32:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u256:(0,ne.nullable)((0,ne.literal)(!0))})]),Qb=(0,ne.object)({address:(0,ne.string)(),module:(0,ne.string)(),name:(0,ne.string)(),typeParams:(0,ne.array)(Zc)}),O5=(0,ne.object)({budget:(0,ne.optional)(Zb),price:(0,ne.optional)(Zb),payment:(0,ne.optional)((0,ne.array)(Yc)),owner:(0,ne.optional)((0,ne.string)())}),I5=[Yb,(0,ne.object)({kind:(0,ne.literal)("GasCoin")}),(0,ne.object)({kind:(0,ne.literal)("Result"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())}),(0,ne.object)({kind:(0,ne.literal)("NestedResult"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),resultIndex:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())})],Yn=(0,ne.union)([...I5]),P5=(0,ne.object)({kind:(0,ne.literal)("MoveCall"),target:(0,ne.pipe)((0,ne.string)(),(0,ne.check)(e=>e.split("::").length===3)),typeArguments:(0,ne.array)((0,ne.string)()),arguments:(0,ne.array)(Yn)}),k5=(0,ne.object)({kind:(0,ne.literal)("TransferObjects"),objects:(0,ne.array)(Yn),address:Yn}),j5=(0,ne.object)({kind:(0,ne.literal)("SplitCoins"),coin:Yn,amounts:(0,ne.array)(Yn)}),R5=(0,ne.object)({kind:(0,ne.literal)("MergeCoins"),destination:Yn,sources:(0,ne.array)(Yn)}),N5=(0,ne.object)({kind:(0,ne.literal)("MakeMoveVec"),type:(0,ne.union)([(0,ne.object)({Some:Zc}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),objects:(0,ne.array)(Yn)}),D5=(0,ne.object)({kind:(0,ne.literal)("Publish"),modules:(0,ne.array)((0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))),dependencies:(0,ne.array)((0,ne.string)())}),$5=(0,ne.object)({kind:(0,ne.literal)("Upgrade"),modules:(0,ne.array)((0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))),dependencies:(0,ne.array)((0,ne.string)()),packageId:(0,ne.string)(),ticket:Yn}),B5=[P5,k5,j5,R5,D5,$5,N5],L5=(0,ne.union)([...B5]),F5=(0,ne.object)({version:(0,ne.literal)(1),sender:(0,ne.optional)((0,ne.string)()),expiration:(0,ne.nullish)(A5),gasConfig:O5,inputs:(0,ne.array)(Yb),transactions:(0,ne.array)(L5)});function U5(e){var r;const t=e.inputs.map((n,i)=>{if(n.Object)return{kind:"Input",index:i,value:{Object:n.Object.ImmOrOwnedObject?{ImmOrOwned:n.Object.ImmOrOwnedObject}:n.Object.Receiving?{Receiving:{digest:n.Object.Receiving.digest,version:n.Object.Receiving.version,objectId:n.Object.Receiving.objectId}}:{Shared:{mutable:n.Object.SharedObject.mutable,initialSharedVersion:n.Object.SharedObject.initialSharedVersion,objectId:n.Object.SharedObject.objectId}}},type:"object"};if(n.Pure)return{kind:"Input",index:i,value:{Pure:Array.from((0,vo.fromBase64)(n.Pure.bytes))},type:"pure"};if(n.UnresolvedPure)return{kind:"Input",type:"pure",index:i,value:n.UnresolvedPure.value};if(n.UnresolvedObject)return{kind:"Input",type:"object",index:i,value:n.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:e.sender??void 0,expiration:((r=e.expiration)==null?void 0:r.$kind)==="Epoch"?{Epoch:Number(e.expiration.Epoch)}:e.expiration?{None:!0}:null,gasConfig:{owner:e.gasData.owner??void 0,budget:e.gasData.budget??void 0,price:e.gasData.price??void 0,payment:e.gasData.payment??void 0},inputs:t,transactions:e.commands.map(n=>{if(n.MakeMoveVec)return{kind:"MakeMoveVec",type:n.MakeMoveVec.type===null?{None:!0}:{Some:Jb.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>Si(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:Si(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>Si(i,t))};if(n.MoveCall)return{kind:"MoveCall",target:`${n.MoveCall.package}::${n.MoveCall.module}::${n.MoveCall.function}`,typeArguments:n.MoveCall.typeArguments,arguments:n.MoveCall.arguments.map(i=>Si(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,vo.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:Si(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>Si(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>Si(i,t)),address:Si(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,vo.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:Si(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function Si(e,t){if(e.$kind==="GasCoin")return{kind:"GasCoin"};if(e.$kind==="Result")return{kind:"Result",index:e.Result};if(e.$kind==="NestedResult")return{kind:"NestedResult",index:e.NestedResult[0],resultIndex:e.NestedResult[1]};if(e.$kind==="Input")return t[e.Input];throw new Error(`Invalid argument ${Object.keys(e)}`)}function z5(e){var t,r,n;return(0,ne.parse)(Pa.TransactionData,{version:2,sender:e.sender??null,expiration:e.expiration?"Epoch"in e.expiration?{Epoch:e.expiration.Epoch}:{None:!0}:null,gasData:{owner:e.gasConfig.owner??null,budget:((t=e.gasConfig.budget)==null?void 0:t.toString())??null,price:((r=e.gasConfig.price)==null?void 0:r.toString())??null,payment:((n=e.gasConfig.payment)==null?void 0:n.map(i=>({digest:i.digest,objectId:i.objectId,version:i.version.toString()})))??null},inputs:e.inputs.map(i=>{if(i.kind==="Input"){if((0,ne.is)(Ed,i.value)){const s=(0,ne.parse)(Ed,i.value);if(s.Object){if(s.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:s.Object.ImmOrOwned.objectId,version:String(s.Object.ImmOrOwned.version),digest:s.Object.ImmOrOwned.digest}}};if(s.Object.Shared)return{Object:{SharedObject:{mutable:s.Object.Shared.mutable??null,initialSharedVersion:s.Object.Shared.initialSharedVersion,objectId:s.Object.Shared.objectId}}};if(s.Object.Receiving)return{Object:{Receiving:{digest:s.Object.Receiving.digest,version:String(s.Object.Receiving.version),objectId:s.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:(0,vo.toBase64)(new Uint8Array(s.Pure))}}}return i.type==="object"?{UnresolvedObject:{objectId:i.value}}:{UnresolvedPure:{value:i.value}}}throw new Error("Invalid input")}),commands:e.transactions.map(i=>{switch(i.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in i.type?Jb.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>Ei(s))}};case"MergeCoins":return{MergeCoins:{destination:Ei(i.destination),sources:i.sources.map(s=>Ei(s))}};case"MoveCall":{const[s,o,a]=i.target.split("::");return{MoveCall:{package:s,module:o,function:a,typeArguments:i.typeArguments,arguments:i.arguments.map(c=>Ei(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,vo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:Ei(i.coin),amounts:i.amounts.map(s=>Ei(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>Ei(s)),address:Ei(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,vo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:Ei(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function Ei(e){switch(e.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:e.index};case"NestedResult":return{NestedResult:[e.index,e.resultIndex]};case"Input":return{Input:e.index}}}var Cd=Object.defineProperty,V5=Object.getOwnPropertyDescriptor,q5=Object.getOwnPropertyNames,W5=Object.prototype.hasOwnProperty,G5=(e,t)=>{for(var r in t)Cd(e,r,{get:t[r],enumerable:!0})},H5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of q5(t))!W5.call(e,i)&&i!==r&&Cd(e,i,{get:()=>t[i],enumerable:!(n=V5(t,i))||n.enumerable});return e},K5=e=>H5(Cd({},"__esModule",{value:!0}),e),ew={};G5(ew,{SerializedTransactionDataV2:()=>nO});var X5=K5(ew),ke=Gi,cr=mo;function ka(e){return(0,ke.union)(Object.entries(e).map(([t,r])=>(0,ke.object)({[t]:r})))}const _n=ka({GasCoin:(0,ke.literal)(!0),Input:(0,ke.pipe)((0,ke.number)(),(0,ke.integer)()),Result:(0,ke.pipe)((0,ke.number)(),(0,ke.integer)()),NestedResult:(0,ke.tuple)([(0,ke.pipe)((0,ke.number)(),(0,ke.integer)()),(0,ke.pipe)((0,ke.number)(),(0,ke.integer)())])}),J5=(0,ke.object)({budget:(0,ke.nullable)(cr.JsonU64),price:(0,ke.nullable)(cr.JsonU64),owner:(0,ke.nullable)(cr.SuiAddress),payment:(0,ke.nullable)((0,ke.array)(cr.ObjectRef))}),Y5=(0,ke.object)({package:cr.ObjectID,module:(0,ke.string)(),function:(0,ke.string)(),typeArguments:(0,ke.array)((0,ke.string)()),arguments:(0,ke.array)(_n)}),Z5=(0,ke.object)({name:(0,ke.string)(),inputs:(0,ke.record)((0,ke.string)(),(0,ke.union)([_n,(0,ke.array)(_n)])),data:(0,ke.record)((0,ke.string)(),(0,ke.unknown)())}),Q5=ka({MoveCall:Y5,TransferObjects:(0,ke.object)({objects:(0,ke.array)(_n),address:_n}),SplitCoins:(0,ke.object)({coin:_n,amounts:(0,ke.array)(_n)}),MergeCoins:(0,ke.object)({destination:_n,sources:(0,ke.array)(_n)}),Publish:(0,ke.object)({modules:(0,ke.array)(cr.BCSBytes),dependencies:(0,ke.array)(cr.ObjectID)}),MakeMoveVec:(0,ke.object)({type:(0,ke.nullable)((0,ke.string)()),elements:(0,ke.array)(_n)}),Upgrade:(0,ke.object)({modules:(0,ke.array)(cr.BCSBytes),dependencies:(0,ke.array)(cr.ObjectID),package:cr.ObjectID,ticket:_n}),$Intent:Z5}),eO=ka({ImmOrOwnedObject:cr.ObjectRef,SharedObject:(0,ke.object)({objectId:cr.ObjectID,initialSharedVersion:cr.JsonU64,mutable:(0,ke.boolean)()}),Receiving:cr.ObjectRef}),tO=ka({Object:eO,Pure:(0,ke.object)({bytes:cr.BCSBytes}),UnresolvedPure:(0,ke.object)({value:(0,ke.unknown)()}),UnresolvedObject:(0,ke.object)({objectId:cr.ObjectID,version:(0,ke.optional)((0,ke.nullable)(cr.JsonU64)),digest:(0,ke.optional)((0,ke.nullable)((0,ke.string)())),initialSharedVersion:(0,ke.optional)((0,ke.nullable)(cr.JsonU64))})}),rO=ka({None:(0,ke.literal)(!0),Epoch:cr.JsonU64}),nO=(0,ke.object)({version:(0,ke.literal)(2),sender:(0,ke.nullish)(cr.SuiAddress),expiration:(0,ke.nullish)(rO),gasData:J5,inputs:(0,ke.array)(tO),commands:(0,ke.array)(Q5)});var Td=Object.defineProperty,iO=Object.getOwnPropertyDescriptor,sO=Object.getOwnPropertyNames,oO=Object.prototype.hasOwnProperty,aO=(e,t)=>{for(var r in t)Td(e,r,{get:t[r],enumerable:!0})},cO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sO(t))!oO.call(e,i)&&i!==r&&Td(e,i,{get:()=>t[i],enumerable:!(n=iO(t,i))||n.enumerable});return e},uO=e=>cO(Td({},"__esModule",{value:!0}),e),tw={};aO(tw,{getClient:()=>yo,resolveTransactionData:()=>mO});var rw=uO(tw),lO=Gi,nw=Gn,Md=Ab,fO=mo,ja=Kc,Ad=jb;const dO=50,hO=1000n,pO=5e10;async function mO(e,t,r){return await wO(e,t),await bO(e,t),t.onlyTransactionKind||(await gO(e,t),await vO(e,t),await yO(e,t)),await _O(e),await r()}async function gO(e,t){e.gasConfig.price||(e.gasConfig.price=String(await yo(t).getReferenceGasPrice()))}async function vO(e,t){if(e.gasConfig.budget)return;const r=await yo(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(pO),payment:[]}}})});if(r.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${r.effects.status.error}`,{cause:r});const n=hO*BigInt(e.gasConfig.price||1n),i=BigInt(r.effects.gasUsed.computationCost)+n,s=i+BigInt(r.effects.gasUsed.storageCost)-BigInt(r.effects.gasUsed.storageRebate);e.gasConfig.budget=String(s>i?s:i)}async function yO(e,t){if(!e.gasConfig.payment){const n=(await yo(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Md.SUI_TYPE_ARG})).data.filter(i=>!e.inputs.find(o=>{var a;return(a=o.Object)!=null&&a.ImmOrOwnedObject?i.coinObjectId===o.Object.ImmOrOwnedObject.objectId:!1})).map(i=>({objectId:i.coinObjectId,digest:i.digest,version:i.version}));if(!n.length)throw new Error("No valid gas coins found for the transaction.");e.gasConfig.payment=n.map(i=>(0,lO.parse)(fO.ObjectRef,i))}}async function bO(e,t){const r=e.inputs.filter(l=>{var f;return l.UnresolvedObject&&!(l.UnresolvedObject.version||(f=l.UnresolvedObject)!=null&&f.initialSharedVersion)}),n=[...new Set(r.map(l=>(0,Md.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?CO(n,dO):[],s=(await Promise.all(i.map(l=>yo(t).multiGetObjects({ids:l,options:{showOwner:!0}})))).flat(),o=new Map(n.map((l,f)=>[l,s[f]])),a=Array.from(o).filter(([l,f])=>f.error).map(([l,f])=>JSON.stringify(f.error));if(a.length)throw new Error(`The following input objects are invalid: ${a.join(", ")}`);const c=s.map(l=>{if(l.error||!l.data)throw new Error(`Failed to fetch object: ${l.error}`);const f=l.data.owner,h=f&&typeof f=="object"&&"Shared"in f?f.Shared.initial_shared_version:null;return{objectId:l.data.objectId,digest:l.data.digest,version:l.data.version,initialSharedVersion:h}}),u=new Map(n.map((l,f)=>[l,c[f]]));for(const[l,f]of e.inputs.entries()){if(!f.UnresolvedObject)continue;let h;const y=(0,Md.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=ja.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:xO(e,l)}):SO(e,l)&&(h=ja.Inputs.ReceivingRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})),e.inputs[e.inputs.indexOf(f)]=h??ja.Inputs.ObjectRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})}}async function wO(e,t){const{inputs:r,commands:n}=e,i=[],s=new Set;n.forEach(a=>{if(a.MoveCall){if(a.MoveCall._argumentTypes)return;if(a.MoveCall.arguments.map(l=>l.$kind==="Input"?e.inputs[l.Input]:null).some(l=>(l==null?void 0:l.UnresolvedPure)||(l==null?void 0:l.UnresolvedObject))){const l=`${a.MoveCall.package}::${a.MoveCall.module}::${a.MoveCall.function}`;s.add(l),i.push(a.MoveCall)}}switch(a.$kind){case"SplitCoins":a.SplitCoins.amounts.forEach(c=>{iw(c,nw.bcs.U64,e)});break;case"TransferObjects":iw(a.TransferObjects.address,nw.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=yo(t);await Promise.all([...s].map(async c=>{const[u,l,f]=c.split("::"),h=await a.getNormalizedMoveFunction({package:u,module:l,function:f});o.set(c,h.parameters.map(y=>(0,Ad.normalizedTypeToMoveTypeSignature)(y)))}))}i.length&&await Promise.all(i.map(async a=>{const c=o.get(`${a.package}::${a.module}::${a.function}`);if(!c)return;const l=c.length>0&&(0,Ad.isTxContext)(c.at(-1))?c.slice(0,c.length-1):c;a._argumentTypes=l})),n.forEach(a=>{if(!a.MoveCall)return;const c=a.MoveCall,u=`${c.package}::${c.module}::${c.function}`,l=c._argumentTypes;if(l){if(l.length!==a.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${u}`);l.forEach((f,h)=>{var R,N;const y=c.arguments[h];if(y.$kind!=="Input")return;const b=r[y.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const w=((R=b.UnresolvedPure)==null?void 0:R.value)??((N=b.UnresolvedObject)==null?void 0:N.objectId),A=(0,Ad.getPureBcsSchema)(f.body);if(A){y.type="pure",r[r.indexOf(b)]=ja.Inputs.Pure(A.serialize(w));return}if(typeof w!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(w,null,2)}`);y.type="object";const P=b.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:w}}:b;r[y.Input]=P})}})}function _O(e){e.inputs.forEach((t,r)=>{if(t.$kind!=="Object"&&t.$kind!=="Pure")throw new Error(`Input at index ${r} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(t)}`)})}function iw(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=ja.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function xO(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const s=i.MoveCall.arguments.indexOf(n);r=i.MoveCall._argumentTypes[s].ref!=="&"||r}(i.$kind==="MakeMoveVec"||i.$kind==="MergeCoins"||i.$kind==="SplitCoins")&&(r=!0)}),r}function SO(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const s=i.MoveCall.arguments.indexOf(n);r=EO(i.MoveCall._argumentTypes[s])||r}}),r}function EO(e){return typeof e.body!="object"||!("datatype"in e.body)?!1:e.body.datatype.package==="0x2"&&e.body.datatype.module==="transfer"&&e.body.datatype.type==="Receiving"}function yo(e){if(!e.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return e.client}function CO(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var Od=Object.defineProperty,TO=Object.getOwnPropertyDescriptor,MO=Object.getOwnPropertyNames,AO=Object.prototype.hasOwnProperty,OO=(e,t)=>{for(var r in t)Od(e,r,{get:t[r],enumerable:!0})},IO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MO(t))!AO.call(e,i)&&i!==r&&Od(e,i,{get:()=>t[i],enumerable:!(n=TO(t,i))||n.enumerable});return e},PO=e=>IO(Od({},"__esModule",{value:!0}),e),sw={};OO(sw,{createObjectMethods:()=>kO});var ow=PO(sw);function kO(e){function t(r){return e(r)}return t.system=()=>t("0x5"),t.clock=()=>t("0x6"),t.random=()=>t("0x8"),t.denyList=()=>t("0x403"),t.option=({type:r,value:n})=>i=>i.moveCall({typeArguments:[r],target:`0x1::option::${n===null?"none":"some"}`,arguments:n===null?[]:[i.object(n)]}),t}var Id=Object.defineProperty,jO=Object.getOwnPropertyDescriptor,RO=Object.getOwnPropertyNames,NO=Object.prototype.hasOwnProperty,DO=(e,t)=>{for(var r in t)Id(e,r,{get:t[r],enumerable:!0})},$O=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RO(t))!NO.call(e,i)&&i!==r&&Id(e,i,{get:()=>t[i],enumerable:!(n=jO(t,i))||n.enumerable});return e},BO=e=>$O(Id({},"__esModule",{value:!0}),e),aw={};DO(aw,{createPure:()=>FO});var cw=BO(aw),LO=Er,rr=Gn;function FO(e){function t(r,n){if(typeof r=="string")return e(Ra(r).serialize(n));if(r instanceof Uint8Array||(0,LO.isSerializedBcs)(r))return e(r);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return t.u8=r=>e(rr.bcs.U8.serialize(r)),t.u16=r=>e(rr.bcs.U16.serialize(r)),t.u32=r=>e(rr.bcs.U32.serialize(r)),t.u64=r=>e(rr.bcs.U64.serialize(r)),t.u128=r=>e(rr.bcs.U128.serialize(r)),t.u256=r=>e(rr.bcs.U256.serialize(r)),t.bool=r=>e(rr.bcs.Bool.serialize(r)),t.string=r=>e(rr.bcs.String.serialize(r)),t.address=r=>e(rr.bcs.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(rr.bcs.vector(Ra(r)).serialize(n)),t.option=(r,n)=>e(rr.bcs.option(Ra(r)).serialize(n)),t}function Ra(e){switch(e){case"u8":return rr.bcs.u8();case"u16":return rr.bcs.u16();case"u32":return rr.bcs.u32();case"u64":return rr.bcs.u64();case"u128":return rr.bcs.u128();case"u256":return rr.bcs.u256();case"bool":return rr.bcs.bool();case"string":return rr.bcs.string();case"id":case"address":return rr.bcs.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?rr.bcs.vector(Ra(n)):rr.bcs.option(Ra(n))}throw new Error(`Invalid Pure type name: ${e}`)}var Pd=Object.defineProperty,UO=Object.getOwnPropertyDescriptor,zO=Object.getOwnPropertyNames,VO=Object.prototype.hasOwnProperty,qO=(e,t)=>{for(var r in t)Pd(e,r,{get:t[r],enumerable:!0})},WO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zO(t))!VO.call(e,i)&&i!==r&&Pd(e,i,{get:()=>t[i],enumerable:!(n=UO(t,i))||n.enumerable});return e},GO=e=>WO(Pd({},"__esModule",{value:!0}),e),uw={};qO(uw,{hashTypedData:()=>XO});var HO=GO(uw),KO=Cb;function XO(e,t){const r=Array.from(`${e}::`).map(i=>i.charCodeAt(0)),n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),(0,KO.blake2b)(n,{dkLen:32})}var kd=Object.defineProperty,JO=Object.getOwnPropertyDescriptor,YO=Object.getOwnPropertyNames,ZO=Object.prototype.hasOwnProperty,QO=(e,t)=>{for(var r in t)kd(e,r,{get:t[r],enumerable:!0})},eI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YO(t))!ZO.call(e,i)&&i!==r&&kd(e,i,{get:()=>t[i],enumerable:!(n=JO(t,i))||n.enumerable});return e},tI=e=>eI(kd({},"__esModule",{value:!0}),e),lw={};QO(lw,{TransactionDataBuilder:()=>Os});var jd=tI(lw),rI=Er,Rd=Gi,Qc=Gn,nI=Hr,Nd=mo,iI=Xb,sI=HO;function fw(e){return(0,nI.normalizeSuiAddress)(e).replace("0x","")}class Os{constructor(t){this.version=2,this.sender=(t==null?void 0:t.sender)??null,this.expiration=(t==null?void 0:t.expiration)??null,this.inputs=(t==null?void 0:t.inputs)??[],this.commands=(t==null?void 0:t.commands)??[],this.gasData=(t==null?void 0:t.gasData)??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(t){const n=Qc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Os.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:n.inputs,commands:n.commands})}static fromBytes(t){const r=Qc.bcs.TransactionData.parse(t),n=r==null?void 0:r.V1,i=n.kind.ProgrammableTransaction;if(!n||!i)throw new Error("Unable to deserialize from bytes.");return Os.restore({version:2,sender:n.sender,expiration:n.expiration,gasData:n.gasData,inputs:i.inputs,commands:i.commands})}static restore(t){return t.version===2?new Os((0,Rd.parse)(Nd.TransactionData,t)):new Os((0,Rd.parse)(Nd.TransactionData,(0,iI.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,sI.hashTypedData)("TransactionData",t);return(0,rI.toBase58)(r)}get gasConfig(){return this.gasData}set gasConfig(t){this.gasData=t}build({maxSizeBytes:t=1/0,overrides:r,onlyTransactionKind:n}={}){const i=this.inputs,s=this.commands,o={ProgrammableTransaction:{inputs:i,commands:s}};if(n)return Qc.bcs.TransactionKind.serialize(o,{maxSize:t}).toBytes();const a=(r==null?void 0:r.expiration)??this.expiration,c=(r==null?void 0:r.sender)??this.sender,u={...this.gasData,...r==null?void 0:r.gasConfig,...r==null?void 0:r.gasData};if(!c)throw new Error("Missing transaction sender");if(!u.budget)throw new Error("Missing gas budget");if(!u.payment)throw new Error("Missing gas payment");if(!u.price)throw new Error("Missing gas price");const l={sender:fw(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:fw(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return Qc.bcs.TransactionData.serialize({V1:l},{maxSize:t}).toBytes()}addInput(t,r){const n=this.inputs.length;return this.inputs.push(r),{Input:n,type:t,$kind:"Input"}}getInputUses(t,r){this.mapArguments((n,i)=>(n.$kind==="Input"&&n.Input===t&&r(n,i),n))}mapArguments(t){for(const r of this.commands)switch(r.$kind){case"MoveCall":r.MoveCall.arguments=r.MoveCall.arguments.map(i=>t(i,r));break;case"TransferObjects":r.TransferObjects.objects=r.TransferObjects.objects.map(i=>t(i,r)),r.TransferObjects.address=t(r.TransferObjects.address,r);break;case"SplitCoins":r.SplitCoins.coin=t(r.SplitCoins.coin,r),r.SplitCoins.amounts=r.SplitCoins.amounts.map(i=>t(i,r));break;case"MergeCoins":r.MergeCoins.destination=t(r.MergeCoins.destination,r),r.MergeCoins.sources=r.MergeCoins.sources.map(i=>t(i,r));break;case"MakeMoveVec":r.MakeMoveVec.elements=r.MakeMoveVec.elements.map(i=>t(i,r));break;case"Upgrade":r.Upgrade.ticket=t(r.Upgrade.ticket,r);break;case"$Intent":const n=r.$Intent.inputs;r.$Intent.inputs={};for(const[i,s]of Object.entries(n))r.$Intent.inputs[i]=Array.isArray(s)?s.map(o=>t(o,r)):t(s,r);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${r.$kind}`)}}replaceCommand(t,r){if(!Array.isArray(r)){this.commands[t]=r;return}const n=r.length-1;this.commands.splice(t,1,...r),n!==0&&this.mapArguments(i=>{switch(i.$kind){case"Result":i.Result>t&&(i.Result+=n);break;case"NestedResult":i.NestedResult[0]>t&&(i.NestedResult[0]+=n);break}return i})}getDigest(){const t=this.build({onlyTransactionKind:!1});return Os.getDigestFromBytes(t)}snapshot(){return(0,Rd.parse)(Nd.TransactionData,this)}}var Dd=Object.defineProperty,oI=Object.getOwnPropertyDescriptor,aI=Object.getOwnPropertyNames,cI=Object.prototype.hasOwnProperty,uI=(e,t)=>{for(var r in t)Dd(e,r,{get:t[r],enumerable:!0})},lI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aI(t))!cI.call(e,i)&&i!==r&&Dd(e,i,{get:()=>t[i],enumerable:!(n=oI(t,i))||n.enumerable});return e},fI=e=>lI(Dd({},"__esModule",{value:!0}),e),dw={};uI(dw,{extractMutableReference:()=>hw,extractReference:()=>pw,extractStructTag:()=>hI,getIdFromCallArg:()=>pI});var dI=fI(dw),Na=Hr;function hw(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function pw(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function hI(e){if(typeof e=="object"&&"Struct"in e)return e;const t=pw(e),r=hw(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function pI(e){if(typeof e=="string")return(0,Na.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,Na.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,Na.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,Na.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,Na.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var $d=Object.defineProperty,mI=Object.getOwnPropertyDescriptor,gI=Object.getOwnPropertyNames,vI=Object.prototype.hasOwnProperty,mw=e=>{throw TypeError(e)},yI=(e,t)=>{for(var r in t)$d(e,r,{get:t[r],enumerable:!0})},bI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gI(t))!vI.call(e,i)&&i!==r&&$d(e,i,{get:()=>t[i],enumerable:!(n=mI(t,i))||n.enumerable});return e},wI=e=>bI($d({},"__esModule",{value:!0}),e),Bd=(e,t,r)=>t.has(e)||mw("Cannot "+r),Ct=(e,t,r)=>(Bd(e,t,"read from private field"),r?r.call(e):t.get(e)),Da=(e,t,r)=>t.has(e)?mw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Is=(e,t,r,n)=>(Bd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ci=(e,t,r)=>(Bd(e,t,"access private method"),r),gw={};yI(gw,{Transaction:()=>MI,isTransaction:()=>_w});var eu=wI(gw),tu=Er,Xi=Gi,_I=Hr,Ps=xd,ks=mo,vw=Xb,xI=X5,ru=Kc,SI=rw,EI=ow,CI=cw,$a=jd,yw=dI,Ba,La,js,Mt,xn,nu,Ld,Fd,Ud;function bw(e,t=1/0){const r={$kind:"Result",Result:e},n=[],i=s=>n[s]??(n[s]={$kind:"NestedResult",NestedResult:[e,s]});return new Proxy(r,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(s,o){if(o in s)return Reflect.get(s,o);if(o===Symbol.iterator)return function*(){let c=0;for(;c<t;)yield i(c),c++};if(typeof o=="symbol")return;const a=parseInt(o,10);if(!(Number.isNaN(a)||a<0))return i(a)}})}const ww=Symbol.for("@mysten/transaction");function _w(e){return!!e&&typeof e=="object"&&e[ww]===!0}const xw={buildPlugins:new Map,serializationPlugins:new Map},zd=Symbol.for("@mysten/transaction/registry");function Fa(){try{const e=globalThis;return e[zd]||(e[zd]=xw),e[zd]}catch{return xw}}const TI=class Z0{constructor(){Da(this,xn),Da(this,Ba),Da(this,La),Da(this,js,new Map),Da(this,Mt),this.object=(0,EI.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Xi.is)(ks.Argument,r))return r;const n=(0,yw.getIdFromCallArg)(r),i=Ct(this,Mt).inputs.find(a=>n===(0,yw.getIdFromCallArg)(a));return(s=i==null?void 0:i.Object)!=null&&s.SharedObject&&typeof r=="object"&&((o=r.Object)!=null&&o.SharedObject)&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||r.Object.SharedObject.mutable),i?{$kind:"Input",Input:Ct(this,Mt).inputs.indexOf(i),type:"object"}:Ct(this,Mt).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,_I.normalizeSuiAddress)(r)}}:r)});const t=Fa();Is(this,Mt,new $a.TransactionDataBuilder),Is(this,La,[...t.buildPlugins.values()]),Is(this,Ba,[...t.serializationPlugins.values()])}static fromKind(t){const r=new Z0;return Is(r,Mt,$a.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,tu.fromBase64)(t):t)),r}static from(t){const r=new Z0;return _w(t)?Is(r,Mt,new $a.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?Is(r,Mt,$a.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,tu.fromBase64)(t):t)):Is(r,Mt,$a.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){Fa().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){Fa().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){Fa().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){Fa().buildPlugins.delete(t)}addSerializationPlugin(t){Ct(this,Ba).push(t)}addBuildPlugin(t){Ct(this,La).push(t)}addIntentResolver(t,r){if(Ct(this,js).has(t)&&Ct(this,js).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Ct(this,js).set(t,r)}setSender(t){Ct(this,Mt).sender=t}setSenderIfNotSet(t){Ct(this,Mt).sender||(Ct(this,Mt).sender=t)}setExpiration(t){Ct(this,Mt).expiration=t?(0,Xi.parse)(ks.TransactionExpiration,t):null}setGasPrice(t){Ct(this,Mt).gasConfig.price=String(t)}setGasBudget(t){Ct(this,Mt).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Ct(this,Mt).gasData.budget==null&&(Ct(this,Mt).gasConfig.budget=String(t))}setGasOwner(t){Ct(this,Mt).gasConfig.owner=t}setGasPayment(t){Ct(this,Mt).gasConfig.payment=t.map(r=>(0,Xi.parse)(ks.ObjectRef,r))}get blockData(){return(0,vw.serializeV1TransactionData)(Ct(this,Mt).snapshot())}getData(){return Ct(this,Mt).snapshot()}get[ww](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,CI.createPure)(t=>(0,tu.isSerializedBcs)(t)?Ct(this,Mt).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Ct(this,Mt).addInput("pure",(0,Xi.is)(ks.NormalizedCallArg,t)?(0,Xi.parse)(ks.NormalizedCallArg,t):t instanceof Uint8Array?ru.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(ru.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(ru.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(ru.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Ct(this,Mt).commands.push(t);return bw(r-1)}splitCoins(t,r){const n=Ps.Commands.SplitCoins(typeof t=="string"?this.object(t):Ci(this,xn,Ld).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):Ci(this,xn,nu).call(this,s))),i=Ct(this,Mt).commands.push(n);return bw(i-1,r.length)}mergeCoins(t,r){return this.add(Ps.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(Ps.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(Ps.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(Ps.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>Ci(this,xn,nu).call(this,n))}))}transferObjects(t,r){return this.add(Ps.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):Ci(this,xn,nu).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(Ps.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,vw.serializeV1TransactionData)(Ct(this,Mt).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Xi.parse)(xI.SerializedTransactionDataV2,Ct(this,Mt).snapshot()),(r,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(t){const{signer:r,...n}=t,i=await this.build(n);return r.signTransaction(i)}async build(t={}){return await this.prepareForSerialization(t),await Ci(this,xn,Fd).call(this,t),Ct(this,Mt).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await Ci(this,xn,Fd).call(this,t),Ct(this,Mt).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Ct(this,Mt).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Ct(this,Ba)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Ct(this,js).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Ct(this,js).get(s))}await Ci(this,xn,Ud).call(this,n,t)}};Ba=new WeakMap,La=new WeakMap,js=new WeakMap,Mt=new WeakMap,xn=new WeakSet,nu=function(e){return(0,tu.isSerializedBcs)(e)?this.pure(e):Ci(this,xn,Ld).call(this,e)},Ld=function(e){return typeof e=="function"?(0,Xi.parse)(ks.Argument,e(this)):(0,Xi.parse)(ks.Argument,e)},Fd=async function(e){if(!e.onlyTransactionKind&&!Ct(this,Mt).sender)throw new Error("Missing transaction sender");await Ci(this,xn,Ud).call(this,[...Ct(this,La),SI.resolveTransactionData],e)},Ud=async function(e,t){const r=n=>{if(n>=e.length)return()=>{};const i=e[n];return async()=>{const s=r(n+1);let o=!1,a=!1;if(await i(Ct(this,Mt),t,async()=>{if(o)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);o=!0,await s(),a=!0}),!o)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await r(0)()};let MI=TI;var Vd=Object.defineProperty,AI=Object.getOwnPropertyDescriptor,OI=Object.getOwnPropertyNames,II=Object.prototype.hasOwnProperty,Sw=e=>{throw TypeError(e)},PI=(e,t)=>{for(var r in t)Vd(e,r,{get:t[r],enumerable:!0})},kI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OI(t))!II.call(e,i)&&i!==r&&Vd(e,i,{get:()=>t[i],enumerable:!(n=AI(t,i))||n.enumerable});return e},jI=e=>kI(Vd({},"__esModule",{value:!0}),e),Ew=(e,t,r)=>t.has(e)||Sw("Cannot "+r),dr=(e,t,r)=>(Ew(e,t,"read from private field"),r?r.call(e):t.get(e)),qd=(e,t,r)=>t.has(e)?Sw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Cw=(e,t,r,n)=>(Ew(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Tw={};PI(Tw,{AsyncCache:()=>Aw,InMemoryCache:()=>Ow,ObjectCache:()=>RI});var Mw=jI(Tw),Wd=Hr,Rs,Cr,iu;class Aw{async getObject(t){const[r,n]=await Promise.all([this.get("OwnedObject",t),this.get("SharedOrImmutableObject",t)]);return r??n??null}async getObjects(t){return Promise.all([...t.map(r=>this.getObject(r))])}async addObject(t){return t.owner?await this.set("OwnedObject",t.objectId,t):await this.set("SharedOrImmutableObject",t.objectId,t),t}async addObjects(t){await Promise.all(t.map(async r=>this.addObject(r)))}async deleteObject(t){await Promise.all([this.delete("OwnedObject",t),this.delete("SharedOrImmutableObject",t)])}async deleteObjects(t){await Promise.all(t.map(r=>this.deleteObject(r)))}async getMoveFunctionDefinition(t){const r=`${(0,Wd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,Wd.normalizeSuiAddress)(t.package),n=`${r}::${t.module}::${t.function}`,i={...t,package:r};return await this.set("MoveFunction",n,i),i}async deleteMoveFunctionDefinition(t){const r=`${(0,Wd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;await this.delete("MoveFunction",r)}async getCustom(t){return this.get("Custom",t)}async setCustom(t,r){return this.set("Custom",t,r)}async deleteCustom(t){return this.delete("Custom",t)}}class Ow extends Aw{constructor(){super(...arguments),qd(this,Rs,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return dr(this,Rs)[t].get(r)??null}async set(t,r,n){dr(this,Rs)[t].set(r,n)}async delete(t,r){dr(this,Rs)[t].delete(r)}async clear(t){if(t)dr(this,Rs)[t].clear();else for(const r of Object.values(dr(this,Rs)))r.clear()}}Rs=new WeakMap;class RI{constructor({cache:t=new Ow,onEffects:r}){qd(this,Cr),qd(this,iu),Cw(this,Cr,t),Cw(this,iu,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await dr(this,Cr).getObjects(i)).filter(a=>a!==null),o=new Map(s.map(a=>[a.objectId,a]));for(const a of t.inputs){if(!a.UnresolvedObject)continue;const c=o.get(a.UnresolvedObject.objectId);c&&(c.initialSharedVersion&&!a.UnresolvedObject.initialSharedVersion?a.UnresolvedObject.initialSharedVersion=c.initialSharedVersion:(c.version&&!a.UnresolvedObject.version&&(a.UnresolvedObject.version=c.version),c.digest&&!a.UnresolvedObject.digest&&(a.UnresolvedObject.digest=c.digest)))}await Promise.all(t.commands.map(async a=>{if(a.MoveCall){const c=await this.getMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function});c&&(a.MoveCall._argumentTypes=c.parameters)}})),await n(),await Promise.all(t.commands.map(async a=>{var c;(c=a.MoveCall)!=null&&c._argumentTypes&&await dr(this,Cr).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await dr(this,Cr).clear()}async getMoveFunctionDefinition(t){return dr(this,Cr).getMoveFunctionDefinition(t)}async getObjects(t){return dr(this,Cr).getObjects(t)}async deleteObjects(t){return dr(this,Cr).deleteObjects(t)}async clearOwnedObjects(){await dr(this,Cr).clear("OwnedObject")}async clearCustom(){await dr(this,Cr).clear("Custom")}async getCustom(t){return dr(this,Cr).getCustom(t)}async setCustom(t,r){return dr(this,Cr).setCustom(t,r)}async deleteCustom(t){return dr(this,Cr).deleteCustom(t)}async applyEffects(t){var r;if(!t.V2)throw new Error(`Unsupported transaction effects version ${t.$kind}`);const{lamportVersion:n,changedObjects:i}=t.V2,s=[],o=[];i.forEach(([a,c])=>{var u;if(c.outputState.NotExist)s.push(a);else if(c.outputState.ObjectWrite){const[l,f]=c.outputState.ObjectWrite;o.push({objectId:a,digest:l,version:n,owner:f.AddressOwner??f.ObjectOwner??null,initialSharedVersion:((u=f.Shared)==null?void 0:u.initialSharedVersion)??null})}}),await Promise.all([dr(this,Cr).addObjects(o),dr(this,Cr).deleteObjects(s),(r=dr(this,iu))==null?void 0:r.call(this,t)])}}Cr=new WeakMap,iu=new WeakMap;var Gd=Object.defineProperty,NI=Object.getOwnPropertyDescriptor,DI=Object.getOwnPropertyNames,$I=Object.prototype.hasOwnProperty,Iw=e=>{throw TypeError(e)},BI=(e,t)=>{for(var r in t)Gd(e,r,{get:t[r],enumerable:!0})},LI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DI(t))!$I.call(e,i)&&i!==r&&Gd(e,i,{get:()=>t[i],enumerable:!(n=NI(t,i))||n.enumerable});return e},FI=e=>LI(Gd({},"__esModule",{value:!0}),e),Pw=(e,t,r)=>t.has(e)||Iw("Cannot "+r),Ua=(e,t,r)=>(Pw(e,t,"read from private field"),r?r.call(e):t.get(e)),kw=(e,t,r)=>t.has(e)?Iw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Hd=(e,t,r,n)=>(Pw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),jw={};BI(jw,{CachingTransactionExecutor:()=>qI});var Rw=FI(jw),UI=Gn,zI=Mw,VI=eu,bo,wo;class qI{constructor({client:t,...r}){kw(this,bo),kw(this,wo,null),Hd(this,bo,t),this.cache=new zI.ObjectCache(r)}async reset(){await Promise.all([this.cache.clearOwnedObjects(),this.cache.clearCustom(),this.waitForLastTransaction()])}async buildTransaction({transaction:t,...r}){return t.addBuildPlugin(this.cache.asPlugin()),t.build({client:Ua(this,bo),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,VI.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await Ua(this,bo).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=UI.bcs.TransactionEffects.parse(Uint8Array.from(s.rawEffects));await this.applyEffects(o)}return s}async signAndExecuteTransaction({options:t,transaction:r,...n}){r.setSenderIfNotSet(n.signer.toSuiAddress());const i=await this.buildTransaction({transaction:r}),{signature:s}=await n.signer.signTransaction(i);return await this.executeTransaction({transaction:i,signature:s,options:t})}async applyEffects(t){var r;Hd(this,wo,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){Ua(this,wo)&&(await Ua(this,bo).waitForTransaction({digest:Ua(this,wo)}),Hd(this,wo,null))}}bo=new WeakMap,wo=new WeakMap;var Kd=Object.defineProperty,WI=Object.getOwnPropertyDescriptor,GI=Object.getOwnPropertyNames,HI=Object.prototype.hasOwnProperty,Nw=e=>{throw TypeError(e)},KI=(e,t)=>{for(var r in t)Kd(e,r,{get:t[r],enumerable:!0})},XI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GI(t))!HI.call(e,i)&&i!==r&&Kd(e,i,{get:()=>t[i],enumerable:!(n=WI(t,i))||n.enumerable});return e},JI=e=>XI(Kd({},"__esModule",{value:!0}),e),YI=(e,t,r)=>t.has(e)||Nw("Cannot "+r),Sn=(e,t,r)=>(YI(e,t,"read from private field"),r?r.call(e):t.get(e)),Dw=(e,t,r)=>t.has(e)?Nw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),$w={};KI($w,{ParallelQueue:()=>QI,SerialQueue:()=>ZI});var Bw=JI($w),Ji,Ns;class ZI{constructor(){Dw(this,Ji,[])}async runTask(t){return new Promise((r,n)=>{Sn(this,Ji).push(()=>{t().finally(()=>{Sn(this,Ji).shift(),Sn(this,Ji).length>0&&Sn(this,Ji)[0]()}).then(r,n)}),Sn(this,Ji).length===1&&Sn(this,Ji)[0]()})}}Ji=new WeakMap;class QI{constructor(t){Dw(this,Ns,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{Sn(this,Ns).length>0?Sn(this,Ns).shift()():this.activeTasks--}).then(r,n)):Sn(this,Ns).push(()=>{t().finally(()=>{Sn(this,Ns).length>0?Sn(this,Ns).shift()():this.activeTasks--}).then(r,n)})})}}Ns=new WeakMap;var Xd=Object.defineProperty,eP=Object.getOwnPropertyDescriptor,tP=Object.getOwnPropertyNames,rP=Object.prototype.hasOwnProperty,Lw=e=>{throw TypeError(e)},nP=(e,t)=>{for(var r in t)Xd(e,r,{get:t[r],enumerable:!0})},iP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tP(t))!rP.call(e,i)&&i!==r&&Xd(e,i,{get:()=>t[i],enumerable:!(n=eP(t,i))||n.enumerable});return e},sP=e=>iP(Xd({},"__esModule",{value:!0}),e),Fw=(e,t,r)=>t.has(e)||Lw("Cannot "+r),Tr=(e,t,r)=>(Fw(e,t,"read from private field"),r?r.call(e):t.get(e)),_o=(e,t,r)=>t.has(e)?Lw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Jd=(e,t,r,n)=>(Fw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Uw={};nP(Uw,{SerialTransactionExecutor:()=>uP,getGasCoinFromEffects:()=>qw});var zw=sP(Uw),oP=Er,Vw=eu,aP=Rw,cP=Bw,su,za,En,ou,Yd,au;class uP{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){_o(this,su,new cP.SerialQueue),_o(this,za),_o(this,En),_o(this,ou),_o(this,Yd,async i=>{if(!i.V2)return;const s=qw(i).ref;s?Tr(this,En).cache.setCustom("gasCoin",s):Tr(this,En).cache.deleteCustom("gasCoin")}),_o(this,au,async i=>{const s=await Tr(this,En).cache.getCustom("gasCoin"),o=Vw.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Tr(this,ou)),o.setSenderIfNotSet(Tr(this,za).toSuiAddress()),Tr(this,En).buildTransaction({transaction:o})}),Jd(this,za,t),Jd(this,ou,r),Jd(this,En,new aP.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Tr(this,Yd).call(this,i)}))}async applyEffects(t){return Tr(this,En).applyEffects(t)}async buildTransaction(t){return Tr(this,su).runTask(()=>Tr(this,au).call(this,t))}resetCache(){return Tr(this,En).reset()}waitForLastTransaction(){return Tr(this,En).waitForLastTransaction()}executeTransaction(t,r){return Tr(this,su).runTask(async()=>{const n=(0,Vw.isTransaction)(t)?await Tr(this,au).call(this,t):t,{signature:i}=await Tr(this,za).signTransaction(n),s=await Tr(this,En).executeTransaction({signature:i,transaction:n,options:r}).catch(async a=>{throw await this.resetCache(),a}),o=Uint8Array.from(s.rawEffects);return{digest:s.digest,effects:(0,oP.toBase64)(o),data:s}})}}su=new WeakMap,za=new WeakMap,En=new WeakMap,ou=new WeakMap,Yd=new WeakMap,au=new WeakMap;function qw(e){if(!e.V2)throw new Error("Unexpected effects version");const t=e.V2.changedObjects[e.V2.gasObjectIndex];if(!t)throw new Error("Gas object not found in effects");const[r,{outputState:n}]=t;if(!n.ObjectWrite)throw new Error("Unexpected gas object state");const[i,s]=n.ObjectWrite;return{ref:{objectId:r,digest:i,version:e.V2.lamportVersion},owner:s.AddressOwner||s.ObjectOwner}}var Zd=Object.defineProperty,lP=Object.getOwnPropertyDescriptor,fP=Object.getOwnPropertyNames,dP=Object.prototype.hasOwnProperty,Ww=e=>{throw TypeError(e)},hP=(e,t)=>{for(var r in t)Zd(e,r,{get:t[r],enumerable:!0})},pP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fP(t))!dP.call(e,i)&&i!==r&&Zd(e,i,{get:()=>t[i],enumerable:!(n=lP(t,i))||n.enumerable});return e},mP=e=>pP(Zd({},"__esModule",{value:!0}),e),Qd=(e,t,r)=>t.has(e)||Ww("Cannot "+r),qe=(e,t,r)=>(Qd(e,t,"read from private field"),r?r.call(e):t.get(e)),hr=(e,t,r)=>t.has(e)?Ww("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),nr=(e,t,r,n)=>(Qd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),rn=(e,t,r)=>(Qd(e,t,"access private method"),r),Gw=(e,t,r,n)=>({set _(i){nr(e,t,i,r)},get _(){return qe(e,t,n)}}),Hw={};hP(Hw,{ParallelTransactionExecutor:()=>_P});var gP=mP(Hw),vP=Er,Kw=Gn,yP=eu,bP=jd,wP=Rw,Xw=Bw,Jw=zw,Yi,Zn,cu,Va,qa,Wa,uu,xo,Nr,Zi,Ds,$s,eh,lu,Ga,So,Eo,Ti,Fr,Yw,Zw,Ha,th,Qw,rh,e2;const Ka={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class _P{constructor(t){hr(this,Fr),hr(this,Yi),hr(this,Zn),hr(this,cu),hr(this,Va),hr(this,qa),hr(this,Wa),hr(this,uu),hr(this,xo),hr(this,Nr),hr(this,Zi,[]),hr(this,Ds),hr(this,$s,new Map),hr(this,eh,new Xw.SerialQueue),hr(this,lu),hr(this,Ga,null),hr(this,So,null),hr(this,Eo,0),hr(this,Ti,null),nr(this,Yi,t.signer),nr(this,Zn,t.client),nr(this,cu,t.coinBatchSize??Ka.coinBatchSize),nr(this,Va,t.initialCoinBalance??Ka.initialCoinBalance),nr(this,qa,t.minimumCoinBalance??Ka.minimumCoinBalance),nr(this,uu,t.defaultGasBudget??qe(this,qa)),nr(this,Wa,t.epochBoundaryWindow??Ka.epochBoundaryWindow),nr(this,xo,t.maxPoolSize??Ka.maxPoolSize),nr(this,Ds,new wP.CachingTransactionExecutor({client:t.client,cache:t.cache})),nr(this,lu,new Xw.ParallelQueue(qe(this,xo))),nr(this,Nr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return nr(this,Ti,null),rn(this,Fr,Ha).call(this,()=>qe(this,Ds).reset())}async waitForLastTransaction(){await rn(this,Fr,Ha).call(this,()=>rn(this,Fr,th).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=xP(),o=await rn(this,Fr,Yw).call(this,t),a=()=>{qe(this,lu).runTask(()=>rn(this,Fr,Zw).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{qe(this,$s).get(u)?(c.add(u),qe(this,$s).get(u).push(()=>{c.delete(u),c.size===0&&a()})):qe(this,$s).set(u,[])}),c.size===0&&a(),n}}Yi=new WeakMap,Zn=new WeakMap,cu=new WeakMap,Va=new WeakMap,qa=new WeakMap,Wa=new WeakMap,uu=new WeakMap,xo=new WeakMap,Nr=new WeakMap,Zi=new WeakMap,Ds=new WeakMap,$s=new WeakMap,eh=new WeakMap,lu=new WeakMap,Ga=new WeakMap,So=new WeakMap,Eo=new WeakMap,Ti=new WeakMap,Fr=new WeakSet,Yw=async function(e){const t=new Set;let r=!1;return e.addSerializationPlugin(async(n,i,s)=>{await s(),!r&&(r=!0,n.inputs.forEach(o=>{var a,c,u,l,f;(c=(a=o.Object)==null?void 0:a.ImmOrOwnedObject)!=null&&c.objectId?t.add(o.Object.ImmOrOwnedObject.objectId):(l=(u=o.Object)==null?void 0:u.Receiving)!=null&&l.objectId?t.add(o.Object.Receiving.objectId):(f=o.UnresolvedObject)!=null&&f.objectId&&!o.UnresolvedObject.initialSharedVersion&&t.add(o.UnresolvedObject.objectId)}))}),await e.prepareForSerialization({client:qe(this,Zn)}),t},Zw=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(qe(this,Yi).toSuiAddress()),await qe(this,eh).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await rn(this,Fr,rh).call(this)),e.setGasBudgetIfNotSet(qe(this,uu)),await rn(this,Fr,Ha).call(this),n=await rn(this,Fr,Qw).call(this),Gw(this,Eo)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await qe(this,Ds).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:qe(this,Zn)}),{signature:o}=await qe(this,Yi).signTransaction(s),a=await qe(this,Ds).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=Kw.bcs.TransactionEffects.parse(c),l=(0,Jw.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===qe(this,Yi).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new bP.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=qe(this,qa)?qe(this,Zi).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(qe(this,Nr)||nr(this,Nr,new Map),qe(this,Nr).set(l.ref.objectId,l.ref))}return nr(this,Ga,a.digest),{digest:a.digest,effects:(0,vP.toBase64)(c),data:a}}catch(s){throw n&&(qe(this,Nr)||nr(this,Nr,new Map),qe(this,Nr).set(n.id,null)),await rn(this,Fr,Ha).call(this,async()=>{await Promise.all([qe(this,Ds).cache.deleteObjects([...t]),rn(this,Fr,th).call(this)])}),s}finally{t.forEach(s=>{const o=qe(this,$s).get(s);o&&o.length>0?o.shift()():o&&qe(this,$s).delete(s)}),Gw(this,Eo)._--}},Ha=async function(e){qe(this,So)&&await qe(this,So),nr(this,So,(e==null?void 0:e().then(()=>{nr(this,So,null)},()=>{}))??null)},th=async function(){const e=qe(this,Ga);e&&(nr(this,Ga,null),await qe(this,Zn).waitForTransaction({digest:e}))},Qw=async function(){if(qe(this,Zi).length===0&&qe(this,Eo)<=qe(this,xo)&&await rn(this,Fr,e2).call(this),qe(this,Zi).length===0)throw new Error("No coins available");return qe(this,Zi).shift()},rh=async function(){if((qe(this,Ti)?qe(this,Ti).expiration-qe(this,Wa)-Date.now():0)>0)return qe(this,Ti).price;if(qe(this,Ti)){const r=Math.max(qe(this,Ti).expiration+qe(this,Wa)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await qe(this,Zn).getLatestSuiSystemState();return nr(this,Ti,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),rn(this,Fr,rh).call(this)},e2=async function(){var u;const e=Math.min(qe(this,cu),qe(this,xo)-(qe(this,Zi).length+qe(this,Eo))+1);if(e===0)return;const t=new yP.Transaction,r=qe(this,Yi).toSuiAddress();if(t.setSender(r),qe(this,Nr)){const l=[],f=[];for(const[h,y]of qe(this,Nr))y?l.push(y):f.push(h);if(f.length>0){const h=await qe(this,Zn).multiGetObjects({ids:f});l.push(...h.filter(y=>y.data!==null).map(({data:y})=>({objectId:y.objectId,version:y.version,digest:y.digest})))}t.setGasPayment(l),nr(this,Nr,new Map)}const n=new Array(e).fill(qe(this,Va)),i=t.splitCoins(t.gas,n),s=[];for(let l=0;l<n.length;l++)s.push(i[l]);t.transferObjects(s,r),await this.waitForLastTransaction();const o=await qe(this,Zn).signAndExecuteTransaction({transaction:t,signer:qe(this,Yi),options:{showRawEffects:!0}}),a=Kw.bcs.TransactionEffects.parse(Uint8Array.from(o.rawEffects));(u=a.V2)==null||u.changedObjects.forEach(([l,{outputState:f}],h)=>{var y;h===((y=a.V2)==null?void 0:y.gasObjectIndex)||!f.ObjectWrite||qe(this,Zi).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(qe(this,Va))})}),qe(this,Nr)||nr(this,Nr,new Map);const c=(0,Jw.getGasCoinFromEffects)(a).ref;qe(this,Nr).set(c.objectId,c),await qe(this,Zn).waitForTransaction({digest:o.digest})};function xP(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var nh=Object.defineProperty,SP=Object.getOwnPropertyDescriptor,EP=Object.getOwnPropertyNames,CP=Object.prototype.hasOwnProperty,TP=(e,t)=>{for(var r in t)nh(e,r,{get:t[r],enumerable:!0})},MP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of EP(t))!CP.call(e,i)&&i!==r&&nh(e,i,{get:()=>t[i],enumerable:!(n=SP(t,i))||n.enumerable});return e},AP=e=>MP(nh({},"__esModule",{value:!0}),e),t2={};TP(t2,{coinWithBalance:()=>kP});var OP=AP(t2),fu=Gi,IP=Gn,r2=Hr,du=xd,n2=Kc,PP=rw;const hu="CoinWithBalance",i2=(0,r2.normalizeStructTag)("0x2::sui::SUI");function kP({type:e=i2,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(hu,RP);const i=e==="gas"?e:(0,r2.normalizeStructTag)(e);return n.add(du.Commands.Intent({name:hu,inputs:{},data:{type:i===i2&&r?"gas":i,balance:BigInt(t)}}))}}const jP=(0,fu.object)({type:(0,fu.string)(),balance:(0,fu.bigint)()});async function RP(e,t,r){var u,l;const n=new Set,i=new Map;if(!e.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(const f of e.commands)if(f.$kind==="$Intent"&&f.$Intent.name===hu){const{type:h,balance:y}=(0,fu.parse)(jP,f.$Intent.data);h!=="gas"&&y>0n&&n.add(h),i.set(h,(i.get(h)??0n)+y)}const s=new Set;for(const f of e.inputs)(u=f.Object)!=null&&u.ImmOrOwnedObject&&s.add(f.Object.ImmOrOwnedObject.objectId),(l=f.UnresolvedObject)!=null&&l.objectId&&s.add(f.UnresolvedObject.objectId);const o=new Map,a=(0,PP.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await NP({coinType:f,balance:i.get(f),client:a,owner:e.sender,usedIds:s}))}));const c=new Map;c.set("gas",{$kind:"GasCoin",GasCoin:!0});for(const[f,h]of e.commands.entries()){if(h.$kind!=="$Intent"||h.$Intent.name!==hu)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,du.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[A,...P]=o.get(y).map(R=>e.addInput("object",n2.Inputs.ObjectRef({objectId:R.coinObjectId,digest:R.digest,version:R.version})));P.length>0&&w.push(du.Commands.MergeCoins(A,P)),c.set(y,A)}w.push(du.Commands.SplitCoins(c.get(y),[e.addInput("pure",n2.Inputs.Pure(IP.bcs.u64().serialize(b)))])),e.replaceCommand(f,w),e.mapArguments(A=>A.$kind==="Result"&&A.Result===f?{$kind:"NestedResult",NestedResult:[f+w.length-1,0]}:A)}return r()}async function NP({coinType:e,balance:t,client:r,owner:n,usedIds:i}){let s=t;const o=[];return a();async function a(c=null){const{data:u,hasNextPage:l,nextCursor:f}=await r.getCoins({owner:n,coinType:e,cursor:c}),h=u.sort((y,b)=>Number(BigInt(b.balance)-BigInt(y.balance)));for(const y of h){if(i.has(y.coinObjectId))continue;const b=BigInt(y.balance);if(o.push(y),s-=b,s<=0)return o}if(l)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}var ih=Object.defineProperty,DP=Object.getOwnPropertyDescriptor,$P=Object.getOwnPropertyNames,BP=Object.prototype.hasOwnProperty,LP=(e,t)=>{for(var r in t)ih(e,r,{get:t[r],enumerable:!0})},FP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $P(t))!BP.call(e,i)&&i!==r&&ih(e,i,{get:()=>t[i],enumerable:!(n=DP(t,i))||n.enumerable});return e},UP=e=>FP(ih({},"__esModule",{value:!0}),e),s2={};LP(s2,{Arguments:()=>WP});var zP=UP(s2),VP=ow,qP=cw;const WP={pure:(0,qP.createPure)(e=>t=>t.pure(e)),object:(0,VP.createObjectMethods)(e=>t=>t.object(e)),sharedObjectRef:(...e)=>t=>t.sharedObjectRef(...e),objectRef:(...e)=>t=>t.objectRef(...e),receivingRef:(...e)=>t=>t.receivingRef(...e)};var sh=Object.defineProperty,GP=Object.getOwnPropertyDescriptor,HP=Object.getOwnPropertyNames,KP=Object.prototype.hasOwnProperty,XP=(e,t)=>{for(var r in t)sh(e,r,{get:t[r],enumerable:!0})},JP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HP(t))!KP.call(e,i)&&i!==r&&sh(e,i,{get:()=>t[i],enumerable:!(n=GP(t,i))||n.enumerable});return e},YP=e=>JP(sh({},"__esModule",{value:!0}),e),o2={};XP(o2,{findTransactionBlockNames:()=>QP,listToRequests:()=>t7,replaceNames:()=>e7});var ZP=YP(o2),a2=xb;const Co="/",QP=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){c2([i.MakeMoveVec.type]).forEach(a=>{r.add(a)});continue}if(!("MoveCall"in i))continue;const s=i.MoveCall;if(!s)continue;const o=s.package.split("::")[0];if(o.includes(Co)){if(!(0,a2.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}c2(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function c2(e){const t=new Set;for(const r of e)if(r.includes(Co)){if(!(0,a2.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const e7=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(Co))continue;if(!t.types[n.MakeMoveVec.type])throw new Error(`No resolution found for type: ${n.MakeMoveVec.type}`);n.MakeMoveVec.type=t.types[n.MakeMoveVec.type]}const i=n.MoveCall;if(!i)continue;const s=i.package.split("::"),o=s[0];if(o.includes(Co)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(Co)&&(s[0]=t.packages[o],i.package=s.join("::"));const a=i.typeArguments;if(a){for(let c=0;c<a.length;c++)if(a[c].includes(Co)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},t7=(e,t)=>{const r=[],n=u2(e.packages),i=u2(e.types);for(const[s,o]of n.entries())r.push({id:s,type:"package",name:o});for(const[s,o]of i.entries())r.push({id:s+n.length,type:"moveType",name:o});return r7(r,t)},u2=e=>[...new Set(e)],r7=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var oh=Object.defineProperty,n7=Object.getOwnPropertyDescriptor,i7=Object.getOwnPropertyNames,s7=Object.prototype.hasOwnProperty,o7=(e,t)=>{for(var r in t)oh(e,r,{get:t[r],enumerable:!0})},a7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of i7(t))!s7.call(e,i)&&i!==r&&oh(e,i,{get:()=>t[i],enumerable:!(n=n7(t,i))||n.enumerable});return e},c7=e=>a7(oh({},"__esModule",{value:!0}),e),l2={};o7(l2,{namedPackagesPlugin:()=>l7});var u7=c7(l2),ah=ZP;const l7=({suiGraphQLClient:e,pageSize:t=10,overrides:r={packages:{},types:{}}})=>{const n={packages:{...r.packages},types:{...r.types}};return async(s,o,a)=>{const c=(0,ah.findTransactionBlockNames)(s),u=(0,ah.listToRequests)({packages:c.packages.filter(l=>!n.packages[l]),types:c.types.filter(l=>!n.types[l])},t);(await Promise.all(u.map(l=>i(e,l)))).forEach(l=>{Object.assign(n.types,l.types),Object.assign(n.packages,l.packages)}),(0,ah.replaceNames)(s,n),await a()};async function i(s,o){const a={packages:{},types:{}};if(o.length===0)return a;const c=`{
|
|
24
|
+
<%s key={someKey} {...props} />`,yr,or,Rn,or),K[or+yr]=!0}}return z===n?B(Bt):T(Bt),Bt}}function re(z,oe,pe){return Z(z,oe,pe,!0)}function Be(z,oe,pe){return Z(z,oe,pe,!1)}var rt=Be,Re=re;ga.Fragment=n,ga.jsx=rt,ga.jsxs=Re}()),ga}mn.env.NODE_ENV==="production"?df.exports=z3():df.exports=V3();var _=df.exports;const yX="",bX="",wX="";window._iconfont_svg_string_4776227='<svg><symbol id="icon-more" viewBox="0 0 1024 1024"><path d="M499.2 217.6m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 524.8m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path><path d="M499.2 832m0-64a64 64 0 1 0 0 128 64 64 0 1 0 0-128Z" ></path></symbol><symbol id="icon-docs" viewBox="0 0 1024 1024"><path d="M665.6 41.728c65.9456 0 121.2928 45.312 136.6016 106.496 5.0688-2.6624 10.8544-4.096 16.9984-4.096a140.8 140.8 0 0 1 140.8 140.8v563.2a140.8 140.8 0 0 1-140.8 140.8H358.4a140.8512 140.8512 0 0 1-135.4752-102.4H204.8a140.8 140.8 0 0 1-140.8-140.8v-563.2A140.8 140.8 0 0 1 204.8 41.728h460.8z m140.8 177.0496v526.9504a140.8 140.8 0 0 1-140.8 140.8l-358.4 0.1024c11.7248 15.5136 30.3104 25.4976 51.2 25.4976h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64a38.3488 38.3488 0 0 1-12.8-2.1504zM665.6 118.528H204.8c-35.328 0-64 28.672-64 64v563.2c0 35.328 28.672 64 64 64h460.8c35.328 0 64-28.672 64-64v-563.2c0-35.328-28.672-64-64-64z m-153.6 281.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h256z m102.4-153.6a38.4 38.4 0 1 1 0 76.8H256a38.4 38.4 0 1 1 0-76.8h358.4z" ></path></symbol><symbol id="icon-link1" viewBox="0 0 1024 1024"><path d="M719.872 268.8l3.738 0.205 0.768 0.051-4.506-0.256a38.502 38.502 0 0 1 28.416 12.544l0.973 1.126a38.554 38.554 0 0 1 1.74 2.253l-2.713-3.379a38.605 38.605 0 0 1 9.984 25.549V563.2a38.4 38.4 0 1 1-76.8 0V394.086L281.856 758.221a38.4 38.4 0 0 1-51.712-56.832L620.646 345.6H463.872a38.4 38.4 0 0 1-38.042-33.178l-0.358-5.222a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-icon-kfckfc" viewBox="0 0 1024 1024"><path d="M53.504 102.912c-0.41 0.563 30.208 42.086 67.84 92.006L299.008 430.9 408.32 576l-7.014 7.885c-3.943 4.352-84.327 90.521-178.432 191.488C128.717 876.595 51.354 960 51.2 960.87c-0.358 0.922 16.077 1.69 39.731 1.536l40.243-0.204 13.21-14.49A217385.626 217385.626 0 0 0 440.32 629.914l4.71-5.479 37.837 50.33L610.048 843.93l89.6 118.63H836.71c114.023 0 136.858-0.358 136.141-2.458-0.563-1.484-35.328-48.025-77.312-103.782-41.984-55.603-90.01-119.398-106.65-141.568-16.793-22.17-66.15-88.064-110.028-146.074-43.879-58.163-79.821-106.598-79.821-107.366 0-1.331 231.782-251.187 310.58-334.746l22.527-23.808h-41.42l-41.217 0.154-48.179 51.814a48197.632 48197.632 0 0 1-144.23 154.88l-95.847 102.912L445.03 258.202 328.55 103.68l-137.062-0.922c-75.418-0.563-137.626-0.41-137.984 0.154z m324.762 166.4c44.8 59.7 113.97 151.5 153.65 204.288 39.732 52.531 127.796 169.677 195.892 259.994 68.045 90.47 124.365 165.376 125.286 166.707 1.178 1.69-12.288 2.253-61.235 2.253h-62.566L605.286 737.69c-286.208-379.802-430.592-571.7-432.332-574.516-1.127-1.69 11.724-2.252 61.081-2.252h62.567l81.664 108.39z" ></path></symbol><symbol id="icon-icon_telegram" viewBox="0 0 1024 1024"><path d="M824.87808 503.6032c55.8592 0 100.096 12.544 133.4272 37.5296 34.2016 26.7264 55.9104 66.7136 64.2048 120.9344h-94.208c-5.8368-27.4944-17.5104-47.5136-34.2016-60.8768-17.5104-13.312-40.8576-19.968-69.2224-19.968-35.0208 0-62.5664 12.4928-82.5856 39.168-19.968 25.856-30.0032 62.5152-30.0032 109.2608 0 47.5136 9.216 85.0432 29.184 111.7184 18.3296 25.856 45.8752 39.2192 82.5856 39.2192 63.3856 0 98.4064-31.6928 105.8816-94.208H1024.19968c-9.984 58.368-32.512 101.7344-66.7136 130.048-33.3824 27.5456-78.3872 41.728-134.2976 41.728-66.7136 0-118.4256-21.7088-155.136-65.024-35.84-41.728-53.3504-95.9488-53.3504-162.6624 0-65.024 17.5104-118.4256 52.5312-159.2832 37.5296-45.056 90.112-67.584 157.6448-67.584z m75.7248-333.6704l-53.76 245.4528a353.792 353.792 0 0 0-12.6464-0.256c-164.096 0-316.3648 113.7664-357.0176 266.752L381.63968 771.9424c-11.6224 10.9056-20.7872 20.1216-41.5744 20.1216l14.1824-205.2608 385.1776-336.7424c16.896-14.5408-3.6352-21.6576-26.112-8.3968L237.76768 532.2752 32.35328 470.1696c-44.288-13.1584-44.544-42.7008 10.0352-64l800.3072-298.9568c36.5568-15.9744 71.8336 8.5504 57.856 62.72z" ></path></symbol><symbol id="icon-icon_medium" viewBox="0 0 1024 1024"><path d="M576.819712 497.6128c-0.7168 169.6768-139.5712 294.7584-293.376 292.3008C127.795712 787.4048-0.357888 656.1792 0.000512 495.2064 0.358912 334.9504 130.611712 204.032 288.819712 204.8c159.9488 0.768 288.2048 131.1744 288 292.8128m27.904-1.536c0.9216-72.9088 12.3904-143.3088 50.1248-207.0528 7.168-12.1856 15.872-23.8592 25.6512-33.9968 44.4928-46.08 99.4816-44.0832 141.312 4.5056 28.8768 33.5872 45.8752 73.216 56.064 115.8656 24.576 102.5536 21.2992 203.5712-19.968 301.6704-11.9808 28.416-28.5184 54.2208-52.9408 73.728-36.2496 29.1328-76.8 29.3888-112.5376-0.3072-39.2704-32.6656-59.4944-77.5168-70.7584-125.696-9.8304-41.984-14.2848-85.248-21.0944-128l4.1472-0.7168M1024.000512 470.5792c-3.1744 93.952-4.9152 159.8976-22.1696 224.0512-3.0208 11.264-6.656 22.7328-12.4928 32.6656-3.8912 6.656-11.776 14.3872-18.3296 14.8992-5.3248 0.4096-14.08-8.192-16.6912-14.6944-7.5776-18.7392-14.848-38.0928-18.6368-57.9584-16.384-86.3744-18.4832-173.7216-10.496-261.0176 3.584-39.424 11.9296-78.4896 19.1488-117.5552 1.792-9.728 6.7584-19.2512 11.776-27.9552 9.728-16.4864 22.3744-16.896 30.9248 0 7.68 15.2576 15.0528 31.744 17.408 48.4864 8.8064 62.0544 15.4112 124.416 19.5584 159.0784" ></path></symbol><symbol id="icon-icon_discord" viewBox="0 0 1024 1024"><path d="M831.8976 213.6064A748.032 748.032 0 0 0 641.7408 153.6c-8.192 14.848-17.7664 34.8672-24.3712 50.7904a694.8864 694.8864 0 0 0-210.688 0c-6.6048-15.872-16.384-35.8912-24.6272-50.7904a745.5744 745.5744 0 0 0-190.3104 60.16C71.424 396.4928 38.8096 574.6176 55.0912 750.2848a758.784 758.784 0 0 0 233.216 120.064c18.7904-26.0096 35.5328-53.6064 49.92-82.688a490.0864 490.0864 0 0 1-78.6432-38.4c6.656-4.9664 13.056-10.0864 19.3024-15.36 151.6544 71.2704 316.416 71.2704 466.2272 0 6.2976 5.2736 12.8 10.3936 19.3024 15.36a488.8576 488.8576 0 0 1-78.848 38.5024c14.4384 28.9792 31.1296 56.6784 49.9712 82.6368a757.2992 757.2992 0 0 0 233.3184-120.1152c19.1488-203.6224-32.6656-380.16-136.96-536.6784zM358.912 642.2528c-45.568 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0.1024 52.0192-36.5056 94.72-82.8416 94.72z m306.176 0c-45.5168 0-82.8416-42.7008-82.8416-94.72 0-51.968 36.5056-94.72 82.8416-94.72 46.336 0 83.6608 42.6496 82.8416 94.72 0 52.0192-36.5056 94.72-82.8416 94.72z" ></path></symbol><symbol id="icon-icon_del" viewBox="0 0 1024 1024"><path d="M512 64a243.2512 243.2512 0 0 1 240.1792 204.8h-1.3312a140.8 140.8 0 0 1 139.1104 162.4576l-63.6928 409.6a140.8 140.8 0 0 1-139.1616 119.1424H336.896a140.8 140.8 0 0 1-139.1616-119.1424l-63.6928-409.6A140.8 140.8 0 0 1 271.8208 268.8a243.2 243.2 0 0 1 240.1792-204.8z m238.848 281.6h-477.696A64 64 0 0 0 209.92 419.4304l63.6928 409.6A64 64 0 0 0 336.896 883.2h350.208a64 64 0 0 0 63.2832-54.1696l63.6928-409.6a64 64 0 0 0-63.232-73.8304zM409.6 473.6a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8A38.4 38.4 0 0 1 409.6 473.6z m204.8 0a38.4 38.4 0 0 1 38.4 38.4v204.8a38.4 38.4 0 1 1-76.8 0v-204.8a38.4 38.4 0 0 1 38.4-38.4z m-102.4-332.8a166.4512 166.4512 0 0 0-160.0512 120.7296l-1.8944 7.2704h323.84l-1.8432-7.2704a166.5024 166.5024 0 0 0-150.6304-120.4736L512 140.8z" ></path></symbol><symbol id="icon-plorer" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0zM726.886 324.3L577.741 764.11c-11.776 34.713-60.826 34.816-72.704 0.051L440.73 575.59l-197.94-71.987c-31.744-11.622-33.536-54.63-5.427-69.785l5.632-2.458 434.586-155.546a38.4 38.4 0 0 1 49.305 48.487z m-98.252 50.586L369.05 467.763l115.2 41.984a38.4 38.4 0 0 1 20.992 18.381l2.252 5.325 33.792 98.97 87.348-257.537z" ></path></symbol><symbol id="icon-disconnect" viewBox="0 0 1024 1024"><path d="M575.357 738.274a38.4 38.4 0 0 1 0 54.306l-72.408 72.408A243.2 243.2 0 1 1 159.012 521.05l72.408-72.408a38.4 38.4 0 1 1 54.306 54.306l-72.408 72.408a166.4 166.4 0 0 0 235.325 235.325l72.408-72.408a38.4 38.4 0 0 1 54.306 0z m-108.612-181.02a38.4 38.4 0 0 1 0 54.307L358.134 720.172a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0zM756.376 702.07a38.4 38.4 0 1 1-54.306 54.306L267.624 321.93a38.4 38.4 0 1 1 54.306-54.306L756.376 702.07z m-36.204-398.242a38.4 38.4 0 0 1 0 54.306L611.561 466.745a38.4 38.4 0 1 1-54.306-54.306l108.611-108.611a38.4 38.4 0 0 1 54.306 0z m144.816-144.816a243.2 243.2 0 0 1 0 343.937l-72.408 72.408a38.4 38.4 0 1 1-54.306-54.306l72.408-72.408a166.4 166.4 0 0 0-235.325-235.325l-72.408 72.408a38.4 38.4 0 0 1-54.306-54.306l72.408-72.408a243.2 243.2 0 0 1 343.937 0z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M665.6 396.8a140.8 140.8 0 0 1 140.8 140.8v128a140.8 140.8 0 0 1-140.8 140.8h-128a140.8 140.8 0 0 1-140.8-140.8v-128a140.8 140.8 0 0 1 140.8-140.8h128z m0 76.8h-128c-35.328 0-64 28.672-64 64v128c0 35.328 28.672 64 64 64h128c35.328 0 64-28.672 64-64v-128c0-35.328-28.672-64-64-64z" ></path><path d="M537.6 217.6c49.46 0 89.6 40.14 89.6 89.6v25.6a38.4 38.4 0 0 1-76.8 0v-25.6a12.8 12.8 0 0 0-12.8-12.8H307.2a12.8 12.8 0 0 0-12.8 12.8v230.4c0 7.066 5.734 12.8 12.8 12.8h25.6a38.4 38.4 0 0 1 0 76.8h-25.6a89.6 89.6 0 0 1-89.6-89.6V307.2c0-49.46 40.14-89.6 89.6-89.6h230.4z" ></path></symbol><symbol id="icon-link" viewBox="0 0 1024 1024"><path d="M436.992 281.6a38.4 38.4 0 0 1 0 76.8 217.6 217.6 0 1 0 217.6 217.6 38.4 38.4 0 1 1 76.8 0 294.4 294.4 0 1 1-294.4-294.4z m385.28-102.4l3.8912 0.2048 0.6144 0.0512-4.5056-0.256a38.2464 38.2464 0 0 1 28.416 12.544l0.8704 1.024a38.5536 38.5536 0 0 1 2.0992 2.7136l-2.9696-3.7376a38.656 38.656 0 0 1 9.984 25.5488V473.6a38.4 38.4 0 1 1-76.8 0V304.4864l-399.616 364.1344a38.4 38.4 0 0 1-51.712-56.832L723.0464 256H566.272a38.4 38.4 0 0 1-38.0416-33.1776l-0.3584-5.2224a38.4 38.4 0 0 1 38.4-38.4h256z" ></path></symbol><symbol id="icon-unfold" viewBox="0 0 2048 1024"><path d="M565.248 78.131a76.8 76.8 0 0 1 108.544 0l362.086 361.984a25.6 25.6 0 0 0 36.25 0l361.984-361.984a76.8 76.8 0 0 1 108.544 108.544l-361.984 362.189a179.2 179.2 0 0 1-253.44 0L565.248 186.675a76.8 76.8 0 0 1 0-108.544z" ></path></symbol><symbol id="icon-rpc" viewBox="0 0 1024 1024"><path d="M204.8 678.4a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m168.96-573.44a268.8 268.8 0 0 1 207.872 439.245l38.144 38.144a192 192 0 1 1-55.603 53.094l-39.27-39.373A268.8 268.8 0 1 1 373.76 104.96zM204.8 755.2a64 64 0 1 0 0 128 64 64 0 0 0 0-128z m517.12-125.44a115.2 115.2 0 1 0 0 230.4 115.2 115.2 0 0 0 0-230.4z m-348.16-448a192 192 0 1 0 0 384 192 192 0 0 0 0-384zM819.2 64a140.8 140.8 0 1 1 0 281.6 140.8 140.8 0 0 1 0-281.6z m0 76.8a64 64 0 1 0 0 128 64 64 0 0 0 0-128z" ></path></symbol><symbol id="icon-mev" viewBox="0 0 1024 1024"><path d="M651.162 95.488c53.401 56.422 131.84 113.818 235.212 171.674a38.4 38.4 0 0 1 19.456 29.9c12.032 129.024-12.544 251.75-73.625 367.156-60.211 113.817-158.976 226.457-295.936 338.33a38.4 38.4 0 0 1-48.589 0C356.608 895.436 259.328 782.181 196.045 662.681c-64.103-121.19-90.266-243.405-77.824-365.876a38.4 38.4 0 0 1 20.531-30.259C239.923 214.323 319.846 156.98 378.624 94.925c104.96-110.95 169.37-108.442 272.538 0.512z m126.464 196.506l-1.178 0.819a41.933 41.933 0 0 1-10.035 3.84c-4.25 1.024-5.427 1.28-14.695 3.328a122.368 122.368 0 0 0-16.896 4.403c-43.878 16.384-71.168 47.411-83.097 96.666-2.304 9.625-3.328 20.838-3.687 38.4l-0.204 13.516v15.872l0.05 9.728v2.048l0.052 3.482c0.256 35.328 0.154 51.2-1.024 71.424-4.506 79.36-42.291 140.39-108.954 178.483-29.542 16.896-61.9 23.962-99.328 23.91h-8.704a9243.136 9243.136 0 0 0-29.286-0.153h-17.46l-10.034-0.051h-22.938c40.448 50.841 88.371 100.71 143.77 149.504l17.97 15.513 17.511-14.899c101.018-88.064 176.077-175.513 225.28-262.144l9.523-17.408c50.893-96.205 73.063-197.273 66.56-303.974l-3.584-2.407a1479.786 1479.786 0 0 1-49.664-29.9z m-171.52 5.12h-1.127c-15.155 0.102-30.054 3.584-45.107 10.598-46.285 21.504-77.056 71.373-76.39 128.051 0.307 25.703 0.256 51.354 0 87.603l-0.103 10.445c-0.102 14.49-0.512 24.371-1.74 34.816-4.865 42.803-19.661 79.77-43.674 110.285l-1.792 2.15 1.331 0.052h1.331c24.832 0 44.288-4.199 61.03-13.824 44.033-25.19 67.38-62.72 70.4-116.122 1.025-18.022 1.127-32.768 0.871-66.56v-5.478l-0.051-5.223v-21.504c0-5.12 0.051-9.728 0.153-14.49 0.512-22.681 1.895-38.604 5.837-54.937a225.075 225.075 0 0 1 35.687-79.514l4.71-6.246h-11.366z m1.484-136.295l-12.236-12.544c-73.728-77.926-87.245-78.438-160.973-0.563-60.467 63.898-139.674 122.112-237.466 174.95l-3.942 2.048-0.768 17.562c-2.407 88.064 18.176 176.384 61.952 265.42l9.779 19.047c9.267 17.51 19.354 34.919 30.26 52.224l-0.871 0.154c2.406-0.512 2.406-0.512 6.144-0.973 15.104-1.536 29.593-6.86 43.776-15.974 36.454-23.552 56.883-56.576 62.105-102.247 0.82-7.168 1.127-14.848 1.23-26.726l0.102-10.343c0.256-35.84 0.307-61.132 0-86.22-1.024-86.58 46.899-164.199 120.78-198.554a183.552 183.552 0 0 1 77.312-17.766h1.536l53.044 0.256h16.076a775.117 775.117 0 0 1-67.84-59.75z" ></path></symbol><symbol id="icon-caution" viewBox="0 0 1024 1024"><path d="M512 682.666667c-47.146667 0-85.333333-42.112-85.333333-94.037334V94.037333C426.666667 42.112 464.853333 0 512 0s85.333333 42.112 85.333333 94.037333v494.592C597.333333 640.554667 559.146667 682.666667 512 682.666667zM512 1024c-47.146667 0-85.333333-35.2-85.333333-78.592v-98.816C426.666667 803.2 464.853333 768 512 768s85.333333 35.2 85.333333 78.592v98.816C597.333333 988.8 559.146667 1024 512 1024z" ></path></symbol><symbol id="icon-settings" viewBox="0 0 1024 1024"><path d="M608 62.31l245.453 141.67a192 192 0 0 1 96 166.298v283.444a192 192 0 0 1-96 166.297L608 961.69a192 192 0 0 1-192 0L170.547 820.02a192 192 0 0 1-96-166.297V370.278a192 192 0 0 1 95.949-166.297L415.949 62.31a192 192 0 0 1 192 0z m-153.6 66.51L208.947 270.49a115.2 115.2 0 0 0-57.6 99.84v283.392a115.2 115.2 0 0 0 57.6 99.788L454.4 895.18a115.2 115.2 0 0 0 115.2 0l245.453-141.67a115.2 115.2 0 0 0 57.6-99.84V370.33a115.2 115.2 0 0 0-57.6-99.79L569.6 128.87a115.2 115.2 0 0 0-115.2 0z m104.858 211.762a89.6 89.6 0 0 1 77.568 44.8l47.257 81.818a89.6 89.6 0 0 1 0 89.6l-47.257 81.818a89.6 89.6 0 0 1-77.568 44.8h-94.516a89.6 89.6 0 0 1-77.568-44.8L339.917 556.8a89.6 89.6 0 0 1 0-89.6l47.257-81.818a89.6 89.6 0 0 1 77.568-44.8h94.516z m0 76.8h-94.516a12.8 12.8 0 0 0-11.059 6.4L406.426 505.6a12.8 12.8 0 0 0 0 12.8l47.257 81.818a12.8 12.8 0 0 0 11.06 6.4h94.515a12.8 12.8 0 0 0 11.059-6.4l47.257-81.818a12.8 12.8 0 0 0 0-12.8l-47.257-81.818a12.8 12.8 0 0 0-11.06-6.4z" ></path></symbol><symbol id="icon-back" viewBox="0 0 1024 1024"><path d="M67.738 495.616l36.3 32.358 220.468 194.868c13.926 12.236 14.438 33.792 1.024 46.796l-0.41 0.41a31.898 31.898 0 0 1-44.288 0L20.736 518.554a31.744 31.744 0 0 1 0-45.773l260.096-251.597a31.898 31.898 0 0 1 44.288 0l0.46 0.41a31.846 31.846 0 0 1-1.023 46.848l-220.57 194.816-36.352 32.358z" ></path></symbol><symbol id="icon-wallet" viewBox="0 0 1024 1024"><path d="M825.6 115.2A134.4 134.4 0 0 1 960 249.6v384c0 60.877-40.448 112.282-95.949 128.82L864 785.868a140.8 140.8 0 0 1-179.456 135.373l-467.2-133.479A140.8 140.8 0 0 1 115.2 652.288V249.6a134.4 134.4 0 0 1 134.4-134.4h576zM256 225.331c-35.328 0-64 28.672-64 64V652.34c0 28.57 18.944 53.709 46.438 61.543l467.2 133.478a64 64 0 0 0 81.562-61.491v-47.616a38.502 38.502 0 0 1 0-17.306V422.861a64 64 0 0 0-46.438-61.543l-467.2-133.478A64 64 0 0 0 256 225.28zM825.6 192H427.827l334.029 95.437A140.8 140.8 0 0 1 864 422.86v253.645c11.776-10.548 19.2-25.856 19.2-42.906v-384c0-31.795-25.805-57.6-57.6-57.6z m-192 259.226a38.4 38.4 0 0 1 38.4 38.4V633.6a38.4 38.4 0 1 1-76.8 0V489.574a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-star" viewBox="0 0 1024 1024"><path d="M474.778 72.653a84.992 84.992 0 0 1 113.1 37.683l90.727 179.712c1.024 2.15 3.277 3.686 5.939 4.096l202.906 29.082c18.278 2.56 35.174 11.059 48.128 24.064a83.302 83.302 0 0 1-1.23 119.09l-148.12 142.542a6.605 6.605 0 0 0-2.049 5.939l34.765 195.584c3.277 18.483 0.154 37.58-8.806 54.17a85.043 85.043 0 0 1-114.176 34.457L515.84 804.659a8.55 8.55 0 0 0-7.885 0l-179.968 94.31c-16.589 8.705-35.635 11.674-54.118 8.5a83.968 83.968 0 0 1-68.813-97.28l34.97-195.328a6.605 6.605 0 0 0-2.048-5.94L89.702 466.484a83.61 83.61 0 0 1-24.832-48.128 83.968 83.968 0 0 1 71.732-95.078l204.339-29.184a7.834 7.834 0 0 0 5.939-4.096l89.395-179.251c8.192-16.59 21.76-29.952 38.503-38.093z m36.198 68.25l-2.56 0.767a7.475 7.475 0 0 0-3.43 3.328l-89.344 179.303c-12.39 24.832-36.301 41.933-63.847 45.875l-204.339 29.133c-4.352 0.614-7.168 4.198-6.605 7.885a6.81 6.81 0 0 0 2.048 3.89l148.275 142.49c20.173 19.354 29.338 47.36 24.423 74.804l-34.919 195.379c-0.665 3.584 1.946 7.27 6.247 8.038 1.894 0.307 3.789 0 5.427-0.819l179.968-94.31a85.35 85.35 0 0 1 79.155 0l180.173 94.361c3.994 2.1 9.011 0.615 10.957-3.02a6.4 6.4 0 0 0 0.717-4.199l-34.714-195.533a83.354 83.354 0 0 1 24.371-74.65l148.122-142.591a6.502 6.502 0 0 0 0.102-9.524 8.14 8.14 0 0 0-4.608-2.252l-202.957-29.082c-27.392-3.942-51.2-20.89-63.59-45.517l-90.726-179.712c-1.844-3.635-6.81-5.273-10.906-3.277l2.56-0.768z" ></path></symbol><symbol id="icon-trade" viewBox="0 0 1024 1024"><path d="M1002.93153 563.627l-433.237 432.64a67.243 67.243 0 0 1-29.696 21.93c-0.853 0.171-1.45 0.342-1.963 0.342a61.27 61.27 0 0 1-22.442 4.608c-1.11 0-2.304 0.853-3.414 0.853-2.048 0-3.84-1.365-5.973-1.365a54.87 54.87 0 0 1-13.653-2.987 77.312 77.312 0 0 1-15.275-6.144c-2.987-1.621-5.803-3.67-8.533-5.803-2.56-1.962-5.718-2.816-7.936-5.461L21.34153 563.627a71.68 71.68 0 0 1 0-102.059 72.704 72.704 0 0 1 102.57 0l316.16 315.477V73.472C440.07353 33.109 472.92753 0 513.29053 0a73.387 73.387 0 0 1 73.216 73.472v701.355L900.53153 461.653a72.363 72.363 0 0 1 102.4 102.059z" ></path></symbol><symbol id="icon-verticalslider" viewBox="0 0 1024 1024"><path d="M310.426 441.6a166.4 166.4 0 0 1 38.4 328.346V870.4a38.4 38.4 0 1 1-76.8 0V769.946a166.451 166.451 0 0 1 38.4-328.346z m0 76.8a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2z m403.2-403.2a38.4 38.4 0 0 1 38.4 38.4v55.654a166.451 166.451 0 0 1-38.4 328.346 166.4 166.4 0 0 1-38.4-328.346V153.6a38.4 38.4 0 0 1 38.4-38.4z m0 166.4a89.6 89.6 0 1 0 0 179.2 89.6 89.6 0 0 0 0-179.2zM310.323 115.2a38.4 38.4 0 0 1 38.4 38.4v146.534a38.4 38.4 0 0 1-76.8 0V153.6a38.4 38.4 0 0 1 38.4-38.4z m403.2 525.26a38.4 38.4 0 0 1 38.4 38.4V870.4a38.4 38.4 0 1 1-76.8 0V678.86a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-swap" viewBox="0 0 1024 1024"><path d="M321.434 116.224a51.2 51.2 0 0 1 69.888 74.752c-47.77 44.646-87.04 81.818-117.658 111.462l-1.997 1.844h289.229a51.2 51.2 0 0 1 50.842 45.26l0.358 5.94a51.2 51.2 0 0 1-51.2 51.2H154.47a51.763 51.763 0 0 1-52.07-52.839c0.205-11.52 3.123-19.097 7.782-27.136 3.226-5.53 7.22-10.752 12.8-17.203 8.192-9.626 20.992-23.04 38.656-40.704a7171.584 7171.584 0 0 1 159.744-152.576z m509.593 188.058a51.2 51.2 0 0 1 0 102.4h-93.593a51.2 51.2 0 0 1 0-102.4h93.593zM663.194 853.709a51.2 51.2 0 0 1-69.888-74.803c47.77-44.647 87.04-81.818 117.657-111.412l2.048-1.894H153.6a51.2 51.2 0 0 1-50.842-45.21l-0.358-5.99a51.2 51.2 0 0 1 51.2-51.2h676.557c27.904 0 52.582 22.272 52.07 52.838a51.456 51.456 0 0 1-7.782 27.136c-3.226 5.53-7.22 10.752-12.8 17.204-8.192 9.625-20.992 23.04-38.656 40.704a7171.584 7171.584 0 0 1-159.744 152.627z" ></path></symbol><symbol id="icon-star_sel" viewBox="0 0 1024 1024"><path d="M470.63 127.846L381.286 307.2a46.182 46.182 0 0 1-34.918 24.986l-204.34 29.184a45.568 45.568 0 0 0-39.167 51.456 45.344 45.344 0 0 0 13.465 26.01l148.276 142.438c10.905 10.496 15.872 25.6 13.21 40.448l-34.97 195.328a45.568 45.568 0 0 0 37.58 52.633 46.95 46.95 0 0 0 29.748-4.659l179.968-94.31a46.95 46.95 0 0 1 43.52 0l180.121 94.361c22.528 11.827 50.586 3.43 62.618-18.688a44.8 44.8 0 0 0 4.71-29.184L746.394 621.62a45.005 45.005 0 0 1 13.21-40.294l148.12-142.592a44.902 44.902 0 0 0 0.666-64.256 46.54 46.54 0 0 0-26.368-13.21l-202.956-29.081a46.182 46.182 0 0 1-34.765-24.781l-90.727-179.712a46.592 46.592 0 0 0-82.944 0.205z" ></path></symbol><symbol id="icon-tips" viewBox="0 0 1024 1024"><path d="M512 166.4a345.6 345.6 0 1 1 0 691.2 345.6 345.6 0 0 1 0-691.2z m0 76.8a268.8 268.8 0 1 0 0 537.6 268.8 268.8 0 0 0 0-537.6z m0 196.3a38.4 38.4 0 0 1 38.4 38.4v219.29a38.4 38.4 0 1 1-76.8 0V477.9a38.4 38.4 0 0 1 38.4-38.4z m0-153.087a38.4 38.4 0 0 1 38.4 38.4v45.414a38.4 38.4 0 1 1-76.8 0v-45.363a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-sel" viewBox="0 0 1024 1024"><path d="M783.36 281.2416a51.2 51.2 0 0 1 71.68 73.0624l-407.9616 400.384a51.2 51.2 0 0 1-67.8912 3.4304l-206.3872-165.376a51.2 51.2 0 1 1 64-79.9232l170.9568 137.0112 375.6032-368.64z" ></path></symbol><symbol id="icon-spread" viewBox="0 0 1024 1024"><path d="M143.36 678.4a38.4 38.4 0 0 1 38.4 38.4v112.64c0 7.066 5.734 12.8 12.8 12.8H307.2a38.4 38.4 0 1 1 0 76.8H194.56a89.6 89.6 0 0 1-89.6-89.6V716.8a38.4 38.4 0 0 1 38.4-38.4z m327.68-573.44a38.4 38.4 0 0 1 0 76.8H234.342L842.24 790.477v-242.33a38.4 38.4 0 1 1 76.8 0V829.44a89.6 89.6 0 0 1-89.6 89.6H552.96a38.4 38.4 0 1 1 0-76.8l232.346-0.051L181.76 237.773V471.04a38.4 38.4 0 0 1-76.8 0V194.56c0-49.46 40.14-89.6 89.6-89.6h276.48z m358.4 0c49.46 0 89.6 40.14 89.6 89.6V307.2a38.4 38.4 0 1 1-76.8 0V194.56a12.8 12.8 0 0 0-12.8-12.8H716.8a38.4 38.4 0 1 1 0-76.8h112.64z" ></path></symbol><symbol id="icon-refresh" viewBox="0 0 1024 1024"><path d="M601.446 178.176a344.576 344.576 0 0 1 124.621 62.413 38.4 38.4 0 0 1 5.12 55.45l-94.566 107.878a38.4 38.4 0 1 1-57.754-50.586l65.741-75.11-4.915-2.816a268.646 268.646 0 0 0-43.008-18.535l-15.104-4.505A268.8 268.8 0 1 0 771.635 581.58a38.4 38.4 0 1 1 74.189 19.865 345.6 345.6 0 1 1-244.378-423.27z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M763.392 256.512a51.2 51.2 0 0 1 0 72.3968L582.2464 509.952l183.1424 183.1424a51.2 51.2 0 0 1-72.3968 72.3968l-183.1424-183.1424-180.992 181.0432a51.2 51.2 0 0 1-72.3968-72.3968L437.504 509.952 258.56 330.9568A51.2 51.2 0 0 1 330.9568 258.56L509.952 437.504l181.0432-180.992a51.2 51.2 0 0 1 72.3968 0z" ></path></symbol><symbol id="icon-alert" viewBox="0 0 1024 1024"><path d="M558.08 125.0816c12.6464 7.5776 23.1936 18.1248 30.72 30.72L959.232 773.12a89.6 89.6 0 0 1-76.8 135.68H141.6192a89.6 89.6 0 0 1-76.8-135.68L435.1488 155.8016a89.6 89.6 0 0 1 122.9312-30.72zM501.0432 195.328L130.6624 812.5952a12.8 12.8 0 0 0 10.9568 19.4048h740.7616a12.8 12.8 0 0 0 10.9568-19.4048L522.9568 195.328a12.8 12.8 0 0 0-21.9136 0zM512 524.8a38.4 38.4 0 0 1 38.4 38.4v153.6a38.4 38.4 0 1 1-76.8 0v-153.6a38.4 38.4 0 0 1 38.4-38.4z m0-204.8a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 1 1-76.8 0V358.4a38.4 38.4 0 0 1 38.4-38.4z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M572.33 707.67l220.673-220.673a85.333 85.333 0 0 0-60.331-145.664H291.328a85.333 85.333 0 0 0-60.33 145.664L451.668 707.67a85.333 85.333 0 0 0 120.662 0z" ></path></symbol></svg>',(e=>{var t=(r=(r=document.getElementsByTagName("script"))[r.length-1]).getAttribute("data-injectcss"),r=r.getAttribute("data-disable-injectsvg");if(!r){var n,i,s,o,a,c=function(f,h){h.parentNode.insertBefore(f,h)};if(t&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch{}}n=function(){var f,h=document.createElement("div");h.innerHTML=e._iconfont_svg_string_4776227,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(f=document.body).firstChild?c(h,f.firstChild):f.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(n,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),n()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(s=n,o=e.document,a=!1,l(),o.onreadystatechange=function(){o.readyState=="complete"&&(o.onreadystatechange=null,u())})}function u(){a||(a=!0,s())}function l(){try{o.documentElement.doScroll("left")}catch{return void setTimeout(l,50)}u()}})(window);const _X="",xX="",SX="",EX="";function Fn(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const q3="1.18.0",W3="1.40.0",G3={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"};class hf extends Error{}class pf extends hf{constructor(t,r){super(t),this.code=r,this.type=G3[r]??"ServerError"}}class am extends hf{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var cm=e=>{throw TypeError(e)},mf=(e,t,r)=>t.has(e)||cm("Cannot "+r),tr=(e,t,r)=>(mf(e,t,"read from private field"),r?r.call(e):t.get(e)),Ss=(e,t,r)=>t.has(e)?cm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),oo=(e,t,r,n)=>(mf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),um=(e,t,r)=>(mf(e,t,"access private method"),r),H3=(e,t,r,n)=>({set _(i){oo(e,t,i,r)},get _(){return tr(e,t,n)}}),Es,va,hi,Cs,ya,ao,Rc,lm,fm;function K3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const X3={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class J3{constructor(t,r={}){if(Ss(this,Rc),Ss(this,Es,0),Ss(this,va,0),Ss(this,hi,null),Ss(this,Cs,null),Ss(this,ya,new Set),Ss(this,ao,new Map),this.endpoint=t,this.options={...X3,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=K3(this.endpoint))}async makeRequest(t,r){const n=await um(this,Rc,lm).call(this);return new Promise((i,s)=>{oo(this,Es,tr(this,Es)+1),tr(this,ao).set(tr(this,Es),{resolve:i,reject:s,timeout:setTimeout(()=>{tr(this,ao).delete(tr(this,Es)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:tr(this,Es),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new pf(i.message,i.code);return s})}async subscribe(t){const r=new Y3(t);return tr(this,ya).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}Es=new WeakMap,va=new WeakMap,hi=new WeakMap,Cs=new WeakMap,ya=new WeakMap,ao=new WeakMap,Rc=new WeakSet,lm=function(){return tr(this,Cs)?tr(this,Cs):(oo(this,Cs,new Promise(e=>{var t;(t=tr(this,hi))==null||t.close(),oo(this,hi,new this.options.WebSocketConstructor(this.endpoint)),tr(this,hi).addEventListener("open",()=>{oo(this,va,0),e(tr(this,hi))}),tr(this,hi).addEventListener("close",()=>{H3(this,va)._++,tr(this,va)<=this.options.maxReconnects&&setTimeout(()=>{um(this,Rc,fm).call(this)},this.options.reconnectTimeout)}),tr(this,hi).addEventListener("message",({data:r})=>{let n;try{n=JSON.parse(r)}catch(i){console.error(new Error(`Failed to parse RPC message: ${r}`,{cause:i}));return}if("id"in n&&n.id!=null&&tr(this,ao).has(n.id)){const{resolve:i,timeout:s}=tr(this,ao).get(n.id);clearTimeout(s),i(n)}else if("params"in n){const{params:i}=n;tr(this,ya).forEach(s=>{s.subscriptionId===i.subscription&&i.subscription===s.subscriptionId&&s.onMessage(i.result)})}})})),tr(this,Cs))},fm=async function(){var e;return(e=tr(this,hi))==null||e.close(),oo(this,Cs,null),Promise.allSettled([...tr(this,ya)].map(t=>t.subscribe(this)))};class Y3{constructor(t){this.subscriptionId=null,this.subscribed=!1,this.input=t}onMessage(t){this.subscribed&&this.input.onMessage(t)}async unsubscribe(t){const{subscriptionId:r}=this;return this.subscribed=!1,r==null?!1:(this.subscriptionId=null,t.makeRequest(this.input.unsubscribe,[r]))}async subscribe(t){this.subscriptionId=null,this.subscribed=!0;const r=await t.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=r)}}var dm=e=>{throw TypeError(e)},gf=(e,t,r)=>t.has(e)||dm("Cannot "+r),en=(e,t,r)=>(gf(e,t,"read from private field"),r?r.call(e):t.get(e)),Dc=(e,t,r)=>t.has(e)?dm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),vf=(e,t,r,n)=>(gf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Z3=(e,t,r)=>(gf(e,t,"access private method"),r),ba,gn,wa,yf,hm;class pm{constructor(t){Dc(this,yf),Dc(this,ba,0),Dc(this,gn),Dc(this,wa),vf(this,gn,t)}fetch(t,r){const n=en(this,gn).fetch??fetch;if(!n)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return n(t,r)}async request(t){var i,s;vf(this,ba,en(this,ba)+1);const r=await this.fetch(((i=en(this,gn).rpc)==null?void 0:i.url)??en(this,gn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":q3,"Client-Target-Api-Version":W3,"Client-Request-Method":t.method,...(s=en(this,gn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:en(this,ba),method:t.method,params:t.params})});if(!r.ok)throw new am(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new pf(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await Z3(this,yf,hm).call(this).subscribe(t);return async()=>!!await r()}}ba=new WeakMap,gn=new WeakMap,wa=new WeakMap,yf=new WeakSet,hm=function(){var e;if(!en(this,wa)){const t=en(this,gn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");vf(this,wa,new J3(((e=en(this,gn).websocket)==null?void 0:e.url)??en(this,gn).url,{WebSocketConstructor:t,...en(this,gn).websocket}))}return en(this,wa)};function mm(e){switch(e){case"mainnet":return"https://fullnode.mainnet.sui.io:443";case"testnet":return"https://fullnode.testnet.sui.io:443";case"devnet":return"https://fullnode.devnet.sui.io:443";case"localnet":return"http://127.0.0.1:9000";default:throw new Error(`Unknown network: ${e}`)}}function Q3(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<e.length;u++){const l=e.charAt(u),f=l.charCodeAt(0);if(t[f]!==255)throw new TypeError(l+" is ambiguous");t[f]=u}const r=e.length,n=e.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let l=0,f=0,h=0;const y=u.length;for(;h!==y&&u[h]===0;)h++,l++;const b=(y-h)*s+1>>>0,w=new Uint8Array(b);for(;h!==y;){let N=u[h],R=0;for(let U=b-1;(N!==0||R<f)&&U!==-1;U--,R++)N+=256*w[U]>>>0,w[U]=N%r>>>0,N=N/r>>>0;if(N!==0)throw new Error("Non-zero carry");f=R,h++}let A=b-f;for(;A!==b&&w[A]===0;)A++;let P=n.repeat(l);for(;A<b;++A)P+=e.charAt(w[A]);return P}function a(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let l=0,f=0,h=0;for(;u[l]===n;)f++,l++;const y=(u.length-l)*i+1>>>0,b=new Uint8Array(y);for(;u[l];){let N=t[u.charCodeAt(l)];if(N===255)return;let R=0;for(let U=y-1;(N!==0||R<h)&&U!==-1;U--,R++)N+=r*b[U]>>>0,b[U]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");h=R,l++}let w=y-h;for(;w!==y&&b[w]===0;)w++;const A=new Uint8Array(f+(y-w));let P=f;for(;w!==y;)A[P++]=b[w++];return A}function c(u){const l=a(u);if(l)return l;throw new Error("Non-base"+r+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var eE="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const gm=Q3(eE),co=e=>gm.encode(e),pi=e=>gm.decode(e),tE=co,rE=pi;function vn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const bf=8192;function Kr(e){if(e.length<bf)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=bf){const n=e.slice(r,r+bf);t+=String.fromCharCode(...n)}return btoa(t)}const vm=Kr,ym=vn;function uo(e){var i;const t=e.startsWith("0x")?e.slice(2):e,r=t.length%2===0?t:`0${t}`,n=((i=r.match(/[0-9a-fA-F]{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];if(n.length!==r.length/2)throw new Error(`Invalid hex string ${e}`);return Uint8Array.from(n)}function mi(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const bm=mi,wm=uo;function wf(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function nE(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}class _m{constructor(t){this.bytePosition=0,this.dataView=new DataView(t.buffer)}shift(t){return this.bytePosition+=t,this}read8(){let t=this.dataView.getUint8(this.bytePosition);return this.shift(1),t}read16(){let t=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),t}read32(){let t=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),t}read64(){let t=this.read32(),n=this.read32().toString(16)+t.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let t=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+t.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let t=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+t.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(t){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,t);return this.shift(t),n}readULEB(){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t),{value:n,length:i}=nE(r);return this.shift(i),n}readVec(t){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(t(this,i,r));return n}}function xm(e,t){switch(t){case"base58":return co(e);case"base64":return Kr(e);case"hex":return mi(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function iE(e,t){switch(t){case"base58":return pi(e);case"base64":return vn(e);case"hex":return uo(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function _f(e,t=["<",">"]){const[r,n]=t,i=[];let s="",o=0;for(let a=0;a<e.length;a++){const c=e[a];if(c===r&&o++,c===n&&o--,o===0&&c===","){i.push(s.trim()),s="";continue}s+=c}return i.push(s.trim()),i}class Sm{constructor({initialSize:t=1024,maxSize:r=1/0,allocateSize:n=1024}={}){this.bytePosition=0,this.size=t,this.maxSize=r,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(t))}ensureSizeOrGrow(t){const r=this.bytePosition+t;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(t){return this.bytePosition+=t,this}write8(t){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(t)),this.shift(1)}write16(t){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(t),!0),this.shift(2)}write32(t){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(t),!0),this.shift(4)}write64(t){return xf(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return xf(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return xf(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return wf(t).forEach(r=>this.write8(r)),this}writeVec(t,r){return this.writeULEB(t.length),Array.from(t).forEach((n,i)=>r(this,n,i,t.length)),this}*[Symbol.iterator](){for(let t=0;t<this.bytePosition;t++)yield this.dataView.getUint8(t);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(t){return xm(this.toBytes(),t)}}function xf(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var Em=e=>{throw TypeError(e)},Cm=(e,t,r)=>t.has(e)||Em("Cannot "+r),yn=(e,t,r)=>(Cm(e,t,"read from private field"),r?r.call(e):t.get(e)),$c=(e,t,r)=>t.has(e)?Em("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Bc=(e,t,r,n)=>(Cm(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),lo,_a,Lc,qi;const sE=class D3{constructor(t){$c(this,lo),$c(this,_a),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Bc(this,lo,t.write),Bc(this,_a,t.serialize??((r,n)=>{const i=new Sm({initialSize:this.serializedSize(r)??void 0,...n});return yn(this,lo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),yn(this,lo).call(this,t,r)}serialize(t,r){return this.validate(t),new Tm(this,yn(this,_a).call(this,t,r))}parse(t){const r=new _m(t);return this.read(r)}fromHex(t){return this.parse(uo(t))}fromBase58(t){return this.parse(pi(t))}fromBase64(t){return this.parse(vn(t))}transform({name:t,input:r,output:n,validate:i}){return new D3({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>yn(this,lo).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>yn(this,_a).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};lo=new WeakMap,_a=new WeakMap;let zn=sE;const Mm=Symbol.for("@mysten/serialized-bcs");function oE(e){return!!e&&typeof e=="object"&&e[Mm]===!0}class Tm{constructor(t,r){$c(this,Lc),$c(this,qi),Bc(this,Lc,t),Bc(this,qi,r)}get[Mm](){return!0}toBytes(){return yn(this,qi)}toHex(){return mi(yn(this,qi))}toBase64(){return Kr(yn(this,qi))}toBase58(){return co(yn(this,qi))}parse(){return yn(this,Lc).parse(yn(this,qi))}}Lc=new WeakMap,qi=new WeakMap;function Uc({size:e,...t}){return new zn({...t,serializedSize:()=>e})}function Sf({readMethod:e,writeMethod:t,...r}){return Uc({...r,read:n=>n[e](),write:(n,i)=>i[t](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function Ef({readMethod:e,writeMethod:t,...r}){return Uc({...r,read:n=>n[e](),write:(n,i)=>i[t](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function aE({serialize:e,...t}){const r=new zn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function cE({toBytes:e,fromBytes:t,...r}){return new zn({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return t(s)},write:(n,i)=>{const s=e(n);i.writeULEB(s.length);for(let o=0;o<s.length;o++)i.write8(s[o])},serialize:n=>{const i=e(n),s=wf(i.length),o=new Uint8Array(s.length+i.length);return o.set(s,0),o.set(i,s.length),o},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function uE(e){let t=null;function r(){return t||(t=e()),t}return new zn({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const W={u8(e){return Sf({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Sf({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Sf({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Ef({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Ef({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Ef({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return Uc({name:"bool",size:1,read:t=>t.read8()===1,write:(t,r)=>r.write8(t?1:0),...e,validate:t=>{var r;if((r=e==null?void 0:e.validate)==null||r.call(e,t),typeof t!="boolean")throw new TypeError(`Expected boolean, found ${typeof t}`)}})},uleb128(e){return aE({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(wf(t)),...e})},bytes(e,t){return Uc({name:`bytes[${e}]`,size:e,read:r=>r.readBytes(e),write:(r,n)=>{const i=new Uint8Array(r);for(let s=0;s<e;s++)n.write8(i[s]??0)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}})},string(e){return cE({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new zn({name:`${t.name}[${e}]`,read:n=>{const i=new Array(e);for(let s=0;s<e;s++)i[s]=t.read(n);return i},write:(n,i)=>{for(const s of n)t.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!n||typeof n!="object"||!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==e)throw new TypeError(`Expected array of length ${e}, found ${n.length}`)}})},option(e){return W.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:t=>t==null?{None:!0}:{Some:t},output:t=>t.$kind==="Some"?t.Some:null})},vector(e,t){return new zn({name:`vector<${e.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=e.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)e.write(i,n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!r||typeof r!="object"||!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(e,t){return new zn({name:`(${e.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<e.length;i++){const s=e[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of e)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<e.length;i++)e[i].write(r[i],n)},...t,validate:r=>{var n;if((n=t==null?void 0:t.validate)==null||n.call(t,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}})},struct(e,t,r){const n=Object.entries(t);return new zn({name:e,serializedSize:i=>{let s=0;for(const[o,a]of n){const c=a.serializedSize(i[o]);if(c==null)return null;s+=c}return s},read:i=>{const s={};for(const[o,a]of n)s[o]=a.read(i);return s},write:(i,s)=>{for(const[o,a]of n)a.write(i[o],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(e,t,r){const n=Object.entries(t);return new zn({name:e,read:i=>{const s=i.readULEB(),o=n[s];if(!o)throw new TypeError(`Unknown value ${s} for enum ${e}`);const[a,c]=o;return{[a]:(c==null?void 0:c.read(i))??!0,$kind:a}},write:(i,s)=>{const[o,a]=Object.entries(i).filter(([c])=>Object.hasOwn(t,c))[0];for(let c=0;c<n.length;c++){const[u,l]=n[c];if(u===o){s.writeULEB(c),l==null||l.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i).filter(c=>i[c]!==void 0&&Object.hasOwn(t,c));if(s.length!==1)throw new TypeError(`Expected object with one key, but found ${s.length} for type ${e}}`);const[o]=s;if(!Object.hasOwn(t,o))throw new TypeError(`Invalid enum variant ${o}`)}})},map(e,t){return W.vector(W.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},lazy(e){return uE(e)}},lE=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:_m,BcsType:zn,BcsWriter:Sm,SerializedBcs:Tm,bcs:W,decodeStr:iE,encodeStr:xm,fromB58:rE,fromB64:ym,fromBase58:pi,fromBase64:vn,fromHEX:wm,fromHex:uo,isSerializedBcs:oE,splitGenericParameters:_f,toB58:tE,toB64:vm,toBase58:co,toBase64:Kr,toHEX:bm,toHex:mi},Symbol.toStringTag,{value:"Module"})),fE=32;function Cf(e){try{return pi(e).length===fE}catch{return!1}}const Fc=32;function gi(e){return hE(e)&&pE(e)===Fc}function xa(e){return gi(e)}function dE(e){return e.includes("::")?Mf(e):e}function Mf(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,s=n.includes("<")?_f(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>dE(o.trim())):[];return{address:Fr(t),module:r,name:i,typeParams:s}}function Am(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Mf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Am(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Fr(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Fc*2,"0")}`}function vi(e,t=!1){return Fr(e,t)}function hE(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function pE(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const mE=/^vector<(.+)>$/,gE=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let Om=class ha{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(mE);if(n)return{vector:ha.parseFromStr(n[1],r)};const i=t.match(gE);if(i)return{struct:{address:r?Fr(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:ha.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return _f(t).map(n=>ha.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${ha.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(ha.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function vE(e){return W.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function yE(e){return W.enum("Option",{None:null,Some:e})}const er=W.bytes(Fc).transform({validate:e=>{const t=typeof e=="string"?e:mi(e);if(!t||!gi(Fr(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?uo(Fr(e)):e,output:e=>Fr(mi(e))}),bn=W.vector(W.u8()).transform({name:"ObjectDigest",input:e=>pi(e),output:e=>co(new Uint8Array(e)),validate:e=>{if(pi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),tn=W.struct("SuiObjectRef",{objectId:er,version:W.u64(),digest:bn}),Im=W.struct("SharedObjectRef",{objectId:er,initialSharedVersion:W.u64(),mutable:W.bool()}),Pm=W.enum("ObjectArg",{ImmOrOwnedObject:tn,SharedObject:Im,Receiving:tn}),jm=W.enum("CallArg",{Pure:W.struct("Pure",{bytes:W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Kr(new Uint8Array(e))})}),Object:Pm}),Tf=W.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:W.lazy(()=>Tf),struct:W.lazy(()=>Bm),u16:null,u32:null,u256:null}),Af=Tf.transform({input:e=>typeof e=="string"?Om.parseFromStr(e,!0):e,output:e=>Om.tagToString(e)}),Vn=W.enum("Argument",{GasCoin:null,Input:W.u16(),Result:W.u16(),NestedResult:W.tuple([W.u16(),W.u16()])}),km=W.struct("ProgrammableMoveCall",{package:er,module:W.string(),function:W.string(),typeArguments:W.vector(Af),arguments:W.vector(Vn)}),Nm=W.enum("Command",{MoveCall:km,TransferObjects:W.struct("TransferObjects",{objects:W.vector(Vn),address:Vn}),SplitCoins:W.struct("SplitCoins",{coin:Vn,amounts:W.vector(Vn)}),MergeCoins:W.struct("MergeCoins",{destination:Vn,sources:W.vector(Vn)}),Publish:W.struct("Publish",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Kr(new Uint8Array(e))})),dependencies:W.vector(er)}),MakeMoveVec:W.struct("MakeMoveVec",{type:yE(Af).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:W.vector(Vn)}),Upgrade:W.struct("Upgrade",{modules:W.vector(W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Kr(new Uint8Array(e))})),dependencies:W.vector(er),package:er,ticket:Vn})}),Rm=W.struct("ProgrammableTransaction",{inputs:W.vector(jm),commands:W.vector(Nm)}),Dm=W.enum("TransactionKind",{ProgrammableTransaction:Rm,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),$m=W.enum("TransactionExpiration",{None:null,Epoch:vE()}),Bm=W.struct("StructTag",{address:er,module:W.string(),name:W.string(),typeParams:W.vector(Tf)}),Lm=W.struct("GasData",{payment:W.vector(tn),owner:er,price:W.u64(),budget:W.u64()}),Um=W.struct("TransactionDataV1",{kind:Dm,sender:er,gasData:Lm,expiration:$m}),Fm=W.enum("TransactionData",{V1:Um}),zm=W.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Vm=W.enum("IntentVersion",{V0:null}),qm=W.enum("AppId",{Sui:null}),Wm=W.struct("Intent",{scope:zm,version:Vm,appId:qm});function Gm(e){return W.struct(`IntentMessage<${e.name}>`,{intent:Wm,value:e})}const Hm=W.enum("CompressedSignature",{ED25519:W.fixedArray(64,W.u8()),Secp256k1:W.fixedArray(64,W.u8()),Secp256r1:W.fixedArray(64,W.u8()),ZkLogin:W.vector(W.u8())}),Km=W.enum("PublicKey",{ED25519:W.fixedArray(32,W.u8()),Secp256k1:W.fixedArray(33,W.u8()),Secp256r1:W.fixedArray(33,W.u8()),ZkLogin:W.vector(W.u8())}),Xm=W.struct("MultiSigPkMap",{pubKey:Km,weight:W.u8()}),Jm=W.struct("MultiSigPublicKey",{pk_map:W.vector(Xm),threshold:W.u16()}),bE=W.struct("MultiSig",{sigs:W.vector(Hm),bitmap:W.u16(),multisig_pk:Jm}),wE=W.vector(W.u8()).transform({input:e=>typeof e=="string"?vn(e):e,output:e=>Kr(new Uint8Array(e))}),Ym=W.struct("SenderSignedTransaction",{intentMessage:Gm(Fm),txSignatures:W.vector(wE)}),_E=W.vector(Ym,{name:"SenderSignedData"}),xE=W.struct("PasskeyAuthenticator",{authenticatorData:W.vector(W.u8()),clientDataJson:W.string(),userSignature:W.vector(W.u8())}),SE=W.enum("PackageUpgradeError",{UnableToFetchPackage:W.struct("UnableToFetchPackage",{packageId:er}),NotAPackage:W.struct("NotAPackage",{objectId:er}),IncompatibleUpgrade:null,DigestDoesNotMatch:W.struct("DigestDoesNotMatch",{digest:W.vector(W.u8())}),UnknownUpgradePolicy:W.struct("UnknownUpgradePolicy",{policy:W.u8()}),PackageIDDoesNotMatch:W.struct("PackageIDDoesNotMatch",{packageId:er,ticketId:er})}),EE=W.struct("ModuleId",{address:er,name:W.string()}),Zm=W.struct("MoveLocation",{module:EE,function:W.u16(),instruction:W.u16(),functionName:W.option(W.string())}),CE=W.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:W.struct("IndexOutOfBounds",{idx:W.u16()}),SecondaryIndexOutOfBounds:W.struct("SecondaryIndexOutOfBounds",{resultIdx:W.u16(),secondaryIdx:W.u16()}),InvalidResultArity:W.struct("InvalidResultArity",{resultIdx:W.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),ME=W.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),TE=W.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:W.struct("MoveObjectTooBig",{objectSize:W.u64(),maxObjectSize:W.u64()}),MovePackageTooBig:W.struct("MovePackageTooBig",{objectSize:W.u64(),maxObjectSize:W.u64()}),CircularObjectOwnership:W.struct("CircularObjectOwnership",{object:er}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:W.option(Zm),MoveAbort:W.tuple([Zm,W.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:W.struct("CommandArgumentError",{argIdx:W.u16(),kind:CE}),TypeArgumentError:W.struct("TypeArgumentError",{argumentIdx:W.u16(),kind:ME}),UnusedValueWithoutDrop:W.struct("UnusedValueWithoutDrop",{resultIdx:W.u16(),secondaryIdx:W.u16()}),InvalidPublicFunctionReturnType:W.struct("InvalidPublicFunctionReturnType",{idx:W.u16()}),InvalidTransferObject:null,EffectsTooLarge:W.struct("EffectsTooLarge",{currentSize:W.u64(),maxSize:W.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:W.struct("PackageUpgradeError",{upgradeError:SE}),WrittenObjectsTooLarge:W.struct("WrittenObjectsTooLarge",{currentSize:W.u64(),maxSize:W.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:W.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:W.vector(er)}),AddressDeniedForCoin:W.struct("AddressDeniedForCoin",{address:er,coinType:W.string()}),CoinTypeGlobalPause:W.struct("CoinTypeGlobalPause",{coinType:W.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Qm=W.enum("ExecutionStatus",{Success:null,Failed:W.struct("ExecutionFailed",{error:TE,command:W.option(W.u64())})}),eg=W.struct("GasCostSummary",{computationCost:W.u64(),storageCost:W.u64(),storageRebate:W.u64(),nonRefundableStorageFee:W.u64()}),fo=W.enum("Owner",{AddressOwner:er,ObjectOwner:er,Shared:W.struct("Shared",{initialSharedVersion:W.u64()}),Immutable:null}),AE=W.struct("TransactionEffectsV1",{status:Qm,executedEpoch:W.u64(),gasUsed:eg,modifiedAtVersions:W.vector(W.tuple([er,W.u64()])),sharedObjects:W.vector(tn),transactionDigest:bn,created:W.vector(W.tuple([tn,fo])),mutated:W.vector(W.tuple([tn,fo])),unwrapped:W.vector(W.tuple([tn,fo])),deleted:W.vector(tn),unwrappedThenDeleted:W.vector(tn),wrapped:W.vector(tn),gasObject:W.tuple([tn,fo]),eventsDigest:W.option(bn),dependencies:W.vector(bn)}),Of=W.tuple([W.u64(),bn]),OE=W.enum("ObjectIn",{NotExist:null,Exist:W.tuple([Of,fo])}),IE=W.enum("ObjectOut",{NotExist:null,ObjectWrite:W.tuple([bn,fo]),PackageWrite:Of}),PE=W.enum("IDOperation",{None:null,Created:null,Deleted:null}),jE=W.struct("EffectsObjectChange",{inputState:OE,outputState:IE,idOperation:PE}),kE=W.enum("UnchangedSharedKind",{ReadOnlyRoot:Of,MutateDeleted:W.u64(),ReadDeleted:W.u64(),Cancelled:W.u64(),PerEpochConfig:null}),NE=W.struct("TransactionEffectsV2",{status:Qm,executedEpoch:W.u64(),gasUsed:eg,transactionDigest:bn,gasObjectIndex:W.option(W.u32()),eventsDigest:W.option(bn),dependencies:W.vector(bn),lamportVersion:W.u64(),changedObjects:W.vector(W.tuple([er,jE])),unchangedSharedObjects:W.vector(W.tuple([er,kE])),auxDataDigest:W.option(bn)}),RE=W.enum("TransactionEffects",{V1:AE,V2:NE}),If={...W,U8:W.u8(),U16:W.u16(),U32:W.u32(),U64:W.u64(),U128:W.u128(),U256:W.u256(),ULEB128:W.uleb128(),Bool:W.bool(),String:W.string(),Address:er,AppId:qm,Argument:Vn,CallArg:jm,CompressedSignature:Hm,GasData:Lm,Intent:Wm,IntentMessage:Gm,IntentScope:zm,IntentVersion:Vm,MultiSig:bE,MultiSigPkMap:Xm,MultiSigPublicKey:Jm,ObjectArg:Pm,ObjectDigest:bn,ProgrammableMoveCall:km,ProgrammableTransaction:Rm,PublicKey:Km,SenderSignedData:_E,SenderSignedTransaction:Ym,SharedObjectRef:Im,StructTag:Bm,SuiObjectRef:tn,Command:Nm,TransactionData:Fm,TransactionDataV1:Um,TransactionExpiration:$m,TransactionKind:Dm,TypeTag:Af,TransactionEffects:RE,PasskeyAuthenticator:xE},tg="…";function DE(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${tg}${e.slice(-4)}`}function $E(e){return`${e.slice(0,10)}${tg}`}const rg=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,ng=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,BE=235;function ig(e){return e.length>BE?!1:e.includes("@")?rg.test(e):ng.test(e)}function sg(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!rg.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!ng.test(r))throw new Error(`Invalid SuiNS name ${e}`);n=r.split(".").slice(0,-1)}return t==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}const LE=9,UE=BigInt(1e9),FE="0x1",og="0x2",zE="0x3",VE=vi("0x6"),qE="sui_system",Pf=`${og}::sui::SUI`,WE=vi("0x5"),GE=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,HE=/^\d+$/,KE=64,ag="/",cg=e=>{const t=e.split(ag);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!HE.test(i)||!ig(r)?!1:GE.test(n)&&n.length<KE},XE=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(ag)&&!cg(r))return!1;return!0};function jf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function JE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ug(e,...t){if(!JE(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function lg(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function YE(e,t){ug(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zc=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Ms=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),fg=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,yi=Ms?e=>e:e=>fg(e);function ho(e){for(let t=0;t<e.length;t++)e[t]=fg(e[t])}function ZE(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Sa(e){return typeof e=="string"&&(e=ZE(e)),ug(e),e}let QE=class{clone(){return this._cloneInto()}};function eC(e){const t=(n,i)=>e(i).update(Sa(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const tC=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class rC extends QE{constructor(t,r,n={},i,s,o){if(super(),this.blockLen=t,this.outputLen=r,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,jf(t),jf(r),jf(i),r<0||r>i)throw new Error("outputLen bigger than keyLen");if(n.key!==void 0&&(n.key.length<1||n.key.length>i))throw new Error("key length must be undefined or 1.."+i);if(n.salt!==void 0&&n.salt.length!==s)throw new Error("salt must be undefined or "+s);if(n.personalization!==void 0&&n.personalization.length!==o)throw new Error("personalization must be undefined or "+o);this.buffer=new Uint8Array(t),this.buffer32=zc(this.buffer)}update(t){lg(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=Sa(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(Ms||ho(i),this.compress(i,0,!1),Ms||ho(i),this.pos=0);const u=Math.min(r-this.pos,s-c),l=o+c;if(u===r&&!(l%4)&&c+u<s){const f=new Uint32Array(a,l,Math.floor((s-c)/4));Ms||ho(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);Ms||ho(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){lg(this),YE(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),Ms||ho(n),this.compress(n,0,!0),Ms||ho(n);const i=zc(t);this.get().forEach((s,o)=>i[o]=yi(s))}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){const{buffer:r,length:n,finished:i,destroyed:s,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.length=n,t.finished=i,t.destroyed=s,t.outputLen=o,t.buffer.set(r),t.pos=a,t}}const Vc=BigInt(2**32-1),kf=BigInt(32);function dg(e,t=!1){return t?{h:Number(e&Vc),l:Number(e>>kf&Vc)}:{h:Number(e>>kf&Vc)|0,l:Number(e&Vc)|0}}function nC(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=dg(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const iC=(e,t)=>BigInt(e>>>0)<<kf|BigInt(t>>>0),sC=(e,t,r)=>e>>>r,oC=(e,t,r)=>e<<32-r|t>>>r,aC=(e,t,r)=>e>>>r|t<<32-r,cC=(e,t,r)=>e<<32-r|t>>>r,uC=(e,t,r)=>e<<64-r|t>>>r-32,lC=(e,t,r)=>e>>>r-32|t<<64-r,fC=(e,t)=>t,dC=(e,t)=>e,hC=(e,t,r)=>e<<r|t>>>32-r,pC=(e,t,r)=>t<<r|e>>>32-r,mC=(e,t,r)=>t<<r-32|e>>>64-r,gC=(e,t,r)=>e<<r-32|t>>>64-r;function vC(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const Nr={fromBig:dg,split:nC,toBig:iC,shrSH:sC,shrSL:oC,rotrSH:aC,rotrSL:cC,rotrBH:uC,rotrBL:lC,rotr32H:fC,rotr32L:dC,rotlSH:hC,rotlSL:pC,rotlBH:mC,rotlBL:gC,add:vC,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},fr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Pe=new Uint32Array(32);function Wi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],w=Pe[2*n+1],A=Nr.add3L(c,l,o);u=Nr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Nr.rotr32H(w,b),Dl:Nr.rotr32L(w,b)},{h:y,l:h}=Nr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Nr.rotrSH(f,l,24),Bl:Nr.rotrSL(f,l,24)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=w}function Gi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Pe[2*e],u=Pe[2*e+1],l=Pe[2*t],f=Pe[2*t+1],h=Pe[2*r],y=Pe[2*r+1],b=Pe[2*n],w=Pe[2*n+1],A=Nr.add3L(c,l,o);u=Nr.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Nr.rotrSH(w,b,16),Dl:Nr.rotrSL(w,b,16)},{h:y,l:h}=Nr.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Nr.rotrBH(f,l,63),Bl:Nr.rotrBL(f,l,63)},Pe[2*e]=c,Pe[2*e+1]=u,Pe[2*t]=l,Pe[2*t+1]=f,Pe[2*r]=h,Pe[2*r+1]=y,Pe[2*n]=b,Pe[2*n+1]=w}class hg extends rC{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=fr[0]|0,this.v0h=fr[1]|0,this.v1l=fr[2]|0,this.v1h=fr[3]|0,this.v2l=fr[4]|0,this.v2h=fr[5]|0,this.v3l=fr[6]|0,this.v3h=fr[7]|0,this.v4l=fr[8]|0,this.v4h=fr[9]|0,this.v5l=fr[10]|0,this.v5h=fr[11]|0,this.v6l=fr[12]|0,this.v6h=fr[13]|0,this.v7l=fr[14]|0,this.v7h=fr[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=zc(Sa(t.salt));this.v4l^=yi(n[0]),this.v4h^=yi(n[1]),this.v5l^=yi(n[2]),this.v5h^=yi(n[3])}if(t.personalization){const n=zc(Sa(t.personalization));this.v6l^=yi(n[0]),this.v6h^=yi(n[1]),this.v7l^=yi(n[2]),this.v7h^=yi(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(Sa(t.key)),this.update(n)}}get(){let{v0l:t,v0h:r,v1l:n,v1h:i,v2l:s,v2h:o,v3l:a,v3h:c,v4l:u,v4h:l,v5l:f,v5h:h,v6l:y,v6h:b,v7l:w,v7h:A}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,A){this.v0l=t|0,this.v0h=r|0,this.v1l=n|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=u|0,this.v4h=l|0,this.v5l=f|0,this.v5h=h|0,this.v6l=y|0,this.v6h=b|0,this.v7l=w|0,this.v7h=A|0}compress(t,r,n){this.get().forEach((c,u)=>Pe[u]=c),Pe.set(fr,16);let{h:i,l:s}=Nr.fromBig(BigInt(this.length));Pe[24]=fr[8]^s,Pe[25]=fr[9]^i,n&&(Pe[28]=~Pe[28],Pe[29]=~Pe[29]);let o=0;const a=tC;for(let c=0;c<12;c++)Wi(0,4,8,12,t,r+2*a[o++]),Gi(0,4,8,12,t,r+2*a[o++]),Wi(1,5,9,13,t,r+2*a[o++]),Gi(1,5,9,13,t,r+2*a[o++]),Wi(2,6,10,14,t,r+2*a[o++]),Gi(2,6,10,14,t,r+2*a[o++]),Wi(3,7,11,15,t,r+2*a[o++]),Gi(3,7,11,15,t,r+2*a[o++]),Wi(0,5,10,15,t,r+2*a[o++]),Gi(0,5,10,15,t,r+2*a[o++]),Wi(1,6,11,12,t,r+2*a[o++]),Gi(1,6,11,12,t,r+2*a[o++]),Wi(2,7,8,13,t,r+2*a[o++]),Gi(2,7,8,13,t,r+2*a[o++]),Wi(3,4,9,14,t,r+2*a[o++]),Gi(3,4,9,14,t,r+2*a[o++]);this.v0l^=Pe[0]^Pe[16],this.v0h^=Pe[1]^Pe[17],this.v1l^=Pe[2]^Pe[18],this.v1h^=Pe[3]^Pe[19],this.v2l^=Pe[4]^Pe[20],this.v2h^=Pe[5]^Pe[21],this.v3l^=Pe[6]^Pe[22],this.v3h^=Pe[7]^Pe[23],this.v4l^=Pe[8]^Pe[24],this.v4h^=Pe[9]^Pe[25],this.v5l^=Pe[10]^Pe[26],this.v5h^=Pe[11]^Pe[27],this.v6l^=Pe[12]^Pe[28],this.v6h^=Pe[13]^Pe[29],this.v7l^=Pe[14]^Pe[30],this.v7h^=Pe[15]^Pe[31],Pe.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const pg=eC(e=>new hg(e)),yC=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:hg,blake2b:pg},Symbol.toStringTag,{value:"Module"}));function bC(e,t,r){const n=If.Address.serialize(e).toBytes(),i=If.TypeTag.serialize(t).toBytes(),s=If.u64().serialize(r.length).toBytes(),o=pg.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${mi(o.digest().slice(0,32))}`}const wC=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:UE,MOVE_STDLIB_ADDRESS:FE,SUI_ADDRESS_LENGTH:Fc,SUI_CLOCK_OBJECT_ID:VE,SUI_DECIMALS:LE,SUI_FRAMEWORK_ADDRESS:og,SUI_SYSTEM_ADDRESS:zE,SUI_SYSTEM_MODULE_NAME:qE,SUI_SYSTEM_STATE_OBJECT_ID:WE,SUI_TYPE_ARG:Pf,deriveDynamicFieldID:bC,formatAddress:DE,formatDigest:$E,fromB64:ym,fromBase58:pi,fromBase64:vn,fromHEX:wm,fromHex:uo,isValidNamedPackage:cg,isValidNamedType:XE,isValidSuiAddress:gi,isValidSuiNSName:ig,isValidSuiObjectId:xa,isValidTransactionDigest:Cf,normalizeStructTag:Am,normalizeSuiAddress:Fr,normalizeSuiNSName:sg,normalizeSuiObjectId:vi,parseStructTag:Mf,toB64:vm,toBase58:co,toBase64:Kr,toHEX:bm,toHex:mi},Symbol.toStringTag,{value:"Module"}));var Nf=Object.defineProperty,_C=Object.getOwnPropertyDescriptor,xC=Object.getOwnPropertyNames,SC=Object.prototype.hasOwnProperty,EC=(e,t)=>{for(var r in t)Nf(e,r,{get:t[r],enumerable:!0})},CC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xC(t))!SC.call(e,i)&&i!==r&&Nf(e,i,{get:()=>t[i],enumerable:!(n=_C(t,i))||n.enumerable});return e},MC=e=>CC(Nf({},"__esModule",{value:!0}),e),mg={};EC(mg,{BIC_REGEX:()=>vg,CUID2_REGEX:()=>yg,DECIMAL_REGEX:()=>bg,EMAIL_REGEX:()=>wg,EMOJI_REGEX:()=>_g,HEXADECIMAL_REGEX:()=>xg,HEX_COLOR_REGEX:()=>Sg,IMEI_REGEX:()=>Eg,IPV4_REGEX:()=>Cg,IPV6_REGEX:()=>Mg,IP_REGEX:()=>Tg,ISO_DATE_REGEX:()=>Ag,ISO_DATE_TIME_REGEX:()=>Og,ISO_TIMESTAMP_REGEX:()=>jg,ISO_TIME_REGEX:()=>Ig,ISO_TIME_SECOND_REGEX:()=>Pg,ISO_WEEK_REGEX:()=>kg,MAC48_REGEX:()=>Ng,MAC64_REGEX:()=>Rg,MAC_REGEX:()=>Dg,OCTAL_REGEX:()=>$g,ULID_REGEX:()=>Bg,UUID_REGEX:()=>Lg,ValiError:()=>qc,_addIssue:()=>le,_isLuhnAlgo:()=>Rf,_isValidObjectKey:()=>Ts,_stringify:()=>Rr,any:()=>b1,array:()=>w1,arrayAsync:()=>_1,awaitAsync:()=>gg,bic:()=>qg,bigint:()=>x1,blob:()=>S1,boolean:()=>E1,brand:()=>Wg,bytes:()=>Gg,check:()=>Hg,checkAsync:()=>Kg,checkItems:()=>Xg,config:()=>qC,creditCard:()=>Jg,cuid2:()=>Yg,custom:()=>C1,customAsync:()=>M1,date:()=>T1,decimal:()=>Zg,deleteGlobalConfig:()=>AC,deleteGlobalMessage:()=>IC,deleteSchemaMessage:()=>jC,deleteSpecificMessage:()=>NC,email:()=>Qg,emoji:()=>ev,empty:()=>tv,endsWith:()=>rv,entriesFromList:()=>DC,enum:()=>Uf,enum_:()=>Uf,everyItem:()=>nv,excludes:()=>iv,fallback:()=>WC,fallbackAsync:()=>GC,file:()=>A1,filterItems:()=>sv,findItem:()=>ov,finite:()=>av,flatten:()=>HC,forward:()=>KC,forwardAsync:()=>XC,function:()=>Ff,function_:()=>Ff,getDefault:()=>_i,getDefaults:()=>Df,getDefaultsAsync:()=>$f,getDotPath:()=>Vg,getFallback:()=>Ca,getFallbacks:()=>Bf,getFallbacksAsync:()=>Lf,getGlobalConfig:()=>Ea,getGlobalMessage:()=>Ug,getSchemaMessage:()=>Fg,getSpecificMessage:()=>zg,hash:()=>cv,hexColor:()=>lv,hexadecimal:()=>uv,imei:()=>fv,includes:()=>dv,instance:()=>O1,integer:()=>hv,intersect:()=>I1,intersectAsync:()=>P1,ip:()=>pv,ipv4:()=>mv,ipv6:()=>gv,is:()=>JC,isOfKind:()=>$C,isOfType:()=>BC,isValiError:()=>LC,isoDate:()=>vv,isoDateTime:()=>yv,isoTime:()=>bv,isoTimeSecond:()=>wv,isoTimestamp:()=>_v,isoWeek:()=>xv,keyof:()=>YC,lazy:()=>j1,lazyAsync:()=>k1,length:()=>Sv,literal:()=>N1,looseObject:()=>R1,looseObjectAsync:()=>D1,looseTuple:()=>$1,looseTupleAsync:()=>B1,mac:()=>Ev,mac48:()=>Cv,mac64:()=>Mv,map:()=>L1,mapAsync:()=>U1,mapItems:()=>Tv,maxBytes:()=>Av,maxLength:()=>Ov,maxSize:()=>Iv,maxValue:()=>Pv,mimeType:()=>jv,minBytes:()=>kv,minLength:()=>Nv,minSize:()=>Rv,minValue:()=>Dv,multipleOf:()=>$v,nan:()=>F1,never:()=>z1,nonEmpty:()=>Bv,nonNullable:()=>V1,nonNullableAsync:()=>q1,nonNullish:()=>W1,nonNullishAsync:()=>G1,nonOptional:()=>zf,nonOptionalAsync:()=>Vf,normalize:()=>Lv,notBytes:()=>Uv,notLength:()=>Fv,notSize:()=>zv,notValue:()=>Vv,null:()=>qf,null_:()=>qf,nullable:()=>H1,nullableAsync:()=>K1,nullish:()=>X1,nullishAsync:()=>J1,number:()=>Y1,object:()=>Z1,objectAsync:()=>Q1,objectWithRest:()=>ey,objectWithRestAsync:()=>ty,octal:()=>qv,omit:()=>ZC,optional:()=>Wf,optionalAsync:()=>Gf,parse:()=>xy,parseAsync:()=>Sy,parser:()=>QC,parserAsync:()=>eM,partial:()=>tM,partialAsync:()=>rM,partialCheck:()=>Gv,partialCheckAsync:()=>Hv,pick:()=>nM,picklist:()=>Hf,pipe:()=>iM,pipeAsync:()=>sM,promise:()=>ry,rawCheck:()=>Kv,rawCheckAsync:()=>Xv,rawTransform:()=>Jv,rawTransformAsync:()=>Yv,readonly:()=>Zv,record:()=>ny,recordAsync:()=>iy,reduceItems:()=>Qv,regex:()=>e1,required:()=>oM,requiredAsync:()=>aM,safeInteger:()=>t1,safeParse:()=>Ey,safeParseAsync:()=>Cy,safeParser:()=>cM,safeParserAsync:()=>uM,set:()=>sy,setAsync:()=>oy,setGlobalConfig:()=>TC,setGlobalMessage:()=>OC,setSchemaMessage:()=>PC,setSpecificMessage:()=>kC,size:()=>r1,someItem:()=>n1,sortItems:()=>i1,startsWith:()=>s1,strictObject:()=>ay,strictObjectAsync:()=>cy,strictTuple:()=>uy,strictTupleAsync:()=>ly,string:()=>fy,symbol:()=>dy,toLowerCase:()=>o1,toMaxValue:()=>a1,toMinValue:()=>c1,toUpperCase:()=>u1,transform:()=>l1,transformAsync:()=>f1,trim:()=>d1,trimEnd:()=>h1,trimStart:()=>p1,tuple:()=>hy,tupleAsync:()=>py,tupleWithRest:()=>my,tupleWithRestAsync:()=>gy,ulid:()=>m1,undefined:()=>Kf,undefined_:()=>Kf,union:()=>vy,unionAsync:()=>yy,unknown:()=>by,unwrap:()=>lM,url:()=>g1,uuid:()=>v1,value:()=>y1,variant:()=>wy,variantAsync:()=>_y,void:()=>Jf,void_:()=>Jf});var Hi=MC(mg);function gg(){return{kind:"transformation",type:"await",reference:gg,async:!0,async _run(e){return e.value=await e.value,e}}}var vg=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,yg=/^[a-z][\da-z]*$/u,bg=/^\d+$/u,wg=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_g=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,xg=/^(?:0h|0x)?[\da-f]+$/iu,Sg=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,Eg=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,Cg=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,Mg=/^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu,Tg=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$|^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu,Ag=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,Og=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3]):[0-5]\d$/u,Ig=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,Pg=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,jg=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])T(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z|[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u,kg=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,Ng=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,Rg=/^(?:[\da-f]{2}:){7}[\da-f]{2}$|^(?:[\da-f]{2}-){7}[\da-f]{2}$|^(?:[\da-f]{4}\.){3}[\da-f]{4}$|^(?:[\da-f]{4}:){3}[\da-f]{4}$/iu,Dg=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$|^(?:[\da-f]{2}:){7}[\da-f]{2}$|^(?:[\da-f]{2}-){7}[\da-f]{2}$|^(?:[\da-f]{4}\.){3}[\da-f]{4}$|^(?:[\da-f]{4}:){3}[\da-f]{4}$/iu,$g=/^(?:0o)?[0-7]+$/iu,Bg=/^[\da-hjkmnp-tv-z]{26}$/iu,Lg=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,rn;function TC(e){rn={...rn,...e}}function Ea(e){return{lang:(e==null?void 0:e.lang)??(rn==null?void 0:rn.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(rn==null?void 0:rn.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(rn==null?void 0:rn.abortPipeEarly)}}function AC(){rn=void 0}var bi;function OC(e,t){bi||(bi=new Map),bi.set(t,e)}function Ug(e){return bi==null?void 0:bi.get(e)}function IC(e){bi==null||bi.delete(e)}var wi;function PC(e,t){wi||(wi=new Map),wi.set(t,e)}function Fg(e){return wi==null?void 0:wi.get(e)}function jC(e){wi==null||wi.delete(e)}var wn;function kC(e,t,r){wn||(wn=new Map),wn.get(e)||wn.set(e,new Map),wn.get(e).set(r,t)}function zg(e,t){var r;return(r=wn==null?void 0:wn.get(e))==null?void 0:r.get(t)}function NC(e,t){var r;(r=wn==null?void 0:wn.get(e))==null||r.delete(t)}function Rr(e){var r,n;const t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&((n=(r=Object.getPrototypeOf(e))==null?void 0:r.constructor)==null?void 0:n.name))??"null":t}function le(e,t,r,n,i){const s=i&&"input"in i?i.input:r.value,o=(i==null?void 0:i.expected)??e.expects??null,a=(i==null?void 0:i.received)??Rr(s),c={kind:e.kind,type:e.type,input:s,expected:o,received:a,message:`Invalid ${t}: ${o?`Expected ${o} but r`:"R"}eceived ${a}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},u=e.kind==="schema",l=(i==null?void 0:i.message)??e.message??zg(e.reference,c.lang)??(u?Fg(c.lang):null)??n.message??Ug(c.lang);l&&(c.message=typeof l=="function"?l(c):l),u&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}var RC=/\D/gu;function Rf(e){const t=e.replace(RC,"");let r=t.length,n=1,i=0;for(;r;){const s=+t[--r];n^=1,i+=n?[0,2,4,6,8,1,3,5,7,9][s]:s}return i%10===0}function Ts(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function DC(e,t){const r={};for(const n of e)r[n]=t;return r}function Vg(e){if(e.path){let t="";for(const r of e.path)if(typeof r.key=="string"||typeof r.key=="number")t?t+=`.${r.key}`:t+=r.key;else return null;return t}return null}function $C(e,t){return t.kind===e}function BC(e,t){return t.type===e}function LC(e){return e instanceof qc}var qc=class extends Error{constructor(t){super(t[0].message);vt(this,"issues");this.name="ValiError",this.issues=t}};function qg(e){return{kind:"validation",type:"bic",reference:qg,async:!1,expects:null,requirement:vg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function Wg(e){return{kind:"transformation",type:"brand",reference:Wg,async:!1,name:e,_run(t){return t}}}function Gg(e,t){return{kind:"validation",type:"bytes",reference:Gg,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i!==this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Hg(e,t){return{kind:"validation",type:"check",reference:Hg,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&le(this,"input",r,n),r}}}function Kg(e,t){return{kind:"validation",type:"check",reference:Kg,async:!0,expects:null,requirement:e,message:t,async _run(r,n){return r.typed&&!await this.requirement(r.value)&&le(this,"input",r,n),r}}}function Xg(e,t){return{kind:"validation",type:"check_items",reference:Xg,async:!1,expects:null,requirement:e,message:t,_run(r,n){if(r.typed)for(let i=0;i<r.value.length;i++){const s=r.value[i];this.requirement(s,i,r.value)||le(this,"item",r,n,{input:s,path:[{type:"array",origin:"value",input:r.value,key:i,value:s}]})}return r}}}var UC=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,FC=/[- ]/gu,zC=[/^3[47]\d{13}$/u,/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,/^6(?:011|5\d{2})\d{12,15}$/u,/^(?:2131|1800|35\d{3})\d{11}$/u,/^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,/^(?:6[27]\d{14,17}|81\d{14,17})$/u,/^4\d{12}(?:\d{3,6})?$/u];function Jg(e){return{kind:"validation",type:"credit_card",reference:Jg,async:!1,expects:null,requirement(t){let r;return UC.test(t)&&(r=t.replace(FC,""))&&zC.some(n=>n.test(r))&&Rf(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function Yg(e){return{kind:"validation",type:"cuid2",reference:Yg,async:!1,expects:null,requirement:yg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function Zg(e){return{kind:"validation",type:"decimal",reference:Zg,async:!1,expects:null,requirement:bg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function Qg(e){return{kind:"validation",type:"email",reference:Qg,expects:null,async:!1,requirement:wg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function ev(e){return{kind:"validation",type:"emoji",reference:ev,async:!1,expects:null,requirement:_g,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function tv(e){return{kind:"validation",type:"empty",reference:tv,async:!1,expects:"0",message:e,_run(t,r){return t.typed&&t.value.length>0&&le(this,"length",t,r,{received:`${t.value.length}`}),t}}}function rv(e,t){return{kind:"validation",type:"ends_with",reference:rv,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.endsWith(this.requirement)&&le(this,"end",r,n,{received:`"${r.value.slice(-this.requirement.length)}"`}),r}}}function nv(e,t){return{kind:"validation",type:"every_item",reference:nv,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.every(this.requirement)&&le(this,"item",r,n),r}}}function iv(e,t){const r=Rr(e);return{kind:"validation",type:"excludes",reference:iv,async:!1,expects:`!${r}`,requirement:e,message:t,_run(n,i){return n.typed&&n.value.includes(this.requirement)&&le(this,"content",n,i,{received:r}),n}}}function sv(e){return{kind:"transformation",type:"filter_items",reference:sv,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function ov(e){return{kind:"transformation",type:"find_item",reference:ov,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function av(e){return{kind:"validation",type:"finite",reference:av,async:!1,expects:null,requirement:Number.isFinite,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"finite",t,r),t}}}var VC={md4:32,md5:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8,adler32:8};function cv(e,t){return{kind:"validation",type:"hash",reference:cv,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${VC[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function uv(e){return{kind:"validation",type:"hexadecimal",reference:uv,async:!1,expects:null,requirement:xg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function lv(e){return{kind:"validation",type:"hex_color",reference:lv,async:!1,expects:null,requirement:Sg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function fv(e){return{kind:"validation",type:"imei",reference:fv,async:!1,expects:null,requirement(t){return Eg.test(t)&&Rf(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function dv(e,t){const r=Rr(e);return{kind:"validation",type:"includes",reference:dv,async:!1,expects:r,requirement:e,message:t,_run(n,i){return n.typed&&!n.value.includes(this.requirement)&&le(this,"content",n,i,{received:`!${r}`}),n}}}function hv(e){return{kind:"validation",type:"integer",reference:hv,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"integer",t,r),t}}}function pv(e){return{kind:"validation",type:"ip",reference:pv,async:!1,expects:null,requirement:Tg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function mv(e){return{kind:"validation",type:"ipv4",reference:mv,async:!1,expects:null,requirement:Cg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function gv(e){return{kind:"validation",type:"ipv6",reference:gv,async:!1,expects:null,requirement:Mg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function vv(e){return{kind:"validation",type:"iso_date",reference:vv,async:!1,expects:null,requirement:Ag,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function yv(e){return{kind:"validation",type:"iso_date_time",reference:yv,async:!1,expects:null,requirement:Og,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function bv(e){return{kind:"validation",type:"iso_time",reference:bv,async:!1,expects:null,requirement:Ig,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function wv(e){return{kind:"validation",type:"iso_time_second",reference:wv,async:!1,expects:null,requirement:Pg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function _v(e){return{kind:"validation",type:"iso_timestamp",reference:_v,async:!1,expects:null,requirement:jg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function xv(e){return{kind:"validation",type:"iso_week",reference:xv,async:!1,expects:null,requirement:kg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function Sv(e,t){return{kind:"validation",type:"length",reference:Sv,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length!==this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Ev(e){return{kind:"validation",type:"mac",reference:Ev,async:!1,expects:null,requirement:Dg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function Cv(e){return{kind:"validation",type:"mac48",reference:Cv,async:!1,expects:null,requirement:Ng,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function Mv(e){return{kind:"validation",type:"mac64",reference:Mv,async:!1,expects:null,requirement:Rg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function Tv(e){return{kind:"transformation",type:"map_items",reference:Tv,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function Av(e,t){return{kind:"validation",type:"max_bytes",reference:Av,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i>this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Ov(e,t){return{kind:"validation",type:"max_length",reference:Ov,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length>this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Iv(e,t){return{kind:"validation",type:"max_size",reference:Iv,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size>this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Pv(e,t){return{kind:"validation",type:"max_value",reference:Pv,async:!1,expects:`<=${e instanceof Date?e.toJSON():Rr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value>this.requirement&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function jv(e,t){return{kind:"validation",type:"mime_type",reference:jv,async:!1,expects:e.map(r=>`"${r}"`).join(" | ")||"never",requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.includes(r.value.type)&&le(this,"MIME type",r,n,{received:`"${r.value.type}"`}),r}}}function kv(e,t){return{kind:"validation",type:"min_bytes",reference:kv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i<this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Nv(e,t){return{kind:"validation",type:"min_length",reference:Nv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length<this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Rv(e,t){return{kind:"validation",type:"min_size",reference:Rv,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size<this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Dv(e,t){return{kind:"validation",type:"min_value",reference:Dv,async:!1,expects:`>=${e instanceof Date?e.toJSON():Rr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value<this.requirement&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function $v(e,t){return{kind:"validation",type:"multiple_of",reference:$v,async:!1,expects:`%${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value%this.requirement!==0&&le(this,"multiple",r,n),r}}}function Bv(e){return{kind:"validation",type:"non_empty",reference:Bv,async:!1,expects:"!0",message:e,_run(t,r){return t.typed&&t.value.length===0&&le(this,"length",t,r,{received:"0"}),t}}}function Lv(e){return{kind:"transformation",type:"normalize",reference:Lv,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function Uv(e,t){return{kind:"validation",type:"not_bytes",reference:Uv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){if(r.typed){const i=new TextEncoder().encode(r.value).length;i===this.requirement&&le(this,"bytes",r,n,{received:`${i}`})}return r}}}function Fv(e,t){return{kind:"validation",type:"not_length",reference:Fv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length===this.requirement&&le(this,"length",r,n,{received:`${r.value.length}`}),r}}}function zv(e,t){return{kind:"validation",type:"not_size",reference:zv,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size===this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Vv(e,t){return{kind:"validation",type:"not_value",reference:Vv,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Rr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&this.requirement<=r.value&&this.requirement>=r.value&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function qv(e){return{kind:"validation",type:"octal",reference:qv,async:!1,expects:null,requirement:$g,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function Wv(e,t){var r;if(e.issues)for(const n of t)for(const i of e.issues){let s=!1;const o=Math.min(n.length,((r=i.path)==null?void 0:r.length)??0);for(let a=0;a<o;a++)if(n[a]!==i.path[a].key){s=!0;break}if(!s)return!1}return!0}function Gv(e,t,r){return{kind:"validation",type:"partial_check",reference:Gv,async:!1,expects:null,requirement:t,message:r,_run(n,i){return Wv(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function Hv(e,t,r){return{kind:"validation",type:"partial_check",reference:Hv,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return Wv(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Kv(e){return{kind:"validation",type:"raw_check",reference:Kv,async:!1,expects:null,_run(t,r){return e({dataset:t,config:r,addIssue:n=>le(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function Xv(e){return{kind:"validation",type:"raw_check",reference:Xv,async:!0,expects:null,async _run(t,r){return await e({dataset:t,config:r,addIssue:n=>le(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function Jv(e){return{kind:"transformation",type:"raw_transform",reference:Jv,async:!1,_run(t,r){const n=e({dataset:t,config:r,addIssue:i=>le(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function Yv(e){return{kind:"transformation",type:"raw_transform",reference:Yv,async:!0,async _run(t,r){const n=await e({dataset:t,config:r,addIssue:i=>le(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function Zv(){return{kind:"transformation",type:"readonly",reference:Zv,async:!1,_run(e){return e}}}function Qv(e,t){return{kind:"transformation",type:"reduce_items",reference:Qv,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function e1(e,t){return{kind:"validation",type:"regex",reference:e1,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"format",r,n),r}}}function t1(e){return{kind:"validation",type:"safe_integer",reference:t1,async:!1,expects:null,requirement:Number.isSafeInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"safe integer",t,r),t}}}function r1(e,t){return{kind:"validation",type:"size",reference:r1,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size!==this.requirement&&le(this,"size",r,n,{received:`${r.value.size}`}),r}}}function n1(e,t){return{kind:"validation",type:"some_item",reference:n1,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.some(this.requirement)&&le(this,"item",r,n),r}}}function i1(e){return{kind:"transformation",type:"sort_items",reference:i1,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function s1(e,t){return{kind:"validation",type:"starts_with",reference:s1,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.startsWith(this.requirement)&&le(this,"start",r,n,{received:`"${r.value.slice(0,this.requirement.length)}"`}),r}}}function o1(){return{kind:"transformation",type:"to_lower_case",reference:o1,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function a1(e){return{kind:"transformation",type:"to_max_value",reference:a1,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function c1(e){return{kind:"transformation",type:"to_min_value",reference:c1,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function u1(){return{kind:"transformation",type:"to_upper_case",reference:u1,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function l1(e){return{kind:"transformation",type:"transform",reference:l1,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function f1(e){return{kind:"transformation",type:"transform",reference:f1,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function d1(){return{kind:"transformation",type:"trim",reference:d1,async:!1,_run(e){return e.value=e.value.trim(),e}}}function h1(){return{kind:"transformation",type:"trim_end",reference:h1,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function p1(){return{kind:"transformation",type:"trim_start",reference:p1,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function m1(e){return{kind:"validation",type:"ulid",reference:m1,async:!1,expects:null,requirement:Bg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function g1(e){return{kind:"validation",type:"url",reference:g1,async:!1,expects:null,requirement(t){try{return new URL(t),!0}catch{return!1}},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"URL",t,r),t}}}function v1(e){return{kind:"validation",type:"uuid",reference:v1,async:!1,expects:null,requirement:Lg,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function y1(e,t){return{kind:"validation",type:"value",reference:y1,async:!1,expects:e instanceof Date?e.toJSON():Rr(e),requirement:e,message:t,_run(r,n){return r.typed&&!(this.requirement<=r.value&&this.requirement>=r.value)&&le(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Rr(r.value)}),r}}}function qC(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function Ca(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function WC(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:Ca(this,r,n)}:r}}}function GC(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await Ca(this,r,n)}:r}}}function HC(e){const t={};for(const r of e)if(r.path){const n=Vg(r);n?(t.nested||(t.nested={}),t.nested[n]?t.nested[n].push(r.message):t.nested[n]=[r.message]):t.other?t.other.push(r.message):t.other=[r.message]}else t.root?t.root.push(r.message):t.root=[r.message];return t}function KC(e,t){return{...e,_run(r,n){const i=r.issues&&[...r.issues];if(e._run(r,n),r.issues){for(const s of r.issues)if(!(i!=null&&i.includes(s))){let o=r.value;for(const a of t){const c=o[a],u={type:"unknown",origin:"value",input:o,key:a,value:c};if(s.path?s.path.push(u):s.path=[u],!c)break;o=c}}}return r}}}function XC(e,t){return{...e,async:!0,async _run(r,n){const i=r.issues&&[...r.issues];if(await e._run(r,n),r.issues){for(const s of r.issues)if(!(i!=null&&i.includes(s))){let o=r.value;for(const a of t){const c=o[a],u={type:"unknown",origin:"value",input:o,key:a,value:c};if(s.path?s.path.push(u):s.path=[u],!c)break;o=c}}}return r}}}function _i(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Df(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Df(e.entries[r]);return t}return"items"in e?e.items.map(Df):_i(e)}async function $f(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await $f(r)]))):"items"in e?Promise.all(e.items.map($f)):_i(e)}function Bf(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Bf(e.entries[r]);return t}return"items"in e?e.items.map(Bf):Ca(e)}async function Lf(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Lf(r)]))):"items"in e?Promise.all(e.items.map(Lf)):Ca(e)}function JC(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function b1(){return{kind:"schema",type:"any",reference:b1,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function w1(e,t){return{kind:"schema",type:"array",reference:w1,expects:"Array",async:!1,item:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<i.length;o++){const a=i[o],c=this.item._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else le(this,"type",r,n);return r}}}function _1(e,t){return{kind:"schema",type:"array",reference:_1,expects:"Array",async:!0,item:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(i.map(a=>this.item._run({typed:!1,value:a},n)));for(let a=0;a<o.length;a++){const c=o[a];if(c.issues){const u={type:"array",origin:"value",input:i,key:a,value:i[a]};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else le(this,"type",r,n);return r}}}function x1(e){return{kind:"schema",type:"bigint",reference:x1,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function S1(e){return{kind:"schema",type:"blob",reference:S1,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function E1(e){return{kind:"schema",type:"boolean",reference:E1,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function C1(e,t){return{kind:"schema",type:"custom",reference:C1,expects:"unknown",async:!1,check:e,message:t,_run(r,n){return this.check(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function M1(e,t){return{kind:"schema",type:"custom",reference:M1,expects:"unknown",async:!0,check:e,message:t,async _run(r,n){return await this.check(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function T1(e){return{kind:"schema",type:"date",reference:T1,expects:"Date",async:!1,message:e,_run(t,r){return t.value instanceof Date?isNaN(t.value)?le(this,"type",t,r,{received:'"Invalid Date"'}):t.typed=!0:le(this,"type",t,r),t}}}function Uf(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:Uf,expects:r.map(Rr).join(" | ")||"never",async:!1,enum:e,options:r,message:t,_run(n,i){return this.options.includes(n.value)?n.typed=!0:le(this,"type",n,i),n}}}function A1(e){return{kind:"schema",type:"file",reference:A1,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function Ff(e){return{kind:"schema",type:"function",reference:Ff,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function O1(e,t){return{kind:"schema",type:"instance",reference:O1,expects:e.name,async:!1,class:e,message:t,_run(r,n){return r.value instanceof this.class?r.typed=!0:le(this,"type",r,n),r}}}function Wc(e,t){if(typeof e==typeof t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{value:e};if(e&&t&&e.constructor===Object&&t.constructor===Object){for(const r in t)if(r in e){const n=Wc(e[r],t[r]);if(n.issue)return n;e[r]=n.value}else e[r]=t[r];return{value:e}}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let r=0;r<e.length;r++){const n=Wc(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function I1(e,t){return{kind:"schema",type:"intersect",reference:I1,expects:[...new Set(e.map(r=>r.expects))].join(" & ")||"never",async:!1,options:e,message:t,_run(r,n){if(this.options.length){const i=r.value;let s;r.typed=!0;for(const o of this.options){const a=o._run({typed:!1,value:i},n);if(a.issues&&(r.issues?r.issues.push(...a.issues):r.issues=a.issues,n.abortEarly)){r.typed=!1;break}a.typed||(r.typed=!1),r.typed&&(s?s.push(a.value):s=[a.value])}if(r.typed){r.value=s[0];for(let o=1;o<s.length;o++){const a=Wc(r.value,s[o]);if(a.issue){le(this,"type",r,n,{received:"unknown"});break}r.value=a.value}}}else le(this,"type",r,n);return r}}}function P1(e,t){return{kind:"schema",type:"intersect",reference:P1,expects:[...new Set(e.map(r=>r.expects))].join(" & ")||"never",async:!0,options:e,message:t,async _run(r,n){if(this.options.length){const i=r.value;let s;r.typed=!0;const o=await Promise.all(this.options.map(a=>a._run({typed:!1,value:i},n)));for(const a of o){if(a.issues&&(r.issues?r.issues.push(...a.issues):r.issues=a.issues,n.abortEarly)){r.typed=!1;break}a.typed||(r.typed=!1),r.typed&&(s?s.push(a.value):s=[a.value])}if(r.typed){r.value=s[0];for(let a=1;a<s.length;a++){const c=Wc(r.value,s[a]);if(c.issue){le(this,"type",r,n,{received:"unknown"});break}r.value=c.value}}}else le(this,"type",r,n);return r}}}function j1(e){return{kind:"schema",type:"lazy",reference:j1,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function k1(e){return{kind:"schema",type:"lazy",reference:k1,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function N1(e,t){return{kind:"schema",type:"literal",reference:N1,expects:Rr(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:le(this,"type",r,n),r}}}function R1(e,t){return{kind:"schema",type:"loose_object",reference:R1,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}if(!r.issues||!n.abortEarly)for(const o in i)Ts(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function D1(e,t){return{kind:"schema",type:"loose_object",reference:D1,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}if(!r.issues||!n.abortEarly)for(const a in i)Ts(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function $1(e,t){return{kind:"schema",type:"loose_tuple",reference:$1,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}if(!r.issues||!n.abortEarly)for(let o=this.items.length;o<i.length;o++)r.value.push(i[o])}else le(this,"type",r,n);return r}}}function B1(e,t){return{kind:"schema",type:"loose_tuple",reference:B1,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!r.issues||!n.abortEarly)for(let a=this.items.length;a<i.length;a++)r.value.push(i[a])}else le(this,"type",r,n);return r}}}function L1(e,t,r){return{kind:"schema",type:"map",reference:L1,expects:"Map",async:!1,key:e,value:t,message:r,_run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;for(const[c,u]of s){const l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"map",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path?y.path.unshift(h):y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"map",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),n.value.set(l.value,f.value)}}else le(this,"type",n,i);return n}}}function U1(e,t,r){return{kind:"schema",type:"map",reference:U1,expects:"Map",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s instanceof Map){n.typed=!0,n.value=new Map;const c=await Promise.all([...s].map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"map",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"map",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),n.value.set(f.value,h.value)}}else le(this,"type",n,i);return n}}}function F1(e){return{kind:"schema",type:"nan",reference:F1,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function z1(e){return{kind:"schema",type:"never",reference:z1,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function V1(e,t){return{kind:"schema",type:"non_nullable",reference:V1,expects:"!null",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function q1(e,t){return{kind:"schema",type:"non_nullable",reference:q1,expects:"!null",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function W1(e,t){return{kind:"schema",type:"non_nullish",reference:W1,expects:"!null & !undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null||r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function G1(e,t){return{kind:"schema",type:"non_nullish",reference:G1,expects:"!null & !undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null||r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function zf(e,t){return{kind:"schema",type:"non_optional",reference:zf,expects:"!undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function Vf(e,t){return{kind:"schema",type:"non_optional",reference:Vf,expects:"!undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===void 0?(le(this,"type",r,n),r):this.wrapped._run(r,n)}}}function qf(e){return{kind:"schema",type:"null",reference:qf,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:le(this,"type",t,r),t}}}function H1(e,...t){const r={kind:"schema",type:"nullable",reference:H1,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=_i(this,n,i)),n.value===null)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function K1(e,...t){const r={kind:"schema",type:"nullable",reference:K1,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await _i(this,n,i)),n.value===null)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function X1(e,...t){const r={kind:"schema",type:"nullish",reference:X1,expects:`${e.expects} | null | undefined`,async:!1,wrapped:e,_run(n,i){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=_i(this,n,i)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function J1(e,...t){const r={kind:"schema",type:"nullish",reference:J1,expects:`${e.expects} | null | undefined`,async:!0,wrapped:e,async _run(n,i){return(n.value===null||n.value===void 0)&&("default"in this&&(n.value=await _i(this,n,i)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Y1(e){return{kind:"schema",type:"number",reference:Y1,expects:"number",async:!1,message:e,_run(t,r){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function Z1(e,t){return{kind:"schema",type:"object",reference:Z1,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}}else le(this,"type",r,n);return r}}}function Q1(e,t){return{kind:"schema",type:"object",reference:Q1,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}}else le(this,"type",r,n);return r}}}function ey(e,t,r){return{kind:"schema",type:"object_with_rest",reference:ey,expects:"Object",async:!1,entries:e,rest:t,message:r,_run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(const c in this.entries){const u=s[c],l=this.entries[c]._run({typed:!1,value:u},i);if(l.issues){const f={type:"object",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),(l.value!==void 0||c in s)&&(n.value[c]=l.value)}if(!n.issues||!i.abortEarly){for(const c in s)if(Ts(s,c)&&!(c in this.entries)){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"object",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value[c]=l.value}}}else le(this,"type",n,i);return n}}}function ty(e,t,r){return{kind:"schema",type:"object_with_rest",reference:ty,expects:"Object",async:!0,entries:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};const[c,u]=await Promise.all([Promise.all(Object.entries(this.entries).map(async([l,f])=>{const h=s[l];return[l,h,await f._run({typed:!1,value:h},i)]})),Promise.all(Object.entries(s).filter(([l])=>Ts(s,l)&&!(l in this.entries)).map(async([l,f])=>[l,f,await this.rest._run({typed:!1,value:f},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),(h.value!==void 0||l in s)&&(n.value[l]=h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"object",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value[l]=h.value}}else le(this,"type",n,i);return n}}}function Wf(e,...t){const r={kind:"schema",type:"optional",reference:Wf,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=_i(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Gf(e,...t){const r={kind:"schema",type:"optional",reference:Gf,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await _i(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped._run(n,i)}};return 0 in t&&(r.default=t[0]),r}function Hf(e,t){return{kind:"schema",type:"picklist",reference:Hf,expects:e.map(Rr).join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){return this.options.includes(r.value)?r.typed=!0:le(this,"type",r,n),r}}}function ry(e){return{kind:"schema",type:"promise",reference:ry,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function ny(e,t,r){return{kind:"schema",type:"record",reference:ny,expects:"Object",async:!1,key:e,value:t,message:r,_run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(const c in s)if(Ts(s,c)){const u=s[c],l=this.key._run({typed:!1,value:c},i);if(l.issues){const h={type:"object",origin:"key",input:s,key:c,value:u};for(const y of l.issues)y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}const f=this.value._run({typed:!1,value:u},i);if(f.issues){const h={type:"object",origin:"value",input:s,key:c,value:u};for(const y of f.issues)y.path?y.path.unshift(h):y.path=[h],(a=n.issues)==null||a.push(y);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}(!l.typed||!f.typed)&&(n.typed=!1),l.typed&&(n.value[l.value]=f.value)}}else le(this,"type",n,i);return n}}}function iy(e,t,r){return{kind:"schema",type:"record",reference:iy,expects:"Object",async:!0,key:e,value:t,message:r,async _run(n,i){var o,a;const s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};const c=await Promise.all(Object.entries(s).filter(([u])=>Ts(s,u)).map(([u,l])=>Promise.all([u,l,this.key._run({typed:!1,value:u},i),this.value._run({typed:!1,value:l},i)])));for(const[u,l,f,h]of c){if(f.issues){const y={type:"object",origin:"key",input:s,key:u,value:l};for(const b of f.issues)b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=f.issues),i.abortEarly){n.typed=!1;break}}if(h.issues){const y={type:"object",origin:"value",input:s,key:u,value:l};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}(!f.typed||!h.typed)&&(n.typed=!1),f.typed&&(n.value[f.value]=h.value)}}else le(this,"type",n,i);return n}}}function sy(e,t){return{kind:"schema",type:"set",reference:sy,expects:"Set",async:!1,value:e,message:t,_run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;for(const o of i){const a=this.value._run({typed:!1,value:o},n);if(a.issues){const c={type:"set",origin:"value",input:i,key:null,value:o};for(const u of a.issues)u.path?u.path.unshift(c):u.path=[c],(s=r.issues)==null||s.push(u);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}a.typed||(r.typed=!1),r.value.add(a.value)}}else le(this,"type",r,n);return r}}}function oy(e,t){return{kind:"schema",type:"set",reference:oy,expects:"Set",async:!0,value:e,message:t,async _run(r,n){var s;const i=r.value;if(i instanceof Set){r.typed=!0,r.value=new Set;const o=await Promise.all([...i].map(async a=>[a,await this.value._run({typed:!1,value:a},n)]));for(const[a,c]of o){if(c.issues){const u={type:"set",origin:"value",input:i,key:null,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.add(c.value)}}else le(this,"type",r,n);return r}}}function ay(e,t){return{kind:"schema",type:"strict_object",reference:ay,expects:"Object",async:!1,entries:e,message:t,_run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(const o in this.entries){const a=i[o],c=this.entries[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"object",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),(c.value!==void 0||o in i)&&(r.value[o]=c.value)}if(!r.issues||!n.abortEarly){for(const o in i)if(!(o in this.entries)){const a=i[o];le(this,"type",r,n,{input:a,expected:"never",path:[{type:"object",origin:"value",input:i,key:o,value:a}]});break}}}else le(this,"type",r,n);return r}}}function cy(e,t){return{kind:"schema",type:"strict_object",reference:cy,expects:"Object",async:!0,entries:e,message:t,async _run(r,n){var s;const i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};const o=await Promise.all(Object.entries(this.entries).map(async([a,c])=>{const u=i[a];return[a,u,await c._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"object",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||a in i)&&(r.value[a]=u.value)}if(!r.issues||!n.abortEarly){for(const a in i)if(!(a in this.entries)){const c=i[a];le(this,"type",r,n,{input:c,expected:"never",path:[{type:"object",origin:"value",input:i,key:a,value:c}]});break}}}else le(this,"type",r,n);return r}}}function uy(e,t){return{kind:"schema",type:"strict_tuple",reference:uy,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const o=i[e.length];le(this,"type",r,n,{input:o,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:o}]})}}else le(this,"type",r,n);return r}}}function ly(e,t){return{kind:"schema",type:"strict_tuple",reference:ly,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}if(!(r.issues&&n.abortEarly)&&this.items.length<i.length){const a=i[e.length];le(this,"type",r,n,{input:a,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:a}]})}}else le(this,"type",r,n);return r}}}function fy(e){return{kind:"schema",type:"string",reference:fy,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function dy(e){return{kind:"schema",type:"symbol",reference:dy,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function hy(e,t){return{kind:"schema",type:"tuple",reference:hy,expects:"Array",async:!1,items:e,message:t,_run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let o=0;o<this.items.length;o++){const a=i[o],c=this.items[o]._run({typed:!1,value:a},n);if(c.issues){const u={type:"array",origin:"value",input:i,key:o,value:a};for(const l of c.issues)l.path?l.path.unshift(u):l.path=[u],(s=r.issues)==null||s.push(l);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value.push(c.value)}}else le(this,"type",r,n);return r}}}function py(e,t){return{kind:"schema",type:"tuple",reference:py,expects:"Array",async:!0,items:e,message:t,async _run(r,n){var s;const i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];const o=await Promise.all(this.items.map(async(a,c)=>{const u=i[c];return[c,u,await a._run({typed:!1,value:u},n)]}));for(const[a,c,u]of o){if(u.issues){const l={type:"array",origin:"value",input:i,key:a,value:c};for(const f of u.issues)f.path?f.path.unshift(l):f.path=[l],(s=r.issues)==null||s.push(f);if(r.issues||(r.issues=u.issues),n.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}}else le(this,"type",r,n);return r}}}function my(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:my,expects:"Array",async:!1,items:e,rest:t,message:r,_run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let c=0;c<this.items.length;c++){const u=s[c],l=this.items[c]._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}if(!n.issues||!i.abortEarly)for(let c=this.items.length;c<s.length;c++){const u=s[c],l=this.rest._run({typed:!1,value:u},i);if(l.issues){const f={type:"array",origin:"value",input:s,key:c,value:u};for(const h of l.issues)h.path?h.path.unshift(f):h.path=[f],(a=n.issues)==null||a.push(h);if(n.issues||(n.issues=l.issues),i.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else le(this,"type",n,i);return n}}}function gy(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:gy,expects:"Array",async:!0,items:e,rest:t,message:r,async _run(n,i){var o,a;const s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];const[c,u]=await Promise.all([Promise.all(this.items.map(async(l,f)=>{const h=s[f];return[f,h,await l._run({typed:!1,value:h},i)]})),Promise.all(s.slice(this.items.length).map(async(l,f)=>[f+this.items.length,l,await this.rest._run({typed:!1,value:l},i)]))]);for(const[l,f,h]of c){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(o=n.issues)==null||o.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}if(!n.issues||!i.abortEarly)for(const[l,f,h]of u){if(h.issues){const y={type:"array",origin:"value",input:s,key:l,value:f};for(const b of h.issues)b.path?b.path.unshift(y):b.path=[y],(a=n.issues)==null||a.push(b);if(n.issues||(n.issues=h.issues),i.abortEarly){n.typed=!1;break}}h.typed||(n.typed=!1),n.value.push(h.value)}}else le(this,"type",n,i);return n}}}function Kf(e){return{kind:"schema",type:"undefined",reference:Kf,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function Gc(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function vy(e,t){return{kind:"schema",type:"union",reference:vy,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){let i,s,o;for(const a of this.options){const c=a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Gc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Gc(o)})}return r}}}function yy(e,t){return{kind:"schema",type:"union",reference:yy,expects:[...new Set(e.map(r=>r.expects))].join(" | ")||"never",async:!0,options:e,message:t,async _run(r,n){let i,s,o;for(const a of this.options){const c=await a._run({typed:!1,value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else o?o.push(c):o=[c]}if(i)return i;if(s){if(s.length===1)return s[0];le(this,"type",r,n,{issues:Gc(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:Gc(o)})}return r}}}function by(){return{kind:"schema",type:"unknown",reference:by,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function Xf(e,t,r=new Set){for(const n of t)n.type==="variant"?Xf(e,n.options,r):r.add(n.entries[e].expects);return r}function wy(e,t,r){let n;return{kind:"schema",type:"variant",reference:wy,expects:"Object",async:!1,key:e,options:t,message:r,_run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!u.entries[this.key]._run({typed:!1,value:a},s).issues){const l=u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...Xf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function _y(e,t,r){let n;return{kind:"schema",type:"variant",reference:_y,expects:"Object",async:!0,key:e,options:t,message:r,async _run(i,s){const o=i.value;if(o&&typeof o=="object"){const a=o[this.key];if(this.key in o){let c;for(const u of this.options)if(u.type==="variant"||!(await u.entries[this.key]._run({typed:!1,value:a},s)).issues){const l=await u._run({typed:!1,value:o},s);if(!l.issues)return l;(!c||!c.typed&&l.typed)&&(c=l)}if(c)return c}n||(n=[...Xf(this.key,this.options)].join(" | ")||"never"),le(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else le(this,"type",i,s);return i}}}function Jf(e){return{kind:"schema",type:"void",reference:Jf,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function YC(e,t){return Hf(Object.keys(e.entries),t)}function ZC(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function xy(e,t,r){const n=e._run({typed:!1,value:t},Ea(r));if(n.issues)throw new qc(n.issues);return n.value}async function Sy(e,t,r){const n=await e._run({typed:!1,value:t},Ea(r));if(n.issues)throw new qc(n.issues);return n.value}function QC(e,t){const r=n=>xy(e,n,t);return r.schema=e,r.config=t,r}function eM(e,t){const r=n=>Sy(e,n,t);return r.schema=e,r.config=t,r}function tM(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Wf(e.entries[n]):e.entries[n];return{...e,entries:r}}function rM(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Gf(e.entries[n]):e.entries[n];return{...e,entries:r}}function nM(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function iM(...e){return{...e[0],pipe:e,_run(t,r){for(let n=0;n<e.length;n++){if(t.issues&&(e[n].kind==="schema"||e[n].kind==="transformation")){t.typed=!1;break}(!t.issues||!r.abortEarly&&!r.abortPipeEarly)&&(t=e[n]._run(t,r))}return t}}}function sM(...e){return{...e[0],pipe:e,async:!0,async _run(t,r){for(let n=0;n<e.length;n++){if(t.issues&&(e[n].kind==="schema"||e[n].kind==="transformation")){t.typed=!1;break}(!t.issues||!r.abortEarly&&!r.abortPipeEarly)&&(t=await e[n]._run(t,r))}return t}}}function oM(e,t,r){const n=Array.isArray(t)?t:void 0,i=Array.isArray(t)?r:t,s={};for(const o in e.entries)s[o]=!n||n.includes(o)?zf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function aM(e,t,r){const n=Array.isArray(t)?t:void 0,i=Array.isArray(t)?r:t,s={};for(const o in e.entries)s[o]=!n||n.includes(o)?Vf(e.entries[o],i):e.entries[o];return{...e,entries:s}}function Ey(e,t,r){const n=e._run({typed:!1,value:t},Ea(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function Cy(e,t,r){const n=await e._run({typed:!1,value:t},Ea(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function cM(e,t){const r=n=>Ey(e,n,t);return r.schema=e,r.config=t,r}function uM(e,t){const r=n=>Cy(e,n,t);return r.schema=e,r.config=t,r}function lM(e){return e.wrapped}const fM=Symbol.for("@mysten/transaction");function dM(e){return!!e&&typeof e=="object"&&e[fM]===!0}const My=Symbol.for("@mysten/SuiClient");function hM(e){return typeof e=="object"&&e!==null&&e[My]===!0}class Ma{get[My](){return!0}constructor(t){this.transport=t.transport??new pm({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!gi(Fr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[t.owner,t.coinType,t.cursor,t.limit]})}async getAllCoins(t){if(!t.owner||!gi(Fr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[t.owner,t.cursor,t.limit]})}async getBalance(t){if(!t.owner||!gi(Fr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[t.owner,t.coinType]})}async getAllBalances(t){if(!t.owner||!gi(Fr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[t.owner]})}async getCoinMetadata(t){return await this.transport.request({method:"suix_getCoinMetadata",params:[t.coinType]})}async getTotalSupply(t){return await this.transport.request({method:"suix_getTotalSupply",params:[t.coinType]})}async call(t,r){return await this.transport.request({method:t,params:r})}async getMoveFunctionArgTypes(t){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[t.package,t.module,t.function]})}async getNormalizedMoveModulesByPackage(t){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[t.package]})}async getNormalizedMoveModule(t){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[t.package,t.module]})}async getNormalizedMoveFunction(t){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[t.package,t.module,t.function]})}async getNormalizedMoveStruct(t){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[t.package,t.module,t.struct]})}async getOwnedObjects(t){if(!t.owner||!gi(Fr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[t.owner,{filter:t.filter,options:t.options},t.cursor,t.limit]})}async getObject(t){if(!t.id||!xa(vi(t.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[t.id,t.options]})}async tryGetPastObject(t){return await this.transport.request({method:"sui_tryGetPastObject",params:[t.id,t.version,t.options]})}async multiGetObjects(t){if(t.ids.forEach(n=>{if(!n||!xa(vi(n)))throw new Error(`Invalid Sui Object id ${n}`)}),t.ids.length!==new Set(t.ids).size)throw new Error(`Duplicate object ids in batch call ${t.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[t.ids,t.options]})}async queryTransactionBlocks(t){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:t.filter,options:t.options},t.cursor,t.limit,(t.order||"descending")==="descending"]})}async getTransactionBlock(t){if(!Cf(t.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[t.digest,t.options]})}async multiGetTransactionBlocks(t){if(t.digests.forEach(n=>{if(!Cf(n))throw new Error(`Invalid Transaction digest ${n}`)}),t.digests.length!==new Set(t.digests).size)throw new Error(`Duplicate digests in batch call ${t.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[t.digests,t.options]})}async executeTransactionBlock({transactionBlock:t,signature:r,options:n,requestType:i}){const s=await this.transport.request({method:"sui_executeTransactionBlock",params:[typeof t=="string"?t:Kr(t),Array.isArray(r)?r:[r],n]});if(i==="WaitForLocalExecution")try{await this.waitForTransaction({digest:s.digest})}catch{}return s}async signAndExecuteTransaction({transaction:t,signer:r,...n}){let i;t instanceof Uint8Array?i=t:(t.setSenderIfNotSet(r.toSuiAddress()),i=await t.build({client:this}));const{signature:s,bytes:o}=await r.signTransaction(i);return this.executeTransactionBlock({transactionBlock:o,signature:s,...n})}async getTotalTransactionBlocks(){const t=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(t)}async getReferenceGasPrice(){const t=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(t)}async getStakes(t){if(!t.owner||!gi(Fr(t.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[t.owner]})}async getStakesByIds(t){return t.stakedSuiIds.forEach(r=>{if(!r||!xa(vi(r)))throw new Error(`Invalid Sui Stake id ${r}`)}),await this.transport.request({method:"suix_getStakesByIds",params:[t.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(t){return await this.transport.request({method:"suix_queryEvents",params:[t.query,t.cursor,t.limit,(t.order||"descending")==="descending"]})}async subscribeEvent(t){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[t.filter],onMessage:t.onMessage})}async subscribeTransaction(t){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[t.filter],onMessage:t.onMessage})}async devInspectTransactionBlock(t){var n;let r;if(dM(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=Kr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=Kr(t.transactionBlock);else throw new Error("Unknown transaction block format.");return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[t.sender,r,(n=t.gasPrice)==null?void 0:n.toString(),t.epoch]})}async dryRunTransactionBlock(t){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:[typeof t.transactionBlock=="string"?t.transactionBlock:Kr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!xa(vi(t.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[t.parentId,t.cursor,t.limit]})}async getDynamicFieldObject(t){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[t.parentId,t.name]})}async getLatestCheckpointSequenceNumber(){const t=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(t)}async getCheckpoint(t){return await this.transport.request({method:"sui_getCheckpoint",params:[t.id]})}async getCheckpoints(t){return await this.transport.request({method:"sui_getCheckpoints",params:[t.cursor,t==null?void 0:t.limit,t.descendingOrder]})}async getCommitteeInfo(t){return await this.transport.request({method:"suix_getCommitteeInfo",params:[t==null?void 0:t.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(t){return await this.transport.request({method:"suix_getEpochMetrics",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getAllEpochAddressMetrics(t){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[t==null?void 0:t.descendingOrder]})}async getEpochs(t){return await this.transport.request({method:"suix_getEpochs",params:[t==null?void 0:t.cursor,t==null?void 0:t.limit,t==null?void 0:t.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){const t=await this.getCheckpoint({id:"0"}),r=pi(t.digest);return mi(r.slice(0,4))}async resolveNameServiceAddress(t){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[t.name]})}async resolveNameServiceNames({format:t="dot",...r}){const{nextCursor:n,hasNextPage:i,data:s}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[r.address,r.cursor,r.limit]});return{hasNextPage:i,nextCursor:n,data:s.map(o=>sg(o,t))}}async getProtocolConfig(t){return await this.transport.request({method:"sui_getProtocolConfig",params:[t==null?void 0:t.version]})}async waitForTransaction({signal:t,timeout:r=60*1e3,pollInterval:n=2*1e3,...i}){const s=AbortSignal.timeout(r),o=new Promise((a,c)=>{s.addEventListener("abort",()=>c(s.reason))});for(o.catch(()=>{});!s.aborted;){t==null||t.throwIfAborted();try{return await this.getTransactionBlock(i)}catch{await Promise.race([new Promise(c=>setTimeout(c,n)),o])}}throw s.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}}const pM=Nc(Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:pf,SuiClient:Ma,SuiHTTPStatusError:am,SuiHTTPTransport:pm,SuiHTTPTransportError:hf,getFullnodeUrl:mm,isSuiClient:hM},Symbol.toStringTag,{value:"Module"}))),Ty=Nc(wC),Er=Nc(lE);var Yf=Object.defineProperty,mM=Object.getOwnPropertyDescriptor,gM=Object.getOwnPropertyNames,vM=Object.prototype.hasOwnProperty,yM=(e,t)=>{for(var r in t)Yf(e,r,{get:t[r],enumerable:!0})},bM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gM(t))!vM.call(e,i)&&i!==r&&Yf(e,i,{get:()=>t[i],enumerable:!(n=mM(t,i))||n.enumerable});return e},wM=e=>bM(Yf({},"__esModule",{value:!0}),e),Ay={};yM(Ay,{SUI_ADDRESS_LENGTH:()=>Zf,isValidSuiAddress:()=>Iy,isValidSuiObjectId:()=>SM,isValidTransactionDigest:()=>xM,normalizeStructTag:()=>Py,normalizeSuiAddress:()=>ed,normalizeSuiObjectId:()=>CM,parseStructTag:()=>Qf});var Xr=wM(Ay),Oy=Er;const _M=32;function xM(e){try{return(0,Oy.fromBase58)(e).length===_M}catch{return!1}}const Zf=32;function Iy(e){return MM(e)&&TM(e)===Zf}function SM(e){return Iy(e)}function EM(e){return e.includes("::")?Qf(e):e}function Qf(e){const[t,r]=e.split("::"),n=e.slice(t.length+r.length+4),i=n.includes("<")?n.slice(0,n.indexOf("<")):n,s=n.includes("<")?(0,Oy.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>EM(o.trim())):[];return{address:ed(t),module:r,name:i,typeParams:s}}function Py(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Qf(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Py(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function ed(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(Zf*2,"0")}`}function CM(e,t=!1){return ed(e,t)}function MM(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function TM(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var td=Object.defineProperty,AM=Object.getOwnPropertyDescriptor,OM=Object.getOwnPropertyNames,IM=Object.prototype.hasOwnProperty,PM=(e,t)=>{for(var r in t)td(e,r,{get:t[r],enumerable:!0})},jM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OM(t))!IM.call(e,i)&&i!==r&&td(e,i,{get:()=>t[i],enumerable:!(n=AM(t,i))||n.enumerable});return e},kM=e=>jM(td({},"__esModule",{value:!0}),e),jy={};PM(jy,{TypeTagSerializer:()=>As});var ky=kM(jy),NM=Er,RM=Xr;const DM=/^vector<(.+)>$/,$M=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class As{static parseFromStr(t,r=!1){if(t==="address")return{address:null};if(t==="bool")return{bool:null};if(t==="u8")return{u8:null};if(t==="u16")return{u16:null};if(t==="u32")return{u32:null};if(t==="u64")return{u64:null};if(t==="u128")return{u128:null};if(t==="u256")return{u256:null};if(t==="signer")return{signer:null};const n=t.match(DM);if(n)return{vector:As.parseFromStr(n[1],r)};const i=t.match($M);if(i)return{struct:{address:r?(0,RM.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:As.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,NM.splitGenericParameters)(t).map(n=>As.parseFromStr(n,r))}static tagToString(t){if("bool"in t)return"bool";if("u8"in t)return"u8";if("u16"in t)return"u16";if("u32"in t)return"u32";if("u64"in t)return"u64";if("u128"in t)return"u128";if("u256"in t)return"u256";if("address"in t)return"address";if("signer"in t)return"signer";if("vector"in t)return`vector<${As.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(As.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var rd=Object.defineProperty,BM=Object.getOwnPropertyDescriptor,LM=Object.getOwnPropertyNames,UM=Object.prototype.hasOwnProperty,FM=(e,t)=>{for(var r in t)rd(e,r,{get:t[r],enumerable:!0})},zM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LM(t))!UM.call(e,i)&&i!==r&&rd(e,i,{get:()=>t[i],enumerable:!(n=BM(t,i))||n.enumerable});return e},VM=e=>zM(rd({},"__esModule",{value:!0}),e),Ny={};FM(Ny,{Address:()=>qn,AppId:()=>Zy,Argument:()=>Wn,CallArg:()=>Uy,Command:()=>zy,CompressedSignature:()=>tb,GasData:()=>Hy,Intent:()=>Qy,IntentMessage:()=>eb,IntentScope:()=>Jy,IntentVersion:()=>Yy,MultiSig:()=>GM,MultiSigPkMap:()=>nb,MultiSigPublicKey:()=>ib,ObjectArg:()=>Ly,ObjectDigest:()=>$y,PasskeyAuthenticator:()=>KM,ProgrammableMoveCall:()=>Fy,ProgrammableTransaction:()=>Vy,PublicKey:()=>rb,SenderSignedData:()=>HM,SenderSignedTransaction:()=>ob,SharedObjectRef:()=>By,StructTag:()=>Gy,SuiObjectRef:()=>Hc,TransactionData:()=>Xy,TransactionDataV1:()=>Ky,TransactionExpiration:()=>Wy,TransactionKind:()=>qy,TypeTag:()=>id,base64String:()=>sb});var Ry=VM(Ny),de=Er,Ta=Xr,Dy=ky;function qM(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function WM(e){return de.bcs.enum("Option",{None:null,Some:e})}const qn=de.bcs.bytes(Ta.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,Ta.isValidSuiAddress)((0,Ta.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,Ta.normalizeSuiAddress)(e)):e,output:e=>(0,Ta.normalizeSuiAddress)((0,de.toHex)(e))}),$y=de.bcs.vector(de.bcs.u8()).transform({name:"ObjectDigest",input:e=>(0,de.fromBase58)(e),output:e=>(0,de.toBase58)(new Uint8Array(e)),validate:e=>{if((0,de.fromBase58)(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Hc=de.bcs.struct("SuiObjectRef",{objectId:qn,version:de.bcs.u64(),digest:$y}),By=de.bcs.struct("SharedObjectRef",{objectId:qn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),Ly=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:Hc,SharedObject:By,Receiving:Hc}),Uy=de.bcs.enum("CallArg",{Pure:de.bcs.struct("Pure",{bytes:de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})}),Object:Ly}),nd=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>nd),struct:de.bcs.lazy(()=>Gy),u16:null,u32:null,u256:null}),id=nd.transform({input:e=>typeof e=="string"?Dy.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>Dy.TypeTagSerializer.tagToString(e)}),Wn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),Fy=de.bcs.struct("ProgrammableMoveCall",{package:qn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(id),arguments:de.bcs.vector(Wn)}),zy=de.bcs.enum("Command",{MoveCall:Fy,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Wn),address:Wn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Wn,amounts:de.bcs.vector(Wn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Wn,sources:de.bcs.vector(Wn)}),Publish:de.bcs.struct("Publish",{modules:de.bcs.vector(de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})),dependencies:de.bcs.vector(qn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:WM(id).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Wn)}),Upgrade:de.bcs.struct("Upgrade",{modules:de.bcs.vector(de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))})),dependencies:de.bcs.vector(qn),package:qn,ticket:Wn})}),Vy=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(Uy),commands:de.bcs.vector(zy)}),qy=de.bcs.enum("TransactionKind",{ProgrammableTransaction:Vy,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Wy=de.bcs.enum("TransactionExpiration",{None:null,Epoch:qM()}),Gy=de.bcs.struct("StructTag",{address:qn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(nd)}),Hy=de.bcs.struct("GasData",{payment:de.bcs.vector(Hc),owner:qn,price:de.bcs.u64(),budget:de.bcs.u64()}),Ky=de.bcs.struct("TransactionDataV1",{kind:qy,sender:qn,gasData:Hy,expiration:Wy}),Xy=de.bcs.enum("TransactionData",{V1:Ky}),Jy=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Yy=de.bcs.enum("IntentVersion",{V0:null}),Zy=de.bcs.enum("AppId",{Sui:null}),Qy=de.bcs.struct("Intent",{scope:Jy,version:Yy,appId:Zy});function eb(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:Qy,value:e})}const tb=de.bcs.enum("CompressedSignature",{ED25519:de.bcs.fixedArray(64,de.bcs.u8()),Secp256k1:de.bcs.fixedArray(64,de.bcs.u8()),Secp256r1:de.bcs.fixedArray(64,de.bcs.u8()),ZkLogin:de.bcs.vector(de.bcs.u8())}),rb=de.bcs.enum("PublicKey",{ED25519:de.bcs.fixedArray(32,de.bcs.u8()),Secp256k1:de.bcs.fixedArray(33,de.bcs.u8()),Secp256r1:de.bcs.fixedArray(33,de.bcs.u8()),ZkLogin:de.bcs.vector(de.bcs.u8())}),nb=de.bcs.struct("MultiSigPkMap",{pubKey:rb,weight:de.bcs.u8()}),ib=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector(nb),threshold:de.bcs.u16()}),GM=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(tb),bitmap:de.bcs.u16(),multisig_pk:ib}),sb=de.bcs.vector(de.bcs.u8()).transform({input:e=>typeof e=="string"?(0,de.fromBase64)(e):e,output:e=>(0,de.toBase64)(new Uint8Array(e))}),ob=de.bcs.struct("SenderSignedTransaction",{intentMessage:eb(Xy),txSignatures:de.bcs.vector(sb)}),HM=de.bcs.vector(ob,{name:"SenderSignedData"}),KM=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var sd=Object.defineProperty,XM=Object.getOwnPropertyDescriptor,JM=Object.getOwnPropertyNames,YM=Object.prototype.hasOwnProperty,ZM=(e,t)=>{for(var r in t)sd(e,r,{get:t[r],enumerable:!0})},QM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JM(t))!YM.call(e,i)&&i!==r&&sd(e,i,{get:()=>t[i],enumerable:!(n=XM(t,i))||n.enumerable});return e},eT=e=>QM(sd({},"__esModule",{value:!0}),e),ab={};ZM(ab,{TransactionEffects:()=>pT});var tT=eT(ab),ve=Er,Rt=Ry;const rT=ve.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ve.bcs.struct("UnableToFetchPackage",{packageId:Rt.Address}),NotAPackage:ve.bcs.struct("NotAPackage",{objectId:Rt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:ve.bcs.struct("DigestDoesNotMatch",{digest:ve.bcs.vector(ve.bcs.u8())}),UnknownUpgradePolicy:ve.bcs.struct("UnknownUpgradePolicy",{policy:ve.bcs.u8()}),PackageIDDoesNotMatch:ve.bcs.struct("PackageIDDoesNotMatch",{packageId:Rt.Address,ticketId:Rt.Address})}),nT=ve.bcs.struct("ModuleId",{address:Rt.Address,name:ve.bcs.string()}),cb=ve.bcs.struct("MoveLocation",{module:nT,function:ve.bcs.u16(),instruction:ve.bcs.u16(),functionName:ve.bcs.option(ve.bcs.string())}),iT=ve.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:ve.bcs.struct("IndexOutOfBounds",{idx:ve.bcs.u16()}),SecondaryIndexOutOfBounds:ve.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidResultArity:ve.bcs.struct("InvalidResultArity",{resultIdx:ve.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),sT=ve.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),oT=ve.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:ve.bcs.struct("MoveObjectTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),MovePackageTooBig:ve.bcs.struct("MovePackageTooBig",{objectSize:ve.bcs.u64(),maxObjectSize:ve.bcs.u64()}),CircularObjectOwnership:ve.bcs.struct("CircularObjectOwnership",{object:Rt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ve.bcs.option(cb),MoveAbort:ve.bcs.tuple([cb,ve.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:ve.bcs.struct("CommandArgumentError",{argIdx:ve.bcs.u16(),kind:iT}),TypeArgumentError:ve.bcs.struct("TypeArgumentError",{argumentIdx:ve.bcs.u16(),kind:sT}),UnusedValueWithoutDrop:ve.bcs.struct("UnusedValueWithoutDrop",{resultIdx:ve.bcs.u16(),secondaryIdx:ve.bcs.u16()}),InvalidPublicFunctionReturnType:ve.bcs.struct("InvalidPublicFunctionReturnType",{idx:ve.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:ve.bcs.struct("EffectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:ve.bcs.struct("PackageUpgradeError",{upgradeError:rT}),WrittenObjectsTooLarge:ve.bcs.struct("WrittenObjectsTooLarge",{currentSize:ve.bcs.u64(),maxSize:ve.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:ve.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:ve.bcs.vector(Rt.Address)}),AddressDeniedForCoin:ve.bcs.struct("AddressDeniedForCoin",{address:Rt.Address,coinType:ve.bcs.string()}),CoinTypeGlobalPause:ve.bcs.struct("CoinTypeGlobalPause",{coinType:ve.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),ub=ve.bcs.enum("ExecutionStatus",{Success:null,Failed:ve.bcs.struct("ExecutionFailed",{error:oT,command:ve.bcs.option(ve.bcs.u64())})}),lb=ve.bcs.struct("GasCostSummary",{computationCost:ve.bcs.u64(),storageCost:ve.bcs.u64(),storageRebate:ve.bcs.u64(),nonRefundableStorageFee:ve.bcs.u64()}),po=ve.bcs.enum("Owner",{AddressOwner:Rt.Address,ObjectOwner:Rt.Address,Shared:ve.bcs.struct("Shared",{initialSharedVersion:ve.bcs.u64()}),Immutable:null}),aT=ve.bcs.struct("TransactionEffectsV1",{status:ub,executedEpoch:ve.bcs.u64(),gasUsed:lb,modifiedAtVersions:ve.bcs.vector(ve.bcs.tuple([Rt.Address,ve.bcs.u64()])),sharedObjects:ve.bcs.vector(Rt.SuiObjectRef),transactionDigest:Rt.ObjectDigest,created:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,po])),mutated:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,po])),unwrapped:ve.bcs.vector(ve.bcs.tuple([Rt.SuiObjectRef,po])),deleted:ve.bcs.vector(Rt.SuiObjectRef),unwrappedThenDeleted:ve.bcs.vector(Rt.SuiObjectRef),wrapped:ve.bcs.vector(Rt.SuiObjectRef),gasObject:ve.bcs.tuple([Rt.SuiObjectRef,po]),eventsDigest:ve.bcs.option(Rt.ObjectDigest),dependencies:ve.bcs.vector(Rt.ObjectDigest)}),od=ve.bcs.tuple([ve.bcs.u64(),Rt.ObjectDigest]),cT=ve.bcs.enum("ObjectIn",{NotExist:null,Exist:ve.bcs.tuple([od,po])}),uT=ve.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ve.bcs.tuple([Rt.ObjectDigest,po]),PackageWrite:od}),lT=ve.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),fT=ve.bcs.struct("EffectsObjectChange",{inputState:cT,outputState:uT,idOperation:lT}),dT=ve.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:od,MutateDeleted:ve.bcs.u64(),ReadDeleted:ve.bcs.u64(),Cancelled:ve.bcs.u64(),PerEpochConfig:null}),hT=ve.bcs.struct("TransactionEffectsV2",{status:ub,executedEpoch:ve.bcs.u64(),gasUsed:lb,transactionDigest:Rt.ObjectDigest,gasObjectIndex:ve.bcs.option(ve.bcs.u32()),eventsDigest:ve.bcs.option(Rt.ObjectDigest),dependencies:ve.bcs.vector(Rt.ObjectDigest),lamportVersion:ve.bcs.u64(),changedObjects:ve.bcs.vector(ve.bcs.tuple([Rt.Address,fT])),unchangedSharedObjects:ve.bcs.vector(ve.bcs.tuple([Rt.Address,dT])),auxDataDigest:ve.bcs.option(Rt.ObjectDigest)}),pT=ve.bcs.enum("TransactionEffects",{V1:aT,V2:hT});var ad=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,gT=Object.getOwnPropertyNames,vT=Object.prototype.hasOwnProperty,yT=(e,t)=>{for(var r in t)ad(e,r,{get:t[r],enumerable:!0})},bT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gT(t))!vT.call(e,i)&&i!==r&&ad(e,i,{get:()=>t[i],enumerable:!(n=mT(t,i))||n.enumerable});return e},wT=e=>bT(ad({},"__esModule",{value:!0}),e),fb={};yT(fb,{BcsType:()=>ST.BcsType,TypeTagSerializer:()=>xT.TypeTagSerializer,bcs:()=>ET});var Gn=wT(fb),Hn=Er,Dt=Ry,_T=tT,xT=ky,ST=Er;const ET={...Hn.bcs,U8:Hn.bcs.u8(),U16:Hn.bcs.u16(),U32:Hn.bcs.u32(),U64:Hn.bcs.u64(),U128:Hn.bcs.u128(),U256:Hn.bcs.u256(),ULEB128:Hn.bcs.uleb128(),Bool:Hn.bcs.bool(),String:Hn.bcs.string(),Address:Dt.Address,AppId:Dt.AppId,Argument:Dt.Argument,CallArg:Dt.CallArg,CompressedSignature:Dt.CompressedSignature,GasData:Dt.GasData,Intent:Dt.Intent,IntentMessage:Dt.IntentMessage,IntentScope:Dt.IntentScope,IntentVersion:Dt.IntentVersion,MultiSig:Dt.MultiSig,MultiSigPkMap:Dt.MultiSigPkMap,MultiSigPublicKey:Dt.MultiSigPublicKey,ObjectArg:Dt.ObjectArg,ObjectDigest:Dt.ObjectDigest,ProgrammableMoveCall:Dt.ProgrammableMoveCall,ProgrammableTransaction:Dt.ProgrammableTransaction,PublicKey:Dt.PublicKey,SenderSignedData:Dt.SenderSignedData,SenderSignedTransaction:Dt.SenderSignedTransaction,SharedObjectRef:Dt.SharedObjectRef,StructTag:Dt.StructTag,SuiObjectRef:Dt.SuiObjectRef,Command:Dt.Command,TransactionData:Dt.TransactionData,TransactionDataV1:Dt.TransactionDataV1,TransactionExpiration:Dt.TransactionExpiration,TransactionKind:Dt.TransactionKind,TypeTag:Dt.TypeTag,TransactionEffects:_T.TransactionEffects,PasskeyAuthenticator:Dt.PasskeyAuthenticator};var cd=Object.defineProperty,CT=Object.getOwnPropertyDescriptor,MT=Object.getOwnPropertyNames,TT=Object.prototype.hasOwnProperty,AT=(e,t)=>{for(var r in t)cd(e,r,{get:t[r],enumerable:!0})},OT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MT(t))!TT.call(e,i)&&i!==r&&cd(e,i,{get:()=>t[i],enumerable:!(n=CT(t,i))||n.enumerable});return e},IT=e=>OT(cd({},"__esModule",{value:!0}),e),db={};AT(db,{formatAddress:()=>jT,formatDigest:()=>kT});var PT=IT(db);const hb="…";function jT(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${hb}${e.slice(-4)}`}function kT(e){return`${e.slice(0,10)}${hb}`}var ud=Object.defineProperty,NT=Object.getOwnPropertyDescriptor,RT=Object.getOwnPropertyNames,DT=Object.prototype.hasOwnProperty,$T=(e,t)=>{for(var r in t)ud(e,r,{get:t[r],enumerable:!0})},BT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RT(t))!DT.call(e,i)&&i!==r&&ud(e,i,{get:()=>t[i],enumerable:!(n=NT(t,i))||n.enumerable});return e},LT=e=>BT(ud({},"__esModule",{value:!0}),e),pb={};$T(pb,{isValidSuiNSName:()=>FT,normalizeSuiNSName:()=>zT});var mb=LT(pb);const gb=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,vb=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,UT=235;function FT(e){return e.length>UT?!1:e.includes("@")?gb.test(e):vb.test(e)}function zT(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!gb.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!vb.test(r))throw new Error(`Invalid SuiNS name ${e}`);n=r.split(".").slice(0,-1)}return t==="dot"?`${n.join(".")}.sui`:`${n.slice(0,-1).join(".")}@${n[n.length-1]}`}var ld=Object.defineProperty,VT=Object.getOwnPropertyDescriptor,qT=Object.getOwnPropertyNames,WT=Object.prototype.hasOwnProperty,GT=(e,t)=>{for(var r in t)ld(e,r,{get:t[r],enumerable:!0})},HT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qT(t))!WT.call(e,i)&&i!==r&&ld(e,i,{get:()=>t[i],enumerable:!(n=VT(t,i))||n.enumerable});return e},KT=e=>HT(ld({},"__esModule",{value:!0}),e),yb={};GT(yb,{MIST_PER_SUI:()=>YT,MOVE_STDLIB_ADDRESS:()=>ZT,SUI_CLOCK_OBJECT_ID:()=>eA,SUI_DECIMALS:()=>JT,SUI_FRAMEWORK_ADDRESS:()=>wb,SUI_SYSTEM_ADDRESS:()=>QT,SUI_SYSTEM_MODULE_NAME:()=>tA,SUI_SYSTEM_STATE_OBJECT_ID:()=>nA,SUI_TYPE_ARG:()=>rA});var XT=KT(yb),bb=Xr;const JT=9,YT=BigInt(1e9),ZT="0x1",wb="0x2",QT="0x3",eA=(0,bb.normalizeSuiObjectId)("0x6"),tA="sui_system",rA=`${wb}::sui::SUI`,nA=(0,bb.normalizeSuiObjectId)("0x5");var fd=Object.defineProperty,iA=Object.getOwnPropertyDescriptor,sA=Object.getOwnPropertyNames,oA=Object.prototype.hasOwnProperty,aA=(e,t)=>{for(var r in t)fd(e,r,{get:t[r],enumerable:!0})},cA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sA(t))!oA.call(e,i)&&i!==r&&fd(e,i,{get:()=>t[i],enumerable:!(n=iA(t,i))||n.enumerable});return e},uA=e=>cA(fd({},"__esModule",{value:!0}),e),_b={};aA(_b,{isValidNamedPackage:()=>Eb,isValidNamedType:()=>pA});var xb=uA(_b),lA=mb;const fA=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,dA=/^\d+$/,hA=64,Sb="/",Eb=e=>{const t=e.split(Sb);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!dA.test(i)||!(0,lA.isValidSuiNSName)(r)?!1:fA.test(n)&&n.length<hA},pA=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(Sb)&&!Eb(r))return!1;return!0},Cb=Nc(yC);var dd=Object.defineProperty,mA=Object.getOwnPropertyDescriptor,gA=Object.getOwnPropertyNames,vA=Object.prototype.hasOwnProperty,yA=(e,t)=>{for(var r in t)dd(e,r,{get:t[r],enumerable:!0})},bA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gA(t))!vA.call(e,i)&&i!==r&&dd(e,i,{get:()=>t[i],enumerable:!(n=mA(t,i))||n.enumerable});return e},wA=e=>bA(dd({},"__esModule",{value:!0}),e),Mb={};yA(Mb,{deriveDynamicFieldID:()=>EA});var _A=wA(Mb),xA=Er,SA=Cb,hd=Gn;function EA(e,t,r){const n=hd.bcs.Address.serialize(e).toBytes(),i=hd.bcs.TypeTag.serialize(t).toBytes(),s=hd.bcs.u64().serialize(r.length).toBytes(),o=SA.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,xA.toHex)(o.digest().slice(0,32))}`}var pd=Object.defineProperty,CA=Object.getOwnPropertyDescriptor,MA=Object.getOwnPropertyNames,TA=Object.prototype.hasOwnProperty,AA=(e,t)=>{for(var r in t)pd(e,r,{get:t[r],enumerable:!0})},OA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MA(t))!TA.call(e,i)&&i!==r&&pd(e,i,{get:()=>t[i],enumerable:!(n=CA(t,i))||n.enumerable});return e},IA=e=>OA(pd({},"__esModule",{value:!0}),e),Tb={};AA(Tb,{MIST_PER_SUI:()=>xi.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>xi.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Ki.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>xi.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>xi.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>xi.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>xi.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>xi.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>xi.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>xi.SUI_TYPE_ARG,deriveDynamicFieldID:()=>PA.deriveDynamicFieldID,formatAddress:()=>Ob.formatAddress,formatDigest:()=>Ob.formatDigest,fromB64:()=>Kn.fromB64,fromBase58:()=>Kn.fromBase58,fromBase64:()=>Kn.fromBase64,fromHEX:()=>Kn.fromHEX,fromHex:()=>Kn.fromHex,isValidNamedPackage:()=>Pb.isValidNamedPackage,isValidNamedType:()=>Pb.isValidNamedType,isValidSuiAddress:()=>Ki.isValidSuiAddress,isValidSuiNSName:()=>Ib.isValidSuiNSName,isValidSuiObjectId:()=>Ki.isValidSuiObjectId,isValidTransactionDigest:()=>Ki.isValidTransactionDigest,normalizeStructTag:()=>Ki.normalizeStructTag,normalizeSuiAddress:()=>Ki.normalizeSuiAddress,normalizeSuiNSName:()=>Ib.normalizeSuiNSName,normalizeSuiObjectId:()=>Ki.normalizeSuiObjectId,parseStructTag:()=>Ki.parseStructTag,toB64:()=>Kn.toB64,toBase58:()=>Kn.toBase58,toBase64:()=>Kn.toBase64,toHEX:()=>Kn.toHEX,toHex:()=>Kn.toHex});var Ab=IA(Tb),Ob=PT,Ki=Xr,Kn=Er,Ib=mb,xi=XT,Pb=xb,PA=_A,md=Object.defineProperty,jA=Object.getOwnPropertyDescriptor,kA=Object.getOwnPropertyNames,NA=Object.prototype.hasOwnProperty,RA=(e,t)=>{for(var r in t)md(e,r,{get:t[r],enumerable:!0})},DA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kA(t))!NA.call(e,i)&&i!==r&&md(e,i,{get:()=>t[i],enumerable:!(n=jA(t,i))||n.enumerable});return e},$A=e=>DA(md({},"__esModule",{value:!0}),e),jb={};RA(jb,{getPureBcsSchema:()=>gd,isTxContext:()=>GA,normalizedTypeToMoveTypeSignature:()=>HA,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>Rb});var kb=$A(jb),Zt=Gn,Nb=Ab,Aa=Xr;const BA="object",LA="ID",UA="ascii",FA="String",zA="string",VA="String",qA="option",WA="Option";function GA(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Aa.normalizeSuiAddress)(t.package)===(0,Aa.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function gd(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Zt.bcs.vector(Zt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=gd(e.vector);return t?Zt.bcs.vector(t):null}if("datatype"in e){const t=(0,Aa.normalizeSuiAddress)(e.datatype.package);if(t===(0,Aa.normalizeSuiAddress)(Nb.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===UA&&e.datatype.type===FA||e.datatype.module===zA&&e.datatype.type===VA)return Zt.bcs.String;if(e.datatype.module===qA&&e.datatype.type===WA){const r=gd(e.datatype.typeParameters[0]);return r?Zt.bcs.vector(r):null}}if(t===(0,Aa.normalizeSuiAddress)(Nb.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===BA&&e.datatype.type===LA)return Zt.bcs.Address}return null}function HA(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Oa(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Oa(e.MutableReference)}:{ref:null,body:Oa(e)}}function Oa(e){if(typeof e=="string")switch(e){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${e}`)}if("Vector"in e)return{vector:Oa(e.Vector)};if("Struct"in e)return{datatype:{package:e.Struct.address,module:e.Struct.module,type:e.Struct.name,typeParameters:e.Struct.typeArguments.map(Oa)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function Rb(e){if(typeof e=="string")switch(e){case"address":return Zt.bcs.Address;case"bool":return Zt.bcs.Bool;case"u8":return Zt.bcs.U8;case"u16":return Zt.bcs.U16;case"u32":return Zt.bcs.U32;case"u64":return Zt.bcs.U64;case"u128":return Zt.bcs.U128;case"u256":return Zt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Zt.bcs.vector(Rb(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var vd=Object.defineProperty,KA=Object.getOwnPropertyDescriptor,XA=Object.getOwnPropertyNames,JA=Object.prototype.hasOwnProperty,YA=(e,t)=>{for(var r in t)vd(e,r,{get:t[r],enumerable:!0})},ZA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XA(t))!JA.call(e,i)&&i!==r&&vd(e,i,{get:()=>t[i],enumerable:!(n=KA(t,i))||n.enumerable});return e},QA=e=>ZA(vd({},"__esModule",{value:!0}),e),Db={};YA(Db,{Inputs:()=>r5});var Kc=QA(Db),e5=Er,yd=Xr;function t5(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,e5.toBase64)(e):e.toBase64()}}}const r5={Pure:t5,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,yd.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,yd.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,yd.normalizeSuiAddress)(e)}}}}};var bd=Object.defineProperty,n5=Object.getOwnPropertyDescriptor,i5=Object.getOwnPropertyNames,s5=Object.prototype.hasOwnProperty,o5=(e,t)=>{for(var r in t)bd(e,r,{get:t[r],enumerable:!0})},a5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of i5(t))!s5.call(e,i)&&i!==r&&bd(e,i,{get:()=>t[i],enumerable:!(n=n5(t,i))||n.enumerable});return e},c5=e=>a5(bd({},"__esModule",{value:!0}),e),$b={};o5($b,{$Intent:()=>Fb,Argument:()=>nn,BCSBytes:()=>Pa,Command:()=>zb,GasData:()=>Lb,JsonU64:()=>Xi,NormalizedCallArg:()=>d5,ObjectArg:()=>wd,ObjectID:()=>Os,ObjectRef:()=>Xc,OpenMoveTypeSignature:()=>Ub,OpenMoveTypeSignatureBody:()=>Jc,StructTag:()=>u5,SuiAddress:()=>Ia,TransactionData:()=>h5,TransactionExpiration:()=>Vb,safeEnum:()=>go});var mo=c5($b),ue=Hi,Bb=Xr;function go(e){const t=Object.entries(e).map(([r,n])=>(0,ue.object)({[r]:n}));return(0,ue.pipe)((0,ue.union)(t),(0,ue.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const Ia=(0,ue.pipe)((0,ue.string)(),(0,ue.transform)(e=>(0,Bb.normalizeSuiAddress)(e)),(0,ue.check)(Bb.isValidSuiAddress)),Os=Ia,Pa=(0,ue.string)(),Xi=(0,ue.pipe)((0,ue.union)([(0,ue.string)(),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())]),(0,ue.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),Xc=(0,ue.object)({objectId:Ia,version:Xi,digest:(0,ue.string)()}),nn=(0,ue.pipe)((0,ue.union)([(0,ue.object)({GasCoin:(0,ue.literal)(!0)}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("pure"))}),(0,ue.object)({Input:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),type:(0,ue.optional)((0,ue.literal)("object"))}),(0,ue.object)({Result:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())}),(0,ue.object)({NestedResult:(0,ue.tuple)([(0,ue.pipe)((0,ue.number)(),(0,ue.integer)()),(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())])})]),(0,ue.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),Lb=(0,ue.object)({budget:(0,ue.nullable)(Xi),price:(0,ue.nullable)(Xi),owner:(0,ue.nullable)(Ia),payment:(0,ue.nullable)((0,ue.array)(Xc))}),u5=(0,ue.object)({address:(0,ue.string)(),module:(0,ue.string)(),name:(0,ue.string)(),typeParams:(0,ue.array)((0,ue.string)())}),Jc=(0,ue.union)([(0,ue.literal)("address"),(0,ue.literal)("bool"),(0,ue.literal)("u8"),(0,ue.literal)("u16"),(0,ue.literal)("u32"),(0,ue.literal)("u64"),(0,ue.literal)("u128"),(0,ue.literal)("u256"),(0,ue.object)({vector:(0,ue.lazy)(()=>Jc)}),(0,ue.object)({datatype:(0,ue.object)({package:(0,ue.string)(),module:(0,ue.string)(),type:(0,ue.string)(),typeParameters:(0,ue.array)((0,ue.lazy)(()=>Jc))})}),(0,ue.object)({typeParameter:(0,ue.pipe)((0,ue.number)(),(0,ue.integer)())})]),Ub=(0,ue.object)({ref:(0,ue.nullable)((0,ue.union)([(0,ue.literal)("&"),(0,ue.literal)("&mut")])),body:Jc}),l5=(0,ue.object)({package:Os,module:(0,ue.string)(),function:(0,ue.string)(),typeArguments:(0,ue.array)((0,ue.string)()),arguments:(0,ue.array)(nn),_argumentTypes:(0,ue.optional)((0,ue.nullable)((0,ue.array)(Ub)))}),Fb=(0,ue.object)({name:(0,ue.string)(),inputs:(0,ue.record)((0,ue.string)(),(0,ue.union)([nn,(0,ue.array)(nn)])),data:(0,ue.record)((0,ue.string)(),(0,ue.unknown)())}),zb=go({MoveCall:l5,TransferObjects:(0,ue.object)({objects:(0,ue.array)(nn),address:nn}),SplitCoins:(0,ue.object)({coin:nn,amounts:(0,ue.array)(nn)}),MergeCoins:(0,ue.object)({destination:nn,sources:(0,ue.array)(nn)}),Publish:(0,ue.object)({modules:(0,ue.array)(Pa),dependencies:(0,ue.array)(Os)}),MakeMoveVec:(0,ue.object)({type:(0,ue.nullable)((0,ue.string)()),elements:(0,ue.array)(nn)}),Upgrade:(0,ue.object)({modules:(0,ue.array)(Pa),dependencies:(0,ue.array)(Os),package:Os,ticket:nn}),$Intent:Fb}),wd=go({ImmOrOwnedObject:Xc,SharedObject:(0,ue.object)({objectId:Os,initialSharedVersion:Xi,mutable:(0,ue.boolean)()}),Receiving:Xc}),f5=go({Object:wd,Pure:(0,ue.object)({bytes:Pa}),UnresolvedPure:(0,ue.object)({value:(0,ue.unknown)()}),UnresolvedObject:(0,ue.object)({objectId:Os,version:(0,ue.optional)((0,ue.nullable)(Xi)),digest:(0,ue.optional)((0,ue.nullable)((0,ue.string)())),initialSharedVersion:(0,ue.optional)((0,ue.nullable)(Xi))})}),d5=go({Object:wd,Pure:(0,ue.object)({bytes:Pa})}),Vb=go({None:(0,ue.literal)(!0),Epoch:Xi}),h5=(0,ue.object)({version:(0,ue.literal)(2),sender:(0,ue.nullish)(Ia),expiration:(0,ue.nullish)(Vb),gasData:Lb,inputs:(0,ue.array)(f5),commands:(0,ue.array)(zb)});var _d=Object.defineProperty,p5=Object.getOwnPropertyDescriptor,m5=Object.getOwnPropertyNames,g5=Object.prototype.hasOwnProperty,v5=(e,t)=>{for(var r in t)_d(e,r,{get:t[r],enumerable:!0})},y5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of m5(t))!g5.call(e,i)&&i!==r&&_d(e,i,{get:()=>t[i],enumerable:!(n=p5(t,i))||n.enumerable});return e},b5=e=>y5(_d({},"__esModule",{value:!0}),e),qb={};v5(qb,{Commands:()=>w5,UpgradePolicy:()=>Hb});var xd=b5(qb),Wb=Er,Xn=Hi,Gb=Xr,Jn=mo,Hb=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(Hb||{});const w5={MoveCall(e){const[t,r="",n=""]="target"in e?e.target.split("::"):[e.package,e.module,e.function];return{$kind:"MoveCall",MoveCall:{package:t,module:r,function:n,typeArguments:e.typeArguments??[],arguments:e.arguments??[]}}},TransferObjects(e,t){return{$kind:"TransferObjects",TransferObjects:{objects:e.map(r=>(0,Xn.parse)(Jn.Argument,r)),address:(0,Xn.parse)(Jn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,Xn.parse)(Jn.Argument,e),amounts:t.map(r=>(0,Xn.parse)(Jn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,Xn.parse)(Jn.Argument,e),sources:t.map(r=>(0,Xn.parse)(Jn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,Wb.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,Gb.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,Wb.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,Gb.normalizeSuiObjectId)(i)),package:r,ticket:(0,Xn.parse)(Jn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,Xn.parse)(Jn.Argument,r))}}},Intent({name:e,inputs:t={},data:r={}}){return{$kind:"$Intent",$Intent:{name:e,inputs:Object.fromEntries(Object.entries(t).map(([n,i])=>[n,Array.isArray(i)?i.map(s=>(0,Xn.parse)(Jn.Argument,s)):(0,Xn.parse)(Jn.Argument,i)])),data:r}}}};var Sd=Object.defineProperty,_5=Object.getOwnPropertyDescriptor,x5=Object.getOwnPropertyNames,S5=Object.prototype.hasOwnProperty,E5=(e,t)=>{for(var r in t)Sd(e,r,{get:t[r],enumerable:!0})},C5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of x5(t))!S5.call(e,i)&&i!==r&&Sd(e,i,{get:()=>t[i],enumerable:!(n=_5(t,i))||n.enumerable});return e},M5=e=>C5(Sd({},"__esModule",{value:!0}),e),Kb={};E5(Kb,{NormalizedCallArg:()=>Ed,ObjectRef:()=>Yc,SerializedTransactionDataV1:()=>U5,StructTag:()=>Qb,TransactionArgument:()=>Yn,TypeTag:()=>Zc,serializeV1TransactionData:()=>F5,transactionDataFromV1:()=>z5});var Xb=M5(Kb),vo=Er,ne=Hi,Jb=Gn,ja=mo;const Yc=(0,ne.object)({digest:(0,ne.string)(),objectId:(0,ne.string)(),version:(0,ne.union)([(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),(0,ne.string)(),(0,ne.bigint)()])}),T5=(0,ja.safeEnum)({ImmOrOwned:Yc,Shared:(0,ne.object)({objectId:ja.ObjectID,initialSharedVersion:ja.JsonU64,mutable:(0,ne.boolean)()}),Receiving:Yc}),Ed=(0,ja.safeEnum)({Object:T5,Pure:(0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))}),Yb=(0,ne.union)([(0,ne.object)({kind:(0,ne.literal)("Input"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),value:(0,ne.unknown)(),type:(0,ne.optional)((0,ne.literal)("object"))}),(0,ne.object)({kind:(0,ne.literal)("Input"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),value:(0,ne.unknown)(),type:(0,ne.literal)("pure")})]),A5=(0,ne.union)([(0,ne.object)({Epoch:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),Zb=(0,ne.pipe)((0,ne.union)([(0,ne.number)(),(0,ne.string)(),(0,ne.bigint)()]),(0,ne.check)(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),Zc=(0,ne.union)([(0,ne.object)({bool:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u8:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u64:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u128:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({address:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({signer:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({vector:(0,ne.lazy)(()=>Zc)}),(0,ne.object)({struct:(0,ne.lazy)(()=>Qb)}),(0,ne.object)({u16:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u32:(0,ne.nullable)((0,ne.literal)(!0))}),(0,ne.object)({u256:(0,ne.nullable)((0,ne.literal)(!0))})]),Qb=(0,ne.object)({address:(0,ne.string)(),module:(0,ne.string)(),name:(0,ne.string)(),typeParams:(0,ne.array)(Zc)}),O5=(0,ne.object)({budget:(0,ne.optional)(Zb),price:(0,ne.optional)(Zb),payment:(0,ne.optional)((0,ne.array)(Yc)),owner:(0,ne.optional)((0,ne.string)())}),I5=[Yb,(0,ne.object)({kind:(0,ne.literal)("GasCoin")}),(0,ne.object)({kind:(0,ne.literal)("Result"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())}),(0,ne.object)({kind:(0,ne.literal)("NestedResult"),index:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)()),resultIndex:(0,ne.pipe)((0,ne.number)(),(0,ne.integer)())})],Yn=(0,ne.union)([...I5]),P5=(0,ne.object)({kind:(0,ne.literal)("MoveCall"),target:(0,ne.pipe)((0,ne.string)(),(0,ne.check)(e=>e.split("::").length===3)),typeArguments:(0,ne.array)((0,ne.string)()),arguments:(0,ne.array)(Yn)}),j5=(0,ne.object)({kind:(0,ne.literal)("TransferObjects"),objects:(0,ne.array)(Yn),address:Yn}),k5=(0,ne.object)({kind:(0,ne.literal)("SplitCoins"),coin:Yn,amounts:(0,ne.array)(Yn)}),N5=(0,ne.object)({kind:(0,ne.literal)("MergeCoins"),destination:Yn,sources:(0,ne.array)(Yn)}),R5=(0,ne.object)({kind:(0,ne.literal)("MakeMoveVec"),type:(0,ne.union)([(0,ne.object)({Some:Zc}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),objects:(0,ne.array)(Yn)}),D5=(0,ne.object)({kind:(0,ne.literal)("Publish"),modules:(0,ne.array)((0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))),dependencies:(0,ne.array)((0,ne.string)())}),$5=(0,ne.object)({kind:(0,ne.literal)("Upgrade"),modules:(0,ne.array)((0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))),dependencies:(0,ne.array)((0,ne.string)()),packageId:(0,ne.string)(),ticket:Yn}),B5=[P5,j5,k5,N5,D5,$5,R5],L5=(0,ne.union)([...B5]),U5=(0,ne.object)({version:(0,ne.literal)(1),sender:(0,ne.optional)((0,ne.string)()),expiration:(0,ne.nullish)(A5),gasConfig:O5,inputs:(0,ne.array)(Yb),transactions:(0,ne.array)(L5)});function F5(e){var r;const t=e.inputs.map((n,i)=>{if(n.Object)return{kind:"Input",index:i,value:{Object:n.Object.ImmOrOwnedObject?{ImmOrOwned:n.Object.ImmOrOwnedObject}:n.Object.Receiving?{Receiving:{digest:n.Object.Receiving.digest,version:n.Object.Receiving.version,objectId:n.Object.Receiving.objectId}}:{Shared:{mutable:n.Object.SharedObject.mutable,initialSharedVersion:n.Object.SharedObject.initialSharedVersion,objectId:n.Object.SharedObject.objectId}}},type:"object"};if(n.Pure)return{kind:"Input",index:i,value:{Pure:Array.from((0,vo.fromBase64)(n.Pure.bytes))},type:"pure"};if(n.UnresolvedPure)return{kind:"Input",type:"pure",index:i,value:n.UnresolvedPure.value};if(n.UnresolvedObject)return{kind:"Input",type:"object",index:i,value:n.UnresolvedObject.objectId};throw new Error("Invalid input")});return{version:1,sender:e.sender??void 0,expiration:((r=e.expiration)==null?void 0:r.$kind)==="Epoch"?{Epoch:Number(e.expiration.Epoch)}:e.expiration?{None:!0}:null,gasConfig:{owner:e.gasData.owner??void 0,budget:e.gasData.budget??void 0,price:e.gasData.price??void 0,payment:e.gasData.payment??void 0},inputs:t,transactions:e.commands.map(n=>{if(n.MakeMoveVec)return{kind:"MakeMoveVec",type:n.MakeMoveVec.type===null?{None:!0}:{Some:Jb.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>Si(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:Si(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>Si(i,t))};if(n.MoveCall)return{kind:"MoveCall",target:`${n.MoveCall.package}::${n.MoveCall.module}::${n.MoveCall.function}`,typeArguments:n.MoveCall.typeArguments,arguments:n.MoveCall.arguments.map(i=>Si(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,vo.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:Si(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>Si(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>Si(i,t)),address:Si(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,vo.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:Si(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function Si(e,t){if(e.$kind==="GasCoin")return{kind:"GasCoin"};if(e.$kind==="Result")return{kind:"Result",index:e.Result};if(e.$kind==="NestedResult")return{kind:"NestedResult",index:e.NestedResult[0],resultIndex:e.NestedResult[1]};if(e.$kind==="Input")return t[e.Input];throw new Error(`Invalid argument ${Object.keys(e)}`)}function z5(e){var t,r,n;return(0,ne.parse)(ja.TransactionData,{version:2,sender:e.sender??null,expiration:e.expiration?"Epoch"in e.expiration?{Epoch:e.expiration.Epoch}:{None:!0}:null,gasData:{owner:e.gasConfig.owner??null,budget:((t=e.gasConfig.budget)==null?void 0:t.toString())??null,price:((r=e.gasConfig.price)==null?void 0:r.toString())??null,payment:((n=e.gasConfig.payment)==null?void 0:n.map(i=>({digest:i.digest,objectId:i.objectId,version:i.version.toString()})))??null},inputs:e.inputs.map(i=>{if(i.kind==="Input"){if((0,ne.is)(Ed,i.value)){const s=(0,ne.parse)(Ed,i.value);if(s.Object){if(s.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:s.Object.ImmOrOwned.objectId,version:String(s.Object.ImmOrOwned.version),digest:s.Object.ImmOrOwned.digest}}};if(s.Object.Shared)return{Object:{SharedObject:{mutable:s.Object.Shared.mutable??null,initialSharedVersion:s.Object.Shared.initialSharedVersion,objectId:s.Object.Shared.objectId}}};if(s.Object.Receiving)return{Object:{Receiving:{digest:s.Object.Receiving.digest,version:String(s.Object.Receiving.version),objectId:s.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:(0,vo.toBase64)(new Uint8Array(s.Pure))}}}return i.type==="object"?{UnresolvedObject:{objectId:i.value}}:{UnresolvedPure:{value:i.value}}}throw new Error("Invalid input")}),commands:e.transactions.map(i=>{switch(i.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in i.type?Jb.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>Ei(s))}};case"MergeCoins":return{MergeCoins:{destination:Ei(i.destination),sources:i.sources.map(s=>Ei(s))}};case"MoveCall":{const[s,o,a]=i.target.split("::");return{MoveCall:{package:s,module:o,function:a,typeArguments:i.typeArguments,arguments:i.arguments.map(c=>Ei(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,vo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:Ei(i.coin),amounts:i.amounts.map(s=>Ei(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>Ei(s)),address:Ei(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,vo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:Ei(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function Ei(e){switch(e.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:e.index};case"NestedResult":return{NestedResult:[e.index,e.resultIndex]};case"Input":return{Input:e.index}}}var Cd=Object.defineProperty,V5=Object.getOwnPropertyDescriptor,q5=Object.getOwnPropertyNames,W5=Object.prototype.hasOwnProperty,G5=(e,t)=>{for(var r in t)Cd(e,r,{get:t[r],enumerable:!0})},H5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of q5(t))!W5.call(e,i)&&i!==r&&Cd(e,i,{get:()=>t[i],enumerable:!(n=V5(t,i))||n.enumerable});return e},K5=e=>H5(Cd({},"__esModule",{value:!0}),e),ew={};G5(ew,{SerializedTransactionDataV2:()=>nO});var X5=K5(ew),je=Hi,cr=mo;function ka(e){return(0,je.union)(Object.entries(e).map(([t,r])=>(0,je.object)({[t]:r})))}const _n=ka({GasCoin:(0,je.literal)(!0),Input:(0,je.pipe)((0,je.number)(),(0,je.integer)()),Result:(0,je.pipe)((0,je.number)(),(0,je.integer)()),NestedResult:(0,je.tuple)([(0,je.pipe)((0,je.number)(),(0,je.integer)()),(0,je.pipe)((0,je.number)(),(0,je.integer)())])}),J5=(0,je.object)({budget:(0,je.nullable)(cr.JsonU64),price:(0,je.nullable)(cr.JsonU64),owner:(0,je.nullable)(cr.SuiAddress),payment:(0,je.nullable)((0,je.array)(cr.ObjectRef))}),Y5=(0,je.object)({package:cr.ObjectID,module:(0,je.string)(),function:(0,je.string)(),typeArguments:(0,je.array)((0,je.string)()),arguments:(0,je.array)(_n)}),Z5=(0,je.object)({name:(0,je.string)(),inputs:(0,je.record)((0,je.string)(),(0,je.union)([_n,(0,je.array)(_n)])),data:(0,je.record)((0,je.string)(),(0,je.unknown)())}),Q5=ka({MoveCall:Y5,TransferObjects:(0,je.object)({objects:(0,je.array)(_n),address:_n}),SplitCoins:(0,je.object)({coin:_n,amounts:(0,je.array)(_n)}),MergeCoins:(0,je.object)({destination:_n,sources:(0,je.array)(_n)}),Publish:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID)}),MakeMoveVec:(0,je.object)({type:(0,je.nullable)((0,je.string)()),elements:(0,je.array)(_n)}),Upgrade:(0,je.object)({modules:(0,je.array)(cr.BCSBytes),dependencies:(0,je.array)(cr.ObjectID),package:cr.ObjectID,ticket:_n}),$Intent:Z5}),eO=ka({ImmOrOwnedObject:cr.ObjectRef,SharedObject:(0,je.object)({objectId:cr.ObjectID,initialSharedVersion:cr.JsonU64,mutable:(0,je.boolean)()}),Receiving:cr.ObjectRef}),tO=ka({Object:eO,Pure:(0,je.object)({bytes:cr.BCSBytes}),UnresolvedPure:(0,je.object)({value:(0,je.unknown)()}),UnresolvedObject:(0,je.object)({objectId:cr.ObjectID,version:(0,je.optional)((0,je.nullable)(cr.JsonU64)),digest:(0,je.optional)((0,je.nullable)((0,je.string)())),initialSharedVersion:(0,je.optional)((0,je.nullable)(cr.JsonU64))})}),rO=ka({None:(0,je.literal)(!0),Epoch:cr.JsonU64}),nO=(0,je.object)({version:(0,je.literal)(2),sender:(0,je.nullish)(cr.SuiAddress),expiration:(0,je.nullish)(rO),gasData:J5,inputs:(0,je.array)(tO),commands:(0,je.array)(Q5)});var Md=Object.defineProperty,iO=Object.getOwnPropertyDescriptor,sO=Object.getOwnPropertyNames,oO=Object.prototype.hasOwnProperty,aO=(e,t)=>{for(var r in t)Md(e,r,{get:t[r],enumerable:!0})},cO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sO(t))!oO.call(e,i)&&i!==r&&Md(e,i,{get:()=>t[i],enumerable:!(n=iO(t,i))||n.enumerable});return e},uO=e=>cO(Md({},"__esModule",{value:!0}),e),tw={};aO(tw,{getClient:()=>yo,resolveTransactionData:()=>mO});var rw=uO(tw),lO=Hi,nw=Gn,Td=Ab,fO=mo,Na=Kc,Ad=kb;const dO=50,hO=1000n,pO=5e10;async function mO(e,t,r){return await wO(e,t),await bO(e,t),t.onlyTransactionKind||(await gO(e,t),await vO(e,t),await yO(e,t)),await _O(e),await r()}async function gO(e,t){e.gasConfig.price||(e.gasConfig.price=String(await yo(t).getReferenceGasPrice()))}async function vO(e,t){if(e.gasConfig.budget)return;const r=await yo(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(pO),payment:[]}}})});if(r.effects.status.status!=="success")throw new Error(`Dry run failed, could not automatically determine a budget: ${r.effects.status.error}`,{cause:r});const n=hO*BigInt(e.gasConfig.price||1n),i=BigInt(r.effects.gasUsed.computationCost)+n,s=i+BigInt(r.effects.gasUsed.storageCost)-BigInt(r.effects.gasUsed.storageRebate);e.gasConfig.budget=String(s>i?s:i)}async function yO(e,t){if(!e.gasConfig.payment){const n=(await yo(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Td.SUI_TYPE_ARG})).data.filter(i=>!e.inputs.find(o=>{var a;return(a=o.Object)!=null&&a.ImmOrOwnedObject?i.coinObjectId===o.Object.ImmOrOwnedObject.objectId:!1})).map(i=>({objectId:i.coinObjectId,digest:i.digest,version:i.version}));if(!n.length)throw new Error("No valid gas coins found for the transaction.");e.gasConfig.payment=n.map(i=>(0,lO.parse)(fO.ObjectRef,i))}}async function bO(e,t){const r=e.inputs.filter(l=>{var f;return l.UnresolvedObject&&!(l.UnresolvedObject.version||(f=l.UnresolvedObject)!=null&&f.initialSharedVersion)}),n=[...new Set(r.map(l=>(0,Td.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?CO(n,dO):[],s=(await Promise.all(i.map(l=>yo(t).multiGetObjects({ids:l,options:{showOwner:!0}})))).flat(),o=new Map(n.map((l,f)=>[l,s[f]])),a=Array.from(o).filter(([l,f])=>f.error).map(([l,f])=>JSON.stringify(f.error));if(a.length)throw new Error(`The following input objects are invalid: ${a.join(", ")}`);const c=s.map(l=>{if(l.error||!l.data)throw new Error(`Failed to fetch object: ${l.error}`);const f=l.data.owner,h=f&&typeof f=="object"&&"Shared"in f?f.Shared.initial_shared_version:null;return{objectId:l.data.objectId,digest:l.data.digest,version:l.data.version,initialSharedVersion:h}}),u=new Map(n.map((l,f)=>[l,c[f]]));for(const[l,f]of e.inputs.entries()){if(!f.UnresolvedObject)continue;let h;const y=(0,Td.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=Na.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:xO(e,l)}):SO(e,l)&&(h=Na.Inputs.ReceivingRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})),e.inputs[e.inputs.indexOf(f)]=h??Na.Inputs.ObjectRef({objectId:y,digest:f.UnresolvedObject.digest??(b==null?void 0:b.digest),version:f.UnresolvedObject.version??(b==null?void 0:b.version)})}}async function wO(e,t){const{inputs:r,commands:n}=e,i=[],s=new Set;n.forEach(a=>{if(a.MoveCall){if(a.MoveCall._argumentTypes)return;if(a.MoveCall.arguments.map(l=>l.$kind==="Input"?e.inputs[l.Input]:null).some(l=>(l==null?void 0:l.UnresolvedPure)||(l==null?void 0:l.UnresolvedObject))){const l=`${a.MoveCall.package}::${a.MoveCall.module}::${a.MoveCall.function}`;s.add(l),i.push(a.MoveCall)}}switch(a.$kind){case"SplitCoins":a.SplitCoins.amounts.forEach(c=>{iw(c,nw.bcs.U64,e)});break;case"TransferObjects":iw(a.TransferObjects.address,nw.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=yo(t);await Promise.all([...s].map(async c=>{const[u,l,f]=c.split("::"),h=await a.getNormalizedMoveFunction({package:u,module:l,function:f});o.set(c,h.parameters.map(y=>(0,Ad.normalizedTypeToMoveTypeSignature)(y)))}))}i.length&&await Promise.all(i.map(async a=>{const c=o.get(`${a.package}::${a.module}::${a.function}`);if(!c)return;const l=c.length>0&&(0,Ad.isTxContext)(c.at(-1))?c.slice(0,c.length-1):c;a._argumentTypes=l})),n.forEach(a=>{if(!a.MoveCall)return;const c=a.MoveCall,u=`${c.package}::${c.module}::${c.function}`,l=c._argumentTypes;if(l){if(l.length!==a.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${u}`);l.forEach((f,h)=>{var N,R;const y=c.arguments[h];if(y.$kind!=="Input")return;const b=r[y.Input];if(!b.UnresolvedPure&&!b.UnresolvedObject)return;const w=((N=b.UnresolvedPure)==null?void 0:N.value)??((R=b.UnresolvedObject)==null?void 0:R.objectId),A=(0,Ad.getPureBcsSchema)(f.body);if(A){y.type="pure",r[r.indexOf(b)]=Na.Inputs.Pure(A.serialize(w));return}if(typeof w!="string")throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(w,null,2)}`);y.type="object";const P=b.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:w}}:b;r[y.Input]=P})}})}function _O(e){e.inputs.forEach((t,r)=>{if(t.$kind!=="Object"&&t.$kind!=="Pure")throw new Error(`Input at index ${r} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(t)}`)})}function iw(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=Na.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function xO(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const s=i.MoveCall.arguments.indexOf(n);r=i.MoveCall._argumentTypes[s].ref!=="&"||r}(i.$kind==="MakeMoveVec"||i.$kind==="MergeCoins"||i.$kind==="SplitCoins")&&(r=!0)}),r}function SO(e,t){let r=!1;return e.getInputUses(t,(n,i)=>{if(i.MoveCall&&i.MoveCall._argumentTypes){const s=i.MoveCall.arguments.indexOf(n);r=EO(i.MoveCall._argumentTypes[s])||r}}),r}function EO(e){return typeof e.body!="object"||!("datatype"in e.body)?!1:e.body.datatype.package==="0x2"&&e.body.datatype.module==="transfer"&&e.body.datatype.type==="Receiving"}function yo(e){if(!e.client)throw new Error("No sui client passed to Transaction#build, but transaction data was not sufficient to build offline.");return e.client}function CO(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var Od=Object.defineProperty,MO=Object.getOwnPropertyDescriptor,TO=Object.getOwnPropertyNames,AO=Object.prototype.hasOwnProperty,OO=(e,t)=>{for(var r in t)Od(e,r,{get:t[r],enumerable:!0})},IO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of TO(t))!AO.call(e,i)&&i!==r&&Od(e,i,{get:()=>t[i],enumerable:!(n=MO(t,i))||n.enumerable});return e},PO=e=>IO(Od({},"__esModule",{value:!0}),e),sw={};OO(sw,{createObjectMethods:()=>jO});var ow=PO(sw);function jO(e){function t(r){return e(r)}return t.system=()=>t("0x5"),t.clock=()=>t("0x6"),t.random=()=>t("0x8"),t.denyList=()=>t("0x403"),t.option=({type:r,value:n})=>i=>i.moveCall({typeArguments:[r],target:`0x1::option::${n===null?"none":"some"}`,arguments:n===null?[]:[i.object(n)]}),t}var Id=Object.defineProperty,kO=Object.getOwnPropertyDescriptor,NO=Object.getOwnPropertyNames,RO=Object.prototype.hasOwnProperty,DO=(e,t)=>{for(var r in t)Id(e,r,{get:t[r],enumerable:!0})},$O=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NO(t))!RO.call(e,i)&&i!==r&&Id(e,i,{get:()=>t[i],enumerable:!(n=kO(t,i))||n.enumerable});return e},BO=e=>$O(Id({},"__esModule",{value:!0}),e),aw={};DO(aw,{createPure:()=>UO});var cw=BO(aw),LO=Er,rr=Gn;function UO(e){function t(r,n){if(typeof r=="string")return e(Ra(r).serialize(n));if(r instanceof Uint8Array||(0,LO.isSerializedBcs)(r))return e(r);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return t.u8=r=>e(rr.bcs.U8.serialize(r)),t.u16=r=>e(rr.bcs.U16.serialize(r)),t.u32=r=>e(rr.bcs.U32.serialize(r)),t.u64=r=>e(rr.bcs.U64.serialize(r)),t.u128=r=>e(rr.bcs.U128.serialize(r)),t.u256=r=>e(rr.bcs.U256.serialize(r)),t.bool=r=>e(rr.bcs.Bool.serialize(r)),t.string=r=>e(rr.bcs.String.serialize(r)),t.address=r=>e(rr.bcs.Address.serialize(r)),t.id=t.address,t.vector=(r,n)=>e(rr.bcs.vector(Ra(r)).serialize(n)),t.option=(r,n)=>e(rr.bcs.option(Ra(r)).serialize(n)),t}function Ra(e){switch(e){case"u8":return rr.bcs.u8();case"u16":return rr.bcs.u16();case"u32":return rr.bcs.u32();case"u64":return rr.bcs.u64();case"u128":return rr.bcs.u128();case"u256":return rr.bcs.u256();case"bool":return rr.bcs.bool();case"string":return rr.bcs.string();case"id":case"address":return rr.bcs.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[r,n]=t.slice(1);return r==="vector"?rr.bcs.vector(Ra(n)):rr.bcs.option(Ra(n))}throw new Error(`Invalid Pure type name: ${e}`)}var Pd=Object.defineProperty,FO=Object.getOwnPropertyDescriptor,zO=Object.getOwnPropertyNames,VO=Object.prototype.hasOwnProperty,qO=(e,t)=>{for(var r in t)Pd(e,r,{get:t[r],enumerable:!0})},WO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zO(t))!VO.call(e,i)&&i!==r&&Pd(e,i,{get:()=>t[i],enumerable:!(n=FO(t,i))||n.enumerable});return e},GO=e=>WO(Pd({},"__esModule",{value:!0}),e),uw={};qO(uw,{hashTypedData:()=>XO});var HO=GO(uw),KO=Cb;function XO(e,t){const r=Array.from(`${e}::`).map(i=>i.charCodeAt(0)),n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),(0,KO.blake2b)(n,{dkLen:32})}var jd=Object.defineProperty,JO=Object.getOwnPropertyDescriptor,YO=Object.getOwnPropertyNames,ZO=Object.prototype.hasOwnProperty,QO=(e,t)=>{for(var r in t)jd(e,r,{get:t[r],enumerable:!0})},eI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YO(t))!ZO.call(e,i)&&i!==r&&jd(e,i,{get:()=>t[i],enumerable:!(n=JO(t,i))||n.enumerable});return e},tI=e=>eI(jd({},"__esModule",{value:!0}),e),lw={};QO(lw,{TransactionDataBuilder:()=>Is});var kd=tI(lw),rI=Er,Nd=Hi,Qc=Gn,nI=Xr,Rd=mo,iI=Xb,sI=HO;function fw(e){return(0,nI.normalizeSuiAddress)(e).replace("0x","")}class Is{constructor(t){this.version=2,this.sender=(t==null?void 0:t.sender)??null,this.expiration=(t==null?void 0:t.expiration)??null,this.inputs=(t==null?void 0:t.inputs)??[],this.commands=(t==null?void 0:t.commands)??[],this.gasData=(t==null?void 0:t.gasData)??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(t){const n=Qc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Is.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:n.inputs,commands:n.commands})}static fromBytes(t){const r=Qc.bcs.TransactionData.parse(t),n=r==null?void 0:r.V1,i=n.kind.ProgrammableTransaction;if(!n||!i)throw new Error("Unable to deserialize from bytes.");return Is.restore({version:2,sender:n.sender,expiration:n.expiration,gasData:n.gasData,inputs:i.inputs,commands:i.commands})}static restore(t){return t.version===2?new Is((0,Nd.parse)(Rd.TransactionData,t)):new Is((0,Nd.parse)(Rd.TransactionData,(0,iI.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,sI.hashTypedData)("TransactionData",t);return(0,rI.toBase58)(r)}get gasConfig(){return this.gasData}set gasConfig(t){this.gasData=t}build({maxSizeBytes:t=1/0,overrides:r,onlyTransactionKind:n}={}){const i=this.inputs,s=this.commands,o={ProgrammableTransaction:{inputs:i,commands:s}};if(n)return Qc.bcs.TransactionKind.serialize(o,{maxSize:t}).toBytes();const a=(r==null?void 0:r.expiration)??this.expiration,c=(r==null?void 0:r.sender)??this.sender,u={...this.gasData,...r==null?void 0:r.gasConfig,...r==null?void 0:r.gasData};if(!c)throw new Error("Missing transaction sender");if(!u.budget)throw new Error("Missing gas budget");if(!u.payment)throw new Error("Missing gas payment");if(!u.price)throw new Error("Missing gas price");const l={sender:fw(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:fw(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return Qc.bcs.TransactionData.serialize({V1:l},{maxSize:t}).toBytes()}addInput(t,r){const n=this.inputs.length;return this.inputs.push(r),{Input:n,type:t,$kind:"Input"}}getInputUses(t,r){this.mapArguments((n,i)=>(n.$kind==="Input"&&n.Input===t&&r(n,i),n))}mapArguments(t){for(const r of this.commands)switch(r.$kind){case"MoveCall":r.MoveCall.arguments=r.MoveCall.arguments.map(i=>t(i,r));break;case"TransferObjects":r.TransferObjects.objects=r.TransferObjects.objects.map(i=>t(i,r)),r.TransferObjects.address=t(r.TransferObjects.address,r);break;case"SplitCoins":r.SplitCoins.coin=t(r.SplitCoins.coin,r),r.SplitCoins.amounts=r.SplitCoins.amounts.map(i=>t(i,r));break;case"MergeCoins":r.MergeCoins.destination=t(r.MergeCoins.destination,r),r.MergeCoins.sources=r.MergeCoins.sources.map(i=>t(i,r));break;case"MakeMoveVec":r.MakeMoveVec.elements=r.MakeMoveVec.elements.map(i=>t(i,r));break;case"Upgrade":r.Upgrade.ticket=t(r.Upgrade.ticket,r);break;case"$Intent":const n=r.$Intent.inputs;r.$Intent.inputs={};for(const[i,s]of Object.entries(n))r.$Intent.inputs[i]=Array.isArray(s)?s.map(o=>t(o,r)):t(s,r);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${r.$kind}`)}}replaceCommand(t,r){if(!Array.isArray(r)){this.commands[t]=r;return}const n=r.length-1;this.commands.splice(t,1,...r),n!==0&&this.mapArguments(i=>{switch(i.$kind){case"Result":i.Result>t&&(i.Result+=n);break;case"NestedResult":i.NestedResult[0]>t&&(i.NestedResult[0]+=n);break}return i})}getDigest(){const t=this.build({onlyTransactionKind:!1});return Is.getDigestFromBytes(t)}snapshot(){return(0,Nd.parse)(Rd.TransactionData,this)}}var Dd=Object.defineProperty,oI=Object.getOwnPropertyDescriptor,aI=Object.getOwnPropertyNames,cI=Object.prototype.hasOwnProperty,uI=(e,t)=>{for(var r in t)Dd(e,r,{get:t[r],enumerable:!0})},lI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aI(t))!cI.call(e,i)&&i!==r&&Dd(e,i,{get:()=>t[i],enumerable:!(n=oI(t,i))||n.enumerable});return e},fI=e=>lI(Dd({},"__esModule",{value:!0}),e),dw={};uI(dw,{extractMutableReference:()=>hw,extractReference:()=>pw,extractStructTag:()=>hI,getIdFromCallArg:()=>pI});var dI=fI(dw),Da=Xr;function hw(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function pw(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function hI(e){if(typeof e=="object"&&"Struct"in e)return e;const t=pw(e),r=hw(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function pI(e){if(typeof e=="string")return(0,Da.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,Da.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,Da.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,Da.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,Da.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var $d=Object.defineProperty,mI=Object.getOwnPropertyDescriptor,gI=Object.getOwnPropertyNames,vI=Object.prototype.hasOwnProperty,mw=e=>{throw TypeError(e)},yI=(e,t)=>{for(var r in t)$d(e,r,{get:t[r],enumerable:!0})},bI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gI(t))!vI.call(e,i)&&i!==r&&$d(e,i,{get:()=>t[i],enumerable:!(n=mI(t,i))||n.enumerable});return e},wI=e=>bI($d({},"__esModule",{value:!0}),e),Bd=(e,t,r)=>t.has(e)||mw("Cannot "+r),Ct=(e,t,r)=>(Bd(e,t,"read from private field"),r?r.call(e):t.get(e)),$a=(e,t,r)=>t.has(e)?mw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ps=(e,t,r,n)=>(Bd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ci=(e,t,r)=>(Bd(e,t,"access private method"),r),gw={};yI(gw,{Transaction:()=>TI,isTransaction:()=>_w});var eu=wI(gw),tu=Er,Ji=Hi,_I=Xr,js=xd,ks=mo,vw=Xb,xI=X5,ru=Kc,SI=rw,EI=ow,CI=cw,Ba=kd,yw=dI,La,Ua,Ns,Tt,xn,nu,Ld,Ud,Fd;function bw(e,t=1/0){const r={$kind:"Result",Result:e},n=[],i=s=>n[s]??(n[s]={$kind:"NestedResult",NestedResult:[e,s]});return new Proxy(r,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(s,o){if(o in s)return Reflect.get(s,o);if(o===Symbol.iterator)return function*(){let c=0;for(;c<t;)yield i(c),c++};if(typeof o=="symbol")return;const a=parseInt(o,10);if(!(Number.isNaN(a)||a<0))return i(a)}})}const ww=Symbol.for("@mysten/transaction");function _w(e){return!!e&&typeof e=="object"&&e[ww]===!0}const xw={buildPlugins:new Map,serializationPlugins:new Map},zd=Symbol.for("@mysten/transaction/registry");function Fa(){try{const e=globalThis;return e[zd]||(e[zd]=xw),e[zd]}catch{return xw}}const MI=class Z0{constructor(){$a(this,xn),$a(this,La),$a(this,Ua),$a(this,Ns,new Map),$a(this,Tt),this.object=(0,EI.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Ji.is)(ks.Argument,r))return r;const n=(0,yw.getIdFromCallArg)(r),i=Ct(this,Tt).inputs.find(a=>n===(0,yw.getIdFromCallArg)(a));return(s=i==null?void 0:i.Object)!=null&&s.SharedObject&&typeof r=="object"&&((o=r.Object)!=null&&o.SharedObject)&&(i.Object.SharedObject.mutable=i.Object.SharedObject.mutable||r.Object.SharedObject.mutable),i?{$kind:"Input",Input:Ct(this,Tt).inputs.indexOf(i),type:"object"}:Ct(this,Tt).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,_I.normalizeSuiAddress)(r)}}:r)});const t=Fa();Ps(this,Tt,new Ba.TransactionDataBuilder),Ps(this,Ua,[...t.buildPlugins.values()]),Ps(this,La,[...t.serializationPlugins.values()])}static fromKind(t){const r=new Z0;return Ps(r,Tt,Ba.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,tu.fromBase64)(t):t)),r}static from(t){const r=new Z0;return _w(t)?Ps(r,Tt,new Ba.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?Ps(r,Tt,Ba.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,tu.fromBase64)(t):t)):Ps(r,Tt,Ba.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){Fa().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){Fa().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){Fa().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){Fa().buildPlugins.delete(t)}addSerializationPlugin(t){Ct(this,La).push(t)}addBuildPlugin(t){Ct(this,Ua).push(t)}addIntentResolver(t,r){if(Ct(this,Ns).has(t)&&Ct(this,Ns).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Ct(this,Ns).set(t,r)}setSender(t){Ct(this,Tt).sender=t}setSenderIfNotSet(t){Ct(this,Tt).sender||(Ct(this,Tt).sender=t)}setExpiration(t){Ct(this,Tt).expiration=t?(0,Ji.parse)(ks.TransactionExpiration,t):null}setGasPrice(t){Ct(this,Tt).gasConfig.price=String(t)}setGasBudget(t){Ct(this,Tt).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Ct(this,Tt).gasData.budget==null&&(Ct(this,Tt).gasConfig.budget=String(t))}setGasOwner(t){Ct(this,Tt).gasConfig.owner=t}setGasPayment(t){Ct(this,Tt).gasConfig.payment=t.map(r=>(0,Ji.parse)(ks.ObjectRef,r))}get blockData(){return(0,vw.serializeV1TransactionData)(Ct(this,Tt).snapshot())}getData(){return Ct(this,Tt).snapshot()}get[ww](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,CI.createPure)(t=>(0,tu.isSerializedBcs)(t)?Ct(this,Tt).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Ct(this,Tt).addInput("pure",(0,Ji.is)(ks.NormalizedCallArg,t)?(0,Ji.parse)(ks.NormalizedCallArg,t):t instanceof Uint8Array?ru.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(ru.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(ru.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(ru.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Ct(this,Tt).commands.push(t);return bw(r-1)}splitCoins(t,r){const n=js.Commands.SplitCoins(typeof t=="string"?this.object(t):Ci(this,xn,Ld).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):Ci(this,xn,nu).call(this,s))),i=Ct(this,Tt).commands.push(n);return bw(i-1,r.length)}mergeCoins(t,r){return this.add(js.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(js.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(js.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(js.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>Ci(this,xn,nu).call(this,n))}))}transferObjects(t,r){return this.add(js.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):Ci(this,xn,nu).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(js.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,vw.serializeV1TransactionData)(Ct(this,Tt).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Ji.parse)(xI.SerializedTransactionDataV2,Ct(this,Tt).snapshot()),(r,n)=>typeof n=="bigint"?n.toString():n,2)}async sign(t){const{signer:r,...n}=t,i=await this.build(n);return r.signTransaction(i)}async build(t={}){return await this.prepareForSerialization(t),await Ci(this,xn,Ud).call(this,t),Ct(this,Tt).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await Ci(this,xn,Ud).call(this,t),Ct(this,Tt).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Ct(this,Tt).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Ct(this,La)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Ct(this,Ns).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Ct(this,Ns).get(s))}await Ci(this,xn,Fd).call(this,n,t)}};La=new WeakMap,Ua=new WeakMap,Ns=new WeakMap,Tt=new WeakMap,xn=new WeakSet,nu=function(e){return(0,tu.isSerializedBcs)(e)?this.pure(e):Ci(this,xn,Ld).call(this,e)},Ld=function(e){return typeof e=="function"?(0,Ji.parse)(ks.Argument,e(this)):(0,Ji.parse)(ks.Argument,e)},Ud=async function(e){if(!e.onlyTransactionKind&&!Ct(this,Tt).sender)throw new Error("Missing transaction sender");await Ci(this,xn,Fd).call(this,[...Ct(this,Ua),SI.resolveTransactionData],e)},Fd=async function(e,t){const r=n=>{if(n>=e.length)return()=>{};const i=e[n];return async()=>{const s=r(n+1);let o=!1,a=!1;if(await i(Ct(this,Tt),t,async()=>{if(o)throw new Error(`next() was call multiple times in TransactionPlugin ${n}`);o=!0,await s(),a=!0}),!o)throw new Error(`next() was not called in TransactionPlugin ${n}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${n}`)}};await r(0)()};let TI=MI;var Vd=Object.defineProperty,AI=Object.getOwnPropertyDescriptor,OI=Object.getOwnPropertyNames,II=Object.prototype.hasOwnProperty,Sw=e=>{throw TypeError(e)},PI=(e,t)=>{for(var r in t)Vd(e,r,{get:t[r],enumerable:!0})},jI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OI(t))!II.call(e,i)&&i!==r&&Vd(e,i,{get:()=>t[i],enumerable:!(n=AI(t,i))||n.enumerable});return e},kI=e=>jI(Vd({},"__esModule",{value:!0}),e),Ew=(e,t,r)=>t.has(e)||Sw("Cannot "+r),dr=(e,t,r)=>(Ew(e,t,"read from private field"),r?r.call(e):t.get(e)),qd=(e,t,r)=>t.has(e)?Sw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Cw=(e,t,r,n)=>(Ew(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Mw={};PI(Mw,{AsyncCache:()=>Aw,InMemoryCache:()=>Ow,ObjectCache:()=>NI});var Tw=kI(Mw),Wd=Xr,Rs,Cr,iu;class Aw{async getObject(t){const[r,n]=await Promise.all([this.get("OwnedObject",t),this.get("SharedOrImmutableObject",t)]);return r??n??null}async getObjects(t){return Promise.all([...t.map(r=>this.getObject(r))])}async addObject(t){return t.owner?await this.set("OwnedObject",t.objectId,t):await this.set("SharedOrImmutableObject",t.objectId,t),t}async addObjects(t){await Promise.all(t.map(async r=>this.addObject(r)))}async deleteObject(t){await Promise.all([this.delete("OwnedObject",t),this.delete("SharedOrImmutableObject",t)])}async deleteObjects(t){await Promise.all(t.map(r=>this.deleteObject(r)))}async getMoveFunctionDefinition(t){const r=`${(0,Wd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,Wd.normalizeSuiAddress)(t.package),n=`${r}::${t.module}::${t.function}`,i={...t,package:r};return await this.set("MoveFunction",n,i),i}async deleteMoveFunctionDefinition(t){const r=`${(0,Wd.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;await this.delete("MoveFunction",r)}async getCustom(t){return this.get("Custom",t)}async setCustom(t,r){return this.set("Custom",t,r)}async deleteCustom(t){return this.delete("Custom",t)}}class Ow extends Aw{constructor(){super(...arguments),qd(this,Rs,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return dr(this,Rs)[t].get(r)??null}async set(t,r,n){dr(this,Rs)[t].set(r,n)}async delete(t,r){dr(this,Rs)[t].delete(r)}async clear(t){if(t)dr(this,Rs)[t].clear();else for(const r of Object.values(dr(this,Rs)))r.clear()}}Rs=new WeakMap;class NI{constructor({cache:t=new Ow,onEffects:r}){qd(this,Cr),qd(this,iu),Cw(this,Cr,t),Cw(this,iu,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await dr(this,Cr).getObjects(i)).filter(a=>a!==null),o=new Map(s.map(a=>[a.objectId,a]));for(const a of t.inputs){if(!a.UnresolvedObject)continue;const c=o.get(a.UnresolvedObject.objectId);c&&(c.initialSharedVersion&&!a.UnresolvedObject.initialSharedVersion?a.UnresolvedObject.initialSharedVersion=c.initialSharedVersion:(c.version&&!a.UnresolvedObject.version&&(a.UnresolvedObject.version=c.version),c.digest&&!a.UnresolvedObject.digest&&(a.UnresolvedObject.digest=c.digest)))}await Promise.all(t.commands.map(async a=>{if(a.MoveCall){const c=await this.getMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function});c&&(a.MoveCall._argumentTypes=c.parameters)}})),await n(),await Promise.all(t.commands.map(async a=>{var c;(c=a.MoveCall)!=null&&c._argumentTypes&&await dr(this,Cr).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await dr(this,Cr).clear()}async getMoveFunctionDefinition(t){return dr(this,Cr).getMoveFunctionDefinition(t)}async getObjects(t){return dr(this,Cr).getObjects(t)}async deleteObjects(t){return dr(this,Cr).deleteObjects(t)}async clearOwnedObjects(){await dr(this,Cr).clear("OwnedObject")}async clearCustom(){await dr(this,Cr).clear("Custom")}async getCustom(t){return dr(this,Cr).getCustom(t)}async setCustom(t,r){return dr(this,Cr).setCustom(t,r)}async deleteCustom(t){return dr(this,Cr).deleteCustom(t)}async applyEffects(t){var r;if(!t.V2)throw new Error(`Unsupported transaction effects version ${t.$kind}`);const{lamportVersion:n,changedObjects:i}=t.V2,s=[],o=[];i.forEach(([a,c])=>{var u;if(c.outputState.NotExist)s.push(a);else if(c.outputState.ObjectWrite){const[l,f]=c.outputState.ObjectWrite;o.push({objectId:a,digest:l,version:n,owner:f.AddressOwner??f.ObjectOwner??null,initialSharedVersion:((u=f.Shared)==null?void 0:u.initialSharedVersion)??null})}}),await Promise.all([dr(this,Cr).addObjects(o),dr(this,Cr).deleteObjects(s),(r=dr(this,iu))==null?void 0:r.call(this,t)])}}Cr=new WeakMap,iu=new WeakMap;var Gd=Object.defineProperty,RI=Object.getOwnPropertyDescriptor,DI=Object.getOwnPropertyNames,$I=Object.prototype.hasOwnProperty,Iw=e=>{throw TypeError(e)},BI=(e,t)=>{for(var r in t)Gd(e,r,{get:t[r],enumerable:!0})},LI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DI(t))!$I.call(e,i)&&i!==r&&Gd(e,i,{get:()=>t[i],enumerable:!(n=RI(t,i))||n.enumerable});return e},UI=e=>LI(Gd({},"__esModule",{value:!0}),e),Pw=(e,t,r)=>t.has(e)||Iw("Cannot "+r),za=(e,t,r)=>(Pw(e,t,"read from private field"),r?r.call(e):t.get(e)),jw=(e,t,r)=>t.has(e)?Iw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Hd=(e,t,r,n)=>(Pw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),kw={};BI(kw,{CachingTransactionExecutor:()=>qI});var Nw=UI(kw),FI=Gn,zI=Tw,VI=eu,bo,wo;class qI{constructor({client:t,...r}){jw(this,bo),jw(this,wo,null),Hd(this,bo,t),this.cache=new zI.ObjectCache(r)}async reset(){await Promise.all([this.cache.clearOwnedObjects(),this.cache.clearCustom(),this.waitForLastTransaction()])}async buildTransaction({transaction:t,...r}){return t.addBuildPlugin(this.cache.asPlugin()),t.build({client:za(this,bo),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,VI.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await za(this,bo).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=FI.bcs.TransactionEffects.parse(Uint8Array.from(s.rawEffects));await this.applyEffects(o)}return s}async signAndExecuteTransaction({options:t,transaction:r,...n}){r.setSenderIfNotSet(n.signer.toSuiAddress());const i=await this.buildTransaction({transaction:r}),{signature:s}=await n.signer.signTransaction(i);return await this.executeTransaction({transaction:i,signature:s,options:t})}async applyEffects(t){var r;Hd(this,wo,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){za(this,wo)&&(await za(this,bo).waitForTransaction({digest:za(this,wo)}),Hd(this,wo,null))}}bo=new WeakMap,wo=new WeakMap;var Kd=Object.defineProperty,WI=Object.getOwnPropertyDescriptor,GI=Object.getOwnPropertyNames,HI=Object.prototype.hasOwnProperty,Rw=e=>{throw TypeError(e)},KI=(e,t)=>{for(var r in t)Kd(e,r,{get:t[r],enumerable:!0})},XI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GI(t))!HI.call(e,i)&&i!==r&&Kd(e,i,{get:()=>t[i],enumerable:!(n=WI(t,i))||n.enumerable});return e},JI=e=>XI(Kd({},"__esModule",{value:!0}),e),YI=(e,t,r)=>t.has(e)||Rw("Cannot "+r),Sn=(e,t,r)=>(YI(e,t,"read from private field"),r?r.call(e):t.get(e)),Dw=(e,t,r)=>t.has(e)?Rw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),$w={};KI($w,{ParallelQueue:()=>QI,SerialQueue:()=>ZI});var Bw=JI($w),Yi,Ds;class ZI{constructor(){Dw(this,Yi,[])}async runTask(t){return new Promise((r,n)=>{Sn(this,Yi).push(()=>{t().finally(()=>{Sn(this,Yi).shift(),Sn(this,Yi).length>0&&Sn(this,Yi)[0]()}).then(r,n)}),Sn(this,Yi).length===1&&Sn(this,Yi)[0]()})}}Yi=new WeakMap;class QI{constructor(t){Dw(this,Ds,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{Sn(this,Ds).length>0?Sn(this,Ds).shift()():this.activeTasks--}).then(r,n)):Sn(this,Ds).push(()=>{t().finally(()=>{Sn(this,Ds).length>0?Sn(this,Ds).shift()():this.activeTasks--}).then(r,n)})})}}Ds=new WeakMap;var Xd=Object.defineProperty,eP=Object.getOwnPropertyDescriptor,tP=Object.getOwnPropertyNames,rP=Object.prototype.hasOwnProperty,Lw=e=>{throw TypeError(e)},nP=(e,t)=>{for(var r in t)Xd(e,r,{get:t[r],enumerable:!0})},iP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tP(t))!rP.call(e,i)&&i!==r&&Xd(e,i,{get:()=>t[i],enumerable:!(n=eP(t,i))||n.enumerable});return e},sP=e=>iP(Xd({},"__esModule",{value:!0}),e),Uw=(e,t,r)=>t.has(e)||Lw("Cannot "+r),Mr=(e,t,r)=>(Uw(e,t,"read from private field"),r?r.call(e):t.get(e)),_o=(e,t,r)=>t.has(e)?Lw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Jd=(e,t,r,n)=>(Uw(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Fw={};nP(Fw,{SerialTransactionExecutor:()=>uP,getGasCoinFromEffects:()=>qw});var zw=sP(Fw),oP=Er,Vw=eu,aP=Nw,cP=Bw,su,Va,En,ou,Yd,au;class uP{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){_o(this,su,new cP.SerialQueue),_o(this,Va),_o(this,En),_o(this,ou),_o(this,Yd,async i=>{if(!i.V2)return;const s=qw(i).ref;s?Mr(this,En).cache.setCustom("gasCoin",s):Mr(this,En).cache.deleteCustom("gasCoin")}),_o(this,au,async i=>{const s=await Mr(this,En).cache.getCustom("gasCoin"),o=Vw.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Mr(this,ou)),o.setSenderIfNotSet(Mr(this,Va).toSuiAddress()),Mr(this,En).buildTransaction({transaction:o})}),Jd(this,Va,t),Jd(this,ou,r),Jd(this,En,new aP.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Mr(this,Yd).call(this,i)}))}async applyEffects(t){return Mr(this,En).applyEffects(t)}async buildTransaction(t){return Mr(this,su).runTask(()=>Mr(this,au).call(this,t))}resetCache(){return Mr(this,En).reset()}waitForLastTransaction(){return Mr(this,En).waitForLastTransaction()}executeTransaction(t,r){return Mr(this,su).runTask(async()=>{const n=(0,Vw.isTransaction)(t)?await Mr(this,au).call(this,t):t,{signature:i}=await Mr(this,Va).signTransaction(n),s=await Mr(this,En).executeTransaction({signature:i,transaction:n,options:r}).catch(async a=>{throw await this.resetCache(),a}),o=Uint8Array.from(s.rawEffects);return{digest:s.digest,effects:(0,oP.toBase64)(o),data:s}})}}su=new WeakMap,Va=new WeakMap,En=new WeakMap,ou=new WeakMap,Yd=new WeakMap,au=new WeakMap;function qw(e){if(!e.V2)throw new Error("Unexpected effects version");const t=e.V2.changedObjects[e.V2.gasObjectIndex];if(!t)throw new Error("Gas object not found in effects");const[r,{outputState:n}]=t;if(!n.ObjectWrite)throw new Error("Unexpected gas object state");const[i,s]=n.ObjectWrite;return{ref:{objectId:r,digest:i,version:e.V2.lamportVersion},owner:s.AddressOwner||s.ObjectOwner}}var Zd=Object.defineProperty,lP=Object.getOwnPropertyDescriptor,fP=Object.getOwnPropertyNames,dP=Object.prototype.hasOwnProperty,Ww=e=>{throw TypeError(e)},hP=(e,t)=>{for(var r in t)Zd(e,r,{get:t[r],enumerable:!0})},pP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fP(t))!dP.call(e,i)&&i!==r&&Zd(e,i,{get:()=>t[i],enumerable:!(n=lP(t,i))||n.enumerable});return e},mP=e=>pP(Zd({},"__esModule",{value:!0}),e),Qd=(e,t,r)=>t.has(e)||Ww("Cannot "+r),qe=(e,t,r)=>(Qd(e,t,"read from private field"),r?r.call(e):t.get(e)),hr=(e,t,r)=>t.has(e)?Ww("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),nr=(e,t,r,n)=>(Qd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),sn=(e,t,r)=>(Qd(e,t,"access private method"),r),Gw=(e,t,r,n)=>({set _(i){nr(e,t,i,r)},get _(){return qe(e,t,n)}}),Hw={};hP(Hw,{ParallelTransactionExecutor:()=>_P});var gP=mP(Hw),vP=Er,Kw=Gn,yP=eu,bP=kd,wP=Nw,Xw=Bw,Jw=zw,Zi,Zn,cu,qa,Wa,Ga,uu,xo,Dr,Qi,$s,Bs,eh,lu,Ha,So,Eo,Mi,zr,Yw,Zw,Ka,th,Qw,rh,e2;const Xa={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class _P{constructor(t){hr(this,zr),hr(this,Zi),hr(this,Zn),hr(this,cu),hr(this,qa),hr(this,Wa),hr(this,Ga),hr(this,uu),hr(this,xo),hr(this,Dr),hr(this,Qi,[]),hr(this,$s),hr(this,Bs,new Map),hr(this,eh,new Xw.SerialQueue),hr(this,lu),hr(this,Ha,null),hr(this,So,null),hr(this,Eo,0),hr(this,Mi,null),nr(this,Zi,t.signer),nr(this,Zn,t.client),nr(this,cu,t.coinBatchSize??Xa.coinBatchSize),nr(this,qa,t.initialCoinBalance??Xa.initialCoinBalance),nr(this,Wa,t.minimumCoinBalance??Xa.minimumCoinBalance),nr(this,uu,t.defaultGasBudget??qe(this,Wa)),nr(this,Ga,t.epochBoundaryWindow??Xa.epochBoundaryWindow),nr(this,xo,t.maxPoolSize??Xa.maxPoolSize),nr(this,$s,new wP.CachingTransactionExecutor({client:t.client,cache:t.cache})),nr(this,lu,new Xw.ParallelQueue(qe(this,xo))),nr(this,Dr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return nr(this,Mi,null),sn(this,zr,Ka).call(this,()=>qe(this,$s).reset())}async waitForLastTransaction(){await sn(this,zr,Ka).call(this,()=>sn(this,zr,th).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=xP(),o=await sn(this,zr,Yw).call(this,t),a=()=>{qe(this,lu).runTask(()=>sn(this,zr,Zw).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{qe(this,Bs).get(u)?(c.add(u),qe(this,Bs).get(u).push(()=>{c.delete(u),c.size===0&&a()})):qe(this,Bs).set(u,[])}),c.size===0&&a(),n}}Zi=new WeakMap,Zn=new WeakMap,cu=new WeakMap,qa=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,uu=new WeakMap,xo=new WeakMap,Dr=new WeakMap,Qi=new WeakMap,$s=new WeakMap,Bs=new WeakMap,eh=new WeakMap,lu=new WeakMap,Ha=new WeakMap,So=new WeakMap,Eo=new WeakMap,Mi=new WeakMap,zr=new WeakSet,Yw=async function(e){const t=new Set;let r=!1;return e.addSerializationPlugin(async(n,i,s)=>{await s(),!r&&(r=!0,n.inputs.forEach(o=>{var a,c,u,l,f;(c=(a=o.Object)==null?void 0:a.ImmOrOwnedObject)!=null&&c.objectId?t.add(o.Object.ImmOrOwnedObject.objectId):(l=(u=o.Object)==null?void 0:u.Receiving)!=null&&l.objectId?t.add(o.Object.Receiving.objectId):(f=o.UnresolvedObject)!=null&&f.objectId&&!o.UnresolvedObject.initialSharedVersion&&t.add(o.UnresolvedObject.objectId)}))}),await e.prepareForSerialization({client:qe(this,Zn)}),t},Zw=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(qe(this,Zi).toSuiAddress()),await qe(this,eh).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await sn(this,zr,rh).call(this)),e.setGasBudgetIfNotSet(qe(this,uu)),await sn(this,zr,Ka).call(this),n=await sn(this,zr,Qw).call(this),Gw(this,Eo)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await qe(this,$s).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:qe(this,Zn)}),{signature:o}=await qe(this,Zi).signTransaction(s),a=await qe(this,$s).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=Kw.bcs.TransactionEffects.parse(c),l=(0,Jw.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===qe(this,Zi).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new bP.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=qe(this,Wa)?qe(this,Qi).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(qe(this,Dr)||nr(this,Dr,new Map),qe(this,Dr).set(l.ref.objectId,l.ref))}return nr(this,Ha,a.digest),{digest:a.digest,effects:(0,vP.toBase64)(c),data:a}}catch(s){throw n&&(qe(this,Dr)||nr(this,Dr,new Map),qe(this,Dr).set(n.id,null)),await sn(this,zr,Ka).call(this,async()=>{await Promise.all([qe(this,$s).cache.deleteObjects([...t]),sn(this,zr,th).call(this)])}),s}finally{t.forEach(s=>{const o=qe(this,Bs).get(s);o&&o.length>0?o.shift()():o&&qe(this,Bs).delete(s)}),Gw(this,Eo)._--}},Ka=async function(e){qe(this,So)&&await qe(this,So),nr(this,So,(e==null?void 0:e().then(()=>{nr(this,So,null)},()=>{}))??null)},th=async function(){const e=qe(this,Ha);e&&(nr(this,Ha,null),await qe(this,Zn).waitForTransaction({digest:e}))},Qw=async function(){if(qe(this,Qi).length===0&&qe(this,Eo)<=qe(this,xo)&&await sn(this,zr,e2).call(this),qe(this,Qi).length===0)throw new Error("No coins available");return qe(this,Qi).shift()},rh=async function(){if((qe(this,Mi)?qe(this,Mi).expiration-qe(this,Ga)-Date.now():0)>0)return qe(this,Mi).price;if(qe(this,Mi)){const r=Math.max(qe(this,Mi).expiration+qe(this,Ga)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await qe(this,Zn).getLatestSuiSystemState();return nr(this,Mi,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),sn(this,zr,rh).call(this)},e2=async function(){var u;const e=Math.min(qe(this,cu),qe(this,xo)-(qe(this,Qi).length+qe(this,Eo))+1);if(e===0)return;const t=new yP.Transaction,r=qe(this,Zi).toSuiAddress();if(t.setSender(r),qe(this,Dr)){const l=[],f=[];for(const[h,y]of qe(this,Dr))y?l.push(y):f.push(h);if(f.length>0){const h=await qe(this,Zn).multiGetObjects({ids:f});l.push(...h.filter(y=>y.data!==null).map(({data:y})=>({objectId:y.objectId,version:y.version,digest:y.digest})))}t.setGasPayment(l),nr(this,Dr,new Map)}const n=new Array(e).fill(qe(this,qa)),i=t.splitCoins(t.gas,n),s=[];for(let l=0;l<n.length;l++)s.push(i[l]);t.transferObjects(s,r),await this.waitForLastTransaction();const o=await qe(this,Zn).signAndExecuteTransaction({transaction:t,signer:qe(this,Zi),options:{showRawEffects:!0}}),a=Kw.bcs.TransactionEffects.parse(Uint8Array.from(o.rawEffects));(u=a.V2)==null||u.changedObjects.forEach(([l,{outputState:f}],h)=>{var y;h===((y=a.V2)==null?void 0:y.gasObjectIndex)||!f.ObjectWrite||qe(this,Qi).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(qe(this,qa))})}),qe(this,Dr)||nr(this,Dr,new Map);const c=(0,Jw.getGasCoinFromEffects)(a).ref;qe(this,Dr).set(c.objectId,c),await qe(this,Zn).waitForTransaction({digest:o.digest})};function xP(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var nh=Object.defineProperty,SP=Object.getOwnPropertyDescriptor,EP=Object.getOwnPropertyNames,CP=Object.prototype.hasOwnProperty,MP=(e,t)=>{for(var r in t)nh(e,r,{get:t[r],enumerable:!0})},TP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of EP(t))!CP.call(e,i)&&i!==r&&nh(e,i,{get:()=>t[i],enumerable:!(n=SP(t,i))||n.enumerable});return e},AP=e=>TP(nh({},"__esModule",{value:!0}),e),t2={};MP(t2,{coinWithBalance:()=>jP});var OP=AP(t2),fu=Hi,IP=Gn,r2=Xr,du=xd,n2=Kc,PP=rw;const hu="CoinWithBalance",i2=(0,r2.normalizeStructTag)("0x2::sui::SUI");function jP({type:e=i2,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(hu,NP);const i=e==="gas"?e:(0,r2.normalizeStructTag)(e);return n.add(du.Commands.Intent({name:hu,inputs:{},data:{type:i===i2&&r?"gas":i,balance:BigInt(t)}}))}}const kP=(0,fu.object)({type:(0,fu.string)(),balance:(0,fu.bigint)()});async function NP(e,t,r){var u,l;const n=new Set,i=new Map;if(!e.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(const f of e.commands)if(f.$kind==="$Intent"&&f.$Intent.name===hu){const{type:h,balance:y}=(0,fu.parse)(kP,f.$Intent.data);h!=="gas"&&y>0n&&n.add(h),i.set(h,(i.get(h)??0n)+y)}const s=new Set;for(const f of e.inputs)(u=f.Object)!=null&&u.ImmOrOwnedObject&&s.add(f.Object.ImmOrOwnedObject.objectId),(l=f.UnresolvedObject)!=null&&l.objectId&&s.add(f.UnresolvedObject.objectId);const o=new Map,a=(0,PP.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await RP({coinType:f,balance:i.get(f),client:a,owner:e.sender,usedIds:s}))}));const c=new Map;c.set("gas",{$kind:"GasCoin",GasCoin:!0});for(const[f,h]of e.commands.entries()){if(h.$kind!=="$Intent"||h.$Intent.name!==hu)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,du.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[A,...P]=o.get(y).map(N=>e.addInput("object",n2.Inputs.ObjectRef({objectId:N.coinObjectId,digest:N.digest,version:N.version})));P.length>0&&w.push(du.Commands.MergeCoins(A,P)),c.set(y,A)}w.push(du.Commands.SplitCoins(c.get(y),[e.addInput("pure",n2.Inputs.Pure(IP.bcs.u64().serialize(b)))])),e.replaceCommand(f,w),e.mapArguments(A=>A.$kind==="Result"&&A.Result===f?{$kind:"NestedResult",NestedResult:[f+w.length-1,0]}:A)}return r()}async function RP({coinType:e,balance:t,client:r,owner:n,usedIds:i}){let s=t;const o=[];return a();async function a(c=null){const{data:u,hasNextPage:l,nextCursor:f}=await r.getCoins({owner:n,coinType:e,cursor:c}),h=u.sort((y,b)=>Number(BigInt(b.balance)-BigInt(y.balance)));for(const y of h){if(i.has(y.coinObjectId))continue;const b=BigInt(y.balance);if(o.push(y),s-=b,s<=0)return o}if(l)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}var ih=Object.defineProperty,DP=Object.getOwnPropertyDescriptor,$P=Object.getOwnPropertyNames,BP=Object.prototype.hasOwnProperty,LP=(e,t)=>{for(var r in t)ih(e,r,{get:t[r],enumerable:!0})},UP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $P(t))!BP.call(e,i)&&i!==r&&ih(e,i,{get:()=>t[i],enumerable:!(n=DP(t,i))||n.enumerable});return e},FP=e=>UP(ih({},"__esModule",{value:!0}),e),s2={};LP(s2,{Arguments:()=>WP});var zP=FP(s2),VP=ow,qP=cw;const WP={pure:(0,qP.createPure)(e=>t=>t.pure(e)),object:(0,VP.createObjectMethods)(e=>t=>t.object(e)),sharedObjectRef:(...e)=>t=>t.sharedObjectRef(...e),objectRef:(...e)=>t=>t.objectRef(...e),receivingRef:(...e)=>t=>t.receivingRef(...e)};var sh=Object.defineProperty,GP=Object.getOwnPropertyDescriptor,HP=Object.getOwnPropertyNames,KP=Object.prototype.hasOwnProperty,XP=(e,t)=>{for(var r in t)sh(e,r,{get:t[r],enumerable:!0})},JP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HP(t))!KP.call(e,i)&&i!==r&&sh(e,i,{get:()=>t[i],enumerable:!(n=GP(t,i))||n.enumerable});return e},YP=e=>JP(sh({},"__esModule",{value:!0}),e),o2={};XP(o2,{findTransactionBlockNames:()=>QP,listToRequests:()=>t7,replaceNames:()=>e7});var ZP=YP(o2),a2=xb;const Co="/",QP=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){c2([i.MakeMoveVec.type]).forEach(a=>{r.add(a)});continue}if(!("MoveCall"in i))continue;const s=i.MoveCall;if(!s)continue;const o=s.package.split("::")[0];if(o.includes(Co)){if(!(0,a2.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}c2(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function c2(e){const t=new Set;for(const r of e)if(r.includes(Co)){if(!(0,a2.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const e7=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(Co))continue;if(!t.types[n.MakeMoveVec.type])throw new Error(`No resolution found for type: ${n.MakeMoveVec.type}`);n.MakeMoveVec.type=t.types[n.MakeMoveVec.type]}const i=n.MoveCall;if(!i)continue;const s=i.package.split("::"),o=s[0];if(o.includes(Co)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(Co)&&(s[0]=t.packages[o],i.package=s.join("::"));const a=i.typeArguments;if(a){for(let c=0;c<a.length;c++)if(a[c].includes(Co)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},t7=(e,t)=>{const r=[],n=u2(e.packages),i=u2(e.types);for(const[s,o]of n.entries())r.push({id:s,type:"package",name:o});for(const[s,o]of i.entries())r.push({id:s+n.length,type:"moveType",name:o});return r7(r,t)},u2=e=>[...new Set(e)],r7=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var oh=Object.defineProperty,n7=Object.getOwnPropertyDescriptor,i7=Object.getOwnPropertyNames,s7=Object.prototype.hasOwnProperty,o7=(e,t)=>{for(var r in t)oh(e,r,{get:t[r],enumerable:!0})},a7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of i7(t))!s7.call(e,i)&&i!==r&&oh(e,i,{get:()=>t[i],enumerable:!(n=n7(t,i))||n.enumerable});return e},c7=e=>a7(oh({},"__esModule",{value:!0}),e),l2={};o7(l2,{namedPackagesPlugin:()=>l7});var u7=c7(l2),ah=ZP;const l7=({suiGraphQLClient:e,pageSize:t=10,overrides:r={packages:{},types:{}}})=>{const n={packages:{...r.packages},types:{...r.types}};return async(s,o,a)=>{const c=(0,ah.findTransactionBlockNames)(s),u=(0,ah.listToRequests)({packages:c.packages.filter(l=>!n.packages[l]),types:c.types.filter(l=>!n.types[l])},t);(await Promise.all(u.map(l=>i(e,l)))).forEach(l=>{Object.assign(n.types,l.types),Object.assign(n.packages,l.packages)}),(0,ah.replaceNames)(s,n),await a()};async function i(s,o){const a={packages:{},types:{}};if(o.length===0)return a;const c=`{
|
|
25
25
|
${o.map(l=>{const f=l.type==="package"?"packageByName":"typeByName",h=l.type==="package"?"address":"repr";return`${f2(l.id)}: ${f}(name:"${l.name}") {
|
|
26
26
|
${h}
|
|
27
27
|
}`})}
|
|
28
|
-
}`,u=await s.query({query:c,variables:void 0});if(u.errors)throw new Error(JSON.stringify({query:c,errors:u.errors}));for(const l of o){const f=f2(l.id);if(!u.data||!u.data[f])throw new Error(`No result found for: ${l.name}`);const h=u.data[f];l.type==="package"&&(a.packages[l.name]=h.address),l.type==="moveType"&&(a.types[l.name]=h.repr)}return a}},f2=e=>`key_${e}`;var ch=Object.defineProperty,f7=Object.getOwnPropertyDescriptor,d7=Object.getOwnPropertyNames,h7=Object.prototype.hasOwnProperty,p7=(e,t)=>{for(var r in t)ch(e,r,{get:t[r],enumerable:!0})},m7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of d7(t))!h7.call(e,i)&&i!==r&&ch(e,i,{get:()=>t[i],enumerable:!(n=f7(t,i))||n.enumerable});return e},g7=e=>m7(ch({},"__esModule",{value:!0}),e),d2={};p7(d2,{Arguments:()=>x7.Arguments,AsyncCache:()=>g2.AsyncCache,Commands:()=>p2.Commands,Inputs:()=>v7.Inputs,ObjectCache:()=>g2.ObjectCache,ParallelTransactionExecutor:()=>w7.ParallelTransactionExecutor,SerialTransactionExecutor:()=>b7.SerialTransactionExecutor,Transaction:()=>m2.Transaction,TransactionDataBuilder:()=>y7.TransactionDataBuilder,UpgradePolicy:()=>p2.UpgradePolicy,coinWithBalance:()=>_7.coinWithBalance,getPureBcsSchema:()=>h2.getPureBcsSchema,isTransaction:()=>m2.isTransaction,namedPackagesPlugin:()=>S7.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>h2.normalizedTypeToMoveTypeSignature});var
|
|
28
|
+
}`,u=await s.query({query:c,variables:void 0});if(u.errors)throw new Error(JSON.stringify({query:c,errors:u.errors}));for(const l of o){const f=f2(l.id);if(!u.data||!u.data[f])throw new Error(`No result found for: ${l.name}`);const h=u.data[f];l.type==="package"&&(a.packages[l.name]=h.address),l.type==="moveType"&&(a.types[l.name]=h.repr)}return a}},f2=e=>`key_${e}`;var ch=Object.defineProperty,f7=Object.getOwnPropertyDescriptor,d7=Object.getOwnPropertyNames,h7=Object.prototype.hasOwnProperty,p7=(e,t)=>{for(var r in t)ch(e,r,{get:t[r],enumerable:!0})},m7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of d7(t))!h7.call(e,i)&&i!==r&&ch(e,i,{get:()=>t[i],enumerable:!(n=f7(t,i))||n.enumerable});return e},g7=e=>m7(ch({},"__esModule",{value:!0}),e),d2={};p7(d2,{Arguments:()=>x7.Arguments,AsyncCache:()=>g2.AsyncCache,Commands:()=>p2.Commands,Inputs:()=>v7.Inputs,ObjectCache:()=>g2.ObjectCache,ParallelTransactionExecutor:()=>w7.ParallelTransactionExecutor,SerialTransactionExecutor:()=>b7.SerialTransactionExecutor,Transaction:()=>m2.Transaction,TransactionDataBuilder:()=>y7.TransactionDataBuilder,UpgradePolicy:()=>p2.UpgradePolicy,coinWithBalance:()=>_7.coinWithBalance,getPureBcsSchema:()=>h2.getPureBcsSchema,isTransaction:()=>m2.isTransaction,namedPackagesPlugin:()=>S7.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>h2.normalizedTypeToMoveTypeSignature});var Mo=g7(d2),h2=kb,v7=Kc,p2=xd,m2=eu,y7=kd,g2=Tw,b7=zw,w7=gP,_7=OP,x7=zP,S7=u7,v2={},pu={},uh={},mu={},lh={},gu={};Object.defineProperty(gu,"__esModule",{value:!0}),gu.Convert=void 0;class E7{static toPriceFeed(t){return fh(t,Ai("PriceFeed"))}static priceFeedToJson(t){return dh(t,Ai("PriceFeed"))}static toPrice(t){return fh(t,Ai("Price"))}static priceToJson(t){return dh(t,Ai("Price"))}static toPriceFeedMetadata(t){return fh(t,Ai("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return dh(t,Ai("PriceFeedMetadata"))}}gu.Convert=E7;function Ti(e,t,r=""){throw Error(r?`Invalid value for key "${r}". Expected type ${JSON.stringify(e)} but got ${JSON.stringify(t)}`:`Invalid value ${JSON.stringify(t)} for type ${JSON.stringify(e)}`)}function C7(e){if(e.jsonToJS===void 0){const t={};e.props.forEach(r=>t[r.json]={key:r.js,typ:r.typ}),e.jsonToJS=t}return e.jsonToJS}function M7(e){if(e.jsToJSON===void 0){const t={};e.props.forEach(r=>t[r.js]={key:r.json,typ:r.typ}),e.jsToJSON=t}return e.jsToJSON}function To(e,t,r,n=""){function i(l,f){return typeof l==typeof f?f:Ti(l,f,n)}function s(l,f){const h=l.length;for(let y=0;y<h;y++){const b=l[y];try{return To(f,b,r)}catch{}}return Ti(l,f)}function o(l,f){return l.indexOf(f)!==-1?f:Ti(l,f)}function a(l,f){return Array.isArray(f)?f.map(h=>To(h,l,r)):Ti("array",f)}function c(l){if(l===null)return null;const f=new Date(l);return isNaN(f.valueOf())?Ti("Date",l):f}function u(l,f,h){if(h===null||typeof h!="object"||Array.isArray(h))return Ti("object",h);const y={};return Object.getOwnPropertyNames(l).forEach(b=>{const w=l[b],A=Object.prototype.hasOwnProperty.call(h,b)?h[b]:void 0;y[w.key]=To(A,w.typ,r,w.key)}),Object.getOwnPropertyNames(h).forEach(b=>{Object.prototype.hasOwnProperty.call(l,b)||(y[b]=To(h[b],f,r,b))}),y}if(t==="any")return e;if(t===null)return e===null?e:Ti(t,e);if(t===!1)return Ti(t,e);for(;typeof t=="object"&&t.ref!==void 0;)t=T7[t.ref];return Array.isArray(t)?o(t,e):typeof t=="object"?t.hasOwnProperty("unionMembers")?s(t.unionMembers,e):t.hasOwnProperty("arrayItems")?a(t.arrayItems,e):t.hasOwnProperty("props")?u(r(t),t.additional,e):Ti(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function fh(e,t){return To(e,t,C7)}function dh(e,t){return To(e,t,M7)}function Ls(...e){return{unionMembers:e}}function hh(e,t){return{props:e,additional:t}}function Ai(e){return{ref:e}}const T7={PriceFeed:hh([{json:"ema_price",js:"ema_price",typ:Ai("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:Ls(void 0,Ai("PriceFeedMetadata"))},{json:"price",js:"price",typ:Ai("Price")},{json:"vaa",js:"vaa",typ:Ls(void 0,"")}],"any"),Price:hh([{json:"conf",js:"conf",typ:""},{json:"expo",js:"expo",typ:0},{json:"price",js:"price",typ:""},{json:"publish_time",js:"publish_time",typ:0}],"any"),PriceFeedMetadata:hh([{json:"attestation_time",js:"attestation_time",typ:Ls(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:Ls(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:Ls(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:Ls(void 0,0)},{json:"slot",js:"slot",typ:Ls(void 0,0)}],"any")};var ph={},y2;function vu(){return y2||(y2=1,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},r={};r.byteLength=l,r.toByteArray=h,r.fromByteArray=w;for(var n=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;function u(N){var R=N.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var U=N.indexOf("=");U===-1&&(U=R);var L=U===R?0:4-U%4;return[U,L]}function l(N){var R=u(N),U=R[0],L=R[1];return(U+L)*3/4-L}function f(N,R,U){return(R+U)*3/4-U}function h(N){var R,U=u(N),L=U[0],G=U[1],q=new s(f(N,L,G)),X=0,ie=G>0?L-4:L,ae;for(ae=0;ae<ie;ae+=4)R=i[N.charCodeAt(ae)]<<18|i[N.charCodeAt(ae+1)]<<12|i[N.charCodeAt(ae+2)]<<6|i[N.charCodeAt(ae+3)],q[X++]=R>>16&255,q[X++]=R>>8&255,q[X++]=R&255;return G===2&&(R=i[N.charCodeAt(ae)]<<2|i[N.charCodeAt(ae+1)]>>4,q[X++]=R&255),G===1&&(R=i[N.charCodeAt(ae)]<<10|i[N.charCodeAt(ae+1)]<<4|i[N.charCodeAt(ae+2)]>>2,q[X++]=R>>8&255,q[X++]=R&255),q}function y(N){return n[N>>18&63]+n[N>>12&63]+n[N>>6&63]+n[N&63]}function b(N,R,U){for(var L,G=[],q=R;q<U;q+=3)L=(N[q]<<16&16711680)+(N[q+1]<<8&65280)+(N[q+2]&255),G.push(y(L));return G.join("")}function w(N){for(var R,U=N.length,L=U%3,G=[],q=16383,X=0,ie=U-L;X<ie;X+=q)G.push(b(N,X,X+q>ie?ie:X+q));return L===1?(R=N[U-1],G.push(n[R>>2]+n[R<<4&63]+"==")):L===2&&(R=(N[U-2]<<8)+N[U-1],G.push(n[R>>10]+n[R>>4&63]+n[R<<2&63]+"=")),G.join("")}var A={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */A.read=function(N,R,U,L,G){var q,X,ie=G*8-L-1,ae=(1<<ie)-1,ce=ae>>1,V=-7,D=U?G-1:0,p=U?-1:1,d=N[R+D];for(D+=p,q=d&(1<<-V)-1,d>>=-V,V+=ie;V>0;q=q*256+N[R+D],D+=p,V-=8);for(X=q&(1<<-V)-1,q>>=-V,V+=L;V>0;X=X*256+N[R+D],D+=p,V-=8);if(q===0)q=1-ce;else{if(q===ae)return X?NaN:(d?-1:1)*(1/0);X=X+Math.pow(2,L),q=q-ce}return(d?-1:1)*X*Math.pow(2,q-L)},A.write=function(N,R,U,L,G,q){var X,ie,ae,ce=q*8-G-1,V=(1<<ce)-1,D=V>>1,p=G===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=L?0:q-1,m=L?1:-1,x=R<0||R===0&&1/R<0?1:0;for(R=Math.abs(R),isNaN(R)||R===1/0?(ie=isNaN(R)?1:0,X=V):(X=Math.floor(Math.log(R)/Math.LN2),R*(ae=Math.pow(2,-X))<1&&(X--,ae*=2),X+D>=1?R+=p/ae:R+=p*Math.pow(2,1-D),R*ae>=2&&(X++,ae/=2),X+D>=V?(ie=0,X=V):X+D>=1?(ie=(R*ae-1)*Math.pow(2,G),X=X+D):(ie=R*Math.pow(2,D-1)*Math.pow(2,G),X=0));G>=8;N[U+d]=ie&255,d+=m,ie/=256,G-=8);for(X=X<<G|ie,ce+=G;ce>0;N[U+d]=X&255,d+=m,X/=256,ce-=8);N[U+d-m]|=x*128};/*!
|
|
29
29
|
* The buffer module from node.js, for the browser.
|
|
30
30
|
*
|
|
31
31
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
32
32
|
* @license MIT
|
|
33
|
-
*/(function(R){const N=r,F=A,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=V,R.SlowBuffer=v,R.INSPECT_MAX_BYTES=50;const G=2147483647;R.kMaxLength=G;const{Uint8Array:q,ArrayBuffer:X,SharedArrayBuffer:ie}=globalThis;V.TYPED_ARRAY_SUPPORT=ae(),!V.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ae(){try{const j=new q(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,q.prototype),Object.setPrototypeOf(j,S),j.foo()===42}catch{return!1}}Object.defineProperty(V.prototype,"parent",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.buffer}}),Object.defineProperty(V.prototype,"offset",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.byteOffset}});function ce(j){if(j>G)throw new RangeError('The value "'+j+'" is invalid for option "size"');const S=new q(j);return Object.setPrototypeOf(S,V.prototype),S}function V(j,S,M){if(typeof j=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(j)}return D(j,S,M)}V.poolSize=8192;function D(j,S,M){if(typeof j=="string")return x(j,S);if(X.isView(j))return E(j);if(j==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j);if(gt(j,X)||j&>(j.buffer,X)||typeof ie<"u"&&(gt(j,ie)||j&>(j.buffer,ie)))return O(j,S,M);if(typeof j=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=j.valueOf&&j.valueOf();if(B!=null&&B!==j)return V.from(B,S,M);const K=C(j);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof j[Symbol.toPrimitive]=="function")return V.from(j[Symbol.toPrimitive]("string"),S,M);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j)}V.from=function(j,S,M){return D(j,S,M)},Object.setPrototypeOf(V.prototype,q.prototype),Object.setPrototypeOf(V,q);function p(j){if(typeof j!="number")throw new TypeError('"size" argument must be of type number');if(j<0)throw new RangeError('The value "'+j+'" is invalid for option "size"')}function d(j,S,M){return p(j),j<=0?ce(j):S!==void 0?typeof M=="string"?ce(j).fill(S,M):ce(j).fill(S):ce(j)}V.alloc=function(j,S,M){return d(j,S,M)};function m(j){return p(j),ce(j<0?0:g(j)|0)}V.allocUnsafe=function(j){return m(j)},V.allocUnsafeSlow=function(j){return m(j)};function x(j,S){if((typeof S!="string"||S==="")&&(S="utf8"),!V.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const M=k(j,S)|0;let B=ce(M);const K=B.write(j,S);return K!==M&&(B=B.slice(0,K)),B}function T(j){const S=j.length<0?0:g(j.length)|0,M=ce(S);for(let B=0;B<S;B+=1)M[B]=j[B]&255;return M}function E(j){if(gt(j,q)){const S=new q(j);return O(S.buffer,S.byteOffset,S.byteLength)}return T(j)}function O(j,S,M){if(S<0||j.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(j.byteLength<S+(M||0))throw new RangeError('"length" is outside of buffer bounds');let B;return S===void 0&&M===void 0?B=new q(j):M===void 0?B=new q(j,S):B=new q(j,S,M),Object.setPrototypeOf(B,V.prototype),B}function C(j){if(V.isBuffer(j)){const S=g(j.length)|0,M=ce(S);return M.length===0||j.copy(M,0,0,S),M}if(j.length!==void 0)return typeof j.length!="number"||Pt(j.length)?ce(0):T(j);if(j.type==="Buffer"&&Array.isArray(j.data))return T(j.data)}function g(j){if(j>=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return j|0}function v(j){return+j!=j&&(j=0),V.alloc(+j)}V.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==V.prototype},V.compare=function(S,M){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),gt(M,q)&&(M=V.from(M,M.offset,M.byteLength)),!V.isBuffer(S)||!V.isBuffer(M))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===M)return 0;let B=S.length,K=M.length;for(let Z=0,re=Math.min(B,K);Z<re;++Z)if(S[Z]!==M[Z]){B=S[Z],K=M[Z];break}return B<K?-1:K<B?1:0},V.isEncoding=function(S){switch(String(S).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},V.concat=function(S,M){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return V.alloc(0);let B;if(M===void 0)for(M=0,B=0;B<S.length;++B)M+=S[B].length;const K=V.allocUnsafe(M);let Z=0;for(B=0;B<S.length;++B){let re=S[B];if(gt(re,q))Z+re.length>K.length?(V.isBuffer(re)||(re=V.from(re)),re.copy(K,Z)):q.prototype.set.call(K,re,Z);else if(V.isBuffer(re))re.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=re.length}return K};function k(j,S){if(V.isBuffer(j))return j.length;if(X.isView(j)||gt(j,X))return j.byteLength;if(typeof j!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof j);const M=j.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&M===0)return 0;let K=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return M;case"utf8":case"utf-8":return It(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M*2;case"hex":return M>>>1;case"base64":return Tt(j).length;default:if(K)return B?-1:It(j).length;S=(""+S).toLowerCase(),K=!0}}V.byteLength=k;function ee(j,S,M){let B=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((M===void 0||M>this.length)&&(M=this.length),M<=0)||(M>>>=0,S>>>=0,M<=S))return"";for(j||(j="utf8");;)switch(j){case"hex":return We(this,S,M);case"utf8":case"utf-8":return $e(this,S,M);case"ascii":return ge(this,S,M);case"latin1":case"binary":return Ae(this,S,M);case"base64":return ht(this,S,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,S,M);default:if(B)throw new TypeError("Unknown encoding: "+j);j=(j+"").toLowerCase(),B=!0}}V.prototype._isBuffer=!0;function se(j,S,M){const B=j[S];j[S]=j[M],j[M]=B}V.prototype.swap16=function(){const S=this.length;if(S%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let M=0;M<S;M+=2)se(this,M,M+1);return this},V.prototype.swap32=function(){const S=this.length;if(S%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let M=0;M<S;M+=4)se(this,M,M+3),se(this,M+1,M+2);return this},V.prototype.swap64=function(){const S=this.length;if(S%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let M=0;M<S;M+=8)se(this,M,M+7),se(this,M+1,M+6),se(this,M+2,M+5),se(this,M+3,M+4);return this},V.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?$e(this,0,S):ee.apply(this,arguments)},V.prototype.toLocaleString=V.prototype.toString,V.prototype.equals=function(S){if(!V.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:V.compare(this,S)===0},V.prototype.inspect=function(){let S="";const M=R.INSPECT_MAX_BYTES;return S=this.toString("hex",0,M).replace(/(.{2})/g,"$1 ").trim(),this.length>M&&(S+=" ... "),"<Buffer "+S+">"},L&&(V.prototype[L]=V.prototype.inspect),V.prototype.compare=function(S,M,B,K,Z){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),!V.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(M===void 0&&(M=0),B===void 0&&(B=S?S.length:0),K===void 0&&(K=0),Z===void 0&&(Z=this.length),M<0||B>S.length||K<0||Z>this.length)throw new RangeError("out of range index");if(K>=Z&&M>=B)return 0;if(K>=Z)return-1;if(M>=B)return 1;if(M>>>=0,B>>>=0,K>>>=0,Z>>>=0,this===S)return 0;let re=Z-K,Be=B-M;const rt=Math.min(re,Be),Ne=this.slice(K,Z),z=S.slice(M,B);for(let oe=0;oe<rt;++oe)if(Ne[oe]!==z[oe]){re=Ne[oe],Be=z[oe];break}return re<Be?-1:Be<re?1:0};function he(j,S,M,B,K){if(j.length===0)return-1;if(typeof M=="string"?(B=M,M=0):M>2147483647?M=2147483647:M<-2147483648&&(M=-2147483648),M=+M,Pt(M)&&(M=K?0:j.length-1),M<0&&(M=j.length+M),M>=j.length){if(K)return-1;M=j.length-1}else if(M<0)if(K)M=0;else return-1;if(typeof S=="string"&&(S=V.from(S,B)),V.isBuffer(S))return S.length===0?-1:ye(j,S,M,B,K);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(j,S,M):q.prototype.lastIndexOf.call(j,S,M):ye(j,[S],M,B,K);throw new TypeError("val must be string, number or Buffer")}function ye(j,S,M,B,K){let Z=1,re=j.length,Be=S.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(j.length<2||S.length<2)return-1;Z=2,re/=2,Be/=2,M/=2}function rt(z,oe){return Z===1?z[oe]:z.readUInt16BE(oe*Z)}let Ne;if(K){let z=-1;for(Ne=M;Ne<re;Ne++)if(rt(j,Ne)===rt(S,z===-1?0:Ne-z)){if(z===-1&&(z=Ne),Ne-z+1===Be)return z*Z}else z!==-1&&(Ne-=Ne-z),z=-1}else for(M+Be>re&&(M=re-Be),Ne=M;Ne>=0;Ne--){let z=!0;for(let oe=0;oe<Be;oe++)if(rt(j,Ne+oe)!==rt(S,oe)){z=!1;break}if(z)return Ne}return-1}V.prototype.includes=function(S,M,B){return this.indexOf(S,M,B)!==-1},V.prototype.indexOf=function(S,M,B){return he(this,S,M,B,!0)},V.prototype.lastIndexOf=function(S,M,B){return he(this,S,M,B,!1)};function Ee(j,S,M,B){M=Number(M)||0;const K=j.length-M;B?(B=Number(B),B>K&&(B=K)):B=K;const Z=S.length;B>Z/2&&(B=Z/2);let re;for(re=0;re<B;++re){const Be=parseInt(S.substr(re*2,2),16);if(Pt(Be))return re;j[M+re]=Be}return re}function Se(j,S,M,B){return Ye(It(S,j.length-M),j,M,B)}function Ge(j,S,M,B){return Ye(it(S),j,M,B)}function Ue(j,S,M,B){return Ye(Tt(S),j,M,B)}function lt(j,S,M,B){return Ye(wt(S,j.length-M),j,M,B)}V.prototype.write=function(S,M,B,K){if(M===void 0)K="utf8",B=this.length,M=0;else if(B===void 0&&typeof M=="string")K=M,B=this.length,M=0;else if(isFinite(M))M=M>>>0,isFinite(B)?(B=B>>>0,K===void 0&&(K="utf8")):(K=B,B=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Z=this.length-M;if((B===void 0||B>Z)&&(B=Z),S.length>0&&(B<0||M<0)||M>this.length)throw new RangeError("Attempt to write outside buffer bounds");K||(K="utf8");let re=!1;for(;;)switch(K){case"hex":return Ee(this,S,M,B);case"utf8":case"utf-8":return Se(this,S,M,B);case"ascii":case"latin1":case"binary":return Ge(this,S,M,B);case"base64":return Ue(this,S,M,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,S,M,B);default:if(re)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),re=!0}},V.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(j,S,M){return S===0&&M===j.length?N.fromByteArray(j):N.fromByteArray(j.slice(S,M))}function $e(j,S,M){M=Math.min(j.length,M);const B=[];let K=S;for(;K<M;){const Z=j[K];let re=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(K+Be<=M){let rt,Ne,z,oe;switch(Be){case 1:Z<128&&(re=Z);break;case 2:rt=j[K+1],(rt&192)===128&&(oe=(Z&31)<<6|rt&63,oe>127&&(re=oe));break;case 3:rt=j[K+1],Ne=j[K+2],(rt&192)===128&&(Ne&192)===128&&(oe=(Z&15)<<12|(rt&63)<<6|Ne&63,oe>2047&&(oe<55296||oe>57343)&&(re=oe));break;case 4:rt=j[K+1],Ne=j[K+2],z=j[K+3],(rt&192)===128&&(Ne&192)===128&&(z&192)===128&&(oe=(Z&15)<<18|(rt&63)<<12|(Ne&63)<<6|z&63,oe>65535&&oe<1114112&&(re=oe))}}re===null?(re=65533,Be=1):re>65535&&(re-=65536,B.push(re>>>10&1023|55296),re=56320|re&1023),B.push(re),K+=Be}return _e(B)}const mt=4096;function _e(j){const S=j.length;if(S<=mt)return String.fromCharCode.apply(String,j);let M="",B=0;for(;B<S;)M+=String.fromCharCode.apply(String,j.slice(B,B+=mt));return M}function ge(j,S,M){let B="";M=Math.min(j.length,M);for(let K=S;K<M;++K)B+=String.fromCharCode(j[K]&127);return B}function Ae(j,S,M){let B="";M=Math.min(j.length,M);for(let K=S;K<M;++K)B+=String.fromCharCode(j[K]);return B}function We(j,S,M){const B=j.length;(!S||S<0)&&(S=0),(!M||M<0||M>B)&&(M=B);let K="";for(let Z=S;Z<M;++Z)K+=ot[j[Z]];return K}function De(j,S,M){const B=j.slice(S,M);let K="";for(let Z=0;Z<B.length-1;Z+=2)K+=String.fromCharCode(B[Z]+B[Z+1]*256);return K}V.prototype.slice=function(S,M){const B=this.length;S=~~S,M=M===void 0?B:~~M,S<0?(S+=B,S<0&&(S=0)):S>B&&(S=B),M<0?(M+=B,M<0&&(M=0)):M>B&&(M=B),M<S&&(M=S);const K=this.subarray(S,M);return Object.setPrototypeOf(K,V.prototype),K};function Oe(j,S,M){if(j%1!==0||j<0)throw new RangeError("offset is not uint");if(j+S>M)throw new RangeError("Trying to access beyond buffer length")}V.prototype.readUintLE=V.prototype.readUIntLE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=this[S],Z=1,re=0;for(;++re<M&&(Z*=256);)K+=this[S+re]*Z;return K},V.prototype.readUintBE=V.prototype.readUIntBE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=this[S+--M],Z=1;for(;M>0&&(Z*=256);)K+=this[S+--M]*Z;return K},V.prototype.readUint8=V.prototype.readUInt8=function(S,M){return S=S>>>0,M||Oe(S,1,this.length),this[S]},V.prototype.readUint16LE=V.prototype.readUInt16LE=function(S,M){return S=S>>>0,M||Oe(S,2,this.length),this[S]|this[S+1]<<8},V.prototype.readUint16BE=V.prototype.readUInt16BE=function(S,M){return S=S>>>0,M||Oe(S,2,this.length),this[S]<<8|this[S+1]},V.prototype.readUint32LE=V.prototype.readUInt32LE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},V.prototype.readUint32BE=V.prototype.readUInt32BE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},V.prototype.readBigUInt64LE=_t(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=M+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24,Z=this[++S]+this[++S]*2**8+this[++S]*2**16+B*2**24;return BigInt(K)+(BigInt(Z)<<BigInt(32))}),V.prototype.readBigUInt64BE=_t(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=M*2**24+this[++S]*2**16+this[++S]*2**8+this[++S],Z=this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B;return(BigInt(K)<<BigInt(32))+BigInt(Z)}),V.prototype.readIntLE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=this[S],Z=1,re=0;for(;++re<M&&(Z*=256);)K+=this[S+re]*Z;return Z*=128,K>=Z&&(K-=Math.pow(2,8*M)),K},V.prototype.readIntBE=function(S,M,B){S=S>>>0,M=M>>>0,B||Oe(S,M,this.length);let K=M,Z=1,re=this[S+--K];for(;K>0&&(Z*=256);)re+=this[S+--K]*Z;return Z*=128,re>=Z&&(re-=Math.pow(2,8*M)),re},V.prototype.readInt8=function(S,M){return S=S>>>0,M||Oe(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},V.prototype.readInt16LE=function(S,M){S=S>>>0,M||Oe(S,2,this.length);const B=this[S]|this[S+1]<<8;return B&32768?B|4294901760:B},V.prototype.readInt16BE=function(S,M){S=S>>>0,M||Oe(S,2,this.length);const B=this[S+1]|this[S]<<8;return B&32768?B|4294901760:B},V.prototype.readInt32LE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},V.prototype.readInt32BE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},V.prototype.readBigInt64LE=_t(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=this[S+4]+this[S+5]*2**8+this[S+6]*2**16+(B<<24);return(BigInt(K)<<BigInt(32))+BigInt(M+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24)}),V.prototype.readBigInt64BE=_t(function(S){S=S>>>0,Et(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ot(S,this.length-8);const K=(M<<24)+this[++S]*2**16+this[++S]*2**8+this[++S];return(BigInt(K)<<BigInt(32))+BigInt(this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B)}),V.prototype.readFloatLE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),F.read(this,S,!0,23,4)},V.prototype.readFloatBE=function(S,M){return S=S>>>0,M||Oe(S,4,this.length),F.read(this,S,!1,23,4)},V.prototype.readDoubleLE=function(S,M){return S=S>>>0,M||Oe(S,8,this.length),F.read(this,S,!0,52,8)},V.prototype.readDoubleBE=function(S,M){return S=S>>>0,M||Oe(S,8,this.length),F.read(this,S,!1,52,8)};function Ie(j,S,M,B,K,Z){if(!V.isBuffer(j))throw new TypeError('"buffer" argument must be a Buffer instance');if(S>K||S<Z)throw new RangeError('"value" argument is out of bounds');if(M+B>j.length)throw new RangeError("Index out of range")}V.prototype.writeUintLE=V.prototype.writeUIntLE=function(S,M,B,K){if(S=+S,M=M>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,M,B,Be,0)}let Z=1,re=0;for(this[M]=S&255;++re<B&&(Z*=256);)this[M+re]=S/Z&255;return M+B},V.prototype.writeUintBE=V.prototype.writeUIntBE=function(S,M,B,K){if(S=+S,M=M>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,M,B,Be,0)}let Z=B-1,re=1;for(this[M+Z]=S&255;--Z>=0&&(re*=256);)this[M+Z]=S/re&255;return M+B},V.prototype.writeUint8=V.prototype.writeUInt8=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,1,255,0),this[M]=S&255,M+1},V.prototype.writeUint16LE=V.prototype.writeUInt16LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,65535,0),this[M]=S&255,this[M+1]=S>>>8,M+2},V.prototype.writeUint16BE=V.prototype.writeUInt16BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,65535,0),this[M]=S>>>8,this[M+1]=S&255,M+2},V.prototype.writeUint32LE=V.prototype.writeUInt32LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,4294967295,0),this[M+3]=S>>>24,this[M+2]=S>>>16,this[M+1]=S>>>8,this[M]=S&255,M+4},V.prototype.writeUint32BE=V.prototype.writeUInt32BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,4294967295,0),this[M]=S>>>24,this[M+1]=S>>>16,this[M+2]=S>>>8,this[M+3]=S&255,M+4};function Fe(j,S,M,B,K){nt(S,B,K,j,M,7);let Z=Number(S&BigInt(4294967295));j[M++]=Z,Z=Z>>8,j[M++]=Z,Z=Z>>8,j[M++]=Z,Z=Z>>8,j[M++]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return j[M++]=re,re=re>>8,j[M++]=re,re=re>>8,j[M++]=re,re=re>>8,j[M++]=re,M}function ft(j,S,M,B,K){nt(S,B,K,j,M,7);let Z=Number(S&BigInt(4294967295));j[M+7]=Z,Z=Z>>8,j[M+6]=Z,Z=Z>>8,j[M+5]=Z,Z=Z>>8,j[M+4]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return j[M+3]=re,re=re>>8,j[M+2]=re,re=re>>8,j[M+1]=re,re=re>>8,j[M]=re,M+8}V.prototype.writeBigUInt64LE=_t(function(S,M=0){return Fe(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeBigUInt64BE=_t(function(S,M=0){return ft(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeIntLE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,M,B,rt-1,-rt)}let Z=0,re=1,Be=0;for(this[M]=S&255;++Z<B&&(re*=256);)S<0&&Be===0&&this[M+Z-1]!==0&&(Be=1),this[M+Z]=(S/re>>0)-Be&255;return M+B},V.prototype.writeIntBE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,M,B,rt-1,-rt)}let Z=B-1,re=1,Be=0;for(this[M+Z]=S&255;--Z>=0&&(re*=256);)S<0&&Be===0&&this[M+Z+1]!==0&&(Be=1),this[M+Z]=(S/re>>0)-Be&255;return M+B},V.prototype.writeInt8=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,1,127,-128),S<0&&(S=255+S+1),this[M]=S&255,M+1},V.prototype.writeInt16LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,32767,-32768),this[M]=S&255,this[M+1]=S>>>8,M+2},V.prototype.writeInt16BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,2,32767,-32768),this[M]=S>>>8,this[M+1]=S&255,M+2},V.prototype.writeInt32LE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,2147483647,-2147483648),this[M]=S&255,this[M+1]=S>>>8,this[M+2]=S>>>16,this[M+3]=S>>>24,M+4},V.prototype.writeInt32BE=function(S,M,B){return S=+S,M=M>>>0,B||Ie(this,S,M,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[M]=S>>>24,this[M+1]=S>>>16,this[M+2]=S>>>8,this[M+3]=S&255,M+4},V.prototype.writeBigInt64LE=_t(function(S,M=0){return Fe(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),V.prototype.writeBigInt64BE=_t(function(S,M=0){return ft(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dt(j,S,M,B,K,Z){if(M+B>j.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("Index out of range")}function He(j,S,M,B,K){return S=+S,M=M>>>0,K||dt(j,S,M,4),F.write(j,S,M,B,23,4),M+4}V.prototype.writeFloatLE=function(S,M,B){return He(this,S,M,!0,B)},V.prototype.writeFloatBE=function(S,M,B){return He(this,S,M,!1,B)};function kt(j,S,M,B,K){return S=+S,M=M>>>0,K||dt(j,S,M,8),F.write(j,S,M,B,52,8),M+8}V.prototype.writeDoubleLE=function(S,M,B){return kt(this,S,M,!0,B)},V.prototype.writeDoubleBE=function(S,M,B){return kt(this,S,M,!1,B)},V.prototype.copy=function(S,M,B,K){if(!V.isBuffer(S))throw new TypeError("argument should be a Buffer");if(B||(B=0),!K&&K!==0&&(K=this.length),M>=S.length&&(M=S.length),M||(M=0),K>0&&K<B&&(K=B),K===B||S.length===0||this.length===0)return 0;if(M<0)throw new RangeError("targetStart out of bounds");if(B<0||B>=this.length)throw new RangeError("Index out of range");if(K<0)throw new RangeError("sourceEnd out of bounds");K>this.length&&(K=this.length),S.length-M<K-B&&(K=S.length-M+B);const Z=K-B;return this===S&&typeof q.prototype.copyWithin=="function"?this.copyWithin(M,B,K):q.prototype.set.call(S,this.subarray(B,K),M),Z},V.prototype.fill=function(S,M,B,K){if(typeof S=="string"){if(typeof M=="string"?(K=M,M=0,B=this.length):typeof B=="string"&&(K=B,B=this.length),K!==void 0&&typeof K!="string")throw new TypeError("encoding must be a string");if(typeof K=="string"&&!V.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(S.length===1){const re=S.charCodeAt(0);(K==="utf8"&&re<128||K==="latin1")&&(S=re)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(M<0||this.length<M||this.length<B)throw new RangeError("Out of range index");if(B<=M)return this;M=M>>>0,B=B===void 0?this.length:B>>>0,S||(S=0);let Z;if(typeof S=="number")for(Z=M;Z<B;++Z)this[Z]=S;else{const re=V.isBuffer(S)?S:V.from(S,K),Be=re.length;if(Be===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<B-M;++Z)this[Z+M]=re[Z%Be]}return this};const St={};function et(j,S,M){St[j]=class extends M{constructor(){super(),Object.defineProperty(this,"message",{value:S.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${j}]`,this.stack,delete this.name}get code(){return j}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${j}]: ${this.message}`}}}et("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),et("ERR_INVALID_ARG_TYPE",function(j,S){return`The "${j}" argument must be of type number. Received type ${typeof S}`},TypeError),et("ERR_OUT_OF_RANGE",function(j,S,M){let B=`The value of "${j}" is out of range.`,K=M;return Number.isInteger(M)&&Math.abs(M)>2**32?K=At(String(M)):typeof M=="bigint"&&(K=String(M),(M>BigInt(2)**BigInt(32)||M<-(BigInt(2)**BigInt(32)))&&(K=At(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function At(j){let S="",M=j.length;const B=j[0]==="-"?1:0;for(;M>=B+4;M-=3)S=`_${j.slice(M-3,M)}${S}`;return`${j.slice(0,M)}${S}`}function $t(j,S,M){Et(S,"offset"),(j[S]===void 0||j[S+M]===void 0)&&Ot(S,j.length-(M+1))}function nt(j,S,M,B,K,Z){if(j>M||j<S){const re=typeof S=="bigint"?"n":"";let Be;throw Z>3?S===0||S===BigInt(0)?Be=`>= 0${re} and < 2${re} ** ${(Z+1)*8}${re}`:Be=`>= -(2${re} ** ${(Z+1)*8-1}${re}) and < 2 ** ${(Z+1)*8-1}${re}`:Be=`>= ${S}${re} and <= ${M}${re}`,new St.ERR_OUT_OF_RANGE("value",Be,j)}$t(B,K,Z)}function Et(j,S){if(typeof j!="number")throw new St.ERR_INVALID_ARG_TYPE(S,"number",j)}function Ot(j,S,M){throw Math.floor(j)!==j?(Et(j,M),new St.ERR_OUT_OF_RANGE(M||"offset","an integer",j)):S<0?new St.ERR_BUFFER_OUT_OF_BOUNDS:new St.ERR_OUT_OF_RANGE(M||"offset",`>= ${M?1:0} and <= ${S}`,j)}const st=/[^+/0-9A-Za-z-_]/g;function jt(j){if(j=j.split("=")[0],j=j.trim().replace(st,""),j.length<2)return"";for(;j.length%4!==0;)j=j+"=";return j}function It(j,S){S=S||1/0;let M;const B=j.length;let K=null;const Z=[];for(let re=0;re<B;++re){if(M=j.charCodeAt(re),M>55295&&M<57344){if(!K){if(M>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(re+1===B){(S-=3)>-1&&Z.push(239,191,189);continue}K=M;continue}if(M<56320){(S-=3)>-1&&Z.push(239,191,189),K=M;continue}M=(K-55296<<10|M-56320)+65536}else K&&(S-=3)>-1&&Z.push(239,191,189);if(K=null,M<128){if((S-=1)<0)break;Z.push(M)}else if(M<2048){if((S-=2)<0)break;Z.push(M>>6|192,M&63|128)}else if(M<65536){if((S-=3)<0)break;Z.push(M>>12|224,M>>6&63|128,M&63|128)}else if(M<1114112){if((S-=4)<0)break;Z.push(M>>18|240,M>>12&63|128,M>>6&63|128,M&63|128)}else throw new Error("Invalid code point")}return Z}function it(j){const S=[];for(let M=0;M<j.length;++M)S.push(j.charCodeAt(M)&255);return S}function wt(j,S){let M,B,K;const Z=[];for(let re=0;re<j.length&&!((S-=2)<0);++re)M=j.charCodeAt(re),B=M>>8,K=M%256,Z.push(K),Z.push(B);return Z}function Tt(j){return N.toByteArray(jt(j))}function Ye(j,S,M,B){let K;for(K=0;K<B&&!(K+M>=S.length||K>=j.length);++K)S[K+M]=j[K];return K}function gt(j,S){return j instanceof S||j!=null&&j.constructor!=null&&j.constructor.name!=null&&j.constructor.name===S.name}function Pt(j){return j!==j}const ot=function(){const j="0123456789abcdef",S=new Array(256);for(let M=0;M<16;++M){const B=M*16;for(let K=0;K<16;++K)S[B+K]=j[M]+j[K]}return S}();function _t(j){return typeof BigInt>"u"?Ut:j}function Ut(){throw new Error("BigInt not supported")}})(t);const P=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=P,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode}(ph)),ph}var A7=vu();const mh=ha(A7);var nn={},gh={exports:{}};gh.exports,function(e){(function(t,r){function n(D,p){if(!D)throw new Error(p||"Assertion failed")}function i(D,p){D.super_=p;var d=function(){};d.prototype=p.prototype,D.prototype=new d,D.prototype.constructor=D}function s(D,p,d){if(s.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init(D||0,p||10,d||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=vu().Buffer}catch{}s.isBN=function(p){return p instanceof s?!0:p!==null&&typeof p=="object"&&p.constructor.wordSize===s.wordSize&&Array.isArray(p.words)},s.max=function(p,d){return p.cmp(d)>0?p:d},s.min=function(p,d){return p.cmp(d)<0?p:d},s.prototype._init=function(p,d,m){if(typeof p=="number")return this._initNumber(p,d,m);if(typeof p=="object")return this._initArray(p,d,m);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),p=p.toString().replace(/\s+/g,"");var x=0;p[0]==="-"&&(x++,this.negative=1),x<p.length&&(d===16?this._parseHex(p,x,m):(this._parseBase(p,d,x),m==="le"&&this._initArray(this.toArray(),d,m)))},s.prototype._initNumber=function(p,d,m){p<0&&(this.negative=1,p=-p),p<67108864?(this.words=[p&67108863],this.length=1):p<4503599627370496?(this.words=[p&67108863,p/67108864&67108863],this.length=2):(n(p<9007199254740992),this.words=[p&67108863,p/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),d,m)},s.prototype._initArray=function(p,d,m){if(n(typeof p.length=="number"),p.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(p.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var T,E,O=0;if(m==="be")for(x=p.length-1,T=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[T]|=E<<O&67108863,this.words[T+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,T++);else if(m==="le")for(x=0,T=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[T]|=E<<O&67108863,this.words[T+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,T++);return this._strip()};function a(D,p){var d=D.charCodeAt(p);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;n(!1,"Invalid character in "+D)}function c(D,p,d){var m=a(D,d);return d-1>=p&&(m|=a(D,d-1)<<4),m}s.prototype._parseHex=function(p,d,m){this.length=Math.ceil((p.length-d)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var T=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<T,this.words[E]|=O&67108863,T>=18?(T-=18,E+=1,this.words[E]|=O>>>26):T+=8;else{var C=p.length-d;for(x=C%2===0?d+1:d;x<p.length;x+=2)O=c(p,d,x)<<T,this.words[E]|=O&67108863,T>=18?(T-=18,E+=1,this.words[E]|=O>>>26):T+=8}this._strip()};function u(D,p,d,m){for(var x=0,T=0,E=Math.min(D.length,d),O=p;O<E;O++){var C=D.charCodeAt(O)-48;x*=m,C>=49?T=C-49+10:C>=17?T=C-17+10:T=C,n(C>=0&&T<m,"Invalid character"),x+=T}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,T=1;T<=67108863;T*=d)x++;x--,T=T/d|0;for(var E=p.length-m,O=E%x,C=Math.min(E,E-O)+m,g=0,v=m;v<C;v+=x)g=u(p,v,v+x,d),this.imuln(T),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(O!==0){var k=1;for(g=u(p,v,p.length,d),v=0;v<O;v++)k*=d;this.imuln(k),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var d=0;d<this.length;d++)p.words[d]=this.words[d];p.length=this.length,p.negative=this.negative,p.red=this.red};function l(D,p){D.words=p.words,D.length=p.length,D.negative=p.negative,D.red=p.red}if(s.prototype._move=function(p){l(p,this)},s.prototype.clone=function(){var p=new s(null);return this.copy(p),p},s.prototype._expand=function(p){for(;this.length<p;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{s.prototype.inspect=f}else s.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],b=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(p,d){p=p||10,d=d|0||1;var m;if(p===16||p==="hex"){m="";for(var x=0,T=0,E=0;E<this.length;E++){var O=this.words[E],C=((O<<x|T)&16777215).toString(16);T=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),T!==0||E!==this.length-1?m=h[6-C.length]+C+m:m=C+m}for(T!==0&&(m=T.toString(16)+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(p===(p|0)&&p>=2&&p<=36){var g=y[p],v=b[p];m="";var k=this.clone();for(k.negative=0;!k.isZero();){var ee=k.modrn(v).toString(p);k=k.idivn(v),k.isZero()?m=ee+m:m=h[g-ee.length]+ee+m}for(this.isZero()&&(m="0"+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(p,d){return this.toArrayLike(o,p,d)}),s.prototype.toArray=function(p,d){return this.toArrayLike(Array,p,d)};var w=function(p,d){return p.allocUnsafe?p.allocUnsafe(d):new p(d)};s.prototype.toArrayLike=function(p,d,m){this._strip();var x=this.byteLength(),T=m||Math.max(1,x);n(x<=T,"byte array longer than desired length"),n(T>0,"Requested array length <= 0");var E=w(p,T),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,T=0,E=0;T<this.length;T++){var O=this.words[T]<<E|x;p[m++]=O&255,m<p.length&&(p[m++]=O>>8&255),m<p.length&&(p[m++]=O>>16&255),E===6?(m<p.length&&(p[m++]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m<p.length)for(p[m++]=x;m<p.length;)p[m++]=0},s.prototype._toArrayLikeBE=function(p,d){for(var m=p.length-1,x=0,T=0,E=0;T<this.length;T++){var O=this.words[T]<<E|x;p[m--]=O&255,m>=0&&(p[m--]=O>>8&255),m>=0&&(p[m--]=O>>16&255),E===6?(m>=0&&(p[m--]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m>=0)for(p[m--]=x;m>=0;)p[m--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var d=p,m=0;return d>=4096&&(m+=13,d>>>=13),d>=64&&(m+=7,d>>>=7),d>=8&&(m+=4,d>>>=4),d>=2&&(m+=2,d>>>=2),m+d},s.prototype._zeroBits=function(p){if(p===0)return 26;var d=p,m=0;return d&8191||(m+=13,d>>>=13),d&127||(m+=7,d>>>=7),d&15||(m+=4,d>>>=4),d&3||(m+=2,d>>>=2),d&1||m++,m},s.prototype.bitLength=function(){var p=this.words[this.length-1],d=this._countBits(p);return(this.length-1)*26+d};function A(D){for(var p=new Array(D.bitLength()),d=0;d<p.length;d++){var m=d/26|0,x=d%26;p[d]=D.words[m]>>>x&1}return p}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var p=0,d=0;d<this.length;d++){var m=this._zeroBits(this.words[d]);if(p+=m,m!==26)break}return p},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(p){return this.negative!==0?this.abs().inotn(p).iaddn(1):this.clone()},s.prototype.fromTwos=function(p){return this.testn(p-1)?this.notn(p).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(p){for(;this.length<p.length;)this.words[this.length++]=0;for(var d=0;d<p.length;d++)this.words[d]=this.words[d]|p.words[d];return this._strip()},s.prototype.ior=function(p){return n((this.negative|p.negative)===0),this.iuor(p)},s.prototype.or=function(p){return this.length>p.length?this.clone().ior(p):p.clone().ior(this)},s.prototype.uor=function(p){return this.length>p.length?this.clone().iuor(p):p.clone().iuor(this)},s.prototype.iuand=function(p){var d;this.length>p.length?d=p:d=this;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]&p.words[m];return this.length=d.length,this._strip()},s.prototype.iand=function(p){return n((this.negative|p.negative)===0),this.iuand(p)},s.prototype.and=function(p){return this.length>p.length?this.clone().iand(p):p.clone().iand(this)},s.prototype.uand=function(p){return this.length>p.length?this.clone().iuand(p):p.clone().iuand(this)},s.prototype.iuxor=function(p){var d,m;this.length>p.length?(d=this,m=p):(d=p,m=this);for(var x=0;x<m.length;x++)this.words[x]=d.words[x]^m.words[x];if(this!==d)for(;x<d.length;x++)this.words[x]=d.words[x];return this.length=d.length,this._strip()},s.prototype.ixor=function(p){return n((this.negative|p.negative)===0),this.iuxor(p)},s.prototype.xor=function(p){return this.length>p.length?this.clone().ixor(p):p.clone().ixor(this)},s.prototype.uxor=function(p){return this.length>p.length?this.clone().iuxor(p):p.clone().iuxor(this)},s.prototype.inotn=function(p){n(typeof p=="number"&&p>=0);var d=Math.ceil(p/26)|0,m=p%26;this._expand(d),m>0&&d--;for(var x=0;x<d;x++)this.words[x]=~this.words[x]&67108863;return m>0&&(this.words[x]=~this.words[x]&67108863>>26-m),this._strip()},s.prototype.notn=function(p){return this.clone().inotn(p)},s.prototype.setn=function(p,d){n(typeof p=="number"&&p>=0);var m=p/26|0,x=p%26;return this._expand(m+1),d?this.words[m]=this.words[m]|1<<x:this.words[m]=this.words[m]&~(1<<x),this._strip()},s.prototype.iadd=function(p){var d;if(this.negative!==0&&p.negative===0)return this.negative=0,d=this.isub(p),this.negative^=1,this._normSign();if(this.negative===0&&p.negative!==0)return p.negative=0,d=this.isub(p),p.negative=1,d._normSign();var m,x;this.length>p.length?(m=this,x=p):(m=p,x=this);for(var T=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+T,this.words[E]=d&67108863,T=d>>>26;for(;T!==0&&E<m.length;E++)d=(m.words[E]|0)+T,this.words[E]=d&67108863,T=d>>>26;if(this.length=m.length,T!==0)this.words[this.length]=T,this.length++;else if(m!==this)for(;E<m.length;E++)this.words[E]=m.words[E];return this},s.prototype.add=function(p){var d;return p.negative!==0&&this.negative===0?(p.negative=0,d=this.sub(p),p.negative^=1,d):p.negative===0&&this.negative!==0?(this.negative=0,d=p.sub(this),this.negative=1,d):this.length>p.length?this.clone().iadd(p):p.clone().iadd(this)},s.prototype.isub=function(p){if(p.negative!==0){p.negative=0;var d=this.iadd(p);return p.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(p),this.negative=1,this._normSign();var m=this.cmp(p);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,T;m>0?(x=this,T=p):(x=p,T=this);for(var E=0,O=0;O<T.length;O++)d=(x.words[O]|0)-(T.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;for(;E!==0&&O<x.length;O++)d=(x.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;if(E===0&&O<x.length&&x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this.length=Math.max(this.length,O),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function P(D,p,d){d.negative=p.negative^D.negative;var m=D.length+p.length|0;d.length=m,m=m-1|0;var x=D.words[0]|0,T=p.words[0]|0,E=x*T,O=E&67108863,C=E/67108864|0;d.words[0]=O;for(var g=1;g<m;g++){for(var v=C>>>26,k=C&67108863,ee=Math.min(g,p.length-1),se=Math.max(0,g-D.length+1);se<=ee;se++){var he=g-se|0;x=D.words[he]|0,T=p.words[se]|0,E=x*T+k,v+=E/67108864|0,k=E&67108863}d.words[g]=k|0,C=v|0}return C!==0?d.words[g]=C|0:d.length--,d._strip()}var R=function(p,d,m){var x=p.words,T=d.words,E=m.words,O=0,C,g,v,k=x[0]|0,ee=k&8191,se=k>>>13,he=x[1]|0,ye=he&8191,Ee=he>>>13,Se=x[2]|0,Ge=Se&8191,Ue=Se>>>13,lt=x[3]|0,ht=lt&8191,$e=lt>>>13,mt=x[4]|0,_e=mt&8191,ge=mt>>>13,Ae=x[5]|0,We=Ae&8191,De=Ae>>>13,Oe=x[6]|0,Ie=Oe&8191,Fe=Oe>>>13,ft=x[7]|0,dt=ft&8191,He=ft>>>13,kt=x[8]|0,St=kt&8191,et=kt>>>13,At=x[9]|0,$t=At&8191,nt=At>>>13,Et=T[0]|0,Ot=Et&8191,st=Et>>>13,jt=T[1]|0,It=jt&8191,it=jt>>>13,wt=T[2]|0,Tt=wt&8191,Ye=wt>>>13,gt=T[3]|0,Pt=gt&8191,ot=gt>>>13,_t=T[4]|0,Ut=_t&8191,j=_t>>>13,S=T[5]|0,M=S&8191,B=S>>>13,K=T[6]|0,Z=K&8191,re=K>>>13,Be=T[7]|0,rt=Be&8191,Ne=Be>>>13,z=T[8]|0,oe=z&8191,pe=z>>>13,je=T[9]|0,Ke=je&8191,Re=je>>>13;m.negative=p.negative^d.negative,m.length=19,C=Math.imul(ee,Ot),g=Math.imul(ee,st),g=g+Math.imul(se,Ot)|0,v=Math.imul(se,st);var ze=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ze>>>26)|0,ze&=67108863,C=Math.imul(ye,Ot),g=Math.imul(ye,st),g=g+Math.imul(Ee,Ot)|0,v=Math.imul(Ee,st),C=C+Math.imul(ee,It)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(se,It)|0,v=v+Math.imul(se,it)|0;var ut=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ut>>>26)|0,ut&=67108863,C=Math.imul(Ge,Ot),g=Math.imul(Ge,st),g=g+Math.imul(Ue,Ot)|0,v=Math.imul(Ue,st),C=C+Math.imul(ye,It)|0,g=g+Math.imul(ye,it)|0,g=g+Math.imul(Ee,It)|0,v=v+Math.imul(Ee,it)|0,C=C+Math.imul(ee,Tt)|0,g=g+Math.imul(ee,Ye)|0,g=g+Math.imul(se,Tt)|0,v=v+Math.imul(se,Ye)|0;var Jt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,C=Math.imul(ht,Ot),g=Math.imul(ht,st),g=g+Math.imul($e,Ot)|0,v=Math.imul($e,st),C=C+Math.imul(Ge,It)|0,g=g+Math.imul(Ge,it)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,it)|0,C=C+Math.imul(ye,Tt)|0,g=g+Math.imul(ye,Ye)|0,g=g+Math.imul(Ee,Tt)|0,v=v+Math.imul(Ee,Ye)|0,C=C+Math.imul(ee,Pt)|0,g=g+Math.imul(ee,ot)|0,g=g+Math.imul(se,Pt)|0,v=v+Math.imul(se,ot)|0;var Rt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,C=Math.imul(_e,Ot),g=Math.imul(_e,st),g=g+Math.imul(ge,Ot)|0,v=Math.imul(ge,st),C=C+Math.imul(ht,It)|0,g=g+Math.imul(ht,it)|0,g=g+Math.imul($e,It)|0,v=v+Math.imul($e,it)|0,C=C+Math.imul(Ge,Tt)|0,g=g+Math.imul(Ge,Ye)|0,g=g+Math.imul(Ue,Tt)|0,v=v+Math.imul(Ue,Ye)|0,C=C+Math.imul(ye,Pt)|0,g=g+Math.imul(ye,ot)|0,g=g+Math.imul(Ee,Pt)|0,v=v+Math.imul(Ee,ot)|0,C=C+Math.imul(ee,Ut)|0,g=g+Math.imul(ee,j)|0,g=g+Math.imul(se,Ut)|0,v=v+Math.imul(se,j)|0;var Bt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,C=Math.imul(We,Ot),g=Math.imul(We,st),g=g+Math.imul(De,Ot)|0,v=Math.imul(De,st),C=C+Math.imul(_e,It)|0,g=g+Math.imul(_e,it)|0,g=g+Math.imul(ge,It)|0,v=v+Math.imul(ge,it)|0,C=C+Math.imul(ht,Tt)|0,g=g+Math.imul(ht,Ye)|0,g=g+Math.imul($e,Tt)|0,v=v+Math.imul($e,Ye)|0,C=C+Math.imul(Ge,Pt)|0,g=g+Math.imul(Ge,ot)|0,g=g+Math.imul(Ue,Pt)|0,v=v+Math.imul(Ue,ot)|0,C=C+Math.imul(ye,Ut)|0,g=g+Math.imul(ye,j)|0,g=g+Math.imul(Ee,Ut)|0,v=v+Math.imul(Ee,j)|0,C=C+Math.imul(ee,M)|0,g=g+Math.imul(ee,B)|0,g=g+Math.imul(se,M)|0,v=v+Math.imul(se,B)|0;var ir=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ir>>>26)|0,ir&=67108863,C=Math.imul(Ie,Ot),g=Math.imul(Ie,st),g=g+Math.imul(Fe,Ot)|0,v=Math.imul(Fe,st),C=C+Math.imul(We,It)|0,g=g+Math.imul(We,it)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,it)|0,C=C+Math.imul(_e,Tt)|0,g=g+Math.imul(_e,Ye)|0,g=g+Math.imul(ge,Tt)|0,v=v+Math.imul(ge,Ye)|0,C=C+Math.imul(ht,Pt)|0,g=g+Math.imul(ht,ot)|0,g=g+Math.imul($e,Pt)|0,v=v+Math.imul($e,ot)|0,C=C+Math.imul(Ge,Ut)|0,g=g+Math.imul(Ge,j)|0,g=g+Math.imul(Ue,Ut)|0,v=v+Math.imul(Ue,j)|0,C=C+Math.imul(ye,M)|0,g=g+Math.imul(ye,B)|0,g=g+Math.imul(Ee,M)|0,v=v+Math.imul(Ee,B)|0,C=C+Math.imul(ee,Z)|0,g=g+Math.imul(ee,re)|0,g=g+Math.imul(se,Z)|0,v=v+Math.imul(se,re)|0;var Sr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,C=Math.imul(dt,Ot),g=Math.imul(dt,st),g=g+Math.imul(He,Ot)|0,v=Math.imul(He,st),C=C+Math.imul(Ie,It)|0,g=g+Math.imul(Ie,it)|0,g=g+Math.imul(Fe,It)|0,v=v+Math.imul(Fe,it)|0,C=C+Math.imul(We,Tt)|0,g=g+Math.imul(We,Ye)|0,g=g+Math.imul(De,Tt)|0,v=v+Math.imul(De,Ye)|0,C=C+Math.imul(_e,Pt)|0,g=g+Math.imul(_e,ot)|0,g=g+Math.imul(ge,Pt)|0,v=v+Math.imul(ge,ot)|0,C=C+Math.imul(ht,Ut)|0,g=g+Math.imul(ht,j)|0,g=g+Math.imul($e,Ut)|0,v=v+Math.imul($e,j)|0,C=C+Math.imul(Ge,M)|0,g=g+Math.imul(Ge,B)|0,g=g+Math.imul(Ue,M)|0,v=v+Math.imul(Ue,B)|0,C=C+Math.imul(ye,Z)|0,g=g+Math.imul(ye,re)|0,g=g+Math.imul(Ee,Z)|0,v=v+Math.imul(Ee,re)|0,C=C+Math.imul(ee,rt)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(se,rt)|0,v=v+Math.imul(se,Ne)|0;var or=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(or>>>26)|0,or&=67108863,C=Math.imul(St,Ot),g=Math.imul(St,st),g=g+Math.imul(et,Ot)|0,v=Math.imul(et,st),C=C+Math.imul(dt,It)|0,g=g+Math.imul(dt,it)|0,g=g+Math.imul(He,It)|0,v=v+Math.imul(He,it)|0,C=C+Math.imul(Ie,Tt)|0,g=g+Math.imul(Ie,Ye)|0,g=g+Math.imul(Fe,Tt)|0,v=v+Math.imul(Fe,Ye)|0,C=C+Math.imul(We,Pt)|0,g=g+Math.imul(We,ot)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,ot)|0,C=C+Math.imul(_e,Ut)|0,g=g+Math.imul(_e,j)|0,g=g+Math.imul(ge,Ut)|0,v=v+Math.imul(ge,j)|0,C=C+Math.imul(ht,M)|0,g=g+Math.imul(ht,B)|0,g=g+Math.imul($e,M)|0,v=v+Math.imul($e,B)|0,C=C+Math.imul(Ge,Z)|0,g=g+Math.imul(Ge,re)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,re)|0,C=C+Math.imul(ye,rt)|0,g=g+Math.imul(ye,Ne)|0,g=g+Math.imul(Ee,rt)|0,v=v+Math.imul(Ee,Ne)|0,C=C+Math.imul(ee,oe)|0,g=g+Math.imul(ee,pe)|0,g=g+Math.imul(se,oe)|0,v=v+Math.imul(se,pe)|0;var Yt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,C=Math.imul($t,Ot),g=Math.imul($t,st),g=g+Math.imul(nt,Ot)|0,v=Math.imul(nt,st),C=C+Math.imul(St,It)|0,g=g+Math.imul(St,it)|0,g=g+Math.imul(et,It)|0,v=v+Math.imul(et,it)|0,C=C+Math.imul(dt,Tt)|0,g=g+Math.imul(dt,Ye)|0,g=g+Math.imul(He,Tt)|0,v=v+Math.imul(He,Ye)|0,C=C+Math.imul(Ie,Pt)|0,g=g+Math.imul(Ie,ot)|0,g=g+Math.imul(Fe,Pt)|0,v=v+Math.imul(Fe,ot)|0,C=C+Math.imul(We,Ut)|0,g=g+Math.imul(We,j)|0,g=g+Math.imul(De,Ut)|0,v=v+Math.imul(De,j)|0,C=C+Math.imul(_e,M)|0,g=g+Math.imul(_e,B)|0,g=g+Math.imul(ge,M)|0,v=v+Math.imul(ge,B)|0,C=C+Math.imul(ht,Z)|0,g=g+Math.imul(ht,re)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,re)|0,C=C+Math.imul(Ge,rt)|0,g=g+Math.imul(Ge,Ne)|0,g=g+Math.imul(Ue,rt)|0,v=v+Math.imul(Ue,Ne)|0,C=C+Math.imul(ye,oe)|0,g=g+Math.imul(ye,pe)|0,g=g+Math.imul(Ee,oe)|0,v=v+Math.imul(Ee,pe)|0,C=C+Math.imul(ee,Ke)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(se,Ke)|0,v=v+Math.imul(se,Re)|0;var yr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(yr>>>26)|0,yr&=67108863,C=Math.imul($t,It),g=Math.imul($t,it),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,it),C=C+Math.imul(St,Tt)|0,g=g+Math.imul(St,Ye)|0,g=g+Math.imul(et,Tt)|0,v=v+Math.imul(et,Ye)|0,C=C+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,ot)|0,g=g+Math.imul(He,Pt)|0,v=v+Math.imul(He,ot)|0,C=C+Math.imul(Ie,Ut)|0,g=g+Math.imul(Ie,j)|0,g=g+Math.imul(Fe,Ut)|0,v=v+Math.imul(Fe,j)|0,C=C+Math.imul(We,M)|0,g=g+Math.imul(We,B)|0,g=g+Math.imul(De,M)|0,v=v+Math.imul(De,B)|0,C=C+Math.imul(_e,Z)|0,g=g+Math.imul(_e,re)|0,g=g+Math.imul(ge,Z)|0,v=v+Math.imul(ge,re)|0,C=C+Math.imul(ht,rt)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,rt)|0,v=v+Math.imul($e,Ne)|0,C=C+Math.imul(Ge,oe)|0,g=g+Math.imul(Ge,pe)|0,g=g+Math.imul(Ue,oe)|0,v=v+Math.imul(Ue,pe)|0,C=C+Math.imul(ye,Ke)|0,g=g+Math.imul(ye,Re)|0,g=g+Math.imul(Ee,Ke)|0,v=v+Math.imul(Ee,Re)|0;var Nn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,C=Math.imul($t,Tt),g=Math.imul($t,Ye),g=g+Math.imul(nt,Tt)|0,v=Math.imul(nt,Ye),C=C+Math.imul(St,Pt)|0,g=g+Math.imul(St,ot)|0,g=g+Math.imul(et,Pt)|0,v=v+Math.imul(et,ot)|0,C=C+Math.imul(dt,Ut)|0,g=g+Math.imul(dt,j)|0,g=g+Math.imul(He,Ut)|0,v=v+Math.imul(He,j)|0,C=C+Math.imul(Ie,M)|0,g=g+Math.imul(Ie,B)|0,g=g+Math.imul(Fe,M)|0,v=v+Math.imul(Fe,B)|0,C=C+Math.imul(We,Z)|0,g=g+Math.imul(We,re)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,re)|0,C=C+Math.imul(_e,rt)|0,g=g+Math.imul(_e,Ne)|0,g=g+Math.imul(ge,rt)|0,v=v+Math.imul(ge,Ne)|0,C=C+Math.imul(ht,oe)|0,g=g+Math.imul(ht,pe)|0,g=g+Math.imul($e,oe)|0,v=v+Math.imul($e,pe)|0,C=C+Math.imul(Ge,Ke)|0,g=g+Math.imul(Ge,Re)|0,g=g+Math.imul(Ue,Ke)|0,v=v+Math.imul(Ue,Re)|0;var Wr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,C=Math.imul($t,Pt),g=Math.imul($t,ot),g=g+Math.imul(nt,Pt)|0,v=Math.imul(nt,ot),C=C+Math.imul(St,Ut)|0,g=g+Math.imul(St,j)|0,g=g+Math.imul(et,Ut)|0,v=v+Math.imul(et,j)|0,C=C+Math.imul(dt,M)|0,g=g+Math.imul(dt,B)|0,g=g+Math.imul(He,M)|0,v=v+Math.imul(He,B)|0,C=C+Math.imul(Ie,Z)|0,g=g+Math.imul(Ie,re)|0,g=g+Math.imul(Fe,Z)|0,v=v+Math.imul(Fe,re)|0,C=C+Math.imul(We,rt)|0,g=g+Math.imul(We,Ne)|0,g=g+Math.imul(De,rt)|0,v=v+Math.imul(De,Ne)|0,C=C+Math.imul(_e,oe)|0,g=g+Math.imul(_e,pe)|0,g=g+Math.imul(ge,oe)|0,v=v+Math.imul(ge,pe)|0,C=C+Math.imul(ht,Ke)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,Ke)|0,v=v+Math.imul($e,Re)|0;var Dn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,C=Math.imul($t,Ut),g=Math.imul($t,j),g=g+Math.imul(nt,Ut)|0,v=Math.imul(nt,j),C=C+Math.imul(St,M)|0,g=g+Math.imul(St,B)|0,g=g+Math.imul(et,M)|0,v=v+Math.imul(et,B)|0,C=C+Math.imul(dt,Z)|0,g=g+Math.imul(dt,re)|0,g=g+Math.imul(He,Z)|0,v=v+Math.imul(He,re)|0,C=C+Math.imul(Ie,rt)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Fe,rt)|0,v=v+Math.imul(Fe,Ne)|0,C=C+Math.imul(We,oe)|0,g=g+Math.imul(We,pe)|0,g=g+Math.imul(De,oe)|0,v=v+Math.imul(De,pe)|0,C=C+Math.imul(_e,Ke)|0,g=g+Math.imul(_e,Re)|0,g=g+Math.imul(ge,Ke)|0,v=v+Math.imul(ge,Re)|0;var Li=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Li>>>26)|0,Li&=67108863,C=Math.imul($t,M),g=Math.imul($t,B),g=g+Math.imul(nt,M)|0,v=Math.imul(nt,B),C=C+Math.imul(St,Z)|0,g=g+Math.imul(St,re)|0,g=g+Math.imul(et,Z)|0,v=v+Math.imul(et,re)|0,C=C+Math.imul(dt,rt)|0,g=g+Math.imul(dt,Ne)|0,g=g+Math.imul(He,rt)|0,v=v+Math.imul(He,Ne)|0,C=C+Math.imul(Ie,oe)|0,g=g+Math.imul(Ie,pe)|0,g=g+Math.imul(Fe,oe)|0,v=v+Math.imul(Fe,pe)|0,C=C+Math.imul(We,Ke)|0,g=g+Math.imul(We,Re)|0,g=g+Math.imul(De,Ke)|0,v=v+Math.imul(De,Re)|0;var Fi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,C=Math.imul($t,Z),g=Math.imul($t,re),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,re),C=C+Math.imul(St,rt)|0,g=g+Math.imul(St,Ne)|0,g=g+Math.imul(et,rt)|0,v=v+Math.imul(et,Ne)|0,C=C+Math.imul(dt,oe)|0,g=g+Math.imul(dt,pe)|0,g=g+Math.imul(He,oe)|0,v=v+Math.imul(He,pe)|0,C=C+Math.imul(Ie,Ke)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Fe,Ke)|0,v=v+Math.imul(Fe,Re)|0;var $n=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+($n>>>26)|0,$n&=67108863,C=Math.imul($t,rt),g=Math.imul($t,Ne),g=g+Math.imul(nt,rt)|0,v=Math.imul(nt,Ne),C=C+Math.imul(St,oe)|0,g=g+Math.imul(St,pe)|0,g=g+Math.imul(et,oe)|0,v=v+Math.imul(et,pe)|0,C=C+Math.imul(dt,Ke)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(He,Ke)|0,v=v+Math.imul(He,Re)|0;var Ui=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,C=Math.imul($t,oe),g=Math.imul($t,pe),g=g+Math.imul(nt,oe)|0,v=Math.imul(nt,pe),C=C+Math.imul(St,Ke)|0,g=g+Math.imul(St,Re)|0,g=g+Math.imul(et,Ke)|0,v=v+Math.imul(et,Re)|0;var zi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(zi>>>26)|0,zi&=67108863,C=Math.imul($t,Ke),g=Math.imul($t,Re),g=g+Math.imul(nt,Ke)|0,v=Math.imul(nt,Re);var $=(O+C|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+($>>>26)|0,$&=67108863,E[0]=ze,E[1]=ut,E[2]=Jt,E[3]=Rt,E[4]=Bt,E[5]=ir,E[6]=Sr,E[7]=or,E[8]=Yt,E[9]=yr,E[10]=Nn,E[11]=Wr,E[12]=Dn,E[13]=Li,E[14]=Fi,E[15]=$n,E[16]=Ui,E[17]=zi,E[18]=$,O!==0&&(E[19]=O,m.length++),m};Math.imul||(R=P);function N(D,p,d){d.negative=p.negative^D.negative,d.length=D.length+p.length;for(var m=0,x=0,T=0;T<d.length-1;T++){var E=x;x=0;for(var O=m&67108863,C=Math.min(T,p.length-1),g=Math.max(0,T-D.length+1);g<=C;g++){var v=T-g,k=D.words[v]|0,ee=p.words[g]|0,se=k*ee,he=se&67108863;E=E+(se/67108864|0)|0,he=he+O|0,O=he&67108863,E=E+(he>>>26)|0,x+=E>>>26,E&=67108863}d.words[T]=O,m=E,E=x}return m!==0?d.words[T]=m:d.length--,d._strip()}function F(D,p,d){return N(D,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=R(this,p,d):x<63?m=P(this,p,d):x<1024?m=N(this,p,d):m=F(this,p,d),m},s.prototype.mul=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),this.mulTo(p,d)},s.prototype.mulf=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),F(this,p,d)},s.prototype.imul=function(p){return this.clone().mulTo(p,this)},s.prototype.imuln=function(p){var d=p<0;d&&(p=-p),n(typeof p=="number"),n(p<67108864);for(var m=0,x=0;x<this.length;x++){var T=(this.words[x]|0)*p,E=(T&67108863)+(m&67108863);m>>=26,m+=T/67108864|0,m+=E>>>26,this.words[x]=E&67108863}return m!==0&&(this.words[x]=m,this.length++),d?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var d=A(p);if(d.length===0)return new s(1);for(var m=this,x=0;x<d.length&&d[x]===0;x++,m=m.sqr());if(++x<d.length)for(var T=m.sqr();x<d.length;x++,T=T.sqr())d[x]!==0&&(m=m.mul(T));return m},s.prototype.iushln=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=67108863>>>26-d<<26-d,T;if(d!==0){var E=0;for(T=0;T<this.length;T++){var O=this.words[T]&x,C=(this.words[T]|0)-O<<d;this.words[T]=C|E,E=O>>>26-d}E&&(this.words[T]=E,this.length++)}if(m!==0){for(T=this.length-1;T>=0;T--)this.words[T+m]=this.words[T];for(T=0;T<m;T++)this.words[T]=0;this.length+=m}return this._strip()},s.prototype.ishln=function(p){return n(this.negative===0),this.iushln(p)},s.prototype.iushrn=function(p,d,m){n(typeof p=="number"&&p>=0);var x;d?x=(d-d%26)/26:x=0;var T=p%26,E=Math.min((p-T)/26,this.length),O=67108863^67108863>>>T<<T,C=m;if(x-=E,x=Math.max(0,x),C){for(var g=0;g<E;g++)C.words[g]=this.words[g];C.length=E}if(E!==0)if(this.length>E)for(this.length-=E,g=0;g<this.length;g++)this.words[g]=this.words[g+E];else this.words[0]=0,this.length=1;var v=0;for(g=this.length-1;g>=0&&(v!==0||g>=x);g--){var k=this.words[g]|0;this.words[g]=v<<26-T|k>>>T,v=k&O}return C&&v!==0&&(C.words[C.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(p,d,m){return n(this.negative===0),this.iushrn(p,d,m)},s.prototype.shln=function(p){return this.clone().ishln(p)},s.prototype.ushln=function(p){return this.clone().iushln(p)},s.prototype.shrn=function(p){return this.clone().ishrn(p)},s.prototype.ushrn=function(p){return this.clone().iushrn(p)},s.prototype.testn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return!1;var T=this.words[m];return!!(T&x)},s.prototype.imaskn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(d!==0&&m++,this.length=Math.min(m,this.length),d!==0){var x=67108863^67108863>>>d<<d;this.words[this.length-1]&=x}return this._strip()},s.prototype.maskn=function(p){return this.clone().imaskn(p)},s.prototype.iaddn=function(p){return n(typeof p=="number"),n(p<67108864),p<0?this.isubn(-p):this.negative!==0?this.length===1&&(this.words[0]|0)<=p?(this.words[0]=p-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(p),this.negative=1,this):this._iaddn(p)},s.prototype._iaddn=function(p){this.words[0]+=p;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(p){if(n(typeof p=="number"),n(p<67108864),p<0)return this.iaddn(-p);if(this.negative!==0)return this.negative=0,this.iaddn(p),this.negative=1,this;if(this.words[0]-=p,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(p){return this.clone().iaddn(p)},s.prototype.subn=function(p){return this.clone().isubn(p)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(p,d,m){var x=p.length+m,T;this._expand(x);var E,O=0;for(T=0;T<p.length;T++){E=(this.words[T+m]|0)+O;var C=(p.words[T]|0)*d;E-=C&67108863,O=(E>>26)-(C/67108864|0),this.words[T+m]=E&67108863}for(;T<this.length-m;T++)E=(this.words[T+m]|0)+O,O=E>>26,this.words[T+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,T=0;T<this.length;T++)E=-(this.words[T]|0)+O,O=E>>26,this.words[T]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),T=p,E=T.words[T.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(T=T.ushln(m),x.iushln(m),E=T.words[T.length-1]|0);var C=x.length-T.length,g;if(d!=="mod"){g=new s(null),g.length=C+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var k=x.clone()._ishlnsubmul(T,1,C);k.negative===0&&(x=k,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var se=(x.words[T.length+ee]|0)*67108864+(x.words[T.length+ee-1]|0);for(se=Math.min(se/E|0,67108863),x._ishlnsubmul(T,se,ee);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(T,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=se)}return g&&g._strip(),x._strip(),d!=="div"&&m!==0&&x.iushrn(m),{div:g||null,mod:x}},s.prototype.divmod=function(p,d,m){if(n(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,T,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(T=E.mod.neg(),m&&T.negative!==0&&T.iadd(p)),{div:x,mod:T}):this.negative===0&&p.negative!==0?(E=this.divmod(p.neg(),d),d!=="mod"&&(x=E.div.neg()),{div:x,mod:E.mod}):this.negative&p.negative?(E=this.neg().divmod(p.neg(),d),d!=="div"&&(T=E.mod.neg(),m&&T.negative!==0&&T.isub(p)),{div:E.div,mod:T}):p.length>this.length||this.cmp(p)<0?{div:new s(0),mod:this}:p.length===1?d==="div"?{div:this.divn(p.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(p.words[0]))}:{div:this.divn(p.words[0]),mod:new s(this.modrn(p.words[0]))}:this._wordDiv(p,d)},s.prototype.div=function(p){return this.divmod(p,"div",!1).div},s.prototype.mod=function(p){return this.divmod(p,"mod",!1).mod},s.prototype.umod=function(p){return this.divmod(p,"mod",!0).mod},s.prototype.divRound=function(p){var d=this.divmod(p);if(d.mod.isZero())return d.div;var m=d.div.negative!==0?d.mod.isub(p):d.mod,x=p.ushrn(1),T=p.andln(1),E=m.cmp(x);return E<0||T===1&&E===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=(1<<26)%p,x=0,T=this.length-1;T>=0;T--)x=(m*x+(this.words[T]|0))%p;return d?-x:x},s.prototype.modn=function(p){return this.modrn(p)},s.prototype.idivn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=0,x=this.length-1;x>=0;x--){var T=(this.words[x]|0)+m*67108864;this.words[x]=T/p|0,m=T%p}return this._strip(),d?this.ineg():this},s.prototype.divn=function(p){return this.clone().idivn(p)},s.prototype.egcd=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),T=new s(0),E=new s(0),O=new s(1),C=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++C;for(var g=m.clone(),v=d.clone();!d.isZero();){for(var k=0,ee=1;!(d.words[0]&ee)&&k<26;++k,ee<<=1);if(k>0)for(d.iushrn(k);k-- >0;)(x.isOdd()||T.isOdd())&&(x.iadd(g),T.isub(v)),x.iushrn(1),T.iushrn(1);for(var se=0,he=1;!(m.words[0]&he)&&se<26;++se,he<<=1);if(se>0)for(m.iushrn(se);se-- >0;)(E.isOdd()||O.isOdd())&&(E.iadd(g),O.isub(v)),E.iushrn(1),O.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(E),T.isub(O)):(m.isub(d),E.isub(x),O.isub(T))}return{a:E,b:O,gcd:m.iushln(C)}},s.prototype._invmp=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),T=new s(0),E=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var O=0,C=1;!(d.words[0]&C)&&O<26;++O,C<<=1);if(O>0)for(d.iushrn(O);O-- >0;)x.isOdd()&&x.iadd(E),x.iushrn(1);for(var g=0,v=1;!(m.words[0]&v)&&g<26;++g,v<<=1);if(g>0)for(m.iushrn(g);g-- >0;)T.isOdd()&&T.iadd(E),T.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(T)):(m.isub(d),T.isub(x))}var k;return d.cmpn(1)===0?k=x:k=T,k.cmpn(0)<0&&k.iadd(p),k},s.prototype.gcd=function(p){if(this.isZero())return p.abs();if(p.isZero())return this.abs();var d=this.clone(),m=p.clone();d.negative=0,m.negative=0;for(var x=0;d.isEven()&&m.isEven();x++)d.iushrn(1),m.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;m.isEven();)m.iushrn(1);var T=d.cmp(m);if(T<0){var E=d;d=m,m=E}else if(T===0||m.cmpn(1)===0)break;d.isub(m)}while(!0);return m.iushln(x)},s.prototype.invm=function(p){return this.egcd(p).a.umod(p)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(p){return this.words[0]&p},s.prototype.bincn=function(p){n(typeof p=="number");var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return this._expand(m+1),this.words[m]|=x,this;for(var T=x,E=m;T!==0&&E<this.length;E++){var O=this.words[E]|0;O+=T,T=O>>>26,O&=67108863,this.words[E]=O}return T!==0&&(this.words[E]=T,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(p){var d=p<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var m;if(this.length>1)m=1;else{d&&(p=-p),n(p<=67108863,"Number is too big");var x=this.words[0]|0;m=x===p?0:x<p?-1:1}return this.negative!==0?-m|0:m},s.prototype.cmp=function(p){if(this.negative!==0&&p.negative===0)return-1;if(this.negative===0&&p.negative!==0)return 1;var d=this.ucmp(p);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(p){if(this.length>p.length)return 1;if(this.length<p.length)return-1;for(var d=0,m=this.length-1;m>=0;m--){var x=this.words[m]|0,T=p.words[m]|0;if(x!==T){x<T?d=-1:x>T&&(d=1);break}}return d},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new ce(p)},s.prototype.toRed=function(p){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return n(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return n(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var L={k256:null,p224:null,p192:null,p25519:null};function G(D,p){this.name=D,this.p=new s(p,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},G.prototype.ireduce=function(p){var d=p,m;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),m=d.bitLength();while(m>this.n);var x=m<this.n?-1:d.ucmp(this.p);return x===0?(d.words[0]=0,d.length=1):x>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},G.prototype.split=function(p,d){p.iushrn(this.n,0,d)},G.prototype.imulK=function(p){return p.imul(this.k)};function q(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,G),q.prototype.split=function(p,d){for(var m=4194303,x=Math.min(p.length,9),T=0;T<x;T++)d.words[T]=p.words[T];if(d.length=x,p.length<=9){p.words[0]=0,p.length=1;return}var E=p.words[9];for(d.words[d.length++]=E&m,T=10;T<p.length;T++){var O=p.words[T]|0;p.words[T-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[T-10]=E,E===0&&p.length>10?p.length-=10:p.length-=9},q.prototype.imulK=function(p){p.words[p.length]=0,p.words[p.length+1]=0,p.length+=2;for(var d=0,m=0;m<p.length;m++){var x=p.words[m]|0;d+=x*977,p.words[m]=d&67108863,d=x*64+(d/67108864|0)}return p.words[p.length-1]===0&&(p.length--,p.words[p.length-1]===0&&p.length--),p};function X(){G.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(X,G);function ie(){G.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ie,G);function ae(){G.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ae,G),ae.prototype.imulK=function(p){for(var d=0,m=0;m<p.length;m++){var x=(p.words[m]|0)*19+d,T=x&67108863;x>>>=26,p.words[m]=T,d=x}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(L[p])return L[p];var d;if(p==="k256")d=new q;else if(p==="p224")d=new X;else if(p==="p192")d=new ie;else if(p==="p25519")d=new ae;else throw new Error("Unknown prime "+p);return L[p]=d,d};function ce(D){if(typeof D=="string"){var p=s._prime(D);this.m=p.p,this.prime=p}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}ce.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},ce.prototype._verify2=function(p,d){n((p.negative|d.negative)===0,"red works only with positives"),n(p.red&&p.red===d.red,"red works only with red numbers")},ce.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},ce.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},ce.prototype.add=function(p,d){this._verify2(p,d);var m=p.add(d);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ce.prototype.iadd=function(p,d){this._verify2(p,d);var m=p.iadd(d);return m.cmp(this.m)>=0&&m.isub(this.m),m},ce.prototype.sub=function(p,d){this._verify2(p,d);var m=p.sub(d);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ce.prototype.isub=function(p,d){this._verify2(p,d);var m=p.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},ce.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},ce.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},ce.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},ce.prototype.isqr=function(p){return this.imul(p,p.clone())},ce.prototype.sqr=function(p){return this.mul(p,p)},ce.prototype.sqrt=function(p){if(p.isZero())return p.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(p,m)}for(var x=this.m.subn(1),T=0;!x.isZero()&&x.andln(1)===0;)T++,x.iushrn(1);n(!x.isZero());var E=new s(1).toRed(this),O=E.redNeg(),C=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,C).cmp(O)!==0;)g.redIAdd(O);for(var v=this.pow(g,x),k=this.pow(p,x.addn(1).iushrn(1)),ee=this.pow(p,x),se=T;ee.cmp(E)!==0;){for(var he=ee,ye=0;he.cmp(E)!==0;ye++)he=he.redSqr();n(ye<se);var Ee=this.pow(v,new s(1).iushln(se-ye-1));k=k.redMul(Ee),v=Ee.redSqr(),ee=ee.redMul(v),se=ye}return k},ce.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},ce.prototype.pow=function(p,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return p.clone();var m=4,x=new Array(1<<m);x[0]=new s(1).toRed(this),x[1]=p;for(var T=2;T<x.length;T++)x[T]=this.mul(x[T-1],p);var E=x[0],O=0,C=0,g=d.bitLength()%26;for(g===0&&(g=26),T=d.length-1;T>=0;T--){for(var v=d.words[T],k=g-1;k>=0;k--){var ee=v>>k&1;if(E!==x[0]&&(E=this.sqr(E)),ee===0&&O===0){C=0;continue}O<<=1,O|=ee,C++,!(C!==m&&(T!==0||k!==0))&&(E=this.mul(E,x[O]),C=0,O=0)}g=26}return E},ce.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},ce.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new V(p)};function V(D){ce.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(V,ce),V.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},V.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},V.prototype.imul=function(p,d){if(p.isZero()||d.isZero())return p.words[0]=0,p.length=1,p;var m=p.imul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=m.isub(x).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},V.prototype.mul=function(p,d){if(p.isZero()||d.isZero())return new s(0)._forceRed(this);var m=p.mul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=m.isub(x).iushrn(this.shift),E=T;return T.cmp(this.m)>=0?E=T.isub(this.m):T.cmpn(0)<0&&(E=T.iadd(this.m)),E._forceRed(this)},V.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,kr)}(gh);var b2=gh.exports;const w2=ha(b2);var O7=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nn,"__esModule",{value:!0}),nn.parseAccumulatorUpdateData=nn.sliceAccumulatorUpdateData=nn.parseTwapMessage=nn.parsePriceFeedMessage=nn.isAccumulatorUpdateData=void 0;const sn=O7(b2),I7="504e4155",P7=1,k7=0,vh=20,j7=0,R7=1;function yh(e){return e.toString("hex").slice(0,8)===I7&&e[4]===P7&&e[5]===k7}nn.isAccumulatorUpdateData=yh;function N7(e){let t=0;if(e.readUInt8(t)!==j7)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new sn.default(e.subarray(t,t+8),"be");t+=8;const s=new sn.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new sn.default(e.subarray(t,t+8),"be");t+=8;const c=new sn.default(e.subarray(t,t+8),"be");t+=8;const u=new sn.default(e.subarray(t,t+8),"be");t+=8;const l=new sn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,price:i,confidence:s,exponent:o,publishTime:a,prevPublishTime:c,emaPrice:u,emaConf:l}}nn.parsePriceFeedMessage=N7;function D7(e){let t=0;if(e.readUInt8(t)!==R7)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new sn.default(e.subarray(t,t+16),"be");t+=16;const s=new sn.default(e.subarray(t,t+16),"be");t+=16;const o=new sn.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new sn.default(e.subarray(t,t+8),"be");t+=8;const u=new sn.default(e.subarray(t,t+8),"be");t+=8;const l=new sn.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,cumulativePrice:i,cumulativeConf:s,numDownSlots:o,exponent:a,publishTime:c,prevPublishTime:u,publishSlot:l}}nn.parseTwapMessage=D7;function $7(e,t,r){if(!yh(e))throw new Error("Invalid accumulator message");let n=6;const i=e.readUint8(n);n+=1+i,n+=1;const s=e.readUint16BE(n);n+=2,n+=s;const o=n,a=[],c=e.readUInt8(n);n+=1;for(let l=0;l<c;l++){const f=n,h=e.readUint16BE(n);n+=2,n+=h;const y=e.readUInt8(n);n+=1,n+=vh*y,a.push(e.subarray(f,n))}if(n!==e.length)throw new Error("Didn't reach the end of the message");const u=a.slice(t,r);return mh.concat([e.subarray(0,o),mh.from([u.length]),...a.slice(t,r)])}nn.sliceAccumulatorUpdateData=$7;function B7(e){if(!yh(e))throw new Error("Invalid accumulator message");let t=6;const r=e.readUint8(t);t+=1+r,t+=1;const n=e.readUint16BE(t);t+=2;const i=e.subarray(t,t+n);t+=n;const s=e.readUInt8(t),o=[];t+=1;for(let a=0;a<s;a++){const c=e.readUint16BE(t);t+=2;const u=e.subarray(t,t+c);t+=c;const l=e.readUInt8(t);t+=1;const f=[];for(let h=0;h<l;h++)f.push(Array.from(e.subarray(t,t+vh))),t+=vh;o.push({message:u,proof:f})}if(t!==e.length)throw new Error("Didn't reach the end of the message");return{vaa:i,updates:o}}nn.parseAccumulatorUpdateData=B7,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.PriceFeedMetadata=e.Price=e.parseTwapMessage=e.parsePriceFeedMessage=e.parseAccumulatorUpdateData=e.sliceAccumulatorUpdateData=e.isAccumulatorUpdateData=void 0;const t=gu;var r=nn;Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"sliceAccumulatorUpdateData",{enumerable:!0,get:function(){return r.sliceAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}}),Object.defineProperty(e,"parsePriceFeedMessage",{enumerable:!0,get:function(){return r.parsePriceFeedMessage}}),Object.defineProperty(e,"parseTwapMessage",{enumerable:!0,get:function(){return r.parseTwapMessage}});class n{constructor(a){vt(this,"conf");vt(this,"expo");vt(this,"price");vt(this,"publishTime");this.conf=a.conf,this.expo=a.expo,this.price=a.price,this.publishTime=a.publishTime}getPriceAsNumberUnchecked(){return Number(this.price)*10**this.expo}getConfAsNumberUnchecked(){return Number(this.conf)*10**this.expo}static fromJson(a){const c=t.Convert.toPrice(a);return new n({conf:c.conf,expo:c.expo,price:c.price,publishTime:c.publish_time})}toJson(){const a={conf:this.conf,expo:this.expo,price:this.price,publish_time:this.publishTime};return t.Convert.priceToJson(a)}}e.Price=n;class i{constructor(a){vt(this,"attestationTime");vt(this,"emitterChain");vt(this,"priceServiceReceiveTime");vt(this,"sequenceNumber");vt(this,"slot");vt(this,"prevPublishTime");this.attestationTime=a.attestationTime,this.emitterChain=a.emitterChain,this.priceServiceReceiveTime=a.receiveTime,this.sequenceNumber=a.sequenceNumber,this.slot=a.slot,this.prevPublishTime=a.prevPublishTime}static fromJson(a){if(a===void 0)return;const c=t.Convert.toPriceFeedMetadata(a);return new i({attestationTime:c.attestation_time,emitterChain:c.emitter_chain,receiveTime:c.price_service_receive_time,sequenceNumber:c.sequence_number,slot:c.slot,prevPublishTime:c.prev_publish_time})}toJson(){const a={attestation_time:this.attestationTime,emitter_chain:this.emitterChain,price_service_receive_time:this.priceServiceReceiveTime,sequence_number:this.sequenceNumber,slot:this.slot,prev_publish_time:this.prevPublishTime};return t.Convert.priceFeedMetadataToJson(a)}}e.PriceFeedMetadata=i;let s=class $3{constructor(a){vt(this,"emaPrice");vt(this,"id");vt(this,"metadata");vt(this,"vaa");vt(this,"price");this.emaPrice=a.emaPrice,this.id=a.id,this.metadata=a.metadata,this.vaa=a.vaa,this.price=a.price}static fromJson(a){const c=t.Convert.toPriceFeed(a);return new $3({emaPrice:n.fromJson(c.ema_price),id:c.id,metadata:i.fromJson(c.metadata),vaa:c.vaa,price:n.fromJson(c.price)})}toJson(){var c;const a={ema_price:this.emaPrice.toJson(),id:this.id,metadata:(c=this.metadata)==null?void 0:c.toJson(),price:this.price.toJson()};return t.Convert.priceFeedToJson(a)}getPriceUnchecked(){return this.price}getEmaPriceUnchecked(){return this.emaPrice}getPriceNoOlderThan(a){const c=this.getPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getEmaPriceNoOlderThan(a){const c=this.getEmaPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getMetadata(){return this.metadata}getVAA(){return this.vaa}};e.PriceFeed=s}(lh);function _2(e,t){return function(){return e.apply(t,arguments)}}const{toString:L7}=Object.prototype,{getPrototypeOf:bh}=Object,yu=(e=>t=>{const r=L7.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Cn=e=>(e=e.toLowerCase(),t=>yu(t)===e),bu=e=>t=>typeof t===e,{isArray:Ao}=Array,Xa=bu("undefined");function F7(e){return e!==null&&!Xa(e)&&e.constructor!==null&&!Xa(e.constructor)&&Kr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const x2=Cn("ArrayBuffer");function U7(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&x2(e.buffer),t}const z7=bu("string"),Kr=bu("function"),S2=bu("number"),wu=e=>e!==null&&typeof e=="object",V7=e=>e===!0||e===!1,_u=e=>{if(yu(e)!=="object")return!1;const t=bh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},q7=Cn("Date"),W7=Cn("File"),G7=Cn("Blob"),H7=Cn("FileList"),K7=e=>wu(e)&&Kr(e.pipe),X7=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Kr(e.append)&&((t=yu(e))==="formdata"||t==="object"&&Kr(e.toString)&&e.toString()==="[object FormData]"))},J7=Cn("URLSearchParams"),[Y7,Z7,Q7,ek]=["ReadableStream","Request","Response","Headers"].map(Cn),tk=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ja(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ao(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let a;for(n=0;n<o;n++)a=s[n],t.call(null,e[a],a,e)}}function E2(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const Ls=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:kr)(),C2=e=>!Xa(e)&&e!==Ls;function wh(){const{caseless:e}=C2(this)&&this||{},t={},r=(n,i)=>{const s=e&&E2(t,i)||i;_u(t[s])&&_u(n)?t[s]=wh(t[s],n):_u(n)?t[s]=wh({},n):Ao(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Ja(arguments[n],r);return t}const rk=(e,t,r,{allOwnKeys:n}={})=>(Ja(t,(i,s)=>{r&&Kr(i)?e[s]=_2(i,r):e[s]=i},{allOwnKeys:n}),e),nk=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ik=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},sk=(e,t,r,n)=>{let i,s,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&bh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},ok=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},ak=e=>{if(!e)return null;if(Ao(e))return e;let t=e.length;if(!S2(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},ck=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&bh(Uint8Array)),uk=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=n.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},lk=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},fk=Cn("HTMLFormElement"),dk=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),T2=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),hk=Cn("RegExp"),M2=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ja(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},pk=e=>{M2(e,(t,r)=>{if(Kr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Kr(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mk=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ao(e)?n(e):n(String(e).split(t)),r},gk=()=>{},vk=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,_h="abcdefghijklmnopqrstuvwxyz",A2="0123456789",O2={DIGIT:A2,ALPHA:_h,ALPHA_DIGIT:_h+_h.toUpperCase()+A2},yk=(e=16,t=O2.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function bk(e){return!!(e&&Kr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const wk=e=>{const t=new Array(10),r=(n,i)=>{if(wu(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Ao(n)?[]:{};return Ja(n,(o,a)=>{const c=r(o,i+1);!Xa(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},_k=Cn("AsyncFunction"),xk=e=>e&&(wu(e)||Kr(e))&&Kr(e.then)&&Kr(e.catch),I2=((e,t)=>e?setImmediate:t?((r,n)=>(Ls.addEventListener("message",({source:i,data:s})=>{i===Ls&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Ls.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Kr(Ls.postMessage)),Sk=typeof queueMicrotask<"u"?queueMicrotask.bind(Ls):typeof mn<"u"&&mn.nextTick||I2;var fe={isArray:Ao,isArrayBuffer:x2,isBuffer:F7,isFormData:X7,isArrayBufferView:U7,isString:z7,isNumber:S2,isBoolean:V7,isObject:wu,isPlainObject:_u,isReadableStream:Y7,isRequest:Z7,isResponse:Q7,isHeaders:ek,isUndefined:Xa,isDate:q7,isFile:W7,isBlob:G7,isRegExp:hk,isFunction:Kr,isStream:K7,isURLSearchParams:J7,isTypedArray:ck,isFileList:H7,forEach:Ja,merge:wh,extend:rk,trim:tk,stripBOM:nk,inherits:ik,toFlatObject:sk,kindOf:yu,kindOfTest:Cn,endsWith:ok,toArray:ak,forEachEntry:uk,matchAll:lk,isHTMLForm:fk,hasOwnProperty:T2,hasOwnProp:T2,reduceDescriptors:M2,freezeMethods:pk,toObjectSet:mk,toCamelCase:dk,noop:gk,toFiniteNumber:vk,findKey:E2,global:Ls,isContextDefined:C2,ALPHABET:O2,generateString:yk,isSpecCompliantForm:bk,toJSONObject:wk,isAsyncFn:_k,isThenable:xk,setImmediate:I2,asap:Sk};function pt(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}fe.inherits(pt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.status}}});const P2=pt.prototype,k2={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{k2[e]={value:e}}),Object.defineProperties(pt,k2),Object.defineProperty(P2,"isAxiosError",{value:!0}),pt.from=(e,t,r,n,i,s)=>{const o=Object.create(P2);return fe.toFlatObject(e,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),pt.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};var Ek=null;function xh(e){return fe.isPlainObject(e)||fe.isArray(e)}function j2(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function R2(e,t,r){return e?e.concat(t).map(function(i,s){return i=j2(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function Ck(e){return fe.isArray(e)&&!e.some(xh)}const Tk=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function xu(e,t,r){if(!fe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=fe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,A){return!fe.isUndefined(A[w])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,o=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(t);if(!fe.isFunction(i))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(fe.isDate(b))return b.toISOString();if(!c&&fe.isBlob(b))throw new pt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(b)||fe.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):mh.from(b):b}function l(b,w,A){let P=b;if(b&&!A&&typeof b=="object"){if(fe.endsWith(w,"{}"))w=n?w:w.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&Ck(b)||(fe.isFileList(b)||fe.endsWith(w,"[]"))&&(P=fe.toArray(b)))return w=j2(w),P.forEach(function(N,F){!(fe.isUndefined(N)||N===null)&&t.append(o===!0?R2([w],F,s):o===null?w:w+"[]",u(N))}),!1}return xh(b)?!0:(t.append(R2(A,w,s),u(b)),!1)}const f=[],h=Object.assign(Tk,{defaultVisitor:l,convertValue:u,isVisitable:xh});function y(b,w){if(!fe.isUndefined(b)){if(f.indexOf(b)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(b),fe.forEach(b,function(P,R){(!(fe.isUndefined(P)||P===null)&&i.call(t,P,fe.isString(R)?R.trim():R,w,h))===!0&&y(P,w?w.concat(R):[R])}),f.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return y(e),t}function N2(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Sh(e,t){this._pairs=[],e&&xu(e,this,t)}const D2=Sh.prototype;D2.append=function(t,r){this._pairs.push([t,r])},D2.toString=function(t){const r=t?function(n){return t.call(this,n,N2)}:N2;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Mk(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $2(e,t,r){if(!t)return e;const n=r&&r.encode||Mk;fe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(t,r):s=fe.isURLSearchParams(t)?t.toString():new Sh(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Ak{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){fe.forEach(this.handlers,function(n){n!==null&&t(n)})}}var B2=Ak,L2={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ok=typeof URLSearchParams<"u"?URLSearchParams:Sh,Ik=typeof FormData<"u"?FormData:null,Pk=typeof Blob<"u"?Blob:null,kk={isBrowser:!0,classes:{URLSearchParams:Ok,FormData:Ik,Blob:Pk},protocols:["http","https","file","blob","url","data"]};const Eh=typeof window<"u"&&typeof document<"u",Ch=typeof navigator=="object"&&navigator||void 0,jk=Eh&&(!Ch||["ReactNative","NativeScript","NS"].indexOf(Ch.product)<0),Rk=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Nk=Eh&&window.location.href||"http://localhost";var Dk=Object.freeze({__proto__:null,hasBrowserEnv:Eh,hasStandardBrowserWebWorkerEnv:Rk,hasStandardBrowserEnv:jk,navigator:Ch,origin:Nk}),Mr={...Dk,...kk};function $k(e,t){return xu(e,new Mr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Mr.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Bk(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Lk(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}function F2(e){function t(r,n,i,s){let o=r[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=s>=r.length;return o=!o&&fe.isArray(i)?i.length:o,c?(fe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!fe.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],s)&&fe.isArray(i[o])&&(i[o]=Lk(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(Bk(n),i,r,0)}),r}return null}function Fk(e,t,r){if(fe.isString(e))try{return(t||JSON.parse)(e),fe.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Th={transitional:L2,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=fe.isObject(t);if(s&&fe.isHTMLForm(t)&&(t=new FormData(t)),fe.isFormData(t))return i?JSON.stringify(F2(t)):t;if(fe.isArrayBuffer(t)||fe.isBuffer(t)||fe.isStream(t)||fe.isFile(t)||fe.isBlob(t)||fe.isReadableStream(t))return t;if(fe.isArrayBufferView(t))return t.buffer;if(fe.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return $k(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return xu(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Fk(t)):t}],transformResponse:[function(t){const r=this.transitional||Th.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(fe.isResponse(t)||fe.isReadableStream(t))return t;if(t&&fe.isString(t)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?pt.from(a,pt.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Mr.classes.FormData,Blob:Mr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],e=>{Th.headers[e]={}});var Mh=Th;const Uk=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var zk=e=>{const t={};let r,n,i;return e&&e.split(`
|
|
34
|
-
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&
|
|
35
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[U2]=this[U2]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ya(o);n[a]||(Gk(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}Eu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Eu.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),fe.freezeMethods(Eu);var Tn=Eu;function Oh(e,t){const r=this||Mh,n=t||r,i=Tn.from(n.headers);let s=n.data;return fe.forEach(e,function(a){s=a.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function z2(e){return!!(e&&e.__CANCEL__)}function Oo(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(Oo,pt,{__CANCEL__:!0});function V2(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new pt("Request failed with status code "+r.status,[pt.ERR_BAD_REQUEST,pt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Hk(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Kk(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=n[s];o||(o=u),r[i]=c,n[i]=u;let f=s,h=0;for(;f!==i;)h+=r[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const y=l&&u-l;return y?Math.round(h*1e3/y):void 0}}function Xk(e,t){let r=0,n=1e3/t,i,s;const o=(u,l=Date.now())=>{r=l,i=null,s&&(clearTimeout(s),s=null),e.apply(null,u)};return[(...u)=>{const l=Date.now(),f=l-r;f>=n?o(u,l):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-f)))},()=>i&&o(i)]}const Cu=(e,t,r=3)=>{let n=0;const i=Kk(50,250);return Xk(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,c=o-n,u=i(c),l=o<=a;n=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&l?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},q2=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},W2=e=>(...t)=>fe.asap(()=>e(...t));var Jk=Mr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Mr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Mr.origin),Mr.navigator&&/(msie|trident)/i.test(Mr.navigator.userAgent)):()=>!0,Yk=Mr.hasStandardBrowserEnv?{write(e,t,r,n,i,s){const o=[e+"="+encodeURIComponent(t)];fe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),fe.isString(n)&&o.push("path="+n),fe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Zk(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qk(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function G2(e,t){return e&&!Zk(t)?Qk(e,t):t}const H2=e=>e instanceof Tn?{...e}:e;function Fs(e,t){t=t||{};const r={};function n(u,l,f,h){return fe.isPlainObject(u)&&fe.isPlainObject(l)?fe.merge.call({caseless:h},u,l):fe.isPlainObject(l)?fe.merge({},l):fe.isArray(l)?l.slice():l}function i(u,l,f,h){if(fe.isUndefined(l)){if(!fe.isUndefined(u))return n(void 0,u,f,h)}else return n(u,l,f,h)}function s(u,l){if(!fe.isUndefined(l))return n(void 0,l)}function o(u,l){if(fe.isUndefined(l)){if(!fe.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,f){if(f in t)return n(u,l);if(f in e)return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,l,f)=>i(H2(u),H2(l),f,!0)};return fe.forEach(Object.keys(Object.assign({},e,t)),function(l){const f=c[l]||i,h=f(e[l],t[l],l);fe.isUndefined(h)&&f!==a||(r[l]=h)}),r}var K2=e=>{const t=Fs({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=Tn.from(o),t.url=$2(G2(t.baseURL,t.url),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(fe.isFormData(r)){if(Mr.hasStandardBrowserEnv||Mr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...l]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Mr.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&Jk(t.url))){const u=i&&s&&Yk.read(s);u&&o.set(i,u)}return t},ej=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=K2(e);let s=i.data;const o=Tn.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,f,h,y,b;function w(){y&&y(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let A=new XMLHttpRequest;A.open(i.method.toUpperCase(),i.url,!0),A.timeout=i.timeout;function P(){if(!A)return;const N=Tn.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:N,config:e,request:A};V2(function(q){r(q),w()},function(q){n(q),w()},L),A=null}"onloadend"in A?A.onloadend=P:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(P)},A.onabort=function(){A&&(n(new pt("Request aborted",pt.ECONNABORTED,e,A)),A=null)},A.onerror=function(){n(new pt("Network Error",pt.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let F=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||L2;i.timeoutErrorMessage&&(F=i.timeoutErrorMessage),n(new pt(F,L.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,e,A)),A=null},s===void 0&&o.setContentType(null),"setRequestHeader"in A&&fe.forEach(o.toJSON(),function(F,L){A.setRequestHeader(L,F)}),fe.isUndefined(i.withCredentials)||(A.withCredentials=!!i.withCredentials),a&&a!=="json"&&(A.responseType=i.responseType),u&&([h,b]=Cu(u,!0),A.addEventListener("progress",h)),c&&A.upload&&([f,y]=Cu(c),A.upload.addEventListener("progress",f),A.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=N=>{A&&(n(!N||N.type?new Oo(null,e,A):N),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const R=Hk(i.url);if(R&&Mr.protocols.indexOf(R)===-1){n(new pt("Unsupported protocol "+R+":",pt.ERR_BAD_REQUEST,e));return}A.send(s||null)})},tj=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i;const s=function(u){if(!i){i=!0,a();const l=u instanceof Error?u:this.reason;n.abort(l instanceof pt?l:new Oo(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,s(new pt(`timeout ${t} of ms exceeded`,pt.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>fe.asap(a),c}};const rj=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},nj=async function*(e,t){for await(const r of ij(e))yield*rj(r,t)},ij=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},X2=(e,t,r,n)=>{const i=nj(e,t);let s=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await i.next();if(u){a(),c.close();return}let f=l.byteLength;if(r){let h=s+=f;r(h)}c.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Tu=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",J2=Tu&&typeof ReadableStream=="function",sj=Tu&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Y2=(e,...t)=>{try{return!!e(...t)}catch{return!1}},oj=J2&&Y2(()=>{let e=!1;const t=new Request(Mr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Z2=64*1024,Ih=J2&&Y2(()=>fe.isReadableStream(new Response("").body)),Mu={stream:Ih&&(e=>e.body)};Tu&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Mu[t]&&(Mu[t]=fe.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new pt(`Response type '${t}' is not supported`,pt.ERR_NOT_SUPPORT,n)})})})(new Response);const aj=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Mr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(e)||fe.isArrayBuffer(e))return e.byteLength;if(fe.isURLSearchParams(e)&&(e=e+""),fe.isString(e))return(await sj(e)).byteLength},cj=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??aj(t)};var uj=Tu&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:h}=K2(e);u=u?(u+"").toLowerCase():"text";let y=tj([i,s&&s.toAbortSignal()],o),b;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let A;try{if(c&&oj&&r!=="get"&&r!=="head"&&(A=await cj(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),G;if(fe.isFormData(n)&&(G=L.headers.get("content-type"))&&l.setContentType(G),L.body){const[q,X]=q2(A,Cu(W2(c)));n=X2(L.body,Z2,q,X)}}fe.isString(f)||(f=f?"include":"omit");const P="credentials"in Request.prototype;b=new Request(t,{...h,signal:y,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:P?f:void 0});let R=await fetch(b);const N=Ih&&(u==="stream"||u==="response");if(Ih&&(a||N&&w)){const L={};["status","statusText","headers"].forEach(ie=>{L[ie]=R[ie]});const G=fe.toFiniteNumber(R.headers.get("content-length")),[q,X]=a&&q2(G,Cu(W2(a),!0))||[];R=new Response(X2(R.body,Z2,q,()=>{X&&X(),w&&w()}),L)}u=u||"text";let F=await Mu[fe.findKey(Mu,u)||"text"](R,e);return!N&&w&&w(),await new Promise((L,G)=>{V2(L,G,{data:F,headers:Tn.from(R.headers),status:R.status,statusText:R.statusText,config:e,request:b})})}catch(P){throw w&&w(),P&&P.name==="TypeError"&&/fetch/i.test(P.message)?Object.assign(new pt("Network Error",pt.ERR_NETWORK,e,b),{cause:P.cause||P}):pt.from(P,P&&P.code,e,b)}});const Ph={http:Ek,xhr:ej,fetch:uj};fe.forEach(Ph,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Q2=e=>`- ${e}`,lj=e=>fe.isFunction(e)||e===null||e===!1;var e_={getAdapter:e=>{e=fe.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let s=0;s<t;s++){r=e[s];let o;if(n=r,!lj(r)&&(n=Ph[(o=String(r)).toLowerCase()],n===void 0))throw new pt(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+s]=n}if(!n){const s=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
33
|
+
*/(function(N){const R=r,U=A,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;N.Buffer=V,N.SlowBuffer=v,N.INSPECT_MAX_BYTES=50;const G=2147483647;N.kMaxLength=G;const{Uint8Array:q,ArrayBuffer:X,SharedArrayBuffer:ie}=globalThis;V.TYPED_ARRAY_SUPPORT=ae(),!V.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ae(){try{const k=new q(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,q.prototype),Object.setPrototypeOf(k,S),k.foo()===42}catch{return!1}}Object.defineProperty(V.prototype,"parent",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.buffer}}),Object.defineProperty(V.prototype,"offset",{enumerable:!0,get:function(){if(V.isBuffer(this))return this.byteOffset}});function ce(k){if(k>G)throw new RangeError('The value "'+k+'" is invalid for option "size"');const S=new q(k);return Object.setPrototypeOf(S,V.prototype),S}function V(k,S,T){if(typeof k=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return D(k,S,T)}V.poolSize=8192;function D(k,S,T){if(typeof k=="string")return x(k,S);if(X.isView(k))return E(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(gt(k,X)||k&>(k.buffer,X)||typeof ie<"u"&&(gt(k,ie)||k&>(k.buffer,ie)))return O(k,S,T);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=k.valueOf&&k.valueOf();if(B!=null&&B!==k)return V.from(B,S,T);const K=C(k);if(K)return K;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return V.from(k[Symbol.toPrimitive]("string"),S,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}V.from=function(k,S,T){return D(k,S,T)},Object.setPrototypeOf(V.prototype,q.prototype),Object.setPrototypeOf(V,q);function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function d(k,S,T){return p(k),k<=0?ce(k):S!==void 0?typeof T=="string"?ce(k).fill(S,T):ce(k).fill(S):ce(k)}V.alloc=function(k,S,T){return d(k,S,T)};function m(k){return p(k),ce(k<0?0:g(k)|0)}V.allocUnsafe=function(k){return m(k)},V.allocUnsafeSlow=function(k){return m(k)};function x(k,S){if((typeof S!="string"||S==="")&&(S="utf8"),!V.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const T=j(k,S)|0;let B=ce(T);const K=B.write(k,S);return K!==T&&(B=B.slice(0,K)),B}function M(k){const S=k.length<0?0:g(k.length)|0,T=ce(S);for(let B=0;B<S;B+=1)T[B]=k[B]&255;return T}function E(k){if(gt(k,q)){const S=new q(k);return O(S.buffer,S.byteOffset,S.byteLength)}return M(k)}function O(k,S,T){if(S<0||k.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(k.byteLength<S+(T||0))throw new RangeError('"length" is outside of buffer bounds');let B;return S===void 0&&T===void 0?B=new q(k):T===void 0?B=new q(k,S):B=new q(k,S,T),Object.setPrototypeOf(B,V.prototype),B}function C(k){if(V.isBuffer(k)){const S=g(k.length)|0,T=ce(S);return T.length===0||k.copy(T,0,0,S),T}if(k.length!==void 0)return typeof k.length!="number"||Pt(k.length)?ce(0):M(k);if(k.type==="Buffer"&&Array.isArray(k.data))return M(k.data)}function g(k){if(k>=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return k|0}function v(k){return+k!=k&&(k=0),V.alloc(+k)}V.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==V.prototype},V.compare=function(S,T){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),gt(T,q)&&(T=V.from(T,T.offset,T.byteLength)),!V.isBuffer(S)||!V.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===T)return 0;let B=S.length,K=T.length;for(let Z=0,re=Math.min(B,K);Z<re;++Z)if(S[Z]!==T[Z]){B=S[Z],K=T[Z];break}return B<K?-1:K<B?1:0},V.isEncoding=function(S){switch(String(S).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},V.concat=function(S,T){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return V.alloc(0);let B;if(T===void 0)for(T=0,B=0;B<S.length;++B)T+=S[B].length;const K=V.allocUnsafe(T);let Z=0;for(B=0;B<S.length;++B){let re=S[B];if(gt(re,q))Z+re.length>K.length?(V.isBuffer(re)||(re=V.from(re)),re.copy(K,Z)):q.prototype.set.call(K,re,Z);else if(V.isBuffer(re))re.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=re.length}return K};function j(k,S){if(V.isBuffer(k))return k.length;if(X.isView(k)||gt(k,X))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const T=k.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&T===0)return 0;let K=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return It(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return Mt(k).length;default:if(K)return B?-1:It(k).length;S=(""+S).toLowerCase(),K=!0}}V.byteLength=j;function ee(k,S,T){let B=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,S>>>=0,T<=S))return"";for(k||(k="utf8");;)switch(k){case"hex":return Ge(this,S,T);case"utf8":case"utf-8":return $e(this,S,T);case"ascii":return ge(this,S,T);case"latin1":case"binary":return Ae(this,S,T);case"base64":return ht(this,S,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,S,T);default:if(B)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),B=!0}}V.prototype._isBuffer=!0;function se(k,S,T){const B=k[S];k[S]=k[T],k[T]=B}V.prototype.swap16=function(){const S=this.length;if(S%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let T=0;T<S;T+=2)se(this,T,T+1);return this},V.prototype.swap32=function(){const S=this.length;if(S%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let T=0;T<S;T+=4)se(this,T,T+3),se(this,T+1,T+2);return this},V.prototype.swap64=function(){const S=this.length;if(S%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let T=0;T<S;T+=8)se(this,T,T+7),se(this,T+1,T+6),se(this,T+2,T+5),se(this,T+3,T+4);return this},V.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?$e(this,0,S):ee.apply(this,arguments)},V.prototype.toLocaleString=V.prototype.toString,V.prototype.equals=function(S){if(!V.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:V.compare(this,S)===0},V.prototype.inspect=function(){let S="";const T=N.INSPECT_MAX_BYTES;return S=this.toString("hex",0,T).replace(/(.{2})/g,"$1 ").trim(),this.length>T&&(S+=" ... "),"<Buffer "+S+">"},L&&(V.prototype[L]=V.prototype.inspect),V.prototype.compare=function(S,T,B,K,Z){if(gt(S,q)&&(S=V.from(S,S.offset,S.byteLength)),!V.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(T===void 0&&(T=0),B===void 0&&(B=S?S.length:0),K===void 0&&(K=0),Z===void 0&&(Z=this.length),T<0||B>S.length||K<0||Z>this.length)throw new RangeError("out of range index");if(K>=Z&&T>=B)return 0;if(K>=Z)return-1;if(T>=B)return 1;if(T>>>=0,B>>>=0,K>>>=0,Z>>>=0,this===S)return 0;let re=Z-K,Be=B-T;const rt=Math.min(re,Be),Re=this.slice(K,Z),z=S.slice(T,B);for(let oe=0;oe<rt;++oe)if(Re[oe]!==z[oe]){re=Re[oe],Be=z[oe];break}return re<Be?-1:Be<re?1:0};function he(k,S,T,B,K){if(k.length===0)return-1;if(typeof T=="string"?(B=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,Pt(T)&&(T=K?0:k.length-1),T<0&&(T=k.length+T),T>=k.length){if(K)return-1;T=k.length-1}else if(T<0)if(K)T=0;else return-1;if(typeof S=="string"&&(S=V.from(S,B)),V.isBuffer(S))return S.length===0?-1:ye(k,S,T,B,K);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?K?q.prototype.indexOf.call(k,S,T):q.prototype.lastIndexOf.call(k,S,T):ye(k,[S],T,B,K);throw new TypeError("val must be string, number or Buffer")}function ye(k,S,T,B,K){let Z=1,re=k.length,Be=S.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(k.length<2||S.length<2)return-1;Z=2,re/=2,Be/=2,T/=2}function rt(z,oe){return Z===1?z[oe]:z.readUInt16BE(oe*Z)}let Re;if(K){let z=-1;for(Re=T;Re<re;Re++)if(rt(k,Re)===rt(S,z===-1?0:Re-z)){if(z===-1&&(z=Re),Re-z+1===Be)return z*Z}else z!==-1&&(Re-=Re-z),z=-1}else for(T+Be>re&&(T=re-Be),Re=T;Re>=0;Re--){let z=!0;for(let oe=0;oe<Be;oe++)if(rt(k,Re+oe)!==rt(S,oe)){z=!1;break}if(z)return Re}return-1}V.prototype.includes=function(S,T,B){return this.indexOf(S,T,B)!==-1},V.prototype.indexOf=function(S,T,B){return he(this,S,T,B,!0)},V.prototype.lastIndexOf=function(S,T,B){return he(this,S,T,B,!1)};function Ee(k,S,T,B){T=Number(T)||0;const K=k.length-T;B?(B=Number(B),B>K&&(B=K)):B=K;const Z=S.length;B>Z/2&&(B=Z/2);let re;for(re=0;re<B;++re){const Be=parseInt(S.substr(re*2,2),16);if(Pt(Be))return re;k[T+re]=Be}return re}function Se(k,S,T,B){return Ye(It(S,k.length-T),k,T,B)}function We(k,S,T,B){return Ye(it(S),k,T,B)}function Fe(k,S,T,B){return Ye(Mt(S),k,T,B)}function lt(k,S,T,B){return Ye(wt(S,k.length-T),k,T,B)}V.prototype.write=function(S,T,B,K){if(T===void 0)K="utf8",B=this.length,T=0;else if(B===void 0&&typeof T=="string")K=T,B=this.length,T=0;else if(isFinite(T))T=T>>>0,isFinite(B)?(B=B>>>0,K===void 0&&(K="utf8")):(K=B,B=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Z=this.length-T;if((B===void 0||B>Z)&&(B=Z),S.length>0&&(B<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");K||(K="utf8");let re=!1;for(;;)switch(K){case"hex":return Ee(this,S,T,B);case"utf8":case"utf-8":return Se(this,S,T,B);case"ascii":case"latin1":case"binary":return We(this,S,T,B);case"base64":return Fe(this,S,T,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,S,T,B);default:if(re)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),re=!0}},V.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ht(k,S,T){return S===0&&T===k.length?R.fromByteArray(k):R.fromByteArray(k.slice(S,T))}function $e(k,S,T){T=Math.min(k.length,T);const B=[];let K=S;for(;K<T;){const Z=k[K];let re=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(K+Be<=T){let rt,Re,z,oe;switch(Be){case 1:Z<128&&(re=Z);break;case 2:rt=k[K+1],(rt&192)===128&&(oe=(Z&31)<<6|rt&63,oe>127&&(re=oe));break;case 3:rt=k[K+1],Re=k[K+2],(rt&192)===128&&(Re&192)===128&&(oe=(Z&15)<<12|(rt&63)<<6|Re&63,oe>2047&&(oe<55296||oe>57343)&&(re=oe));break;case 4:rt=k[K+1],Re=k[K+2],z=k[K+3],(rt&192)===128&&(Re&192)===128&&(z&192)===128&&(oe=(Z&15)<<18|(rt&63)<<12|(Re&63)<<6|z&63,oe>65535&&oe<1114112&&(re=oe))}}re===null?(re=65533,Be=1):re>65535&&(re-=65536,B.push(re>>>10&1023|55296),re=56320|re&1023),B.push(re),K+=Be}return _e(B)}const mt=4096;function _e(k){const S=k.length;if(S<=mt)return String.fromCharCode.apply(String,k);let T="",B=0;for(;B<S;)T+=String.fromCharCode.apply(String,k.slice(B,B+=mt));return T}function ge(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]&127);return B}function Ae(k,S,T){let B="";T=Math.min(k.length,T);for(let K=S;K<T;++K)B+=String.fromCharCode(k[K]);return B}function Ge(k,S,T){const B=k.length;(!S||S<0)&&(S=0),(!T||T<0||T>B)&&(T=B);let K="";for(let Z=S;Z<T;++Z)K+=ot[k[Z]];return K}function De(k,S,T){const B=k.slice(S,T);let K="";for(let Z=0;Z<B.length-1;Z+=2)K+=String.fromCharCode(B[Z]+B[Z+1]*256);return K}V.prototype.slice=function(S,T){const B=this.length;S=~~S,T=T===void 0?B:~~T,S<0?(S+=B,S<0&&(S=0)):S>B&&(S=B),T<0?(T+=B,T<0&&(T=0)):T>B&&(T=B),T<S&&(T=S);const K=this.subarray(S,T);return Object.setPrototypeOf(K,V.prototype),K};function Oe(k,S,T){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+S>T)throw new RangeError("Trying to access beyond buffer length")}V.prototype.readUintLE=V.prototype.readUIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,re=0;for(;++re<T&&(Z*=256);)K+=this[S+re]*Z;return K},V.prototype.readUintBE=V.prototype.readUIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S+--T],Z=1;for(;T>0&&(Z*=256);)K+=this[S+--T]*Z;return K},V.prototype.readUint8=V.prototype.readUInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]},V.prototype.readUint16LE=V.prototype.readUInt16LE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]|this[S+1]<<8},V.prototype.readUint16BE=V.prototype.readUInt16BE=function(S,T){return S=S>>>0,T||Oe(S,2,this.length),this[S]<<8|this[S+1]},V.prototype.readUint32LE=V.prototype.readUInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},V.prototype.readUint32BE=V.prototype.readUInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},V.prototype.readBigUInt64LE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=T+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24,Z=this[++S]+this[++S]*2**8+this[++S]*2**16+B*2**24;return BigInt(K)+(BigInt(Z)<<BigInt(32))}),V.prototype.readBigUInt64BE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=T*2**24+this[++S]*2**16+this[++S]*2**8+this[++S],Z=this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B;return(BigInt(K)<<BigInt(32))+BigInt(Z)}),V.prototype.readIntLE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=this[S],Z=1,re=0;for(;++re<T&&(Z*=256);)K+=this[S+re]*Z;return Z*=128,K>=Z&&(K-=Math.pow(2,8*T)),K},V.prototype.readIntBE=function(S,T,B){S=S>>>0,T=T>>>0,B||Oe(S,T,this.length);let K=T,Z=1,re=this[S+--K];for(;K>0&&(Z*=256);)re+=this[S+--K]*Z;return Z*=128,re>=Z&&(re-=Math.pow(2,8*T)),re},V.prototype.readInt8=function(S,T){return S=S>>>0,T||Oe(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},V.prototype.readInt16LE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S]|this[S+1]<<8;return B&32768?B|4294901760:B},V.prototype.readInt16BE=function(S,T){S=S>>>0,T||Oe(S,2,this.length);const B=this[S+1]|this[S]<<8;return B&32768?B|4294901760:B},V.prototype.readInt32LE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},V.prototype.readInt32BE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},V.prototype.readBigInt64LE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=this[S+4]+this[S+5]*2**8+this[S+6]*2**16+(B<<24);return(BigInt(K)<<BigInt(32))+BigInt(T+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24)}),V.prototype.readBigInt64BE=_t(function(S){S=S>>>0,Et(S,"offset");const T=this[S],B=this[S+7];(T===void 0||B===void 0)&&Ot(S,this.length-8);const K=(T<<24)+this[++S]*2**16+this[++S]*2**8+this[++S];return(BigInt(K)<<BigInt(32))+BigInt(this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+B)}),V.prototype.readFloatLE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),U.read(this,S,!0,23,4)},V.prototype.readFloatBE=function(S,T){return S=S>>>0,T||Oe(S,4,this.length),U.read(this,S,!1,23,4)},V.prototype.readDoubleLE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),U.read(this,S,!0,52,8)},V.prototype.readDoubleBE=function(S,T){return S=S>>>0,T||Oe(S,8,this.length),U.read(this,S,!1,52,8)};function Ie(k,S,T,B,K,Z){if(!V.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(S>K||S<Z)throw new RangeError('"value" argument is out of bounds');if(T+B>k.length)throw new RangeError("Index out of range")}V.prototype.writeUintLE=V.prototype.writeUIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=1,re=0;for(this[T]=S&255;++re<B&&(Z*=256);)this[T+re]=S/Z&255;return T+B},V.prototype.writeUintBE=V.prototype.writeUIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,B=B>>>0,!K){const Be=Math.pow(2,8*B)-1;Ie(this,S,T,B,Be,0)}let Z=B-1,re=1;for(this[T+Z]=S&255;--Z>=0&&(re*=256);)this[T+Z]=S/re&255;return T+B},V.prototype.writeUint8=V.prototype.writeUInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,255,0),this[T]=S&255,T+1},V.prototype.writeUint16LE=V.prototype.writeUInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeUint16BE=V.prototype.writeUInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,65535,0),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeUint32LE=V.prototype.writeUInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T+3]=S>>>24,this[T+2]=S>>>16,this[T+1]=S>>>8,this[T]=S&255,T+4},V.prototype.writeUint32BE=V.prototype.writeUInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,4294967295,0),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4};function Ue(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z,Z=Z>>8,k[T++]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return k[T++]=re,re=re>>8,k[T++]=re,re=re>>8,k[T++]=re,re=re>>8,k[T++]=re,T}function ft(k,S,T,B,K){nt(S,B,K,k,T,7);let Z=Number(S&BigInt(4294967295));k[T+7]=Z,Z=Z>>8,k[T+6]=Z,Z=Z>>8,k[T+5]=Z,Z=Z>>8,k[T+4]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return k[T+3]=re,re=re>>8,k[T+2]=re,re=re>>8,k[T+1]=re,re=re>>8,k[T]=re,T+8}V.prototype.writeBigUInt64LE=_t(function(S,T=0){return Ue(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeBigUInt64BE=_t(function(S,T=0){return ft(this,S,T,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeIntLE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,T,B,rt-1,-rt)}let Z=0,re=1,Be=0;for(this[T]=S&255;++Z<B&&(re*=256);)S<0&&Be===0&&this[T+Z-1]!==0&&(Be=1),this[T+Z]=(S/re>>0)-Be&255;return T+B},V.prototype.writeIntBE=function(S,T,B,K){if(S=+S,T=T>>>0,!K){const rt=Math.pow(2,8*B-1);Ie(this,S,T,B,rt-1,-rt)}let Z=B-1,re=1,Be=0;for(this[T+Z]=S&255;--Z>=0&&(re*=256);)S<0&&Be===0&&this[T+Z+1]!==0&&(Be=1),this[T+Z]=(S/re>>0)-Be&255;return T+B},V.prototype.writeInt8=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,1,127,-128),S<0&&(S=255+S+1),this[T]=S&255,T+1},V.prototype.writeInt16LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S&255,this[T+1]=S>>>8,T+2},V.prototype.writeInt16BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,2,32767,-32768),this[T]=S>>>8,this[T+1]=S&255,T+2},V.prototype.writeInt32LE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),this[T]=S&255,this[T+1]=S>>>8,this[T+2]=S>>>16,this[T+3]=S>>>24,T+4},V.prototype.writeInt32BE=function(S,T,B){return S=+S,T=T>>>0,B||Ie(this,S,T,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=S&255,T+4},V.prototype.writeBigInt64LE=_t(function(S,T=0){return Ue(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),V.prototype.writeBigInt64BE=_t(function(S,T=0){return ft(this,S,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function dt(k,S,T,B,K,Z){if(T+B>k.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function He(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,4),U.write(k,S,T,B,23,4),T+4}V.prototype.writeFloatLE=function(S,T,B){return He(this,S,T,!0,B)},V.prototype.writeFloatBE=function(S,T,B){return He(this,S,T,!1,B)};function jt(k,S,T,B,K){return S=+S,T=T>>>0,K||dt(k,S,T,8),U.write(k,S,T,B,52,8),T+8}V.prototype.writeDoubleLE=function(S,T,B){return jt(this,S,T,!0,B)},V.prototype.writeDoubleBE=function(S,T,B){return jt(this,S,T,!1,B)},V.prototype.copy=function(S,T,B,K){if(!V.isBuffer(S))throw new TypeError("argument should be a Buffer");if(B||(B=0),!K&&K!==0&&(K=this.length),T>=S.length&&(T=S.length),T||(T=0),K>0&&K<B&&(K=B),K===B||S.length===0||this.length===0)return 0;if(T<0)throw new RangeError("targetStart out of bounds");if(B<0||B>=this.length)throw new RangeError("Index out of range");if(K<0)throw new RangeError("sourceEnd out of bounds");K>this.length&&(K=this.length),S.length-T<K-B&&(K=S.length-T+B);const Z=K-B;return this===S&&typeof q.prototype.copyWithin=="function"?this.copyWithin(T,B,K):q.prototype.set.call(S,this.subarray(B,K),T),Z},V.prototype.fill=function(S,T,B,K){if(typeof S=="string"){if(typeof T=="string"?(K=T,T=0,B=this.length):typeof B=="string"&&(K=B,B=this.length),K!==void 0&&typeof K!="string")throw new TypeError("encoding must be a string");if(typeof K=="string"&&!V.isEncoding(K))throw new TypeError("Unknown encoding: "+K);if(S.length===1){const re=S.charCodeAt(0);(K==="utf8"&&re<128||K==="latin1")&&(S=re)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(T<0||this.length<T||this.length<B)throw new RangeError("Out of range index");if(B<=T)return this;T=T>>>0,B=B===void 0?this.length:B>>>0,S||(S=0);let Z;if(typeof S=="number")for(Z=T;Z<B;++Z)this[Z]=S;else{const re=V.isBuffer(S)?S:V.from(S,K),Be=re.length;if(Be===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<B-T;++Z)this[Z+T]=re[Z%Be]}return this};const St={};function et(k,S,T){St[k]=class extends T{constructor(){super(),Object.defineProperty(this,"message",{value:S.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${k}]`,this.stack,delete this.name}get code(){return k}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${k}]: ${this.message}`}}}et("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),et("ERR_INVALID_ARG_TYPE",function(k,S){return`The "${k}" argument must be of type number. Received type ${typeof S}`},TypeError),et("ERR_OUT_OF_RANGE",function(k,S,T){let B=`The value of "${k}" is out of range.`,K=T;return Number.isInteger(T)&&Math.abs(T)>2**32?K=At(String(T)):typeof T=="bigint"&&(K=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(K=At(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function At(k){let S="",T=k.length;const B=k[0]==="-"?1:0;for(;T>=B+4;T-=3)S=`_${k.slice(T-3,T)}${S}`;return`${k.slice(0,T)}${S}`}function $t(k,S,T){Et(S,"offset"),(k[S]===void 0||k[S+T]===void 0)&&Ot(S,k.length-(T+1))}function nt(k,S,T,B,K,Z){if(k>T||k<S){const re=typeof S=="bigint"?"n":"";let Be;throw Z>3?S===0||S===BigInt(0)?Be=`>= 0${re} and < 2${re} ** ${(Z+1)*8}${re}`:Be=`>= -(2${re} ** ${(Z+1)*8-1}${re}) and < 2 ** ${(Z+1)*8-1}${re}`:Be=`>= ${S}${re} and <= ${T}${re}`,new St.ERR_OUT_OF_RANGE("value",Be,k)}$t(B,K,Z)}function Et(k,S){if(typeof k!="number")throw new St.ERR_INVALID_ARG_TYPE(S,"number",k)}function Ot(k,S,T){throw Math.floor(k)!==k?(Et(k,T),new St.ERR_OUT_OF_RANGE(T||"offset","an integer",k)):S<0?new St.ERR_BUFFER_OUT_OF_BOUNDS:new St.ERR_OUT_OF_RANGE(T||"offset",`>= ${T?1:0} and <= ${S}`,k)}const st=/[^+/0-9A-Za-z-_]/g;function kt(k){if(k=k.split("=")[0],k=k.trim().replace(st,""),k.length<2)return"";for(;k.length%4!==0;)k=k+"=";return k}function It(k,S){S=S||1/0;let T;const B=k.length;let K=null;const Z=[];for(let re=0;re<B;++re){if(T=k.charCodeAt(re),T>55295&&T<57344){if(!K){if(T>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(re+1===B){(S-=3)>-1&&Z.push(239,191,189);continue}K=T;continue}if(T<56320){(S-=3)>-1&&Z.push(239,191,189),K=T;continue}T=(K-55296<<10|T-56320)+65536}else K&&(S-=3)>-1&&Z.push(239,191,189);if(K=null,T<128){if((S-=1)<0)break;Z.push(T)}else if(T<2048){if((S-=2)<0)break;Z.push(T>>6|192,T&63|128)}else if(T<65536){if((S-=3)<0)break;Z.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((S-=4)<0)break;Z.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return Z}function it(k){const S=[];for(let T=0;T<k.length;++T)S.push(k.charCodeAt(T)&255);return S}function wt(k,S){let T,B,K;const Z=[];for(let re=0;re<k.length&&!((S-=2)<0);++re)T=k.charCodeAt(re),B=T>>8,K=T%256,Z.push(K),Z.push(B);return Z}function Mt(k){return R.toByteArray(kt(k))}function Ye(k,S,T,B){let K;for(K=0;K<B&&!(K+T>=S.length||K>=k.length);++K)S[K+T]=k[K];return K}function gt(k,S){return k instanceof S||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===S.name}function Pt(k){return k!==k}const ot=function(){const k="0123456789abcdef",S=new Array(256);for(let T=0;T<16;++T){const B=T*16;for(let K=0;K<16;++K)S[B+K]=k[T]+k[K]}return S}();function _t(k){return typeof BigInt>"u"?Ft:k}function Ft(){throw new Error("BigInt not supported")}})(t);const P=t.Buffer;e.Blob=t.Blob,e.BlobOptions=t.BlobOptions,e.Buffer=t.Buffer,e.File=t.File,e.FileOptions=t.FileOptions,e.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,e.SlowBuffer=t.SlowBuffer,e.TranscodeEncoding=t.TranscodeEncoding,e.atob=t.atob,e.btoa=t.btoa,e.constants=t.constants,e.default=P,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode}(ph)),ph}var A7=vu();const mh=pa(A7);var on={},gh={exports:{}};gh.exports,function(e){(function(t,r){function n(D,p){if(!D)throw new Error(p||"Assertion failed")}function i(D,p){D.super_=p;var d=function(){};d.prototype=p.prototype,D.prototype=new d,D.prototype.constructor=D}function s(D,p,d){if(s.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init(D||0,p||10,d||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=vu().Buffer}catch{}s.isBN=function(p){return p instanceof s?!0:p!==null&&typeof p=="object"&&p.constructor.wordSize===s.wordSize&&Array.isArray(p.words)},s.max=function(p,d){return p.cmp(d)>0?p:d},s.min=function(p,d){return p.cmp(d)<0?p:d},s.prototype._init=function(p,d,m){if(typeof p=="number")return this._initNumber(p,d,m);if(typeof p=="object")return this._initArray(p,d,m);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),p=p.toString().replace(/\s+/g,"");var x=0;p[0]==="-"&&(x++,this.negative=1),x<p.length&&(d===16?this._parseHex(p,x,m):(this._parseBase(p,d,x),m==="le"&&this._initArray(this.toArray(),d,m)))},s.prototype._initNumber=function(p,d,m){p<0&&(this.negative=1,p=-p),p<67108864?(this.words=[p&67108863],this.length=1):p<4503599627370496?(this.words=[p&67108863,p/67108864&67108863],this.length=2):(n(p<9007199254740992),this.words=[p&67108863,p/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),d,m)},s.prototype._initArray=function(p,d,m){if(n(typeof p.length=="number"),p.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(p.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var M,E,O=0;if(m==="be")for(x=p.length-1,M=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);else if(m==="le")for(x=0,M=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[M]|=E<<O&67108863,this.words[M+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,M++);return this._strip()};function a(D,p){var d=D.charCodeAt(p);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;n(!1,"Invalid character in "+D)}function c(D,p,d){var m=a(D,d);return d-1>=p&&(m|=a(D,d-1)<<4),m}s.prototype._parseHex=function(p,d,m){this.length=Math.ceil((p.length-d)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var M=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=8;else{var C=p.length-d;for(x=C%2===0?d+1:d;x<p.length;x+=2)O=c(p,d,x)<<M,this.words[E]|=O&67108863,M>=18?(M-=18,E+=1,this.words[E]|=O>>>26):M+=8}this._strip()};function u(D,p,d,m){for(var x=0,M=0,E=Math.min(D.length,d),O=p;O<E;O++){var C=D.charCodeAt(O)-48;x*=m,C>=49?M=C-49+10:C>=17?M=C-17+10:M=C,n(C>=0&&M<m,"Invalid character"),x+=M}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,M=1;M<=67108863;M*=d)x++;x--,M=M/d|0;for(var E=p.length-m,O=E%x,C=Math.min(E,E-O)+m,g=0,v=m;v<C;v+=x)g=u(p,v,v+x,d),this.imuln(M),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(O!==0){var j=1;for(g=u(p,v,p.length,d),v=0;v<O;v++)j*=d;this.imuln(j),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var d=0;d<this.length;d++)p.words[d]=this.words[d];p.length=this.length,p.negative=this.negative,p.red=this.red};function l(D,p){D.words=p.words,D.length=p.length,D.negative=p.negative,D.red=p.red}if(s.prototype._move=function(p){l(p,this)},s.prototype.clone=function(){var p=new s(null);return this.copy(p),p},s.prototype._expand=function(p){for(;this.length<p;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{s.prototype.inspect=f}else s.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],b=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(p,d){p=p||10,d=d|0||1;var m;if(p===16||p==="hex"){m="";for(var x=0,M=0,E=0;E<this.length;E++){var O=this.words[E],C=((O<<x|M)&16777215).toString(16);M=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),M!==0||E!==this.length-1?m=h[6-C.length]+C+m:m=C+m}for(M!==0&&(m=M.toString(16)+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(p===(p|0)&&p>=2&&p<=36){var g=y[p],v=b[p];m="";var j=this.clone();for(j.negative=0;!j.isZero();){var ee=j.modrn(v).toString(p);j=j.idivn(v),j.isZero()?m=ee+m:m=h[g-ee.length]+ee+m}for(this.isZero()&&(m="0"+m);m.length%d!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(p,d){return this.toArrayLike(o,p,d)}),s.prototype.toArray=function(p,d){return this.toArrayLike(Array,p,d)};var w=function(p,d){return p.allocUnsafe?p.allocUnsafe(d):new p(d)};s.prototype.toArrayLike=function(p,d,m){this._strip();var x=this.byteLength(),M=m||Math.max(1,x);n(x<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0");var E=w(p,M),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,M=0,E=0;M<this.length;M++){var O=this.words[M]<<E|x;p[m++]=O&255,m<p.length&&(p[m++]=O>>8&255),m<p.length&&(p[m++]=O>>16&255),E===6?(m<p.length&&(p[m++]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m<p.length)for(p[m++]=x;m<p.length;)p[m++]=0},s.prototype._toArrayLikeBE=function(p,d){for(var m=p.length-1,x=0,M=0,E=0;M<this.length;M++){var O=this.words[M]<<E|x;p[m--]=O&255,m>=0&&(p[m--]=O>>8&255),m>=0&&(p[m--]=O>>16&255),E===6?(m>=0&&(p[m--]=O>>24&255),x=0,E=0):(x=O>>>24,E+=2)}if(m>=0)for(p[m--]=x;m>=0;)p[m--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var d=p,m=0;return d>=4096&&(m+=13,d>>>=13),d>=64&&(m+=7,d>>>=7),d>=8&&(m+=4,d>>>=4),d>=2&&(m+=2,d>>>=2),m+d},s.prototype._zeroBits=function(p){if(p===0)return 26;var d=p,m=0;return d&8191||(m+=13,d>>>=13),d&127||(m+=7,d>>>=7),d&15||(m+=4,d>>>=4),d&3||(m+=2,d>>>=2),d&1||m++,m},s.prototype.bitLength=function(){var p=this.words[this.length-1],d=this._countBits(p);return(this.length-1)*26+d};function A(D){for(var p=new Array(D.bitLength()),d=0;d<p.length;d++){var m=d/26|0,x=d%26;p[d]=D.words[m]>>>x&1}return p}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var p=0,d=0;d<this.length;d++){var m=this._zeroBits(this.words[d]);if(p+=m,m!==26)break}return p},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(p){return this.negative!==0?this.abs().inotn(p).iaddn(1):this.clone()},s.prototype.fromTwos=function(p){return this.testn(p-1)?this.notn(p).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(p){for(;this.length<p.length;)this.words[this.length++]=0;for(var d=0;d<p.length;d++)this.words[d]=this.words[d]|p.words[d];return this._strip()},s.prototype.ior=function(p){return n((this.negative|p.negative)===0),this.iuor(p)},s.prototype.or=function(p){return this.length>p.length?this.clone().ior(p):p.clone().ior(this)},s.prototype.uor=function(p){return this.length>p.length?this.clone().iuor(p):p.clone().iuor(this)},s.prototype.iuand=function(p){var d;this.length>p.length?d=p:d=this;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]&p.words[m];return this.length=d.length,this._strip()},s.prototype.iand=function(p){return n((this.negative|p.negative)===0),this.iuand(p)},s.prototype.and=function(p){return this.length>p.length?this.clone().iand(p):p.clone().iand(this)},s.prototype.uand=function(p){return this.length>p.length?this.clone().iuand(p):p.clone().iuand(this)},s.prototype.iuxor=function(p){var d,m;this.length>p.length?(d=this,m=p):(d=p,m=this);for(var x=0;x<m.length;x++)this.words[x]=d.words[x]^m.words[x];if(this!==d)for(;x<d.length;x++)this.words[x]=d.words[x];return this.length=d.length,this._strip()},s.prototype.ixor=function(p){return n((this.negative|p.negative)===0),this.iuxor(p)},s.prototype.xor=function(p){return this.length>p.length?this.clone().ixor(p):p.clone().ixor(this)},s.prototype.uxor=function(p){return this.length>p.length?this.clone().iuxor(p):p.clone().iuxor(this)},s.prototype.inotn=function(p){n(typeof p=="number"&&p>=0);var d=Math.ceil(p/26)|0,m=p%26;this._expand(d),m>0&&d--;for(var x=0;x<d;x++)this.words[x]=~this.words[x]&67108863;return m>0&&(this.words[x]=~this.words[x]&67108863>>26-m),this._strip()},s.prototype.notn=function(p){return this.clone().inotn(p)},s.prototype.setn=function(p,d){n(typeof p=="number"&&p>=0);var m=p/26|0,x=p%26;return this._expand(m+1),d?this.words[m]=this.words[m]|1<<x:this.words[m]=this.words[m]&~(1<<x),this._strip()},s.prototype.iadd=function(p){var d;if(this.negative!==0&&p.negative===0)return this.negative=0,d=this.isub(p),this.negative^=1,this._normSign();if(this.negative===0&&p.negative!==0)return p.negative=0,d=this.isub(p),p.negative=1,d._normSign();var m,x;this.length>p.length?(m=this,x=p):(m=p,x=this);for(var M=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;for(;M!==0&&E<m.length;E++)d=(m.words[E]|0)+M,this.words[E]=d&67108863,M=d>>>26;if(this.length=m.length,M!==0)this.words[this.length]=M,this.length++;else if(m!==this)for(;E<m.length;E++)this.words[E]=m.words[E];return this},s.prototype.add=function(p){var d;return p.negative!==0&&this.negative===0?(p.negative=0,d=this.sub(p),p.negative^=1,d):p.negative===0&&this.negative!==0?(this.negative=0,d=p.sub(this),this.negative=1,d):this.length>p.length?this.clone().iadd(p):p.clone().iadd(this)},s.prototype.isub=function(p){if(p.negative!==0){p.negative=0;var d=this.iadd(p);return p.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(p),this.negative=1,this._normSign();var m=this.cmp(p);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,M;m>0?(x=this,M=p):(x=p,M=this);for(var E=0,O=0;O<M.length;O++)d=(x.words[O]|0)-(M.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;for(;E!==0&&O<x.length;O++)d=(x.words[O]|0)+E,E=d>>26,this.words[O]=d&67108863;if(E===0&&O<x.length&&x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this.length=Math.max(this.length,O),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function P(D,p,d){d.negative=p.negative^D.negative;var m=D.length+p.length|0;d.length=m,m=m-1|0;var x=D.words[0]|0,M=p.words[0]|0,E=x*M,O=E&67108863,C=E/67108864|0;d.words[0]=O;for(var g=1;g<m;g++){for(var v=C>>>26,j=C&67108863,ee=Math.min(g,p.length-1),se=Math.max(0,g-D.length+1);se<=ee;se++){var he=g-se|0;x=D.words[he]|0,M=p.words[se]|0,E=x*M+j,v+=E/67108864|0,j=E&67108863}d.words[g]=j|0,C=v|0}return C!==0?d.words[g]=C|0:d.length--,d._strip()}var N=function(p,d,m){var x=p.words,M=d.words,E=m.words,O=0,C,g,v,j=x[0]|0,ee=j&8191,se=j>>>13,he=x[1]|0,ye=he&8191,Ee=he>>>13,Se=x[2]|0,We=Se&8191,Fe=Se>>>13,lt=x[3]|0,ht=lt&8191,$e=lt>>>13,mt=x[4]|0,_e=mt&8191,ge=mt>>>13,Ae=x[5]|0,Ge=Ae&8191,De=Ae>>>13,Oe=x[6]|0,Ie=Oe&8191,Ue=Oe>>>13,ft=x[7]|0,dt=ft&8191,He=ft>>>13,jt=x[8]|0,St=jt&8191,et=jt>>>13,At=x[9]|0,$t=At&8191,nt=At>>>13,Et=M[0]|0,Ot=Et&8191,st=Et>>>13,kt=M[1]|0,It=kt&8191,it=kt>>>13,wt=M[2]|0,Mt=wt&8191,Ye=wt>>>13,gt=M[3]|0,Pt=gt&8191,ot=gt>>>13,_t=M[4]|0,Ft=_t&8191,k=_t>>>13,S=M[5]|0,T=S&8191,B=S>>>13,K=M[6]|0,Z=K&8191,re=K>>>13,Be=M[7]|0,rt=Be&8191,Re=Be>>>13,z=M[8]|0,oe=z&8191,pe=z>>>13,ke=M[9]|0,Ke=ke&8191,Ne=ke>>>13;m.negative=p.negative^d.negative,m.length=19,C=Math.imul(ee,Ot),g=Math.imul(ee,st),g=g+Math.imul(se,Ot)|0,v=Math.imul(se,st);var ze=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ze>>>26)|0,ze&=67108863,C=Math.imul(ye,Ot),g=Math.imul(ye,st),g=g+Math.imul(Ee,Ot)|0,v=Math.imul(Ee,st),C=C+Math.imul(ee,It)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(se,It)|0,v=v+Math.imul(se,it)|0;var ut=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ut>>>26)|0,ut&=67108863,C=Math.imul(We,Ot),g=Math.imul(We,st),g=g+Math.imul(Fe,Ot)|0,v=Math.imul(Fe,st),C=C+Math.imul(ye,It)|0,g=g+Math.imul(ye,it)|0,g=g+Math.imul(Ee,It)|0,v=v+Math.imul(Ee,it)|0,C=C+Math.imul(ee,Mt)|0,g=g+Math.imul(ee,Ye)|0,g=g+Math.imul(se,Mt)|0,v=v+Math.imul(se,Ye)|0;var Jt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,C=Math.imul(ht,Ot),g=Math.imul(ht,st),g=g+Math.imul($e,Ot)|0,v=Math.imul($e,st),C=C+Math.imul(We,It)|0,g=g+Math.imul(We,it)|0,g=g+Math.imul(Fe,It)|0,v=v+Math.imul(Fe,it)|0,C=C+Math.imul(ye,Mt)|0,g=g+Math.imul(ye,Ye)|0,g=g+Math.imul(Ee,Mt)|0,v=v+Math.imul(Ee,Ye)|0,C=C+Math.imul(ee,Pt)|0,g=g+Math.imul(ee,ot)|0,g=g+Math.imul(se,Pt)|0,v=v+Math.imul(se,ot)|0;var Nt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,C=Math.imul(_e,Ot),g=Math.imul(_e,st),g=g+Math.imul(ge,Ot)|0,v=Math.imul(ge,st),C=C+Math.imul(ht,It)|0,g=g+Math.imul(ht,it)|0,g=g+Math.imul($e,It)|0,v=v+Math.imul($e,it)|0,C=C+Math.imul(We,Mt)|0,g=g+Math.imul(We,Ye)|0,g=g+Math.imul(Fe,Mt)|0,v=v+Math.imul(Fe,Ye)|0,C=C+Math.imul(ye,Pt)|0,g=g+Math.imul(ye,ot)|0,g=g+Math.imul(Ee,Pt)|0,v=v+Math.imul(Ee,ot)|0,C=C+Math.imul(ee,Ft)|0,g=g+Math.imul(ee,k)|0,g=g+Math.imul(se,Ft)|0,v=v+Math.imul(se,k)|0;var Bt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,C=Math.imul(Ge,Ot),g=Math.imul(Ge,st),g=g+Math.imul(De,Ot)|0,v=Math.imul(De,st),C=C+Math.imul(_e,It)|0,g=g+Math.imul(_e,it)|0,g=g+Math.imul(ge,It)|0,v=v+Math.imul(ge,it)|0,C=C+Math.imul(ht,Mt)|0,g=g+Math.imul(ht,Ye)|0,g=g+Math.imul($e,Mt)|0,v=v+Math.imul($e,Ye)|0,C=C+Math.imul(We,Pt)|0,g=g+Math.imul(We,ot)|0,g=g+Math.imul(Fe,Pt)|0,v=v+Math.imul(Fe,ot)|0,C=C+Math.imul(ye,Ft)|0,g=g+Math.imul(ye,k)|0,g=g+Math.imul(Ee,Ft)|0,v=v+Math.imul(Ee,k)|0,C=C+Math.imul(ee,T)|0,g=g+Math.imul(ee,B)|0,g=g+Math.imul(se,T)|0,v=v+Math.imul(se,B)|0;var ir=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ir>>>26)|0,ir&=67108863,C=Math.imul(Ie,Ot),g=Math.imul(Ie,st),g=g+Math.imul(Ue,Ot)|0,v=Math.imul(Ue,st),C=C+Math.imul(Ge,It)|0,g=g+Math.imul(Ge,it)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,it)|0,C=C+Math.imul(_e,Mt)|0,g=g+Math.imul(_e,Ye)|0,g=g+Math.imul(ge,Mt)|0,v=v+Math.imul(ge,Ye)|0,C=C+Math.imul(ht,Pt)|0,g=g+Math.imul(ht,ot)|0,g=g+Math.imul($e,Pt)|0,v=v+Math.imul($e,ot)|0,C=C+Math.imul(We,Ft)|0,g=g+Math.imul(We,k)|0,g=g+Math.imul(Fe,Ft)|0,v=v+Math.imul(Fe,k)|0,C=C+Math.imul(ye,T)|0,g=g+Math.imul(ye,B)|0,g=g+Math.imul(Ee,T)|0,v=v+Math.imul(Ee,B)|0,C=C+Math.imul(ee,Z)|0,g=g+Math.imul(ee,re)|0,g=g+Math.imul(se,Z)|0,v=v+Math.imul(se,re)|0;var Sr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,C=Math.imul(dt,Ot),g=Math.imul(dt,st),g=g+Math.imul(He,Ot)|0,v=Math.imul(He,st),C=C+Math.imul(Ie,It)|0,g=g+Math.imul(Ie,it)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,it)|0,C=C+Math.imul(Ge,Mt)|0,g=g+Math.imul(Ge,Ye)|0,g=g+Math.imul(De,Mt)|0,v=v+Math.imul(De,Ye)|0,C=C+Math.imul(_e,Pt)|0,g=g+Math.imul(_e,ot)|0,g=g+Math.imul(ge,Pt)|0,v=v+Math.imul(ge,ot)|0,C=C+Math.imul(ht,Ft)|0,g=g+Math.imul(ht,k)|0,g=g+Math.imul($e,Ft)|0,v=v+Math.imul($e,k)|0,C=C+Math.imul(We,T)|0,g=g+Math.imul(We,B)|0,g=g+Math.imul(Fe,T)|0,v=v+Math.imul(Fe,B)|0,C=C+Math.imul(ye,Z)|0,g=g+Math.imul(ye,re)|0,g=g+Math.imul(Ee,Z)|0,v=v+Math.imul(Ee,re)|0,C=C+Math.imul(ee,rt)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(se,rt)|0,v=v+Math.imul(se,Re)|0;var or=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(or>>>26)|0,or&=67108863,C=Math.imul(St,Ot),g=Math.imul(St,st),g=g+Math.imul(et,Ot)|0,v=Math.imul(et,st),C=C+Math.imul(dt,It)|0,g=g+Math.imul(dt,it)|0,g=g+Math.imul(He,It)|0,v=v+Math.imul(He,it)|0,C=C+Math.imul(Ie,Mt)|0,g=g+Math.imul(Ie,Ye)|0,g=g+Math.imul(Ue,Mt)|0,v=v+Math.imul(Ue,Ye)|0,C=C+Math.imul(Ge,Pt)|0,g=g+Math.imul(Ge,ot)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,ot)|0,C=C+Math.imul(_e,Ft)|0,g=g+Math.imul(_e,k)|0,g=g+Math.imul(ge,Ft)|0,v=v+Math.imul(ge,k)|0,C=C+Math.imul(ht,T)|0,g=g+Math.imul(ht,B)|0,g=g+Math.imul($e,T)|0,v=v+Math.imul($e,B)|0,C=C+Math.imul(We,Z)|0,g=g+Math.imul(We,re)|0,g=g+Math.imul(Fe,Z)|0,v=v+Math.imul(Fe,re)|0,C=C+Math.imul(ye,rt)|0,g=g+Math.imul(ye,Re)|0,g=g+Math.imul(Ee,rt)|0,v=v+Math.imul(Ee,Re)|0,C=C+Math.imul(ee,oe)|0,g=g+Math.imul(ee,pe)|0,g=g+Math.imul(se,oe)|0,v=v+Math.imul(se,pe)|0;var Yt=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,C=Math.imul($t,Ot),g=Math.imul($t,st),g=g+Math.imul(nt,Ot)|0,v=Math.imul(nt,st),C=C+Math.imul(St,It)|0,g=g+Math.imul(St,it)|0,g=g+Math.imul(et,It)|0,v=v+Math.imul(et,it)|0,C=C+Math.imul(dt,Mt)|0,g=g+Math.imul(dt,Ye)|0,g=g+Math.imul(He,Mt)|0,v=v+Math.imul(He,Ye)|0,C=C+Math.imul(Ie,Pt)|0,g=g+Math.imul(Ie,ot)|0,g=g+Math.imul(Ue,Pt)|0,v=v+Math.imul(Ue,ot)|0,C=C+Math.imul(Ge,Ft)|0,g=g+Math.imul(Ge,k)|0,g=g+Math.imul(De,Ft)|0,v=v+Math.imul(De,k)|0,C=C+Math.imul(_e,T)|0,g=g+Math.imul(_e,B)|0,g=g+Math.imul(ge,T)|0,v=v+Math.imul(ge,B)|0,C=C+Math.imul(ht,Z)|0,g=g+Math.imul(ht,re)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,re)|0,C=C+Math.imul(We,rt)|0,g=g+Math.imul(We,Re)|0,g=g+Math.imul(Fe,rt)|0,v=v+Math.imul(Fe,Re)|0,C=C+Math.imul(ye,oe)|0,g=g+Math.imul(ye,pe)|0,g=g+Math.imul(Ee,oe)|0,v=v+Math.imul(Ee,pe)|0,C=C+Math.imul(ee,Ke)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(se,Ke)|0,v=v+Math.imul(se,Ne)|0;var yr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(yr>>>26)|0,yr&=67108863,C=Math.imul($t,It),g=Math.imul($t,it),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,it),C=C+Math.imul(St,Mt)|0,g=g+Math.imul(St,Ye)|0,g=g+Math.imul(et,Mt)|0,v=v+Math.imul(et,Ye)|0,C=C+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,ot)|0,g=g+Math.imul(He,Pt)|0,v=v+Math.imul(He,ot)|0,C=C+Math.imul(Ie,Ft)|0,g=g+Math.imul(Ie,k)|0,g=g+Math.imul(Ue,Ft)|0,v=v+Math.imul(Ue,k)|0,C=C+Math.imul(Ge,T)|0,g=g+Math.imul(Ge,B)|0,g=g+Math.imul(De,T)|0,v=v+Math.imul(De,B)|0,C=C+Math.imul(_e,Z)|0,g=g+Math.imul(_e,re)|0,g=g+Math.imul(ge,Z)|0,v=v+Math.imul(ge,re)|0,C=C+Math.imul(ht,rt)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,rt)|0,v=v+Math.imul($e,Re)|0,C=C+Math.imul(We,oe)|0,g=g+Math.imul(We,pe)|0,g=g+Math.imul(Fe,oe)|0,v=v+Math.imul(Fe,pe)|0,C=C+Math.imul(ye,Ke)|0,g=g+Math.imul(ye,Ne)|0,g=g+Math.imul(Ee,Ke)|0,v=v+Math.imul(Ee,Ne)|0;var Rn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,C=Math.imul($t,Mt),g=Math.imul($t,Ye),g=g+Math.imul(nt,Mt)|0,v=Math.imul(nt,Ye),C=C+Math.imul(St,Pt)|0,g=g+Math.imul(St,ot)|0,g=g+Math.imul(et,Pt)|0,v=v+Math.imul(et,ot)|0,C=C+Math.imul(dt,Ft)|0,g=g+Math.imul(dt,k)|0,g=g+Math.imul(He,Ft)|0,v=v+Math.imul(He,k)|0,C=C+Math.imul(Ie,T)|0,g=g+Math.imul(Ie,B)|0,g=g+Math.imul(Ue,T)|0,v=v+Math.imul(Ue,B)|0,C=C+Math.imul(Ge,Z)|0,g=g+Math.imul(Ge,re)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,re)|0,C=C+Math.imul(_e,rt)|0,g=g+Math.imul(_e,Re)|0,g=g+Math.imul(ge,rt)|0,v=v+Math.imul(ge,Re)|0,C=C+Math.imul(ht,oe)|0,g=g+Math.imul(ht,pe)|0,g=g+Math.imul($e,oe)|0,v=v+Math.imul($e,pe)|0,C=C+Math.imul(We,Ke)|0,g=g+Math.imul(We,Ne)|0,g=g+Math.imul(Fe,Ke)|0,v=v+Math.imul(Fe,Ne)|0;var Hr=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,C=Math.imul($t,Pt),g=Math.imul($t,ot),g=g+Math.imul(nt,Pt)|0,v=Math.imul(nt,ot),C=C+Math.imul(St,Ft)|0,g=g+Math.imul(St,k)|0,g=g+Math.imul(et,Ft)|0,v=v+Math.imul(et,k)|0,C=C+Math.imul(dt,T)|0,g=g+Math.imul(dt,B)|0,g=g+Math.imul(He,T)|0,v=v+Math.imul(He,B)|0,C=C+Math.imul(Ie,Z)|0,g=g+Math.imul(Ie,re)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,re)|0,C=C+Math.imul(Ge,rt)|0,g=g+Math.imul(Ge,Re)|0,g=g+Math.imul(De,rt)|0,v=v+Math.imul(De,Re)|0,C=C+Math.imul(_e,oe)|0,g=g+Math.imul(_e,pe)|0,g=g+Math.imul(ge,oe)|0,v=v+Math.imul(ge,pe)|0,C=C+Math.imul(ht,Ke)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,Ke)|0,v=v+Math.imul($e,Ne)|0;var Dn=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,C=Math.imul($t,Ft),g=Math.imul($t,k),g=g+Math.imul(nt,Ft)|0,v=Math.imul(nt,k),C=C+Math.imul(St,T)|0,g=g+Math.imul(St,B)|0,g=g+Math.imul(et,T)|0,v=v+Math.imul(et,B)|0,C=C+Math.imul(dt,Z)|0,g=g+Math.imul(dt,re)|0,g=g+Math.imul(He,Z)|0,v=v+Math.imul(He,re)|0,C=C+Math.imul(Ie,rt)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Ue,rt)|0,v=v+Math.imul(Ue,Re)|0,C=C+Math.imul(Ge,oe)|0,g=g+Math.imul(Ge,pe)|0,g=g+Math.imul(De,oe)|0,v=v+Math.imul(De,pe)|0,C=C+Math.imul(_e,Ke)|0,g=g+Math.imul(_e,Ne)|0,g=g+Math.imul(ge,Ke)|0,v=v+Math.imul(ge,Ne)|0;var Ui=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,C=Math.imul($t,T),g=Math.imul($t,B),g=g+Math.imul(nt,T)|0,v=Math.imul(nt,B),C=C+Math.imul(St,Z)|0,g=g+Math.imul(St,re)|0,g=g+Math.imul(et,Z)|0,v=v+Math.imul(et,re)|0,C=C+Math.imul(dt,rt)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(He,rt)|0,v=v+Math.imul(He,Re)|0,C=C+Math.imul(Ie,oe)|0,g=g+Math.imul(Ie,pe)|0,g=g+Math.imul(Ue,oe)|0,v=v+Math.imul(Ue,pe)|0,C=C+Math.imul(Ge,Ke)|0,g=g+Math.imul(Ge,Ne)|0,g=g+Math.imul(De,Ke)|0,v=v+Math.imul(De,Ne)|0;var Fi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,C=Math.imul($t,Z),g=Math.imul($t,re),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,re),C=C+Math.imul(St,rt)|0,g=g+Math.imul(St,Re)|0,g=g+Math.imul(et,rt)|0,v=v+Math.imul(et,Re)|0,C=C+Math.imul(dt,oe)|0,g=g+Math.imul(dt,pe)|0,g=g+Math.imul(He,oe)|0,v=v+Math.imul(He,pe)|0,C=C+Math.imul(Ie,Ke)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Ue,Ke)|0,v=v+Math.imul(Ue,Ne)|0;var $n=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+($n>>>26)|0,$n&=67108863,C=Math.imul($t,rt),g=Math.imul($t,Re),g=g+Math.imul(nt,rt)|0,v=Math.imul(nt,Re),C=C+Math.imul(St,oe)|0,g=g+Math.imul(St,pe)|0,g=g+Math.imul(et,oe)|0,v=v+Math.imul(et,pe)|0,C=C+Math.imul(dt,Ke)|0,g=g+Math.imul(dt,Ne)|0,g=g+Math.imul(He,Ke)|0,v=v+Math.imul(He,Ne)|0;var zi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(zi>>>26)|0,zi&=67108863,C=Math.imul($t,oe),g=Math.imul($t,pe),g=g+Math.imul(nt,oe)|0,v=Math.imul(nt,pe),C=C+Math.imul(St,Ke)|0,g=g+Math.imul(St,Ne)|0,g=g+Math.imul(et,Ke)|0,v=v+Math.imul(et,Ne)|0;var Vi=(O+C|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,C=Math.imul($t,Ke),g=Math.imul($t,Ne),g=g+Math.imul(nt,Ke)|0,v=Math.imul(nt,Ne);var $=(O+C|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+($>>>26)|0,$&=67108863,E[0]=ze,E[1]=ut,E[2]=Jt,E[3]=Nt,E[4]=Bt,E[5]=ir,E[6]=Sr,E[7]=or,E[8]=Yt,E[9]=yr,E[10]=Rn,E[11]=Hr,E[12]=Dn,E[13]=Ui,E[14]=Fi,E[15]=$n,E[16]=zi,E[17]=Vi,E[18]=$,O!==0&&(E[19]=O,m.length++),m};Math.imul||(N=P);function R(D,p,d){d.negative=p.negative^D.negative,d.length=D.length+p.length;for(var m=0,x=0,M=0;M<d.length-1;M++){var E=x;x=0;for(var O=m&67108863,C=Math.min(M,p.length-1),g=Math.max(0,M-D.length+1);g<=C;g++){var v=M-g,j=D.words[v]|0,ee=p.words[g]|0,se=j*ee,he=se&67108863;E=E+(se/67108864|0)|0,he=he+O|0,O=he&67108863,E=E+(he>>>26)|0,x+=E>>>26,E&=67108863}d.words[M]=O,m=E,E=x}return m!==0?d.words[M]=m:d.length--,d._strip()}function U(D,p,d){return R(D,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=N(this,p,d):x<63?m=P(this,p,d):x<1024?m=R(this,p,d):m=U(this,p,d),m},s.prototype.mul=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),this.mulTo(p,d)},s.prototype.mulf=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),U(this,p,d)},s.prototype.imul=function(p){return this.clone().mulTo(p,this)},s.prototype.imuln=function(p){var d=p<0;d&&(p=-p),n(typeof p=="number"),n(p<67108864);for(var m=0,x=0;x<this.length;x++){var M=(this.words[x]|0)*p,E=(M&67108863)+(m&67108863);m>>=26,m+=M/67108864|0,m+=E>>>26,this.words[x]=E&67108863}return m!==0&&(this.words[x]=m,this.length++),d?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var d=A(p);if(d.length===0)return new s(1);for(var m=this,x=0;x<d.length&&d[x]===0;x++,m=m.sqr());if(++x<d.length)for(var M=m.sqr();x<d.length;x++,M=M.sqr())d[x]!==0&&(m=m.mul(M));return m},s.prototype.iushln=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=67108863>>>26-d<<26-d,M;if(d!==0){var E=0;for(M=0;M<this.length;M++){var O=this.words[M]&x,C=(this.words[M]|0)-O<<d;this.words[M]=C|E,E=O>>>26-d}E&&(this.words[M]=E,this.length++)}if(m!==0){for(M=this.length-1;M>=0;M--)this.words[M+m]=this.words[M];for(M=0;M<m;M++)this.words[M]=0;this.length+=m}return this._strip()},s.prototype.ishln=function(p){return n(this.negative===0),this.iushln(p)},s.prototype.iushrn=function(p,d,m){n(typeof p=="number"&&p>=0);var x;d?x=(d-d%26)/26:x=0;var M=p%26,E=Math.min((p-M)/26,this.length),O=67108863^67108863>>>M<<M,C=m;if(x-=E,x=Math.max(0,x),C){for(var g=0;g<E;g++)C.words[g]=this.words[g];C.length=E}if(E!==0)if(this.length>E)for(this.length-=E,g=0;g<this.length;g++)this.words[g]=this.words[g+E];else this.words[0]=0,this.length=1;var v=0;for(g=this.length-1;g>=0&&(v!==0||g>=x);g--){var j=this.words[g]|0;this.words[g]=v<<26-M|j>>>M,v=j&O}return C&&v!==0&&(C.words[C.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(p,d,m){return n(this.negative===0),this.iushrn(p,d,m)},s.prototype.shln=function(p){return this.clone().ishln(p)},s.prototype.ushln=function(p){return this.clone().iushln(p)},s.prototype.shrn=function(p){return this.clone().ishrn(p)},s.prototype.ushrn=function(p){return this.clone().iushrn(p)},s.prototype.testn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return!1;var M=this.words[m];return!!(M&x)},s.prototype.imaskn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,m=(p-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(d!==0&&m++,this.length=Math.min(m,this.length),d!==0){var x=67108863^67108863>>>d<<d;this.words[this.length-1]&=x}return this._strip()},s.prototype.maskn=function(p){return this.clone().imaskn(p)},s.prototype.iaddn=function(p){return n(typeof p=="number"),n(p<67108864),p<0?this.isubn(-p):this.negative!==0?this.length===1&&(this.words[0]|0)<=p?(this.words[0]=p-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(p),this.negative=1,this):this._iaddn(p)},s.prototype._iaddn=function(p){this.words[0]+=p;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(p){if(n(typeof p=="number"),n(p<67108864),p<0)return this.iaddn(-p);if(this.negative!==0)return this.negative=0,this.iaddn(p),this.negative=1,this;if(this.words[0]-=p,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(p){return this.clone().iaddn(p)},s.prototype.subn=function(p){return this.clone().isubn(p)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(p,d,m){var x=p.length+m,M;this._expand(x);var E,O=0;for(M=0;M<p.length;M++){E=(this.words[M+m]|0)+O;var C=(p.words[M]|0)*d;E-=C&67108863,O=(E>>26)-(C/67108864|0),this.words[M+m]=E&67108863}for(;M<this.length-m;M++)E=(this.words[M+m]|0)+O,O=E>>26,this.words[M+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,M=0;M<this.length;M++)E=-(this.words[M]|0)+O,O=E>>26,this.words[M]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),M=p,E=M.words[M.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(M=M.ushln(m),x.iushln(m),E=M.words[M.length-1]|0);var C=x.length-M.length,g;if(d!=="mod"){g=new s(null),g.length=C+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var j=x.clone()._ishlnsubmul(M,1,C);j.negative===0&&(x=j,g&&(g.words[C]=1));for(var ee=C-1;ee>=0;ee--){var se=(x.words[M.length+ee]|0)*67108864+(x.words[M.length+ee-1]|0);for(se=Math.min(se/E|0,67108863),x._ishlnsubmul(M,se,ee);x.negative!==0;)se--,x.negative=0,x._ishlnsubmul(M,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=se)}return g&&g._strip(),x._strip(),d!=="div"&&m!==0&&x.iushrn(m),{div:g||null,mod:x}},s.prototype.divmod=function(p,d,m){if(n(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var x,M,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(M=E.mod.neg(),m&&M.negative!==0&&M.iadd(p)),{div:x,mod:M}):this.negative===0&&p.negative!==0?(E=this.divmod(p.neg(),d),d!=="mod"&&(x=E.div.neg()),{div:x,mod:E.mod}):this.negative&p.negative?(E=this.neg().divmod(p.neg(),d),d!=="div"&&(M=E.mod.neg(),m&&M.negative!==0&&M.isub(p)),{div:E.div,mod:M}):p.length>this.length||this.cmp(p)<0?{div:new s(0),mod:this}:p.length===1?d==="div"?{div:this.divn(p.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(p.words[0]))}:{div:this.divn(p.words[0]),mod:new s(this.modrn(p.words[0]))}:this._wordDiv(p,d)},s.prototype.div=function(p){return this.divmod(p,"div",!1).div},s.prototype.mod=function(p){return this.divmod(p,"mod",!1).mod},s.prototype.umod=function(p){return this.divmod(p,"mod",!0).mod},s.prototype.divRound=function(p){var d=this.divmod(p);if(d.mod.isZero())return d.div;var m=d.div.negative!==0?d.mod.isub(p):d.mod,x=p.ushrn(1),M=p.andln(1),E=m.cmp(x);return E<0||M===1&&E===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=(1<<26)%p,x=0,M=this.length-1;M>=0;M--)x=(m*x+(this.words[M]|0))%p;return d?-x:x},s.prototype.modn=function(p){return this.modrn(p)},s.prototype.idivn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var m=0,x=this.length-1;x>=0;x--){var M=(this.words[x]|0)+m*67108864;this.words[x]=M/p|0,m=M%p}return this._strip(),d?this.ineg():this},s.prototype.divn=function(p){return this.clone().idivn(p)},s.prototype.egcd=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),M=new s(0),E=new s(0),O=new s(1),C=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++C;for(var g=m.clone(),v=d.clone();!d.isZero();){for(var j=0,ee=1;!(d.words[0]&ee)&&j<26;++j,ee<<=1);if(j>0)for(d.iushrn(j);j-- >0;)(x.isOdd()||M.isOdd())&&(x.iadd(g),M.isub(v)),x.iushrn(1),M.iushrn(1);for(var se=0,he=1;!(m.words[0]&he)&&se<26;++se,he<<=1);if(se>0)for(m.iushrn(se);se-- >0;)(E.isOdd()||O.isOdd())&&(E.iadd(g),O.isub(v)),E.iushrn(1),O.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(E),M.isub(O)):(m.isub(d),E.isub(x),O.isub(M))}return{a:E,b:O,gcd:m.iushln(C)}},s.prototype._invmp=function(p){n(p.negative===0),n(!p.isZero());var d=this,m=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var x=new s(1),M=new s(0),E=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var O=0,C=1;!(d.words[0]&C)&&O<26;++O,C<<=1);if(O>0)for(d.iushrn(O);O-- >0;)x.isOdd()&&x.iadd(E),x.iushrn(1);for(var g=0,v=1;!(m.words[0]&v)&&g<26;++g,v<<=1);if(g>0)for(m.iushrn(g);g-- >0;)M.isOdd()&&M.iadd(E),M.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(M)):(m.isub(d),M.isub(x))}var j;return d.cmpn(1)===0?j=x:j=M,j.cmpn(0)<0&&j.iadd(p),j},s.prototype.gcd=function(p){if(this.isZero())return p.abs();if(p.isZero())return this.abs();var d=this.clone(),m=p.clone();d.negative=0,m.negative=0;for(var x=0;d.isEven()&&m.isEven();x++)d.iushrn(1),m.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;m.isEven();)m.iushrn(1);var M=d.cmp(m);if(M<0){var E=d;d=m,m=E}else if(M===0||m.cmpn(1)===0)break;d.isub(m)}while(!0);return m.iushln(x)},s.prototype.invm=function(p){return this.egcd(p).a.umod(p)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(p){return this.words[0]&p},s.prototype.bincn=function(p){n(typeof p=="number");var d=p%26,m=(p-d)/26,x=1<<d;if(this.length<=m)return this._expand(m+1),this.words[m]|=x,this;for(var M=x,E=m;M!==0&&E<this.length;E++){var O=this.words[E]|0;O+=M,M=O>>>26,O&=67108863,this.words[E]=O}return M!==0&&(this.words[E]=M,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(p){var d=p<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var m;if(this.length>1)m=1;else{d&&(p=-p),n(p<=67108863,"Number is too big");var x=this.words[0]|0;m=x===p?0:x<p?-1:1}return this.negative!==0?-m|0:m},s.prototype.cmp=function(p){if(this.negative!==0&&p.negative===0)return-1;if(this.negative===0&&p.negative!==0)return 1;var d=this.ucmp(p);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(p){if(this.length>p.length)return 1;if(this.length<p.length)return-1;for(var d=0,m=this.length-1;m>=0;m--){var x=this.words[m]|0,M=p.words[m]|0;if(x!==M){x<M?d=-1:x>M&&(d=1);break}}return d},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new ce(p)},s.prototype.toRed=function(p){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return n(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return n(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var L={k256:null,p224:null,p192:null,p25519:null};function G(D,p){this.name=D,this.p=new s(p,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},G.prototype.ireduce=function(p){var d=p,m;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),m=d.bitLength();while(m>this.n);var x=m<this.n?-1:d.ucmp(this.p);return x===0?(d.words[0]=0,d.length=1):x>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},G.prototype.split=function(p,d){p.iushrn(this.n,0,d)},G.prototype.imulK=function(p){return p.imul(this.k)};function q(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,G),q.prototype.split=function(p,d){for(var m=4194303,x=Math.min(p.length,9),M=0;M<x;M++)d.words[M]=p.words[M];if(d.length=x,p.length<=9){p.words[0]=0,p.length=1;return}var E=p.words[9];for(d.words[d.length++]=E&m,M=10;M<p.length;M++){var O=p.words[M]|0;p.words[M-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[M-10]=E,E===0&&p.length>10?p.length-=10:p.length-=9},q.prototype.imulK=function(p){p.words[p.length]=0,p.words[p.length+1]=0,p.length+=2;for(var d=0,m=0;m<p.length;m++){var x=p.words[m]|0;d+=x*977,p.words[m]=d&67108863,d=x*64+(d/67108864|0)}return p.words[p.length-1]===0&&(p.length--,p.words[p.length-1]===0&&p.length--),p};function X(){G.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(X,G);function ie(){G.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ie,G);function ae(){G.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ae,G),ae.prototype.imulK=function(p){for(var d=0,m=0;m<p.length;m++){var x=(p.words[m]|0)*19+d,M=x&67108863;x>>>=26,p.words[m]=M,d=x}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(L[p])return L[p];var d;if(p==="k256")d=new q;else if(p==="p224")d=new X;else if(p==="p192")d=new ie;else if(p==="p25519")d=new ae;else throw new Error("Unknown prime "+p);return L[p]=d,d};function ce(D){if(typeof D=="string"){var p=s._prime(D);this.m=p.p,this.prime=p}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}ce.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},ce.prototype._verify2=function(p,d){n((p.negative|d.negative)===0,"red works only with positives"),n(p.red&&p.red===d.red,"red works only with red numbers")},ce.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},ce.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},ce.prototype.add=function(p,d){this._verify2(p,d);var m=p.add(d);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ce.prototype.iadd=function(p,d){this._verify2(p,d);var m=p.iadd(d);return m.cmp(this.m)>=0&&m.isub(this.m),m},ce.prototype.sub=function(p,d){this._verify2(p,d);var m=p.sub(d);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ce.prototype.isub=function(p,d){this._verify2(p,d);var m=p.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},ce.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},ce.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},ce.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},ce.prototype.isqr=function(p){return this.imul(p,p.clone())},ce.prototype.sqr=function(p){return this.mul(p,p)},ce.prototype.sqrt=function(p){if(p.isZero())return p.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(p,m)}for(var x=this.m.subn(1),M=0;!x.isZero()&&x.andln(1)===0;)M++,x.iushrn(1);n(!x.isZero());var E=new s(1).toRed(this),O=E.redNeg(),C=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,C).cmp(O)!==0;)g.redIAdd(O);for(var v=this.pow(g,x),j=this.pow(p,x.addn(1).iushrn(1)),ee=this.pow(p,x),se=M;ee.cmp(E)!==0;){for(var he=ee,ye=0;he.cmp(E)!==0;ye++)he=he.redSqr();n(ye<se);var Ee=this.pow(v,new s(1).iushln(se-ye-1));j=j.redMul(Ee),v=Ee.redSqr(),ee=ee.redMul(v),se=ye}return j},ce.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},ce.prototype.pow=function(p,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return p.clone();var m=4,x=new Array(1<<m);x[0]=new s(1).toRed(this),x[1]=p;for(var M=2;M<x.length;M++)x[M]=this.mul(x[M-1],p);var E=x[0],O=0,C=0,g=d.bitLength()%26;for(g===0&&(g=26),M=d.length-1;M>=0;M--){for(var v=d.words[M],j=g-1;j>=0;j--){var ee=v>>j&1;if(E!==x[0]&&(E=this.sqr(E)),ee===0&&O===0){C=0;continue}O<<=1,O|=ee,C++,!(C!==m&&(M!==0||j!==0))&&(E=this.mul(E,x[O]),C=0,O=0)}g=26}return E},ce.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},ce.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new V(p)};function V(D){ce.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(V,ce),V.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},V.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},V.prototype.imul=function(p,d){if(p.isZero()||d.isZero())return p.words[0]=0,p.length=1,p;var m=p.imul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.prototype.mul=function(p,d){if(p.isZero()||d.isZero())return new s(0)._forceRed(this);var m=p.mul(d),x=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=m.isub(x).iushrn(this.shift),E=M;return M.cmp(this.m)>=0?E=M.isub(this.m):M.cmpn(0)<0&&(E=M.iadd(this.m)),E._forceRed(this)},V.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,kr)}(gh);var b2=gh.exports;const w2=pa(b2);var O7=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(on,"__esModule",{value:!0}),on.parseAccumulatorUpdateData=on.sliceAccumulatorUpdateData=on.parseTwapMessage=on.parsePriceFeedMessage=on.isAccumulatorUpdateData=void 0;const an=O7(b2),I7="504e4155",P7=1,j7=0,vh=20,k7=0,N7=1;function yh(e){return e.toString("hex").slice(0,8)===I7&&e[4]===P7&&e[5]===j7}on.isAccumulatorUpdateData=yh;function R7(e){let t=0;if(e.readUInt8(t)!==k7)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new an.default(e.subarray(t,t+8),"be");t+=8;const s=new an.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new an.default(e.subarray(t,t+8),"be");t+=8;const c=new an.default(e.subarray(t,t+8),"be");t+=8;const u=new an.default(e.subarray(t,t+8),"be");t+=8;const l=new an.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,price:i,confidence:s,exponent:o,publishTime:a,prevPublishTime:c,emaPrice:u,emaConf:l}}on.parsePriceFeedMessage=R7;function D7(e){let t=0;if(e.readUInt8(t)!==N7)throw new Error("Not a twap message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new an.default(e.subarray(t,t+16),"be");t+=16;const s=new an.default(e.subarray(t,t+16),"be");t+=16;const o=new an.default(e.subarray(t,t+8),"be");t+=8;const a=e.readInt32BE(t);t+=4;const c=new an.default(e.subarray(t,t+8),"be");t+=8;const u=new an.default(e.subarray(t,t+8),"be");t+=8;const l=new an.default(e.subarray(t,t+8),"be");return t+=8,{feedId:n,cumulativePrice:i,cumulativeConf:s,numDownSlots:o,exponent:a,publishTime:c,prevPublishTime:u,publishSlot:l}}on.parseTwapMessage=D7;function $7(e,t,r){if(!yh(e))throw new Error("Invalid accumulator message");let n=6;const i=e.readUint8(n);n+=1+i,n+=1;const s=e.readUint16BE(n);n+=2,n+=s;const o=n,a=[],c=e.readUInt8(n);n+=1;for(let l=0;l<c;l++){const f=n,h=e.readUint16BE(n);n+=2,n+=h;const y=e.readUInt8(n);n+=1,n+=vh*y,a.push(e.subarray(f,n))}if(n!==e.length)throw new Error("Didn't reach the end of the message");const u=a.slice(t,r);return mh.concat([e.subarray(0,o),mh.from([u.length]),...a.slice(t,r)])}on.sliceAccumulatorUpdateData=$7;function B7(e){if(!yh(e))throw new Error("Invalid accumulator message");let t=6;const r=e.readUint8(t);t+=1+r,t+=1;const n=e.readUint16BE(t);t+=2;const i=e.subarray(t,t+n);t+=n;const s=e.readUInt8(t),o=[];t+=1;for(let a=0;a<s;a++){const c=e.readUint16BE(t);t+=2;const u=e.subarray(t,t+c);t+=c;const l=e.readUInt8(t);t+=1;const f=[];for(let h=0;h<l;h++)f.push(Array.from(e.subarray(t,t+vh))),t+=vh;o.push({message:u,proof:f})}if(t!==e.length)throw new Error("Didn't reach the end of the message");return{vaa:i,updates:o}}on.parseAccumulatorUpdateData=B7,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.PriceFeedMetadata=e.Price=e.parseTwapMessage=e.parsePriceFeedMessage=e.parseAccumulatorUpdateData=e.sliceAccumulatorUpdateData=e.isAccumulatorUpdateData=void 0;const t=gu;var r=on;Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"sliceAccumulatorUpdateData",{enumerable:!0,get:function(){return r.sliceAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}}),Object.defineProperty(e,"parsePriceFeedMessage",{enumerable:!0,get:function(){return r.parsePriceFeedMessage}}),Object.defineProperty(e,"parseTwapMessage",{enumerable:!0,get:function(){return r.parseTwapMessage}});class n{constructor(a){vt(this,"conf");vt(this,"expo");vt(this,"price");vt(this,"publishTime");this.conf=a.conf,this.expo=a.expo,this.price=a.price,this.publishTime=a.publishTime}getPriceAsNumberUnchecked(){return Number(this.price)*10**this.expo}getConfAsNumberUnchecked(){return Number(this.conf)*10**this.expo}static fromJson(a){const c=t.Convert.toPrice(a);return new n({conf:c.conf,expo:c.expo,price:c.price,publishTime:c.publish_time})}toJson(){const a={conf:this.conf,expo:this.expo,price:this.price,publish_time:this.publishTime};return t.Convert.priceToJson(a)}}e.Price=n;class i{constructor(a){vt(this,"attestationTime");vt(this,"emitterChain");vt(this,"priceServiceReceiveTime");vt(this,"sequenceNumber");vt(this,"slot");vt(this,"prevPublishTime");this.attestationTime=a.attestationTime,this.emitterChain=a.emitterChain,this.priceServiceReceiveTime=a.receiveTime,this.sequenceNumber=a.sequenceNumber,this.slot=a.slot,this.prevPublishTime=a.prevPublishTime}static fromJson(a){if(a===void 0)return;const c=t.Convert.toPriceFeedMetadata(a);return new i({attestationTime:c.attestation_time,emitterChain:c.emitter_chain,receiveTime:c.price_service_receive_time,sequenceNumber:c.sequence_number,slot:c.slot,prevPublishTime:c.prev_publish_time})}toJson(){const a={attestation_time:this.attestationTime,emitter_chain:this.emitterChain,price_service_receive_time:this.priceServiceReceiveTime,sequence_number:this.sequenceNumber,slot:this.slot,prev_publish_time:this.prevPublishTime};return t.Convert.priceFeedMetadataToJson(a)}}e.PriceFeedMetadata=i;let s=class $3{constructor(a){vt(this,"emaPrice");vt(this,"id");vt(this,"metadata");vt(this,"vaa");vt(this,"price");this.emaPrice=a.emaPrice,this.id=a.id,this.metadata=a.metadata,this.vaa=a.vaa,this.price=a.price}static fromJson(a){const c=t.Convert.toPriceFeed(a);return new $3({emaPrice:n.fromJson(c.ema_price),id:c.id,metadata:i.fromJson(c.metadata),vaa:c.vaa,price:n.fromJson(c.price)})}toJson(){var c;const a={ema_price:this.emaPrice.toJson(),id:this.id,metadata:(c=this.metadata)==null?void 0:c.toJson(),price:this.price.toJson()};return t.Convert.priceFeedToJson(a)}getPriceUnchecked(){return this.price}getEmaPriceUnchecked(){return this.emaPrice}getPriceNoOlderThan(a){const c=this.getPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getEmaPriceNoOlderThan(a){const c=this.getEmaPriceUnchecked(),u=Math.floor(Date.now()/1e3);if(!(Math.abs(u-c.publishTime)>a))return c}getMetadata(){return this.metadata}getVAA(){return this.vaa}};e.PriceFeed=s}(lh);function _2(e,t){return function(){return e.apply(t,arguments)}}const{toString:L7}=Object.prototype,{getPrototypeOf:bh}=Object,yu=(e=>t=>{const r=L7.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Cn=e=>(e=e.toLowerCase(),t=>yu(t)===e),bu=e=>t=>typeof t===e,{isArray:Ao}=Array,Ja=bu("undefined");function U7(e){return e!==null&&!Ja(e)&&e.constructor!==null&&!Ja(e.constructor)&&Jr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const x2=Cn("ArrayBuffer");function F7(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&x2(e.buffer),t}const z7=bu("string"),Jr=bu("function"),S2=bu("number"),wu=e=>e!==null&&typeof e=="object",V7=e=>e===!0||e===!1,_u=e=>{if(yu(e)!=="object")return!1;const t=bh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},q7=Cn("Date"),W7=Cn("File"),G7=Cn("Blob"),H7=Cn("FileList"),K7=e=>wu(e)&&Jr(e.pipe),X7=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Jr(e.append)&&((t=yu(e))==="formdata"||t==="object"&&Jr(e.toString)&&e.toString()==="[object FormData]"))},J7=Cn("URLSearchParams"),[Y7,Z7,Q7,ej]=["ReadableStream","Request","Response","Headers"].map(Cn),tj=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ya(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ao(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let a;for(n=0;n<o;n++)a=s[n],t.call(null,e[a],a,e)}}function E2(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const Us=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:kr)(),C2=e=>!Ja(e)&&e!==Us;function wh(){const{caseless:e}=C2(this)&&this||{},t={},r=(n,i)=>{const s=e&&E2(t,i)||i;_u(t[s])&&_u(n)?t[s]=wh(t[s],n):_u(n)?t[s]=wh({},n):Ao(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Ya(arguments[n],r);return t}const rj=(e,t,r,{allOwnKeys:n}={})=>(Ya(t,(i,s)=>{r&&Jr(i)?e[s]=_2(i,r):e[s]=i},{allOwnKeys:n}),e),nj=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ij=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},sj=(e,t,r,n)=>{let i,s,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&bh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},oj=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},aj=e=>{if(!e)return null;if(Ao(e))return e;let t=e.length;if(!S2(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},cj=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&bh(Uint8Array)),uj=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=n.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},lj=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},fj=Cn("HTMLFormElement"),dj=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),M2=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),hj=Cn("RegExp"),T2=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ya(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},pj=e=>{T2(e,(t,r)=>{if(Jr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(Jr(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mj=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ao(e)?n(e):n(String(e).split(t)),r},gj=()=>{},vj=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,_h="abcdefghijklmnopqrstuvwxyz",A2="0123456789",O2={DIGIT:A2,ALPHA:_h,ALPHA_DIGIT:_h+_h.toUpperCase()+A2},yj=(e=16,t=O2.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function bj(e){return!!(e&&Jr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const wj=e=>{const t=new Array(10),r=(n,i)=>{if(wu(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Ao(n)?[]:{};return Ya(n,(o,a)=>{const c=r(o,i+1);!Ja(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},_j=Cn("AsyncFunction"),xj=e=>e&&(wu(e)||Jr(e))&&Jr(e.then)&&Jr(e.catch),I2=((e,t)=>e?setImmediate:t?((r,n)=>(Us.addEventListener("message",({source:i,data:s})=>{i===Us&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Us.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Jr(Us.postMessage)),Sj=typeof queueMicrotask<"u"?queueMicrotask.bind(Us):typeof mn<"u"&&mn.nextTick||I2;var fe={isArray:Ao,isArrayBuffer:x2,isBuffer:U7,isFormData:X7,isArrayBufferView:F7,isString:z7,isNumber:S2,isBoolean:V7,isObject:wu,isPlainObject:_u,isReadableStream:Y7,isRequest:Z7,isResponse:Q7,isHeaders:ej,isUndefined:Ja,isDate:q7,isFile:W7,isBlob:G7,isRegExp:hj,isFunction:Jr,isStream:K7,isURLSearchParams:J7,isTypedArray:cj,isFileList:H7,forEach:Ya,merge:wh,extend:rj,trim:tj,stripBOM:nj,inherits:ij,toFlatObject:sj,kindOf:yu,kindOfTest:Cn,endsWith:oj,toArray:aj,forEachEntry:uj,matchAll:lj,isHTMLForm:fj,hasOwnProperty:M2,hasOwnProp:M2,reduceDescriptors:T2,freezeMethods:pj,toObjectSet:mj,toCamelCase:dj,noop:gj,toFiniteNumber:vj,findKey:E2,global:Us,isContextDefined:C2,ALPHABET:O2,generateString:yj,isSpecCompliantForm:bj,toJSONObject:wj,isAsyncFn:_j,isThenable:xj,setImmediate:I2,asap:Sj};function pt(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}fe.inherits(pt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.status}}});const P2=pt.prototype,j2={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{j2[e]={value:e}}),Object.defineProperties(pt,j2),Object.defineProperty(P2,"isAxiosError",{value:!0}),pt.from=(e,t,r,n,i,s)=>{const o=Object.create(P2);return fe.toFlatObject(e,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),pt.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};var Ej=null;function xh(e){return fe.isPlainObject(e)||fe.isArray(e)}function k2(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function N2(e,t,r){return e?e.concat(t).map(function(i,s){return i=k2(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function Cj(e){return fe.isArray(e)&&!e.some(xh)}const Mj=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function xu(e,t,r){if(!fe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=fe.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,A){return!fe.isUndefined(A[w])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,o=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(t);if(!fe.isFunction(i))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(fe.isDate(b))return b.toISOString();if(!c&&fe.isBlob(b))throw new pt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(b)||fe.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):mh.from(b):b}function l(b,w,A){let P=b;if(b&&!A&&typeof b=="object"){if(fe.endsWith(w,"{}"))w=n?w:w.slice(0,-2),b=JSON.stringify(b);else if(fe.isArray(b)&&Cj(b)||(fe.isFileList(b)||fe.endsWith(w,"[]"))&&(P=fe.toArray(b)))return w=k2(w),P.forEach(function(R,U){!(fe.isUndefined(R)||R===null)&&t.append(o===!0?N2([w],U,s):o===null?w:w+"[]",u(R))}),!1}return xh(b)?!0:(t.append(N2(A,w,s),u(b)),!1)}const f=[],h=Object.assign(Mj,{defaultVisitor:l,convertValue:u,isVisitable:xh});function y(b,w){if(!fe.isUndefined(b)){if(f.indexOf(b)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(b),fe.forEach(b,function(P,N){(!(fe.isUndefined(P)||P===null)&&i.call(t,P,fe.isString(N)?N.trim():N,w,h))===!0&&y(P,w?w.concat(N):[N])}),f.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return y(e),t}function R2(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Sh(e,t){this._pairs=[],e&&xu(e,this,t)}const D2=Sh.prototype;D2.append=function(t,r){this._pairs.push([t,r])},D2.toString=function(t){const r=t?function(n){return t.call(this,n,R2)}:R2;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Tj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $2(e,t,r){if(!t)return e;const n=r&&r.encode||Tj;fe.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(t,r):s=fe.isURLSearchParams(t)?t.toString():new Sh(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Aj{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){fe.forEach(this.handlers,function(n){n!==null&&t(n)})}}var B2=Aj,L2={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Oj=typeof URLSearchParams<"u"?URLSearchParams:Sh,Ij=typeof FormData<"u"?FormData:null,Pj=typeof Blob<"u"?Blob:null,jj={isBrowser:!0,classes:{URLSearchParams:Oj,FormData:Ij,Blob:Pj},protocols:["http","https","file","blob","url","data"]};const Eh=typeof window<"u"&&typeof document<"u",Ch=typeof navigator=="object"&&navigator||void 0,kj=Eh&&(!Ch||["ReactNative","NativeScript","NS"].indexOf(Ch.product)<0),Nj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Rj=Eh&&window.location.href||"http://localhost";var Dj=Object.freeze({__proto__:null,hasBrowserEnv:Eh,hasStandardBrowserWebWorkerEnv:Nj,hasStandardBrowserEnv:kj,navigator:Ch,origin:Rj}),Tr={...Dj,...jj};function $j(e,t){return xu(e,new Tr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Tr.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Bj(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Lj(e){const t={},r=Object.keys(e);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],t[s]=e[s];return t}function U2(e){function t(r,n,i,s){let o=r[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=s>=r.length;return o=!o&&fe.isArray(i)?i.length:o,c?(fe.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!fe.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],s)&&fe.isArray(i[o])&&(i[o]=Lj(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(Bj(n),i,r,0)}),r}return null}function Uj(e,t,r){if(fe.isString(e))try{return(t||JSON.parse)(e),fe.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Mh={transitional:L2,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=fe.isObject(t);if(s&&fe.isHTMLForm(t)&&(t=new FormData(t)),fe.isFormData(t))return i?JSON.stringify(U2(t)):t;if(fe.isArrayBuffer(t)||fe.isBuffer(t)||fe.isStream(t)||fe.isFile(t)||fe.isBlob(t)||fe.isReadableStream(t))return t;if(fe.isArrayBufferView(t))return t.buffer;if(fe.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return $j(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return xu(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),Uj(t)):t}],transformResponse:[function(t){const r=this.transitional||Mh.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(fe.isResponse(t)||fe.isReadableStream(t))return t;if(t&&fe.isString(t)&&(n&&!this.responseType||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?pt.from(a,pt.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tr.classes.FormData,Blob:Tr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],e=>{Mh.headers[e]={}});var Th=Mh;const Fj=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var zj=e=>{const t={};let r,n,i;return e&&e.split(`
|
|
34
|
+
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&Fj[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const F2=Symbol("internals");function Za(e){return e&&String(e).trim().toLowerCase()}function Su(e){return e===!1||e==null?e:fe.isArray(e)?e.map(Su):String(e)}function Vj(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const qj=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ah(e,t,r,n,i){if(fe.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!fe.isString(t)){if(fe.isString(n))return t.indexOf(n)!==-1;if(fe.isRegExp(n))return n.test(t)}}function Wj(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Gj(e,t){const r=fe.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,s,o){return this[n].call(this,t,i,s,o)},configurable:!0})})}class Eu{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=Za(c);if(!l)throw new Error("header name must be a non-empty string");const f=fe.findKey(i,l);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=Su(a))}const o=(a,c)=>fe.forEach(a,(u,l)=>s(u,l,c));if(fe.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(fe.isString(t)&&(t=t.trim())&&!qj(t))o(zj(t),r);else if(fe.isHeaders(t))for(const[a,c]of t.entries())s(c,a,n);else t!=null&&s(r,t,n);return this}get(t,r){if(t=Za(t),t){const n=fe.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return Vj(i);if(fe.isFunction(r))return r.call(this,i,n);if(fe.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Za(t),t){const n=fe.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ah(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=Za(o),o){const a=fe.findKey(n,o);a&&(!r||Ah(n,n[a],a,r))&&(delete n[a],i=!0)}}return fe.isArray(t)?t.forEach(s):s(t),i}clear(t){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const s=r[n];(!t||Ah(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const r=this,n={};return fe.forEach(this,(i,s)=>{const o=fe.findKey(n,s);if(o){r[o]=Su(i),delete r[s];return}const a=t?Wj(s):String(s).trim();a!==s&&delete r[s],r[a]=Su(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return fe.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&fe.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
35
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[F2]=this[F2]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Za(o);n[a]||(Gj(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}Eu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Eu.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),fe.freezeMethods(Eu);var Mn=Eu;function Oh(e,t){const r=this||Th,n=t||r,i=Mn.from(n.headers);let s=n.data;return fe.forEach(e,function(a){s=a.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function z2(e){return!!(e&&e.__CANCEL__)}function Oo(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(Oo,pt,{__CANCEL__:!0});function V2(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new pt("Request failed with status code "+r.status,[pt.ERR_BAD_REQUEST,pt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Hj(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Kj(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),l=n[s];o||(o=u),r[i]=c,n[i]=u;let f=s,h=0;for(;f!==i;)h+=r[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const y=l&&u-l;return y?Math.round(h*1e3/y):void 0}}function Xj(e,t){let r=0,n=1e3/t,i,s;const o=(u,l=Date.now())=>{r=l,i=null,s&&(clearTimeout(s),s=null),e.apply(null,u)};return[(...u)=>{const l=Date.now(),f=l-r;f>=n?o(u,l):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},n-f)))},()=>i&&o(i)]}const Cu=(e,t,r=3)=>{let n=0;const i=Kj(50,250);return Xj(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,c=o-n,u=i(c),l=o<=a;n=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&l?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},q2=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},W2=e=>(...t)=>fe.asap(()=>e(...t));var Jj=Tr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Tr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Tr.origin),Tr.navigator&&/(msie|trident)/i.test(Tr.navigator.userAgent)):()=>!0,Yj=Tr.hasStandardBrowserEnv?{write(e,t,r,n,i,s){const o=[e+"="+encodeURIComponent(t)];fe.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),fe.isString(n)&&o.push("path="+n),fe.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Zj(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qj(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function G2(e,t){return e&&!Zj(t)?Qj(e,t):t}const H2=e=>e instanceof Mn?{...e}:e;function Fs(e,t){t=t||{};const r={};function n(u,l,f,h){return fe.isPlainObject(u)&&fe.isPlainObject(l)?fe.merge.call({caseless:h},u,l):fe.isPlainObject(l)?fe.merge({},l):fe.isArray(l)?l.slice():l}function i(u,l,f,h){if(fe.isUndefined(l)){if(!fe.isUndefined(u))return n(void 0,u,f,h)}else return n(u,l,f,h)}function s(u,l){if(!fe.isUndefined(l))return n(void 0,l)}function o(u,l){if(fe.isUndefined(l)){if(!fe.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,f){if(f in t)return n(u,l);if(f in e)return n(void 0,u)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,l,f)=>i(H2(u),H2(l),f,!0)};return fe.forEach(Object.keys(Object.assign({},e,t)),function(l){const f=c[l]||i,h=f(e[l],t[l],l);fe.isUndefined(h)&&f!==a||(r[l]=h)}),r}var K2=e=>{const t=Fs({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=Mn.from(o),t.url=$2(G2(t.baseURL,t.url),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(fe.isFormData(r)){if(Tr.hasStandardBrowserEnv||Tr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...l]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...l].join("; "))}}if(Tr.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&Jj(t.url))){const u=i&&s&&Yj.read(s);u&&o.set(i,u)}return t},ek=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const i=K2(e);let s=i.data;const o=Mn.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,f,h,y,b;function w(){y&&y(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(l),i.signal&&i.signal.removeEventListener("abort",l)}let A=new XMLHttpRequest;A.open(i.method.toUpperCase(),i.url,!0),A.timeout=i.timeout;function P(){if(!A)return;const R=Mn.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:R,config:e,request:A};V2(function(q){r(q),w()},function(q){n(q),w()},L),A=null}"onloadend"in A?A.onloadend=P:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(P)},A.onabort=function(){A&&(n(new pt("Request aborted",pt.ECONNABORTED,e,A)),A=null)},A.onerror=function(){n(new pt("Network Error",pt.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let U=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const L=i.transitional||L2;i.timeoutErrorMessage&&(U=i.timeoutErrorMessage),n(new pt(U,L.clarifyTimeoutError?pt.ETIMEDOUT:pt.ECONNABORTED,e,A)),A=null},s===void 0&&o.setContentType(null),"setRequestHeader"in A&&fe.forEach(o.toJSON(),function(U,L){A.setRequestHeader(L,U)}),fe.isUndefined(i.withCredentials)||(A.withCredentials=!!i.withCredentials),a&&a!=="json"&&(A.responseType=i.responseType),u&&([h,b]=Cu(u,!0),A.addEventListener("progress",h)),c&&A.upload&&([f,y]=Cu(c),A.upload.addEventListener("progress",f),A.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=R=>{A&&(n(!R||R.type?new Oo(null,e,A):R),A.abort(),A=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const N=Hj(i.url);if(N&&Tr.protocols.indexOf(N)===-1){n(new pt("Unsupported protocol "+N+":",pt.ERR_BAD_REQUEST,e));return}A.send(s||null)})},tk=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i;const s=function(u){if(!i){i=!0,a();const l=u instanceof Error?u:this.reason;n.abort(l instanceof pt?l:new Oo(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,s(new pt(`timeout ${t} of ms exceeded`,pt.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>fe.asap(a),c}};const rk=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},nk=async function*(e,t){for await(const r of ik(e))yield*rk(r,t)},ik=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},X2=(e,t,r,n)=>{const i=nk(e,t);let s=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:l}=await i.next();if(u){a(),c.close();return}let f=l.byteLength;if(r){let h=s+=f;r(h)}c.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(c){return a(c),i.return()}},{highWaterMark:2})},Mu=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",J2=Mu&&typeof ReadableStream=="function",sk=Mu&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Y2=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ok=J2&&Y2(()=>{let e=!1;const t=new Request(Tr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Z2=64*1024,Ih=J2&&Y2(()=>fe.isReadableStream(new Response("").body)),Tu={stream:Ih&&(e=>e.body)};Mu&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Tu[t]&&(Tu[t]=fe.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new pt(`Response type '${t}' is not supported`,pt.ERR_NOT_SUPPORT,n)})})})(new Response);const ak=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Tr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(e)||fe.isArrayBuffer(e))return e.byteLength;if(fe.isURLSearchParams(e)&&(e=e+""),fe.isString(e))return(await sk(e)).byteLength},ck=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??ak(t)};var uk=Mu&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:h}=K2(e);u=u?(u+"").toLowerCase():"text";let y=tk([i,s&&s.toAbortSignal()],o),b;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let A;try{if(c&&ok&&r!=="get"&&r!=="head"&&(A=await ck(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),G;if(fe.isFormData(n)&&(G=L.headers.get("content-type"))&&l.setContentType(G),L.body){const[q,X]=q2(A,Cu(W2(c)));n=X2(L.body,Z2,q,X)}}fe.isString(f)||(f=f?"include":"omit");const P="credentials"in Request.prototype;b=new Request(t,{...h,signal:y,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:P?f:void 0});let N=await fetch(b);const R=Ih&&(u==="stream"||u==="response");if(Ih&&(a||R&&w)){const L={};["status","statusText","headers"].forEach(ie=>{L[ie]=N[ie]});const G=fe.toFiniteNumber(N.headers.get("content-length")),[q,X]=a&&q2(G,Cu(W2(a),!0))||[];N=new Response(X2(N.body,Z2,q,()=>{X&&X(),w&&w()}),L)}u=u||"text";let U=await Tu[fe.findKey(Tu,u)||"text"](N,e);return!R&&w&&w(),await new Promise((L,G)=>{V2(L,G,{data:U,headers:Mn.from(N.headers),status:N.status,statusText:N.statusText,config:e,request:b})})}catch(P){throw w&&w(),P&&P.name==="TypeError"&&/fetch/i.test(P.message)?Object.assign(new pt("Network Error",pt.ERR_NETWORK,e,b),{cause:P.cause||P}):pt.from(P,P&&P.code,e,b)}});const Ph={http:Ej,xhr:ek,fetch:uk};fe.forEach(Ph,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Q2=e=>`- ${e}`,lk=e=>fe.isFunction(e)||e===null||e===!1;var e_={getAdapter:e=>{e=fe.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let s=0;s<t;s++){r=e[s];let o;if(n=r,!lk(r)&&(n=Ph[(o=String(r)).toLowerCase()],n===void 0))throw new pt(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+s]=n}if(!n){const s=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
36
36
|
`+s.map(Q2).join(`
|
|
37
|
-
`):" "+Q2(s[0]):"as no adapter specified";throw new pt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Ph};function
|
|
38
|
-
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Fs(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&Ou.assertOptions(n,{silentJSONParsing:Qn.transitional(Qn.boolean),forcedJSONParsing:Qn.transitional(Qn.boolean),clarifyTimeoutError:Qn.transitional(Qn.boolean)},!1),i!=null&&(fe.isFunction(i)?r.paramsSerializer={serialize:i}:Ou.assertOptions(i,{encode:Qn.function,serialize:Qn.function},!0)),Ou.assertOptions(r,{baseUrl:Qn.spelling("baseURL"),withXsrfToken:Qn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),r.headers=Tn.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(r)===!1||(c=c&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let l,f=0,h;if(!c){const b=[t_.bind(this),void 0];for(b.unshift.apply(b,a),b.push.apply(b,u),h=b.length,l=Promise.resolve(r);f<h;)l=l.then(b[f++],b[f++]);return l}h=a.length;let y=r;for(f=0;f<h;){const b=a[f++],w=a[f++];try{y=b(y)}catch(A){w.call(this,A);break}}try{l=t_.call(this,y)}catch(b){return Promise.reject(b)}for(f=0,h=u.length;f<h;)l=l.then(u[f++],u[f++]);return l}getUri(t){t=Fs(this.defaults,t);const r=G2(t.baseURL,t.url);return $2(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){Iu.prototype[t]=function(r,n){return this.request(Fs(n||{},{method:t,url:r,data:(n||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function r(n){return function(s,o,a){return this.request(Fs(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Iu.prototype[t]=r(),Iu.prototype[t+"Form"]=r(!0)});var Pu=Iu;class jh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},t(function(s,o,a){n.reason||(n.reason=new Oo(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new jh(function(i){t=i}),cancel:t}}}var dj=jh;function hj(e){return function(r){return e.apply(null,r)}}function pj(e){return fe.isObject(e)&&e.isAxiosError===!0}const Rh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Rh).forEach(([e,t])=>{Rh[t]=e});var mj=Rh;function i_(e){const t=new Pu(e),r=_2(Pu.prototype.request,t);return fe.extend(r,Pu.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return i_(Fs(e,i))},r}const ur=i_(Mh);ur.Axios=Pu,ur.CanceledError=Oo,ur.CancelToken=dj,ur.isCancel=z2,ur.VERSION=r_,ur.toFormData=xu,ur.AxiosError=pt,ur.Cancel=ur.CanceledError,ur.all=function(t){return Promise.all(t)},ur.spread=hj,ur.isAxiosError=pj,ur.mergeConfig=Fs,ur.AxiosHeaders=Tn,ur.formToJSON=e=>F2(fe.isHTMLForm(e)?new FormData(e):e),ur.getAdapter=e_.getAdapter,ur.HttpStatusCode=mj,ur.default=ur;var s_=ur,Nh={exports:{}},Xr={},o_={exports:{}};(function(e){function t(r){return r&&r.__esModule?r:{default:r}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(o_);var gj=o_.exports,Dh={exports:{}},$h={exports:{}},a_;function ku(){return a_||(a_=1,function(e){function t(r){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}($h)),$h.exports}var c_;function vj(){return c_||(c_=1,function(e){var t=ku().default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},s=Object.prototype,o=s.hasOwnProperty,a=Object.defineProperty||function(E,O,C){E[O]=C.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function h(E,O,C){return Object.defineProperty(E,O,{value:C,enumerable:!0,configurable:!0,writable:!0}),E[O]}try{h({},"")}catch{h=function(C,g,v){return C[g]=v}}function y(E,O,C,g){var v=O&&O.prototype instanceof F?O:F,k=Object.create(v.prototype),ee=new x(g||[]);return a(k,"_invoke",{value:D(E,C,ee)}),k}function b(E,O,C){try{return{type:"normal",arg:E.call(O,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=y;var w="suspendedStart",A="suspendedYield",P="executing",R="completed",N={};function F(){}function L(){}function G(){}var q={};h(q,u,function(){return this});var X=Object.getPrototypeOf,ie=X&&X(X(T([])));ie&&ie!==s&&o.call(ie,u)&&(q=ie);var ae=G.prototype=F.prototype=Object.create(q);function ce(E){["next","throw","return"].forEach(function(O){h(E,O,function(C){return this._invoke(O,C)})})}function V(E,O){function C(v,k,ee,se){var he=b(E[v],E,k);if(he.type!=="throw"){var ye=he.arg,Ee=ye.value;return Ee&&t(Ee)=="object"&&o.call(Ee,"__await")?O.resolve(Ee.__await).then(function(Se){C("next",Se,ee,se)},function(Se){C("throw",Se,ee,se)}):O.resolve(Ee).then(function(Se){ye.value=Se,ee(ye)},function(Se){return C("throw",Se,ee,se)})}se(he.arg)}var g;a(this,"_invoke",{value:function(k,ee){function se(){return new O(function(he,ye){C(k,ee,he,ye)})}return g=g?g.then(se,se):se()}})}function D(E,O,C){var g=w;return function(v,k){if(g===P)throw Error("Generator is already running");if(g===R){if(v==="throw")throw k;return{value:n,done:!0}}for(C.method=v,C.arg=k;;){var ee=C.delegate;if(ee){var se=p(ee,C);if(se){if(se===N)continue;return se}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===w)throw g=R,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=P;var he=b(E,O,C);if(he.type==="normal"){if(g=C.done?R:A,he.arg===N)continue;return{value:he.arg,done:C.done}}he.type==="throw"&&(g=R,C.method="throw",C.arg=he.arg)}}}function p(E,O){var C=O.method,g=E.iterator[C];if(g===n)return O.delegate=null,C==="throw"&&E.iterator.return&&(O.method="return",O.arg=n,p(E,O),O.method==="throw")||C!=="return"&&(O.method="throw",O.arg=new TypeError("The iterator does not provide a '"+C+"' method")),N;var v=b(g,E.iterator,O.arg);if(v.type==="throw")return O.method="throw",O.arg=v.arg,O.delegate=null,N;var k=v.arg;return k?k.done?(O[E.resultName]=k.value,O.next=E.nextLoc,O.method!=="return"&&(O.method="next",O.arg=n),O.delegate=null,N):k:(O.method="throw",O.arg=new TypeError("iterator result is not an object"),O.delegate=null,N)}function d(E){var O={tryLoc:E[0]};1 in E&&(O.catchLoc=E[1]),2 in E&&(O.finallyLoc=E[2],O.afterLoc=E[3]),this.tryEntries.push(O)}function m(E){var O=E.completion||{};O.type="normal",delete O.arg,E.completion=O}function x(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(d,this),this.reset(!0)}function T(E){if(E||E===""){var O=E[u];if(O)return O.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var C=-1,g=function v(){for(;++C<E.length;)if(o.call(E,C))return v.value=E[C],v.done=!1,v;return v.value=n,v.done=!0,v};return g.next=g}}throw new TypeError(t(E)+" is not iterable")}return L.prototype=G,a(ae,"constructor",{value:G,configurable:!0}),a(G,"constructor",{value:L,configurable:!0}),L.displayName=h(G,f,"GeneratorFunction"),i.isGeneratorFunction=function(E){var O=typeof E=="function"&&E.constructor;return!!O&&(O===L||(O.displayName||O.name)==="GeneratorFunction")},i.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,G):(E.__proto__=G,h(E,f,"GeneratorFunction")),E.prototype=Object.create(ae),E},i.awrap=function(E){return{__await:E}},ce(V.prototype),h(V.prototype,l,function(){return this}),i.AsyncIterator=V,i.async=function(E,O,C,g,v){v===void 0&&(v=Promise);var k=new V(y(E,O,C,g),v);return i.isGeneratorFunction(O)?k:k.next().then(function(ee){return ee.done?ee.value:k.next()})},ce(ae),h(ae,f,"Generator"),h(ae,u,function(){return this}),h(ae,"toString",function(){return"[object Generator]"}),i.keys=function(E){var O=Object(E),C=[];for(var g in O)C.push(g);return C.reverse(),function v(){for(;C.length;){var k=C.pop();if(k in O)return v.value=k,v.done=!1,v}return v.done=!0,v}},i.values=T,x.prototype={constructor:x,reset:function(O){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(m),!O)for(var C in this)C.charAt(0)==="t"&&o.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=n)},stop:function(){this.done=!0;var O=this.tryEntries[0].completion;if(O.type==="throw")throw O.arg;return this.rval},dispatchException:function(O){if(this.done)throw O;var C=this;function g(ye,Ee){return ee.type="throw",ee.arg=O,C.next=ye,Ee&&(C.method="next",C.arg=n),!!Ee}for(var v=this.tryEntries.length-1;v>=0;--v){var k=this.tryEntries[v],ee=k.completion;if(k.tryLoc==="root")return g("end");if(k.tryLoc<=this.prev){var se=o.call(k,"catchLoc"),he=o.call(k,"finallyLoc");if(se&&he){if(this.prev<k.catchLoc)return g(k.catchLoc,!0);if(this.prev<k.finallyLoc)return g(k.finallyLoc)}else if(se){if(this.prev<k.catchLoc)return g(k.catchLoc,!0)}else{if(!he)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return g(k.finallyLoc)}}}},abrupt:function(O,C){for(var g=this.tryEntries.length-1;g>=0;--g){var v=this.tryEntries[g];if(v.tryLoc<=this.prev&&o.call(v,"finallyLoc")&&this.prev<v.finallyLoc){var k=v;break}}k&&(O==="break"||O==="continue")&&k.tryLoc<=C&&C<=k.finallyLoc&&(k=null);var ee=k?k.completion:{};return ee.type=O,ee.arg=C,k?(this.method="next",this.next=k.finallyLoc,N):this.complete(ee)},complete:function(O,C){if(O.type==="throw")throw O.arg;return O.type==="break"||O.type==="continue"?this.next=O.arg:O.type==="return"?(this.rval=this.arg=O.arg,this.method="return",this.next="end"):O.type==="normal"&&C&&(this.next=C),N},finish:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.finallyLoc===O)return this.complete(g.completion,g.afterLoc),m(g),N}},catch:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc===O){var v=g.completion;if(v.type==="throw"){var k=v.arg;m(g)}return k}}throw Error("illegal catch attempt")},delegateYield:function(O,C,g){return this.delegate={iterator:T(O),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),N}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Dh)),Dh.exports}var Bh,u_;function yj(){if(u_)return Bh;u_=1;var e=vj()();Bh=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Bh}var Lh={exports:{}},l_;function bj(){return l_||(l_=1,function(e){function t(n,i,s,o,a,c,u){try{var l=n[c](u),f=l.value}catch(h){return void s(h)}l.done?i(f):Promise.resolve(f).then(o,a)}function r(n){return function(){var i=this,s=arguments;return new Promise(function(o,a){var c=n.apply(i,s);function u(f){t(c,o,a,u,l,"next",f)}function l(f){t(c,o,a,u,l,"throw",f)}u(void 0)})}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Lh)),Lh.exports}var Fh={exports:{}},Uh={exports:{}},zh={exports:{}},f_;function wj(){return f_||(f_=1,function(e){var t=ku().default;function r(n,i){if(t(n)!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var o=s.call(n,i||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(zh)),zh.exports}var d_;function _j(){return d_||(d_=1,function(e){var t=ku().default,r=wj();function n(i){var s=r(i,"string");return t(s)=="symbol"?s:s+""}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Uh)),Uh.exports}var h_;function xj(){return h_||(h_=1,function(e){var t=_j();function r(n,i,s){return(i=t(i))in n?Object.defineProperty(n,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[i]=s,n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Fh)),Fh.exports}var Vh,p_;function Sj(){if(p_)return Vh;p_=1;const e=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);return Vh=t=>!e.has(t&&t.code),Vh}var Za=gj;Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.isNetworkError=Gh,Xr.isRetryableError=Ru,Xr.isSafeRequestError=y_,Xr.isIdempotentRequestError=Hh,Xr.isNetworkOrIdempotentRequestError=Kh,Xr.exponentialDelay=b_,Xr.default=Us,Xr.DEFAULT_OPTIONS=Xr.namespace=void 0;var ju=Za(yj()),Ej=Za(ku()),m_=Za(bj()),Cj=Za(xj()),Tj=Za(Sj());function g_(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?g_(Object(r),!0).forEach(function(n){(0,Cj.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Wh="axios-retry";Xr.namespace=Wh;function Gh(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,Tj.default)(e)}var v_=["get","head","options"],Mj=v_.concat(["put","delete"]);function Ru(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function y_(e){return e.config?Ru(e)&&v_.indexOf(e.config.method)!==-1:!1}function Hh(e){return e.config?Ru(e)&&Mj.indexOf(e.config.method)!==-1:!1}function Kh(e){return Gh(e)||Hh(e)}function Aj(){return 0}function b_(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,r=Math.pow(2,e)*t,n=r*.2*Math.random();return r+n}var w_={retries:3,retryCondition:Kh,retryDelay:Aj,shouldResetTimeout:!1,onRetry:function(){}};Xr.DEFAULT_OPTIONS=w_;function Oj(e,t){return qh(qh(qh({},w_),t),e[Wh])}function __(e,t){var r=Oj(e,t);return r.retryCount=r.retryCount||0,e[Wh]=r,r}function Ij(e,t){e.defaults.agent===t.agent&&delete t.agent,e.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,e.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}function Pj(e,t){return Xh.apply(this,arguments)}function Xh(){return Xh=(0,m_.default)(ju.default.mark(function e(t,r){var n,i,s,o;return ju.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(n=t.retries,i=t.retryCondition,s=t.retryCount<n&&i(r),(0,Ej.default)(s)!=="object"){c.next=13;break}return c.prev=3,c.next=6,s;case 6:return o=c.sent,c.abrupt("return",o!==!1);case 10:return c.prev=10,c.t0=c.catch(3),c.abrupt("return",!1);case 13:return c.abrupt("return",s);case 14:case"end":return c.stop()}},e,null,[[3,10]])})),Xh.apply(this,arguments)}function Us(e,t){var r=e.interceptors.request.use(function(i){var s=__(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,m_.default)(ju.default.mark(function s(o){var a,c,u,l,f,h,y,b;return ju.default.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(a=o.config,a){A.next=3;break}return A.abrupt("return",Promise.reject(o));case 3:return c=__(a,t),A.next=6,Pj(c,o);case 6:if(!A.sent){A.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),Ij(e,a),!(!l&&a.timeout&&c.lastRequestTime)){A.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){A.next=16;break}return A.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(P){return P}],A.next=20,f(c.retryCount,o,a);case 20:return A.abrupt("return",new Promise(function(P){return setTimeout(function(){return P(e(a))},h)}));case 21:return A.abrupt("return",Promise.reject(o));case 22:case"end":return A.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}Us.isNetworkError=Gh,Us.isSafeRequestError=y_,Us.isIdempotentRequestError=Hh,Us.isNetworkOrIdempotentRequestError=Kh,Us.exponentialDelay=b_,Us.isRetryableError=Ru;const x_=Xr.default;Nh.exports=x_,Nh.exports.default=x_;var kj=Nh.exports,Nu={},Io=null;typeof WebSocket<"u"?Io=WebSocket:typeof MozWebSocket<"u"?Io=MozWebSocket:typeof kr<"u"?Io=kr.WebSocket||kr.MozWebSocket:typeof window<"u"?Io=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Io=self.WebSocket||self.MozWebSocket);var jj=Io,Rj=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.ResilientWebSocket=void 0;const Nj=Rj(jj),Dj=3e4+3e3;class $j{constructor(t,r){vt(this,"endpoint");vt(this,"wsClient");vt(this,"wsUserClosed");vt(this,"wsFailedAttempts");vt(this,"pingTimeout");vt(this,"logger");vt(this,"onError");vt(this,"onMessage");vt(this,"onReconnect");this.endpoint=t,this.logger=r,this.wsFailedAttempts=0,this.onError=n=>{var i;(i=this.logger)==null||i.error(n)},this.wsUserClosed=!0,this.onMessage=()=>{},this.onReconnect=()=>{}}async send(t){var r,n,i;(r=this.logger)==null||r.info(`Sending ${t}`),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0?(n=this.logger)==null||n.error("Couldn't connect to the websocket server. Error callback is called."):(i=this.wsClient)==null||i.send(t)}async startWebSocket(){var t;this.wsClient===void 0&&((t=this.logger)==null||t.info("Creating Web Socket client"),this.wsClient=new Nj.default(this.endpoint),this.wsUserClosed=!1,this.wsClient.onopen=()=>{this.wsFailedAttempts=0,this.wsClient.on!==void 0&&this.heartbeat()},this.wsClient.onerror=r=>{this.onError(r.error)},this.wsClient.onmessage=r=>{this.onMessage(r.data)},this.wsClient.onclose=async()=>{var r,n;if(this.pingTimeout!==void 0&&clearInterval(this.pingTimeout),this.wsUserClosed===!1){this.wsFailedAttempts+=1,this.wsClient=void 0;const i=Bj(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await S_(i),this.restartUnexpectedClosedWebsocket()}else(n=this.logger)==null||n.info("The connection has been closed successfully.")},this.wsClient.on!==void 0&&this.wsClient.on("ping",this.heartbeat.bind(this)))}heartbeat(){var t;(t=this.logger)==null||t.info("Heartbeat"),this.pingTimeout!==void 0&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n;(r=this.logger)==null||r.warn("Connection timed out. Reconnecting..."),(n=this.wsClient)==null||n.terminate(),this.restartUnexpectedClosedWebsocket()},Dj)}async waitForMaybeReadyWebSocket(){let t=0;for(;this.wsClient!==void 0&&this.wsClient.readyState!==this.wsClient.OPEN;)if(t>5e3){this.wsClient.close();return}else t+=10,await S_(10)}async restartUnexpectedClosedWebsocket(){var t;if(this.wsUserClosed!==!0){if(await this.startWebSocket(),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0){(t=this.logger)==null||t.error("Couldn't reconnect to websocket. Error callback is called.");return}this.onReconnect()}}closeWebSocket(){if(this.wsClient!==void 0){const t=this.wsClient;this.wsClient=void 0,t.close()}this.wsUserClosed=!0}}Nu.ResilientWebSocket=$j;async function S_(e){return new Promise(t=>setTimeout(t,e))}function Bj(e){return 2**e*100}var Po={};Object.defineProperty(Po,"__esModule",{value:!0}),Po.removeLeading0xIfExists=Po.makeWebsocketUrl=void 0;function Lj(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}Po.makeWebsocketUrl=Lj;function Fj(e){return e.startsWith("0x")?e.substring(2):e}Po.removeLeading0xIfExists=Fj;var E_=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mu,"__esModule",{value:!0}),mu.PriceServiceConnection=void 0;const Jh=lh,Uj=E_(s_),C_=E_(kj),zj=Nu,Yh=Po;class Vj{constructor(t,r){vt(this,"httpClient");vt(this,"priceFeedCallbacks");vt(this,"wsClient");vt(this,"wsEndpoint");vt(this,"logger");vt(this,"priceFeedRequestConfig");vt(this,"onWsError");var n,i,s;this.httpClient=Uj.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,C_.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:C_.default.exponentialDelay}),this.priceFeedRequestConfig={binary:(n=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:n.binary,verbose:((i=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:i.verbose)??(r==null?void 0:r.verbose),allowOutOfOrder:(s=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:s.allowOutOfOrder},this.priceFeedCallbacks=new Map,this.logger=(r==null?void 0:r.logger)||{trace:()=>{},debug:()=>{},info:()=>{},warn:console.warn,error:console.error},this.onWsError=o=>{this.logger.error(o),typeof mn<"u"&&typeof mn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),mn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Yh.makeWebsocketUrl)(t)}async getLatestPriceFeeds(t){return t.length===0?[]:(await this.httpClient.get("/api/latest_price_feeds",{params:{ids:t,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}})).data.map(i=>Jh.PriceFeed.fromJson(i))}async getLatestVaas(t){return(await this.httpClient.get("/api/latest_vaas",{params:{ids:t}})).data}async getVaa(t,r){const n=await this.httpClient.get("/api/get_vaa",{params:{id:t,publish_time:r}});return[n.data.vaa,n.data.publishTime]}async getPriceFeed(t,r){const n=await this.httpClient.get("/api/get_price_feed",{params:{id:t,publish_time:r,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}});return Jh.PriceFeed.fromJson(n.data)}async getPriceFeedIds(){return(await this.httpClient.get("/api/price_feed_ids")).data}async subscribePriceFeedUpdates(t,r){var s;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(o=>(0,Yh.removeLeading0xIfExists)(o));const n=[];for(const o of t)this.priceFeedCallbacks.has(o)||(this.priceFeedCallbacks.set(o,new Set),n.push(o)),this.priceFeedCallbacks.get(o).add(r);const i={ids:n,type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};await((s=this.wsClient)==null?void 0:s.send(JSON.stringify(i)))}async unsubscribePriceFeedUpdates(t,r){var s;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(o=>(0,Yh.removeLeading0xIfExists)(o));const n=[];for(const o of t)if(this.priceFeedCallbacks.has(o)){let a=!1;r===void 0?(this.priceFeedCallbacks.delete(o),a=!0):(this.priceFeedCallbacks.get(o).delete(r),this.priceFeedCallbacks.get(o).size===0&&(this.priceFeedCallbacks.delete(o),a=!0)),a&&n.push(o)}const i={ids:n,type:"unsubscribe"};await((s=this.wsClient)==null?void 0:s.send(JSON.stringify(i))),this.priceFeedCallbacks.size===0&&this.closeWebSocket()}async startWebSocket(){if(this.wsEndpoint===void 0)throw new Error("Websocket endpoint is undefined.");this.wsClient=new zj.ResilientWebSocket(this.wsEndpoint,this.logger),this.wsClient.onError=this.onWsError,this.wsClient.onReconnect=()=>{var t;if(this.priceFeedCallbacks.size>0){const r={ids:Array.from(this.priceFeedCallbacks.keys()),type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};this.logger.info("Resubscribing to existing price feeds."),(t=this.wsClient)==null||t.send(JSON.stringify(r))}},this.wsClient.onMessage=t=>{this.logger.info(`Received message ${t.toString()}`);let r;try{r=JSON.parse(t.toString())}catch(n){this.logger.error(`Error parsing message ${t.toString()} as JSON.`),this.logger.error(n),this.onWsError(n);return}if(r.type==="response")r.status==="error"&&(this.logger.error(`Error response from the websocket server ${r.error}.`),this.onWsError(new Error(r.error)));else if(r.type==="price_update"){let n;try{n=Jh.PriceFeed.fromJson(r.price_feed)}catch(i){this.logger.error(`Error parsing price feeds from message ${t.toString()}.`),this.logger.error(i),this.onWsError(i);return}if(this.priceFeedCallbacks.has(n.id))for(const i of this.priceFeedCallbacks.get(n.id))i(n)}else this.logger.warn(`Ignoring unsupported server response ${t.toString()}.`)},await this.wsClient.startWebSocket()}closeWebSocket(){var t;(t=this.wsClient)==null||t.closeWebSocket(),this.wsClient=void 0,this.priceFeedCallbacks.clear()}}mu.PriceServiceConnection=Vj,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=mu;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=lh;Object.defineProperty(e,"PriceFeedMetadata",{enumerable:!0,get:function(){return r.PriceFeedMetadata}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return r.PriceFeed}}),Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return r.Price}}),Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}})}(uh),Object.defineProperty(pu,"__esModule",{value:!0}),pu.SuiPriceServiceConnection=void 0;const qj=uh,Wj=vu();class Gj extends qj.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>Wj.Buffer.from(n,"base64"))}}pu.SuiPriceServiceConnection=Gj;var Du={};Object.defineProperty(Du,"__esModule",{value:!0}),Du.SuiPythClient=void 0;const $u=My,ko=Gn,Hj=vu(),Zh=16*1024;class Kj{constructor(t,r,n){vt(this,"provider");vt(this,"pythStateId");vt(this,"wormholeStateId");vt(this,"pythPackageId");vt(this,"wormholePackageId");vt(this,"priceTableInfo");vt(this,"priceFeedObjectIdCache",new Map);vt(this,"baseUpdateFee");this.provider=t,this.pythStateId=r,this.wormholeStateId=n,this.pythPackageId=void 0,this.wormholePackageId=void 0}async getBaseUpdateFee(){if(this.baseUpdateFee===void 0){const t=await this.provider.getObject({id:this.pythStateId,options:{showContent:!0}});if(!t.data||!t.data.content||t.data.content.dataType!=="moveObject")throw new Error("Unable to fetch pyth state object");this.baseUpdateFee=t.data.content.fields.base_update_fee}return this.baseUpdateFee}async getPackageId(t){const r=await this.provider.getObject({id:t,options:{showContent:!0}}).then(n=>{var i,s,o;if(((s=(i=n.data)==null?void 0:i.content)==null?void 0:s.dataType)=="moveObject")return n.data.content.fields;throw console.log((o=n.data)==null?void 0:o.content),new Error(`Cannot fetch package id for object ${t}`)});if("upgrade_cap"in r)return r.upgrade_cap.fields.package;throw new Error("upgrade_cap not found")}async verifyVaas(t,r){const n=await this.getWormholePackageId(),i=[];for(const s of t){const[o]=r.moveCall({target:`${n}::vaa::parse_and_verify`,arguments:[r.object(this.wormholeStateId),r.pure(ko.bcs.vector(ko.bcs.U8).serialize(Array.from(s),{maxSize:Zh}).toBytes()),r.object($u.SUI_CLOCK_OBJECT_ID)]});i.push(o)}return i}async updatePriceFeeds(t,r,n){const i=await this.getPythPackageId();let s;if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const o=this.extractVaaBytesFromAccumulatorMessage(r[0]),a=await this.verifyVaas([o],t);[s]=t.moveCall({target:`${i}::pyth::create_authenticated_price_infos_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(ko.bcs.vector(ko.bcs.U8).serialize(Array.from(r[0]),{maxSize:Zh}).toBytes()),a[0],t.object($u.SUI_CLOCK_OBJECT_ID)]});const c=[],u=await this.getBaseUpdateFee(),l=t.splitCoins(t.gas,n.map(()=>t.pure.u64(u)));let f=0;for(const h of n){const y=await this.getPriceFeedObjectId(h);if(!y)throw new Error(`Price feed ${h} not found, please create it first`);c.push(y),[s]=t.moveCall({target:`${i}::pyth::update_single_price_feed`,arguments:[t.object(this.pythStateId),s,t.object(y),l[f],t.object($u.SUI_CLOCK_OBJECT_ID)]}),f++}return t.moveCall({target:`${i}::hot_potato_vector::destroy`,arguments:[s],typeArguments:[`${i}::price_info::PriceInfo`]}),c}async createPriceFeed(t,r){const n=await this.getPythPackageId();if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const i=this.extractVaaBytesFromAccumulatorMessage(r[0]),s=await this.verifyVaas([i],t);t.moveCall({target:`${n}::pyth::create_price_feeds_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(ko.bcs.vector(ko.bcs.U8).serialize(Array.from(r[0]),{maxSize:Zh}).toBytes()),s[0],t.object($u.SUI_CLOCK_OBJECT_ID)]})}async getWormholePackageId(){return this.wormholePackageId||(this.wormholePackageId=await this.getPackageId(this.wormholeStateId)),this.wormholePackageId}async getPythPackageId(){return this.pythPackageId||(this.pythPackageId=await this.getPackageId(this.pythStateId)),this.pythPackageId}async getPriceFeedObjectId(t){const r=t.replace("0x","");if(!this.priceFeedObjectIdCache.has(r)){const{id:n,fieldType:i}=await this.getPriceTableInfo(),s=await this.provider.getDynamicFieldObject({parentId:n,name:{type:`${i}::price_identifier::PriceIdentifier`,value:{bytes:Array.from(Hj.Buffer.from(r,"hex"))}}});if(!s.data||!s.data.content)return;if(s.data.content.dataType!=="moveObject")throw new Error("Price feed type mismatch");this.priceFeedObjectIdCache.set(r,s.data.content.fields.value)}return this.priceFeedObjectIdCache.get(r)}async getPriceTableInfo(){if(this.priceTableInfo===void 0){const t=await this.provider.getDynamicFieldObject({parentId:this.pythStateId,name:{type:"vector<u8>",value:"price_info"}});if(!t.data||!t.data.type)throw new Error("Price Table not found, contract may not be initialized");let r=t.data.type.replace("0x2::table::Table<","");r=r.replace("::price_identifier::PriceIdentifier, 0x2::object::ID>",""),this.priceTableInfo={id:t.data.objectId,fieldType:r}}return this.priceTableInfo}extractVaaBytesFromAccumulatorMessage(t){const n=7+t.readUint8(6)+1,i=t.readUint16BE(n),s=n+2;return t.subarray(s,s+i)}}Du.SuiPythClient=Kj,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=pu;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=Du;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=uh;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})}(v2);var T_=pT,Qh=My,Xj=To,Bu=v2,Jj=Object.create,ep=Object.defineProperty,Yj=Object.defineProperties,Zj=Object.getOwnPropertyDescriptor,Qj=Object.getOwnPropertyDescriptors,M_=Object.getOwnPropertyNames,A_=Object.getOwnPropertySymbols,e9=Object.getPrototypeOf,O_=Object.prototype.hasOwnProperty,t9=Object.prototype.propertyIsEnumerable,I_=(e,t,r)=>t in e?ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,r9=(e,t)=>{for(var r in t||(t={}))O_.call(t,r)&&I_(e,r,t[r]);if(A_)for(var r of A_(t))t9.call(t,r)&&I_(e,r,t[r]);return e},n9=(e,t)=>Yj(e,Qj(t)),i9=(e=>typeof Un<"u"?Un:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Un<"u"?Un:t)[r]}):e)(function(e){if(typeof Un<"u")return Un.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),s9=(e,t)=>function(){return t||(0,e[M_(e)[0]])((t={exports:{}}).exports,t),t.exports},o9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of M_(t))!O_.call(e,i)&&i!==r&&ep(e,i,{get:()=>t[i],enumerable:!(n=Zj(t,i))||n.enumerable});return e},jo=(e,t,r)=>(r=e!=null?Jj(e9(e)):{},o9(!e||!e.__esModule?ep(r,"default",{value:e,enumerable:!0}):r,e)),xt=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{a(r.next(c))}catch(u){i(u)}},o=c=>{try{a(r.throw(c))}catch(u){i(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,o);a((r=r.apply(e,t)).next())}),Ro=s9({"node_modules/bn.js/lib/bn.js"(e,t){(function(r,n){function i(p,d){if(!p)throw new Error(d||"Assertion failed")}function s(p,d){p.super_=d;var m=function(){};m.prototype=d.prototype,p.prototype=new m,p.prototype.constructor=p}function o(p,d,m){if(o.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((d==="le"||d==="be")&&(m=d,d=10),this._init(p||0,d||10,m||"be"))}typeof r=="object"?r.exports=o:n.BN=o,o.BN=o,o.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=i9("buffer").Buffer}catch{}o.isBN=function(d){return d instanceof o?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===o.wordSize&&Array.isArray(d.words)},o.max=function(d,m){return d.cmp(m)>0?d:m},o.min=function(d,m){return d.cmp(m)<0?d:m},o.prototype._init=function(d,m,x){if(typeof d=="number")return this._initNumber(d,m,x);if(typeof d=="object")return this._initArray(d,m,x);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),d=d.toString().replace(/\s+/g,"");var T=0;d[0]==="-"&&(T++,this.negative=1),T<d.length&&(m===16?this._parseHex(d,T,x):(this._parseBase(d,m,T),x==="le"&&this._initArray(this.toArray(),m,x)))},o.prototype._initNumber=function(d,m,x){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(i(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),m,x)},o.prototype._initArray=function(d,m,x){if(i(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var T=0;T<this.length;T++)this.words[T]=0;var E,O,C=0;if(x==="be")for(T=d.length-1,E=0;T>=0;T-=3)O=d[T]|d[T-1]<<8|d[T-2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);else if(x==="le")for(T=0,E=0;T<d.length;T+=3)O=d[T]|d[T+1]<<8|d[T+2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);return this._strip()};function c(p,d){var m=p.charCodeAt(d);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;i(!1,"Invalid character in "+p)}function u(p,d,m){var x=c(p,m);return m-1>=d&&(x|=c(p,m-1)<<4),x}o.prototype._parseHex=function(d,m,x){this.length=Math.ceil((d.length-m)/6),this.words=new Array(this.length);for(var T=0;T<this.length;T++)this.words[T]=0;var E=0,O=0,C;if(x==="be")for(T=d.length-1;T>=m;T-=2)C=u(d,m,T)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8;else{var g=d.length-m;for(T=g%2===0?m+1:m;T<d.length;T+=2)C=u(d,m,T)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8}this._strip()};function l(p,d,m,x){for(var T=0,E=0,O=Math.min(p.length,m),C=d;C<O;C++){var g=p.charCodeAt(C)-48;T*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),T+=E}return T}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var T=0,E=1;E<=67108863;E*=m)T++;T--,E=E/m|0;for(var O=d.length-x,C=O%T,g=Math.min(O,O-C)+x,v=0,k=x;k<g;k+=T)v=l(d,k,k+T,m),this.imuln(E),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(C!==0){var ee=1;for(v=l(d,k,d.length,m),k=0;k<C;k++)ee*=m;this.imuln(ee),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},o.prototype.copy=function(d){d.words=new Array(this.length);for(var m=0;m<this.length;m++)d.words[m]=this.words[m];d.length=this.length,d.negative=this.negative,d.red=this.red};function f(p,d){p.words=d.words,p.length=d.length,p.negative=d.negative,p.red=d.red}if(o.prototype._move=function(d){f(d,this)},o.prototype.clone=function(){var d=new o(null);return this.copy(d),d},o.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],b=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(d,m){d=d||10,m=m|0||1;var x;if(d===16||d==="hex"){x="";for(var T=0,E=0,O=0;O<this.length;O++){var C=this.words[O],g=((C<<T|E)&16777215).toString(16);E=C>>>24-T&16777215,T+=2,T>=26&&(T-=26,O--),E!==0||O!==this.length-1?x=y[6-g.length]+g+x:x=g+x}for(E!==0&&(x=E.toString(16)+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(d===(d|0)&&d>=2&&d<=36){var v=b[d],k=w[d];x="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var se=ee.modrn(k).toString(d);ee=ee.idivn(k),ee.isZero()?x=se+x:x=y[v-se.length]+se+x}for(this.isZero()&&(x="0"+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(d,m){return this.toArrayLike(a,d,m)}),o.prototype.toArray=function(d,m){return this.toArrayLike(Array,d,m)};var A=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var T=this.byteLength(),E=x||Math.max(1,T);i(T<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=A(d,E),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](O,T),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,T=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|T;d[x++]=C&255,x<d.length&&(d[x++]=C>>8&255),x<d.length&&(d[x++]=C>>16&255),O===6?(x<d.length&&(d[x++]=C>>24&255),T=0,O=0):(T=C>>>24,O+=2)}if(x<d.length)for(d[x++]=T;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,T=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|T;d[x--]=C&255,x>=0&&(d[x--]=C>>8&255),x>=0&&(d[x--]=C>>16&255),O===6?(x>=0&&(d[x--]=C>>24&255),T=0,O=0):(T=C>>>24,O+=2)}if(x>=0)for(d[x--]=T;x>=0;)d[x--]=0},Math.clz32?o.prototype._countBits=function(d){return 32-Math.clz32(d)}:o.prototype._countBits=function(d){var m=d,x=0;return m>=4096&&(x+=13,m>>>=13),m>=64&&(x+=7,m>>>=7),m>=8&&(x+=4,m>>>=4),m>=2&&(x+=2,m>>>=2),x+m},o.prototype._zeroBits=function(d){if(d===0)return 26;var m=d,x=0;return m&8191||(x+=13,m>>>=13),m&127||(x+=7,m>>>=7),m&15||(x+=4,m>>>=4),m&3||(x+=2,m>>>=2),m&1||x++,x},o.prototype.bitLength=function(){var d=this.words[this.length-1],m=this._countBits(d);return(this.length-1)*26+m};function P(p){for(var d=new Array(p.bitLength()),m=0;m<d.length;m++){var x=m/26|0,T=m%26;d[m]=p.words[x]>>>T&1}return d}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,m=0;m<this.length;m++){var x=this._zeroBits(this.words[m]);if(d+=x,x!==26)break}return d},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},o.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]|d.words[m];return this._strip()},o.prototype.ior=function(d){return i((this.negative|d.negative)===0),this.iuor(d)},o.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},o.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},o.prototype.iuand=function(d){var m;this.length>d.length?m=d:m=this;for(var x=0;x<m.length;x++)this.words[x]=this.words[x]&d.words[x];return this.length=m.length,this._strip()},o.prototype.iand=function(d){return i((this.negative|d.negative)===0),this.iuand(d)},o.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},o.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},o.prototype.iuxor=function(d){var m,x;this.length>d.length?(m=this,x=d):(m=d,x=this);for(var T=0;T<x.length;T++)this.words[T]=m.words[T]^x.words[T];if(this!==m)for(;T<m.length;T++)this.words[T]=m.words[T];return this.length=m.length,this._strip()},o.prototype.ixor=function(d){return i((this.negative|d.negative)===0),this.iuxor(d)},o.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},o.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},o.prototype.inotn=function(d){i(typeof d=="number"&&d>=0);var m=Math.ceil(d/26)|0,x=d%26;this._expand(m),x>0&&m--;for(var T=0;T<m;T++)this.words[T]=~this.words[T]&67108863;return x>0&&(this.words[T]=~this.words[T]&67108863>>26-x),this._strip()},o.prototype.notn=function(d){return this.clone().inotn(d)},o.prototype.setn=function(d,m){i(typeof d=="number"&&d>=0);var x=d/26|0,T=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<T:this.words[x]=this.words[x]&~(1<<T),this._strip()},o.prototype.iadd=function(d){var m;if(this.negative!==0&&d.negative===0)return this.negative=0,m=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,m=this.isub(d),d.negative=1,m._normSign();var x,T;this.length>d.length?(x=this,T=d):(x=d,T=this);for(var E=0,O=0;O<T.length;O++)m=(x.words[O]|0)+(T.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;for(;E!==0&&O<x.length;O++)m=(x.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;if(this.length=x.length,E!==0)this.words[this.length]=E,this.length++;else if(x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this},o.prototype.add=function(d){var m;return d.negative!==0&&this.negative===0?(d.negative=0,m=this.sub(d),d.negative^=1,m):d.negative===0&&this.negative!==0?(this.negative=0,m=d.sub(this),this.negative=1,m):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},o.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var m=this.iadd(d);return d.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var x=this.cmp(d);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var T,E;x>0?(T=this,E=d):(T=d,E=this);for(var O=0,C=0;C<E.length;C++)m=(T.words[C]|0)-(E.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;for(;O!==0&&C<T.length;C++)m=(T.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;if(O===0&&C<T.length&&T!==this)for(;C<T.length;C++)this.words[C]=T.words[C];return this.length=Math.max(this.length,C),T!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(d){return this.clone().isub(d)};function R(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var T=p.words[0]|0,E=d.words[0]|0,O=T*E,C=O&67108863,g=O/67108864|0;m.words[0]=C;for(var v=1;v<x;v++){for(var k=g>>>26,ee=g&67108863,se=Math.min(v,d.length-1),he=Math.max(0,v-p.length+1);he<=se;he++){var ye=v-he|0;T=p.words[ye]|0,E=d.words[he]|0,O=T*E+ee,k+=O/67108864|0,ee=O&67108863}m.words[v]=ee|0,g=k|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var N=function(d,m,x){var T=d.words,E=m.words,O=x.words,C=0,g,v,k,ee=T[0]|0,se=ee&8191,he=ee>>>13,ye=T[1]|0,Ee=ye&8191,Se=ye>>>13,Ge=T[2]|0,Ue=Ge&8191,lt=Ge>>>13,ht=T[3]|0,$e=ht&8191,mt=ht>>>13,_e=T[4]|0,ge=_e&8191,Ae=_e>>>13,We=T[5]|0,De=We&8191,Oe=We>>>13,Ie=T[6]|0,Fe=Ie&8191,ft=Ie>>>13,dt=T[7]|0,He=dt&8191,kt=dt>>>13,St=T[8]|0,et=St&8191,At=St>>>13,$t=T[9]|0,nt=$t&8191,Et=$t>>>13,Ot=E[0]|0,st=Ot&8191,jt=Ot>>>13,It=E[1]|0,it=It&8191,wt=It>>>13,Tt=E[2]|0,Ye=Tt&8191,gt=Tt>>>13,Pt=E[3]|0,ot=Pt&8191,_t=Pt>>>13,Ut=E[4]|0,j=Ut&8191,S=Ut>>>13,M=E[5]|0,B=M&8191,K=M>>>13,Z=E[6]|0,re=Z&8191,Be=Z>>>13,rt=E[7]|0,Ne=rt&8191,z=rt>>>13,oe=E[8]|0,pe=oe&8191,je=oe>>>13,Ke=E[9]|0,Re=Ke&8191,ze=Ke>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(se,st),v=Math.imul(se,jt),v=v+Math.imul(he,st)|0,k=Math.imul(he,jt);var ut=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(ut>>>26)|0,ut&=67108863,g=Math.imul(Ee,st),v=Math.imul(Ee,jt),v=v+Math.imul(Se,st)|0,k=Math.imul(Se,jt),g=g+Math.imul(se,it)|0,v=v+Math.imul(se,wt)|0,v=v+Math.imul(he,it)|0,k=k+Math.imul(he,wt)|0;var Jt=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,jt),v=v+Math.imul(lt,st)|0,k=Math.imul(lt,jt),g=g+Math.imul(Ee,it)|0,v=v+Math.imul(Ee,wt)|0,v=v+Math.imul(Se,it)|0,k=k+Math.imul(Se,wt)|0,g=g+Math.imul(se,Ye)|0,v=v+Math.imul(se,gt)|0,v=v+Math.imul(he,Ye)|0,k=k+Math.imul(he,gt)|0;var Rt=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul($e,st),v=Math.imul($e,jt),v=v+Math.imul(mt,st)|0,k=Math.imul(mt,jt),g=g+Math.imul(Ue,it)|0,v=v+Math.imul(Ue,wt)|0,v=v+Math.imul(lt,it)|0,k=k+Math.imul(lt,wt)|0,g=g+Math.imul(Ee,Ye)|0,v=v+Math.imul(Ee,gt)|0,v=v+Math.imul(Se,Ye)|0,k=k+Math.imul(Se,gt)|0,g=g+Math.imul(se,ot)|0,v=v+Math.imul(se,_t)|0,v=v+Math.imul(he,ot)|0,k=k+Math.imul(he,_t)|0;var Bt=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,g=Math.imul(ge,st),v=Math.imul(ge,jt),v=v+Math.imul(Ae,st)|0,k=Math.imul(Ae,jt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,wt)|0,v=v+Math.imul(mt,it)|0,k=k+Math.imul(mt,wt)|0,g=g+Math.imul(Ue,Ye)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(lt,Ye)|0,k=k+Math.imul(lt,gt)|0,g=g+Math.imul(Ee,ot)|0,v=v+Math.imul(Ee,_t)|0,v=v+Math.imul(Se,ot)|0,k=k+Math.imul(Se,_t)|0,g=g+Math.imul(se,j)|0,v=v+Math.imul(se,S)|0,v=v+Math.imul(he,j)|0,k=k+Math.imul(he,S)|0;var ir=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(De,st),v=Math.imul(De,jt),v=v+Math.imul(Oe,st)|0,k=Math.imul(Oe,jt),g=g+Math.imul(ge,it)|0,v=v+Math.imul(ge,wt)|0,v=v+Math.imul(Ae,it)|0,k=k+Math.imul(Ae,wt)|0,g=g+Math.imul($e,Ye)|0,v=v+Math.imul($e,gt)|0,v=v+Math.imul(mt,Ye)|0,k=k+Math.imul(mt,gt)|0,g=g+Math.imul(Ue,ot)|0,v=v+Math.imul(Ue,_t)|0,v=v+Math.imul(lt,ot)|0,k=k+Math.imul(lt,_t)|0,g=g+Math.imul(Ee,j)|0,v=v+Math.imul(Ee,S)|0,v=v+Math.imul(Se,j)|0,k=k+Math.imul(Se,S)|0,g=g+Math.imul(se,B)|0,v=v+Math.imul(se,K)|0,v=v+Math.imul(he,B)|0,k=k+Math.imul(he,K)|0;var Sr=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,g=Math.imul(Fe,st),v=Math.imul(Fe,jt),v=v+Math.imul(ft,st)|0,k=Math.imul(ft,jt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(Oe,it)|0,k=k+Math.imul(Oe,wt)|0,g=g+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,gt)|0,v=v+Math.imul(Ae,Ye)|0,k=k+Math.imul(Ae,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,_t)|0,v=v+Math.imul(mt,ot)|0,k=k+Math.imul(mt,_t)|0,g=g+Math.imul(Ue,j)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(lt,j)|0,k=k+Math.imul(lt,S)|0,g=g+Math.imul(Ee,B)|0,v=v+Math.imul(Ee,K)|0,v=v+Math.imul(Se,B)|0,k=k+Math.imul(Se,K)|0,g=g+Math.imul(se,re)|0,v=v+Math.imul(se,Be)|0,v=v+Math.imul(he,re)|0,k=k+Math.imul(he,Be)|0;var or=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(or>>>26)|0,or&=67108863,g=Math.imul(He,st),v=Math.imul(He,jt),v=v+Math.imul(kt,st)|0,k=Math.imul(kt,jt),g=g+Math.imul(Fe,it)|0,v=v+Math.imul(Fe,wt)|0,v=v+Math.imul(ft,it)|0,k=k+Math.imul(ft,wt)|0,g=g+Math.imul(De,Ye)|0,v=v+Math.imul(De,gt)|0,v=v+Math.imul(Oe,Ye)|0,k=k+Math.imul(Oe,gt)|0,g=g+Math.imul(ge,ot)|0,v=v+Math.imul(ge,_t)|0,v=v+Math.imul(Ae,ot)|0,k=k+Math.imul(Ae,_t)|0,g=g+Math.imul($e,j)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,j)|0,k=k+Math.imul(mt,S)|0,g=g+Math.imul(Ue,B)|0,v=v+Math.imul(Ue,K)|0,v=v+Math.imul(lt,B)|0,k=k+Math.imul(lt,K)|0,g=g+Math.imul(Ee,re)|0,v=v+Math.imul(Ee,Be)|0,v=v+Math.imul(Se,re)|0,k=k+Math.imul(Se,Be)|0,g=g+Math.imul(se,Ne)|0,v=v+Math.imul(se,z)|0,v=v+Math.imul(he,Ne)|0,k=k+Math.imul(he,z)|0;var Yt=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(et,st),v=Math.imul(et,jt),v=v+Math.imul(At,st)|0,k=Math.imul(At,jt),g=g+Math.imul(He,it)|0,v=v+Math.imul(He,wt)|0,v=v+Math.imul(kt,it)|0,k=k+Math.imul(kt,wt)|0,g=g+Math.imul(Fe,Ye)|0,v=v+Math.imul(Fe,gt)|0,v=v+Math.imul(ft,Ye)|0,k=k+Math.imul(ft,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,_t)|0,v=v+Math.imul(Oe,ot)|0,k=k+Math.imul(Oe,_t)|0,g=g+Math.imul(ge,j)|0,v=v+Math.imul(ge,S)|0,v=v+Math.imul(Ae,j)|0,k=k+Math.imul(Ae,S)|0,g=g+Math.imul($e,B)|0,v=v+Math.imul($e,K)|0,v=v+Math.imul(mt,B)|0,k=k+Math.imul(mt,K)|0,g=g+Math.imul(Ue,re)|0,v=v+Math.imul(Ue,Be)|0,v=v+Math.imul(lt,re)|0,k=k+Math.imul(lt,Be)|0,g=g+Math.imul(Ee,Ne)|0,v=v+Math.imul(Ee,z)|0,v=v+Math.imul(Se,Ne)|0,k=k+Math.imul(Se,z)|0,g=g+Math.imul(se,pe)|0,v=v+Math.imul(se,je)|0,v=v+Math.imul(he,pe)|0,k=k+Math.imul(he,je)|0;var yr=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(yr>>>26)|0,yr&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,jt),v=v+Math.imul(Et,st)|0,k=Math.imul(Et,jt),g=g+Math.imul(et,it)|0,v=v+Math.imul(et,wt)|0,v=v+Math.imul(At,it)|0,k=k+Math.imul(At,wt)|0,g=g+Math.imul(He,Ye)|0,v=v+Math.imul(He,gt)|0,v=v+Math.imul(kt,Ye)|0,k=k+Math.imul(kt,gt)|0,g=g+Math.imul(Fe,ot)|0,v=v+Math.imul(Fe,_t)|0,v=v+Math.imul(ft,ot)|0,k=k+Math.imul(ft,_t)|0,g=g+Math.imul(De,j)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,j)|0,k=k+Math.imul(Oe,S)|0,g=g+Math.imul(ge,B)|0,v=v+Math.imul(ge,K)|0,v=v+Math.imul(Ae,B)|0,k=k+Math.imul(Ae,K)|0,g=g+Math.imul($e,re)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(mt,re)|0,k=k+Math.imul(mt,Be)|0,g=g+Math.imul(Ue,Ne)|0,v=v+Math.imul(Ue,z)|0,v=v+Math.imul(lt,Ne)|0,k=k+Math.imul(lt,z)|0,g=g+Math.imul(Ee,pe)|0,v=v+Math.imul(Ee,je)|0,v=v+Math.imul(Se,pe)|0,k=k+Math.imul(Se,je)|0,g=g+Math.imul(se,Re)|0,v=v+Math.imul(se,ze)|0,v=v+Math.imul(he,Re)|0,k=k+Math.imul(he,ze)|0;var Nn=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,wt),v=v+Math.imul(Et,it)|0,k=Math.imul(Et,wt),g=g+Math.imul(et,Ye)|0,v=v+Math.imul(et,gt)|0,v=v+Math.imul(At,Ye)|0,k=k+Math.imul(At,gt)|0,g=g+Math.imul(He,ot)|0,v=v+Math.imul(He,_t)|0,v=v+Math.imul(kt,ot)|0,k=k+Math.imul(kt,_t)|0,g=g+Math.imul(Fe,j)|0,v=v+Math.imul(Fe,S)|0,v=v+Math.imul(ft,j)|0,k=k+Math.imul(ft,S)|0,g=g+Math.imul(De,B)|0,v=v+Math.imul(De,K)|0,v=v+Math.imul(Oe,B)|0,k=k+Math.imul(Oe,K)|0,g=g+Math.imul(ge,re)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(Ae,re)|0,k=k+Math.imul(Ae,Be)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,z)|0,v=v+Math.imul(mt,Ne)|0,k=k+Math.imul(mt,z)|0,g=g+Math.imul(Ue,pe)|0,v=v+Math.imul(Ue,je)|0,v=v+Math.imul(lt,pe)|0,k=k+Math.imul(lt,je)|0,g=g+Math.imul(Ee,Re)|0,v=v+Math.imul(Ee,ze)|0,v=v+Math.imul(Se,Re)|0,k=k+Math.imul(Se,ze)|0;var Wr=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,g=Math.imul(nt,Ye),v=Math.imul(nt,gt),v=v+Math.imul(Et,Ye)|0,k=Math.imul(Et,gt),g=g+Math.imul(et,ot)|0,v=v+Math.imul(et,_t)|0,v=v+Math.imul(At,ot)|0,k=k+Math.imul(At,_t)|0,g=g+Math.imul(He,j)|0,v=v+Math.imul(He,S)|0,v=v+Math.imul(kt,j)|0,k=k+Math.imul(kt,S)|0,g=g+Math.imul(Fe,B)|0,v=v+Math.imul(Fe,K)|0,v=v+Math.imul(ft,B)|0,k=k+Math.imul(ft,K)|0,g=g+Math.imul(De,re)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(Oe,re)|0,k=k+Math.imul(Oe,Be)|0,g=g+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,z)|0,v=v+Math.imul(Ae,Ne)|0,k=k+Math.imul(Ae,z)|0,g=g+Math.imul($e,pe)|0,v=v+Math.imul($e,je)|0,v=v+Math.imul(mt,pe)|0,k=k+Math.imul(mt,je)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,ze)|0,v=v+Math.imul(lt,Re)|0,k=k+Math.imul(lt,ze)|0;var Dn=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,_t),v=v+Math.imul(Et,ot)|0,k=Math.imul(Et,_t),g=g+Math.imul(et,j)|0,v=v+Math.imul(et,S)|0,v=v+Math.imul(At,j)|0,k=k+Math.imul(At,S)|0,g=g+Math.imul(He,B)|0,v=v+Math.imul(He,K)|0,v=v+Math.imul(kt,B)|0,k=k+Math.imul(kt,K)|0,g=g+Math.imul(Fe,re)|0,v=v+Math.imul(Fe,Be)|0,v=v+Math.imul(ft,re)|0,k=k+Math.imul(ft,Be)|0,g=g+Math.imul(De,Ne)|0,v=v+Math.imul(De,z)|0,v=v+Math.imul(Oe,Ne)|0,k=k+Math.imul(Oe,z)|0,g=g+Math.imul(ge,pe)|0,v=v+Math.imul(ge,je)|0,v=v+Math.imul(Ae,pe)|0,k=k+Math.imul(Ae,je)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,ze)|0,v=v+Math.imul(mt,Re)|0,k=k+Math.imul(mt,ze)|0;var Li=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Li>>>26)|0,Li&=67108863,g=Math.imul(nt,j),v=Math.imul(nt,S),v=v+Math.imul(Et,j)|0,k=Math.imul(Et,S),g=g+Math.imul(et,B)|0,v=v+Math.imul(et,K)|0,v=v+Math.imul(At,B)|0,k=k+Math.imul(At,K)|0,g=g+Math.imul(He,re)|0,v=v+Math.imul(He,Be)|0,v=v+Math.imul(kt,re)|0,k=k+Math.imul(kt,Be)|0,g=g+Math.imul(Fe,Ne)|0,v=v+Math.imul(Fe,z)|0,v=v+Math.imul(ft,Ne)|0,k=k+Math.imul(ft,z)|0,g=g+Math.imul(De,pe)|0,v=v+Math.imul(De,je)|0,v=v+Math.imul(Oe,pe)|0,k=k+Math.imul(Oe,je)|0,g=g+Math.imul(ge,Re)|0,v=v+Math.imul(ge,ze)|0,v=v+Math.imul(Ae,Re)|0,k=k+Math.imul(Ae,ze)|0;var Fi=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(Et,B)|0,k=Math.imul(Et,K),g=g+Math.imul(et,re)|0,v=v+Math.imul(et,Be)|0,v=v+Math.imul(At,re)|0,k=k+Math.imul(At,Be)|0,g=g+Math.imul(He,Ne)|0,v=v+Math.imul(He,z)|0,v=v+Math.imul(kt,Ne)|0,k=k+Math.imul(kt,z)|0,g=g+Math.imul(Fe,pe)|0,v=v+Math.imul(Fe,je)|0,v=v+Math.imul(ft,pe)|0,k=k+Math.imul(ft,je)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,ze)|0,v=v+Math.imul(Oe,Re)|0,k=k+Math.imul(Oe,ze)|0;var $n=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+($n>>>26)|0,$n&=67108863,g=Math.imul(nt,re),v=Math.imul(nt,Be),v=v+Math.imul(Et,re)|0,k=Math.imul(Et,Be),g=g+Math.imul(et,Ne)|0,v=v+Math.imul(et,z)|0,v=v+Math.imul(At,Ne)|0,k=k+Math.imul(At,z)|0,g=g+Math.imul(He,pe)|0,v=v+Math.imul(He,je)|0,v=v+Math.imul(kt,pe)|0,k=k+Math.imul(kt,je)|0,g=g+Math.imul(Fe,Re)|0,v=v+Math.imul(Fe,ze)|0,v=v+Math.imul(ft,Re)|0,k=k+Math.imul(ft,ze)|0;var Ui=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,z),v=v+Math.imul(Et,Ne)|0,k=Math.imul(Et,z),g=g+Math.imul(et,pe)|0,v=v+Math.imul(et,je)|0,v=v+Math.imul(At,pe)|0,k=k+Math.imul(At,je)|0,g=g+Math.imul(He,Re)|0,v=v+Math.imul(He,ze)|0,v=v+Math.imul(kt,Re)|0,k=k+Math.imul(kt,ze)|0;var zi=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+(zi>>>26)|0,zi&=67108863,g=Math.imul(nt,pe),v=Math.imul(nt,je),v=v+Math.imul(Et,pe)|0,k=Math.imul(Et,je),g=g+Math.imul(et,Re)|0,v=v+Math.imul(et,ze)|0,v=v+Math.imul(At,Re)|0,k=k+Math.imul(At,ze)|0;var $=(C+g|0)+((v&8191)<<13)|0;C=(k+(v>>>13)|0)+($>>>26)|0,$&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,ze),v=v+Math.imul(Et,Re)|0,k=Math.imul(Et,ze);var H=(C+g|0)+((v&8191)<<13)|0;return C=(k+(v>>>13)|0)+(H>>>26)|0,H&=67108863,O[0]=ut,O[1]=Jt,O[2]=Rt,O[3]=Bt,O[4]=ir,O[5]=Sr,O[6]=or,O[7]=Yt,O[8]=yr,O[9]=Nn,O[10]=Wr,O[11]=Dn,O[12]=Li,O[13]=Fi,O[14]=$n,O[15]=Ui,O[16]=zi,O[17]=$,O[18]=H,C!==0&&(O[19]=C,x.length++),x};Math.imul||(N=R);function F(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,T=0,E=0;E<m.length-1;E++){var O=T;T=0;for(var C=x&67108863,g=Math.min(E,d.length-1),v=Math.max(0,E-p.length+1);v<=g;v++){var k=E-v,ee=p.words[k]|0,se=d.words[v]|0,he=ee*se,ye=he&67108863;O=O+(he/67108864|0)|0,ye=ye+C|0,C=ye&67108863,O=O+(ye>>>26)|0,T+=O>>>26,O&=67108863}m.words[E]=C,x=O,O=T}return x!==0?m.words[E]=x:m.length--,m._strip()}function L(p,d,m){return F(p,d,m)}o.prototype.mulTo=function(d,m){var x,T=this.length+d.length;return this.length===10&&d.length===10?x=N(this,d,m):T<63?x=R(this,d,m):T<1024?x=F(this,d,m):x=L(this,d,m),x},o.prototype.mul=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),this.mulTo(d,m)},o.prototype.mulf=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),L(this,d,m)},o.prototype.imul=function(d){return this.clone().mulTo(d,this)},o.prototype.imuln=function(d){var m=d<0;m&&(d=-d),i(typeof d=="number"),i(d<67108864);for(var x=0,T=0;T<this.length;T++){var E=(this.words[T]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[T]=O&67108863}return x!==0&&(this.words[T]=x,this.length++),m?this.ineg():this},o.prototype.muln=function(d){return this.clone().imuln(d)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(d){var m=P(d);if(m.length===0)return new o(1);for(var x=this,T=0;T<m.length&&m[T]===0;T++,x=x.sqr());if(++T<m.length)for(var E=x.sqr();T<m.length;T++,E=E.sqr())m[T]!==0&&(x=x.mul(E));return x},o.prototype.iushln=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,T=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var C=this.words[E]&T,g=(this.words[E]|0)-C<<m;this.words[E]=g|O,O=C>>>26-m}O&&(this.words[E]=O,this.length++)}if(x!==0){for(E=this.length-1;E>=0;E--)this.words[E+x]=this.words[E];for(E=0;E<x;E++)this.words[E]=0;this.length+=x}return this._strip()},o.prototype.ishln=function(d){return i(this.negative===0),this.iushln(d)},o.prototype.iushrn=function(d,m,x){i(typeof d=="number"&&d>=0);var T;m?T=(m-m%26)/26:T=0;var E=d%26,O=Math.min((d-E)/26,this.length),C=67108863^67108863>>>E<<E,g=x;if(T-=O,T=Math.max(0,T),g){for(var v=0;v<O;v++)g.words[v]=this.words[v];g.length=O}if(O!==0)if(this.length>O)for(this.length-=O,v=0;v<this.length;v++)this.words[v]=this.words[v+O];else this.words[0]=0,this.length=1;var k=0;for(v=this.length-1;v>=0&&(k!==0||v>=T);v--){var ee=this.words[v]|0;this.words[v]=k<<26-E|ee>>>E,k=ee&C}return g&&k!==0&&(g.words[g.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(d,m,x){return i(this.negative===0),this.iushrn(d,m,x)},o.prototype.shln=function(d){return this.clone().ishln(d)},o.prototype.ushln=function(d){return this.clone().iushln(d)},o.prototype.shrn=function(d){return this.clone().ishrn(d)},o.prototype.ushrn=function(d){return this.clone().iushrn(d)},o.prototype.testn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,T=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&T)},o.prototype.imaskn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(m!==0&&x++,this.length=Math.min(x,this.length),m!==0){var T=67108863^67108863>>>m<<m;this.words[this.length-1]&=T}return this._strip()},o.prototype.maskn=function(d){return this.clone().imaskn(d)},o.prototype.iaddn=function(d){return i(typeof d=="number"),i(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<=d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},o.prototype._iaddn=function(d){this.words[0]+=d;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(d){if(i(typeof d=="number"),i(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this._strip()},o.prototype.addn=function(d){return this.clone().iaddn(d)},o.prototype.subn=function(d){return this.clone().isubn(d)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(d,m,x){var T=d.length+x,E;this._expand(T);var O,C=0;for(E=0;E<d.length;E++){O=(this.words[E+x]|0)+C;var g=(d.words[E]|0)*m;O-=g&67108863,C=(O>>26)-(g/67108864|0),this.words[E+x]=O&67108863}for(;E<this.length-x;E++)O=(this.words[E+x]|0)+C,C=O>>26,this.words[E+x]=O&67108863;if(C===0)return this._strip();for(i(C===-1),C=0,E=0;E<this.length;E++)O=-(this.words[E]|0)+C,C=O>>26,this.words[E]=O&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,m){var x=this.length-d.length,T=this.clone(),E=d,O=E.words[E.length-1]|0,C=this._countBits(O);x=26-C,x!==0&&(E=E.ushln(x),T.iushln(x),O=E.words[E.length-1]|0);var g=T.length-E.length,v;if(m!=="mod"){v=new o(null),v.length=g+1,v.words=new Array(v.length);for(var k=0;k<v.length;k++)v.words[k]=0}var ee=T.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(T=ee,v&&(v.words[g]=1));for(var se=g-1;se>=0;se--){var he=(T.words[E.length+se]|0)*67108864+(T.words[E.length+se-1]|0);for(he=Math.min(he/O|0,67108863),T._ishlnsubmul(E,he,se);T.negative!==0;)he--,T.negative=0,T._ishlnsubmul(E,1,se),T.isZero()||(T.negative^=1);v&&(v.words[se]=he)}return v&&v._strip(),T._strip(),m!=="div"&&x!==0&&T.iushrn(x),{div:v||null,mod:T}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var T,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(T=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:T,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(T=O.div.neg()),{div:T,mod:O.mod}):this.negative&d.negative?(O=this.neg().divmod(d.neg(),m),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.isub(d)),{div:O.div,mod:E}):d.length>this.length||this.cmp(d)<0?{div:new o(0),mod:this}:d.length===1?m==="div"?{div:this.divn(d.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new o(this.modrn(d.words[0]))}:this._wordDiv(d,m)},o.prototype.div=function(d){return this.divmod(d,"div",!1).div},o.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},o.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},o.prototype.divRound=function(d){var m=this.divmod(d);if(m.mod.isZero())return m.div;var x=m.div.negative!==0?m.mod.isub(d):m.mod,T=d.ushrn(1),E=d.andln(1),O=x.cmp(T);return O<0||E===1&&O===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=(1<<26)%d,T=0,E=this.length-1;E>=0;E--)T=(x*T+(this.words[E]|0))%d;return m?-T:T},o.prototype.modn=function(d){return this.modrn(d)},o.prototype.idivn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=0,T=this.length-1;T>=0;T--){var E=(this.words[T]|0)+x*67108864;this.words[T]=E/d|0,x=E%d}return this._strip(),m?this.ineg():this},o.prototype.divn=function(d){return this.clone().idivn(d)},o.prototype.egcd=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var T=new o(1),E=new o(0),O=new o(0),C=new o(1),g=0;m.isEven()&&x.isEven();)m.iushrn(1),x.iushrn(1),++g;for(var v=x.clone(),k=m.clone();!m.isZero();){for(var ee=0,se=1;!(m.words[0]&se)&&ee<26;++ee,se<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(T.isOdd()||E.isOdd())&&(T.iadd(v),E.isub(k)),T.iushrn(1),E.iushrn(1);for(var he=0,ye=1;!(x.words[0]&ye)&&he<26;++he,ye<<=1);if(he>0)for(x.iushrn(he);he-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(v),C.isub(k)),O.iushrn(1),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),T.isub(O),E.isub(C)):(x.isub(m),O.isub(T),C.isub(E))}return{a:O,b:C,gcd:x.iushln(g)}},o.prototype._invmp=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var T=new o(1),E=new o(0),O=x.clone();m.cmpn(1)>0&&x.cmpn(1)>0;){for(var C=0,g=1;!(m.words[0]&g)&&C<26;++C,g<<=1);if(C>0)for(m.iushrn(C);C-- >0;)T.isOdd()&&T.iadd(O),T.iushrn(1);for(var v=0,k=1;!(x.words[0]&k)&&v<26;++v,k<<=1);if(v>0)for(x.iushrn(v);v-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);m.cmp(x)>=0?(m.isub(x),T.isub(E)):(x.isub(m),E.isub(T))}var ee;return m.cmpn(1)===0?ee=T:ee=E,ee.cmpn(0)<0&&ee.iadd(d),ee},o.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var m=this.clone(),x=d.clone();m.negative=0,x.negative=0;for(var T=0;m.isEven()&&x.isEven();T++)m.iushrn(1),x.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;x.isEven();)x.iushrn(1);var E=m.cmp(x);if(E<0){var O=m;m=x,x=O}else if(E===0||x.cmpn(1)===0)break;m.isub(x)}while(!0);return x.iushln(T)},o.prototype.invm=function(d){return this.egcd(d).a.umod(d)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(d){return this.words[0]&d},o.prototype.bincn=function(d){i(typeof d=="number");var m=d%26,x=(d-m)/26,T=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=T,this;for(var E=T,O=x;E!==0&&O<this.length;O++){var C=this.words[O]|0;C+=E,E=C>>>26,C&=67108863,this.words[O]=C}return E!==0&&(this.words[O]=E,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(d){var m=d<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var x;if(this.length>1)x=1;else{m&&(d=-d),i(d<=67108863,"Number is too big");var T=this.words[0]|0;x=T===d?0:T<d?-1:1}return this.negative!==0?-x|0:x},o.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var m=this.ucmp(d);return this.negative!==0?-m|0:m},o.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var m=0,x=this.length-1;x>=0;x--){var T=this.words[x]|0,E=d.words[x]|0;if(T!==E){T<E?m=-1:T>E&&(m=1);break}}return m},o.prototype.gtn=function(d){return this.cmpn(d)===1},o.prototype.gt=function(d){return this.cmp(d)===1},o.prototype.gten=function(d){return this.cmpn(d)>=0},o.prototype.gte=function(d){return this.cmp(d)>=0},o.prototype.ltn=function(d){return this.cmpn(d)===-1},o.prototype.lt=function(d){return this.cmp(d)===-1},o.prototype.lten=function(d){return this.cmpn(d)<=0},o.prototype.lte=function(d){return this.cmp(d)<=0},o.prototype.eqn=function(d){return this.cmpn(d)===0},o.prototype.eq=function(d){return this.cmp(d)===0},o.red=function(d){return new V(d)},o.prototype.toRed=function(d){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(d){return this.red=d,this},o.prototype.forceRed=function(d){return i(!this.red,"Already a number in reduction context"),this._forceRed(d)},o.prototype.redAdd=function(d){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},o.prototype.redIAdd=function(d){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},o.prototype.redSub=function(d){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},o.prototype.redISub=function(d){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},o.prototype.redShl=function(d){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},o.prototype.redMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},o.prototype.redIMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(d){return i(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var G={k256:null,p224:null,p192:null,p25519:null};function q(p,d){this.name=p,this.p=new o(d,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}q.prototype._tmp=function(){var d=new o(null);return d.words=new Array(Math.ceil(this.n/13)),d},q.prototype.ireduce=function(d){var m=d,x;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),x=m.bitLength();while(x>this.n);var T=x<this.n?-1:m.ucmp(this.p);return T===0?(m.words[0]=0,m.length=1):T>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},q.prototype.split=function(d,m){d.iushrn(this.n,0,m)},q.prototype.imulK=function(d){return d.imul(this.k)};function X(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(X,q),X.prototype.split=function(d,m){for(var x=4194303,T=Math.min(d.length,9),E=0;E<T;E++)m.words[E]=d.words[E];if(m.length=T,d.length<=9){d.words[0]=0,d.length=1;return}var O=d.words[9];for(m.words[m.length++]=O&x,E=10;E<d.length;E++){var C=d.words[E]|0;d.words[E-10]=(C&x)<<4|O>>>22,O=C}O>>>=22,d.words[E-10]=O,O===0&&d.length>10?d.length-=10:d.length-=9},X.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var m=0,x=0;x<d.length;x++){var T=d.words[x]|0;m+=T*977,d.words[x]=m&67108863,m=T*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function ie(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ie,q);function ae(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(ae,q);function ce(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(ce,q),ce.prototype.imulK=function(d){for(var m=0,x=0;x<d.length;x++){var T=(d.words[x]|0)*19+m,E=T&67108863;T>>>=26,d.words[x]=E,m=T}return m!==0&&(d.words[d.length++]=m),d},o._prime=function(d){if(G[d])return G[d];var m;if(d==="k256")m=new X;else if(d==="p224")m=new ie;else if(d==="p192")m=new ae;else if(d==="p25519")m=new ce;else throw new Error("Unknown prime "+d);return G[d]=m,m};function V(p){if(typeof p=="string"){var d=o._prime(p);this.m=d.p,this.prime=d}else i(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}V.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},V.prototype._verify2=function(d,m){i((d.negative|m.negative)===0,"red works only with positives"),i(d.red&&d.red===m.red,"red works only with red numbers")},V.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},V.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},V.prototype.add=function(d,m){this._verify2(d,m);var x=d.add(m);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},V.prototype.iadd=function(d,m){this._verify2(d,m);var x=d.iadd(m);return x.cmp(this.m)>=0&&x.isub(this.m),x},V.prototype.sub=function(d,m){this._verify2(d,m);var x=d.sub(m);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},V.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},V.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},V.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},V.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},V.prototype.isqr=function(d){return this.imul(d,d.clone())},V.prototype.sqr=function(d){return this.mul(d,d)},V.prototype.sqrt=function(d){if(d.isZero())return d.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var x=this.m.add(new o(1)).iushrn(2);return this.pow(d,x)}for(var T=this.m.subn(1),E=0;!T.isZero()&&T.andln(1)===0;)E++,T.iushrn(1);i(!T.isZero());var O=new o(1).toRed(this),C=O.redNeg(),g=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new o(2*v*v).toRed(this);this.pow(v,g).cmp(C)!==0;)v.redIAdd(C);for(var k=this.pow(v,T),ee=this.pow(d,T.addn(1).iushrn(1)),se=this.pow(d,T),he=E;se.cmp(O)!==0;){for(var ye=se,Ee=0;ye.cmp(O)!==0;Ee++)ye=ye.redSqr();i(Ee<he);var Se=this.pow(k,new o(1).iushln(he-Ee-1));ee=ee.redMul(Se),k=Se.redSqr(),se=se.redMul(k),he=Ee}return ee},V.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},V.prototype.pow=function(d,m){if(m.isZero())return new o(1).toRed(this);if(m.cmpn(1)===0)return d.clone();var x=4,T=new Array(1<<x);T[0]=new o(1).toRed(this),T[1]=d;for(var E=2;E<T.length;E++)T[E]=this.mul(T[E-1],d);var O=T[0],C=0,g=0,v=m.bitLength()%26;for(v===0&&(v=26),E=m.length-1;E>=0;E--){for(var k=m.words[E],ee=v-1;ee>=0;ee--){var se=k>>ee&1;if(O!==T[0]&&(O=this.sqr(O)),se===0&&C===0){g=0;continue}C<<=1,C|=se,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,T[C]),g=0,C=0)}v=26}return O},V.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},V.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new D(d)};function D(p){V.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(D,V),D.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},D.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},D.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var x=d.imul(m),T=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(T).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),T=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(T).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),No=9e15,Qi=1e9,tp="0123456789abcdef",Lu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Fu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",rp={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-No,maxE:No,crypto:!1},P_,Oi,at=!0,Uu="[DecimalError] ",es=Uu+"Invalid argument: ",k_=Uu+"Precision limit exceeded",j_=Uu+"crypto unavailable",R_="[object Decimal]",Ar=Math.floor,pr=Math.pow,a9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,c9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,u9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,N_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Mn=1e7,Ze=7,l9=9007199254740991,f9=Lu.length-1,np=Fu.length-1,be={toStringTag:R_};be.absoluteValue=be.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)},be.ceil=function(){return Xe(new this.constructor(this),this.e+1,2)},be.clampedTo=be.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(es+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},be.comparedTo=be.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},be.cosine=be.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ze,n.rounding=1,r=d9(n,U_(n,r)),n.precision=e,n.rounding=t,Xe(Oi==2||Oi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},be.cubeRoot=be.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(at=!1,s=l.s*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=br(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Ar((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=qt(u.plus(l).times(a),u.plus(c),o+2,1),br(a.d).slice(0,o)===(r=br(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Xe(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Xe(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return at=!0,Xe(n,e,f.rounding,t)},be.decimalPlaces=be.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ar(this.e/Ze))*Ze,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},be.dividedBy=be.div=function(e){return qt(this,new this.constructor(e))},be.dividedToIntegerBy=be.divToInt=function(e){var t=this,r=t.constructor;return Xe(qt(t,new r(e),0,1,1),r.precision,r.rounding)},be.equals=be.eq=function(e){return this.cmp(e)===0},be.floor=function(){return Xe(new this.constructor(this),this.e+1,3)},be.greaterThan=be.gt=function(e){return this.cmp(e)>0},be.greaterThanOrEqualTo=be.gte=function(e){var t=this.cmp(e);return t==1||t===0},be.hyperbolicCosine=be.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/Wu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Do(o,1,s.times(t),new o(1),!0);for(var c,u=e,l=new o(8);u--;)c=s.times(s),s=a.minus(c.times(l.minus(c.times(l))));return Xe(s,o.precision=r,o.rounding=n,!0)},be.hyperbolicSine=be.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Do(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Wu(5,e)),i=Do(s,2,i,i,!0);for(var o,a=new s(5),c=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(a.plus(o.times(c.times(o).plus(u))))}return s.precision=t,s.rounding=r,Xe(i,t,r,!0)},be.hyperbolicTangent=be.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,qt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},be.inverseCosine=be.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?An(r,i,s):new r(0):new r(NaN):t.isZero()?An(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=An(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},be.inverseHyperbolicCosine=be.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},be.inverseHyperbolicSine=be.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln())},be.inverseHyperbolicTangent=be.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Xe(new s(i),e,t,!0):(s.precision=r=n-i.e,i=qt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},be.inverseSine=be.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=An(s,r+4,n).times(.5),e.s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},be.inverseTangent=be.atan=function(){var e,t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=np)return o=An(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=np)return o=An(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/Ze+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(at=!1,t=Math.ceil(a/Ze),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),at=!0,Xe(o,l.precision=f,l.rounding=h,!0)},be.isFinite=function(){return!!this.d},be.isInteger=be.isInt=function(){return!!this.d&&Ar(this.e/Ze)>this.d.length-2},be.isNaN=function(){return!this.s},be.isNegative=be.isNeg=function(){return this.s<0},be.isPositive=be.isPos=function(){return this.s>0},be.isZero=function(){return!!this.d&&this.d[0]===0},be.lessThan=be.lt=function(e){return this.cmp(e)<0},be.lessThanOrEqualTo=be.lte=function(e){return this.cmp(e)<1},be.logarithm=be.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(at=!1,a=f+y,o=rs(u,a),n=t?qu(l,a+10):rs(e,a),c=qt(o,n,a,1),Qa(c.d,i=f,h))do if(a+=10,o=rs(u,a),n=t?qu(l,a+10):rs(e,a),c=qt(o,n,a,1),!s){+br(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(Qa(c.d,i+=10,h));return at=!0,Xe(c,f,h)},be.minus=be.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return at?Xe(e,a,c):e}if(r=Ar(e.e/Ze),l=Ar(y.e/Ze),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Ze),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=Mn-1;--u[i],u[n]+=Mn}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Vu(u,r),at?Xe(e,a,c):e):new b(c===3?-0:0)},be.modulo=be.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Xe(new n(r),n.precision,n.rounding):(at=!1,n.modulo==9?(t=qt(r,e.abs(),0,3,1),t.s*=e.s):t=qt(r,e,0,n.modulo,1),t=t.times(e),at=!0,r.minus(t))},be.naturalExponential=be.exp=function(){return ip(this)},be.naturalLogarithm=be.ln=function(){return rs(this)},be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(e)},be.plus=be.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),at?Xe(e,a,c):e;if(s=Ar(f.e/Ze),n=Ar(e.e/Ze),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Ze),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/Mn|0,u[i]%=Mn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Vu(u,n),at?Xe(e,a,c):e},be.precision=be.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(es+e);return r.d?(t=D_(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},be.round=function(){var e=this,t=e.constructor;return Xe(new t(e),e.e+1,t.rounding)},be.sine=be.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ze,n.rounding=1,r=p9(n,U_(n,r)),n.precision=e,n.rounding=t,Xe(Oi>2?r.neg():r,e,t,!0)):new n(NaN)},be.squareRoot=be.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(at=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=br(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ar((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(s=n,n=s.plus(qt(o,s,r+2,1)).times(.5),br(s.d).slice(0,r)===(t=br(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Xe(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Xe(n,c+1,1),e=!n.times(n).eq(o));break}return at=!0,Xe(n,c,l.rounding,e)},be.tangent=be.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=qt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(Oi==2||Oi==4?r.neg():r,e,t,!0)):new n(NaN)},be.times=be.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Ar(l.e/Ze)+Ar(e.e/Ze),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%Mn|0,t=a/Mn|0;s[i]=(s[i]+t)%Mn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Vu(s,r),at?Xe(e,f.precision,f.rounding):e},be.toBinary=function(e,t){return op(this,2,e,t)},be.toDecimalPlaces=be.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Ur(e,0,Qi),t===void 0?t=n.rounding:Ur(t,0,8),Xe(r,e+r.e+1,t))},be.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,!0):(Ur(e,0,Qi),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e+1,t),r=ei(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},be.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=ei(i):(Ur(e,0,Qi),t===void 0?t=s.rounding:Ur(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=ei(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},be.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=D_(b)-y.e-1,o=s%Ze,t.d[0]=pr(10,o<0?Ze+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(es+a);e=a.gt(t)?s>0?t:u:a}for(at=!1,a=new w(br(b)),l=w.precision,w.precision=s=b.length*Ze*2;f=qt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=qt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=qt(u,n,s,1).minus(y).abs().cmp(qt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,at=!0,h},be.toHexadecimal=be.toHex=function(e,t){return op(this,16,e,t)},be.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:Ur(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(at=!1,r=qt(r,e,0,t,1).times(e),at=!0,Xe(r)):(e.s=r.s,r=e),r},be.toNumber=function(){return+this},be.toOctal=function(e,t){return op(this,8,e,t)},be.toPower=be.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(pr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Xe(a,n,s);if(t=Ar(e.e/Ze),t>=e.d.length-1&&(r=u<0?-u:u)<=l9)return i=$_(c,a,r,n),e.s<0?new c(1).div(i):Xe(i,n,s);if(o=a.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=pr(+a,u),t=r==0||!isFinite(r)?Ar(u*(Math.log("0."+br(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(at=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=ip(e.times(rs(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),Qa(i.d,n,s)&&(t=n+10,i=Xe(ip(e.times(rs(a,t+r)),t),t+5,1),+br(i.d).slice(n+1,n+15)+1==1e14&&(i=Xe(i,n+1,0)))),i.s=o,at=!0,c.rounding=s,Xe(i,n,s))},be.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ur(e,1,Qi),t===void 0?t=i.rounding:Ur(t,0,8),n=Xe(new i(n),e,t),r=ei(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},be.toSignificantDigits=be.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Ur(e,1,Qi),t===void 0?t=n.rounding:Ur(t,0,8)),Xe(new n(r),e,t)},be.toString=function(){var e=this,t=e.constructor,r=ei(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},be.truncated=be.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)},be.valueOf=be.toJSON=function(){var e=this,t=e.constructor,r=ei(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function br(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Ze-n.length,r&&(s+=ts(r)),s+=n;o=e[t],n=o+"",r=Ze-n.length,r&&(s+=ts(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Ur(e,t,r){if(e!==~~e||e<t||e>r)throw Error(es+e)}function Qa(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Ze,i=0):(i=Math.ceil((t+1)/Ze),t%=Ze),s=pr(10,Ze-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==pr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==pr(10,t-3)-1,o}function zu(e,t,r){for(var n,i=[0],s,o=0,a=e.length;o<a;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=tp.indexOf(e.charAt(o++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function d9(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Wu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Do(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var qt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,A,P,R,N,F,L,G,q,X,ie,ae,ce,V,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=Mn,y=Ze,l=Ar(n.e/y)-Ar(i.e/y)),ce=m.length,ie=d.length,P=new D(p),R=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=D.precision,o=D.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)R.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ie||h)&&G--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,N=d.slice(0,ce),F=N.length;F<ce;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,ce,F),u<0?(L=N[0],ce!=F&&(L=L*c+(N[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=N.length,u=t(w,N,A,F),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<F&&w.unshift(0),r(N,w,F,c),u==-1&&(F=N.length,u=t(m,N,ce,F),u<1&&(h++,r(N,ce<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[F++]=d[X]||0:(N=[d[X]],F=1);while((X++<ie||N[0]!==void 0)&&G--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,P_=b;else{for(f=1,h=R[0];h>=10;h/=10)f++;P.e=f+l*y-1,Xe(P,a?s+P.e+1:s,o,b)}return P}}();function Xe(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,a=f[0];a>=10;a/=10)i++;if(s=t-i,s<0)s+=Ze,o=t,l=f[h=0],c=l/pr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Ze),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Ze,o=s-Ze+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Ze,o=s-Ze+i,c=o<0?0:l/pr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%pr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/pr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=pr(10,(Ze-t%Ze)%Ze),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=pr(10,Ze-s),f[h]=o>0?(l/pr(10,i-o)%pr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==Mn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=Mn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return at&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ei(e,t,r){if(!e.isFinite())return F_(e);var n,i=e.e,s=br(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+ts(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+ts(-i-1)+s,r&&(n=r-o)>0&&(s+=ts(n))):i>=o?(s+=ts(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+ts(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=ts(n))),s}function Vu(e,t){var r=e[0];for(t*=Ze;r>=10;r/=10)t++;return t}function qu(e,t,r){if(t>f9)throw at=!0,r&&(e.precision=r),Error(k_);return Xe(new e(Lu),t,1,!0)}function An(e,t,r){if(t>np)throw Error(k_);return Xe(new e(Fu),t,r,!0)}function D_(e){var t=e.length-1,r=t*Ze+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function ts(e){for(var t="";e--;)t+="0";return t}function $_(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Ze+4);for(at=!1;;){if(r%2&&(s=s.times(t),z_(s.d,o)&&(i=!0)),r=Ar(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),z_(t.d,o)}return at=!0,s}function B_(e){return e.d[e.d.length-1]&1}function L_(e,t,r){for(var n,i=new e(t[0]),s=0;++s<t.length;)if(n=new e(t[s]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function ip(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(at=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(pr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Xe(s.times(e),c,1),r=r.times(++l),a=o.plus(qt(s,r,c,1)),br(a.d).slice(0,c)===br(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&Qa(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Xe(o,h.precision=b,y,at=!0);else return h.precision=b,o}o=a}}function rs(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(at=!1,l=N):l=t,P.precision=l+=b,r=br(A),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=br(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new P("0."+r),s++):w=new P(n+"."+r.slice(1))}else return u=qu(P,l+2,N).times(s+""),w=rs(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Xe(w,N,R,at=!0):w;for(f=w,c=o=w=qt(w.minus(1),w.plus(1),l,1),h=Xe(w.times(w),l,1),i=3;;){if(o=Xe(o.times(h),l,1),u=c.plus(qt(o,new P(i),l,1)),br(u.d).slice(0,l)===br(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(qu(P,l+2,N).times(s+""))),c=qt(c,new P(y),l,1),t==null)if(Qa(c.d,l-b,R,a))P.precision=l+=b,u=o=w=qt(f.minus(1),f.plus(1),l,1),h=Xe(w.times(w),l,1),i=a=1;else return Xe(c,P.precision=N,R,at=!0);else return P.precision=N,c;c=u,i+=2}}function F_(e){return String(e.s*e.s/0)}function sp(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ze,r<0&&(n+=Ze),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ze;n<i;)e.d.push(+t.slice(n,n+=Ze));t=t.slice(n),n=Ze-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),at&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function h9(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),N_.test(t))return sp(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(c9.test(t))r=16,t=t.toLowerCase();else if(a9.test(t))r=2;else if(u9.test(t))r=8;else throw Error(es+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=$_(n,new n(r),s,s*2)),u=zu(t,r,Mn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Vu(u,l),e.d=u,at=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?pr(2,c):ec.pow(2,c))),at=!0,e)}function p9(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Do(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Wu(5,r)),t=Do(e,2,t,t);for(var i,s=new e(5),o=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(a))));return t}function Do(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Ze);for(at=!1,c=r.times(r),a=new e(n);;){if(o=qt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=qt(o.times(c),new e(t++*t++),u,1),o=a.plus(n),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return at=!0,o.d.length=l+1,o}function Wu(e,t){for(var r=e;--t;)r*=e;return r}function U_(e,t){var r,n=t.s<0,i=An(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Oi=n?4:1,t;if(r=t.divToInt(i),r.isZero())Oi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Oi=B_(r)?n?2:3:n?4:1,t;Oi=B_(r)?n?1:4:n?3:2}return t.minus(i).abs()}function op(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Ur(r,1,Qi),n===void 0?n=y.rounding:Ur(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=F_(e);else{for(l=ei(e),o=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(l=l.replace(".",""),h=new y(1),h.e=l.length-o,h.d=zu(ei(h),10,i),h.e=h.d.length),f=zu(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=qt(e,h,r,n,0,i),f=e.d,s=e.e,u=P_),o=f[r],a=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>a||o===a&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++s,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=tp.charAt(f[o]);if(b){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=zu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=tp.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>c)for(s-=c;s--;)l+="0";else s<c&&(l=l.slice(0,s)+"."+l.slice(s))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function z_(e,t){if(e.length>t)return e.length=t,!0}function m9(e){return new this(e).abs()}function g9(e){return new this(e).acos()}function v9(e){return new this(e).acosh()}function y9(e,t){return new this(e).plus(t)}function b9(e){return new this(e).asin()}function w9(e){return new this(e).asinh()}function _9(e){return new this(e).atan()}function x9(e){return new this(e).atanh()}function S9(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=An(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?An(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=An(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(qt(e,t,s,1)),t=An(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(qt(e,t,s,1)),r}function E9(e){return new this(e).cbrt()}function C9(e){return Xe(e=new this(e),e.e+1,2)}function T9(e,t,r){return new this(e).clamp(t,r)}function M9(e){if(!e||typeof e!="object")throw Error(Uu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,Qi,"rounding",0,8,"toExpNeg",-No,0,"toExpPos",0,No,"maxE",0,No,"minE",-No,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=rp[r]),(n=e[r])!==void 0)if(Ar(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(es+r+": "+n);if(r="crypto",i&&(this[r]=rp[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(j_);else this[r]=!1;else throw Error(es+r+": "+n);return this}function A9(e){return new this(e).cos()}function O9(e){return new this(e).cosh()}function V_(e){var t,r,n;function i(s){var o,a,c,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,q_(s)){u.s=s.s,at?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;at?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return sp(u,s.toString())}else if(c!=="string")throw Error(es+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),N_.test(s)?sp(u,s):h9(u,s)}if(i.prototype=be,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=M9,i.clone=V_,i.isDecimal=q_,i.abs=m9,i.acos=g9,i.acosh=v9,i.add=y9,i.asin=b9,i.asinh=w9,i.atan=_9,i.atanh=x9,i.atan2=S9,i.cbrt=E9,i.ceil=C9,i.clamp=T9,i.cos=A9,i.cosh=O9,i.div=I9,i.exp=P9,i.floor=k9,i.hypot=j9,i.ln=R9,i.log=N9,i.log10=$9,i.log2=D9,i.max=B9,i.min=L9,i.mod=F9,i.mul=U9,i.pow=z9,i.random=V9,i.round=q9,i.sign=W9,i.sin=G9,i.sinh=H9,i.sqrt=K9,i.sub=X9,i.sum=J9,i.tan=Y9,i.tanh=Z9,i.trunc=Q9,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function I9(e,t){return new this(e).div(t)}function P9(e){return new this(e).exp()}function k9(e){return Xe(e=new this(e),e.e+1,3)}function j9(){var e,t,r=new this(0);for(at=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return at=!0,new this(1/0);r=t}return at=!0,r.sqrt()}function q_(e){return e instanceof ec||e&&e.toStringTag===R_||!1}function R9(e){return new this(e).ln()}function N9(e,t){return new this(e).log(t)}function D9(e){return new this(e).log(2)}function $9(e){return new this(e).log(10)}function B9(){return L_(this,arguments,"lt")}function L9(){return L_(this,arguments,"gt")}function F9(e,t){return new this(e).mod(t)}function U9(e,t){return new this(e).mul(t)}function z9(e,t){return new this(e).pow(t)}function V9(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Ur(e,1,Qi),n=Math.ceil(e/Ze),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(j_);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Ze,n&&e&&(i=pr(10,Ze-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ze)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ze&&(r-=Ze-n)}return o.e=r,o.d=a,o}function q9(e){return Xe(e=new this(e),e.e+1,this.rounding)}function W9(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function G9(e){return new this(e).sin()}function H9(e){return new this(e).sinh()}function K9(e){return new this(e).sqrt()}function X9(e,t){return new this(e).sub(t)}function J9(){var e=0,t=arguments,r=new this(t[e]);for(at=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return at=!0,Xe(r,this.precision,this.rounding)}function Y9(e){return new this(e).tan()}function Z9(e){return new this(e).tanh()}function Q9(e){return Xe(e=new this(e),e.e+1,1)}be[Symbol.for("nodejs.util.inspect.custom")]=be.toString,be[Symbol.toStringTag]="Decimal";var ec=be.constructor=V_(rp);Lu=new ec(Lu),Fu=new ec(Fu);var Gu=ec,ns=jo(Ro()),ap=jo(Ro()),eR=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet");this.slippage="900000000000000000",this.poolRegistry="0xfcc774493db2c45c79f688f88d28023a3e7d98e4ee9f48bbf5c7990f651577ae",this.protocolFeeVault="0xf194d9b1bcad972e45a7dd67dd49b3ee1e3357a00a50850c52cd51bb450e13b4",this.treasury="0x28e499dff5e864a2eafe476269a4f5035f1c16f338da7be18b103499abf271ce",this.insuranceFund="0xf0c40d67b078000e18032334c3325c47b9ec9f3d9ae4128be820d54663d14e3b",this.referrealVault="0x35d35b0e5b177593d8c3a801462485572fc30861e6ce96a55af6dc4730709278"}amountLimit(e){return new ap.default(e).mul(new ap.default(this.slippage)).div(new ap.default("1000000000000000000")).toString()}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.aftermathLpSupplyType==null)throw new Error("LP supply type not supported");const l=[t.object(r.id),t.object(this.poolRegistry),t.object(this.protocolFeeVault),t.object(this.treasury),t.object(this.insuranceFund),t.object(this.referrealVault),t.pure.u64(this.amountLimit(r.amountOut)),t.pure.u64(this.slippage),n];return t.moveCall({target:`${e.publishedAt()}::aftermath::${a}`,typeArguments:[c,u,r.extendedDetails.aftermathLpSupplyType],arguments:l})})}},W_="0x000000000000000000000000000000000000000000000000000000000000dee9",tR=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return xt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:W_,module:"custodian_v2"}}});if(i!=null&&i.data!=null){if(i.data.length!==0)return i.data[0].data.objectId;if(i.data.length<50)break}else break}return null})}getOrCreateAccountCap(e,t,r){return xt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${W_}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=yield this.getOrCreateAccountCap(t,e.client,e.signer),f=[t.object(r.id),n,l.accountCap,t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},rR=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n];return t.moveCall({target:`${e.publishedAt()}::kriya_amm::${a}`,typeArguments:[c,u],arguments:l})})}},nR=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n,t.object(this.version),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},iR=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.container),n];return t.moveCall({target:`${e.publishedAt()}::flowx_amm::${a}`,typeArguments:[c,u],arguments:l})})}},sR=class{constructor(e){if(e!==0)throw new Error("Flowx clmm only supported on mainnet");this.versioned="0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",this.poolRegistry="0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},oR=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.turbosFeeType==null)throw new Error("Turbos fee type not supported");const l=[t.object(r.id),n,t.object(ti),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},G_=class{constructor(e,t){this.globalConfig=e===0?"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f":"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",this.partner=t??(e===0?"0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b":"0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")}flash_swap(e,t,r,n){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["flash_swap_a2b",s,o]:["flash_swap_b2a",o,s];let l=n?r.amountIn:r.amountOut;const f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(l),t.pure.bool(n),t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:f});return{targetCoin:h[0],flashReceipt:h[1],payAmount:h[2]}}repay_flash_swap(e,t,r,n,i){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["repay_flash_swap_a2b",o,a]:["repay_flash_swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i];return t.moveCall({target:`${e.publishedAt()}::cetus::${c}`,typeArguments:[u,l],arguments:f})[0]}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function H_(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function aR(e){return e.split("::")[0]}function zs(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const c=zs(r),u=n9(r9({},c),{type_arguments:i.map(l=>zs(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>Vs.isSuiCoin(l)?l:zs(l).source_address),u.source_address=H_(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===X_||r===lR?"0x2":Qh.normalizeSuiObjectId(s[0]),module:s[1],name:s[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=H_(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function K_(e){return zs(e).source_address}var cR="0x2::coin::Coin",uR=/^0x2::coin::Coin<(.+)>$/,X_="0x2::sui::SUI",lR="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",Vs=class ws{static getCoinTypeArg(t){const r=t.type.match(uR);return r?r[1]:null}static isSUI(t){const r=ws.getCoinTypeArg(t);return r?ws.getCoinSymbol(r)==="SUI":!1}static getCoinSymbol(t){return t.substring(t.lastIndexOf(":")+1)}static getBalance(t){return BigInt(t.fields.balance)}static totalBalance(t,r){let n=BigInt(0);return t.forEach(i=>{r===i.coinAddress&&(n+=BigInt(i.balance))}),n}static getID(t){return t.fields.id.id}static getCoinTypeFromArg(t){return`${cR}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{K_(i.coinAddress)===K_(t)&&n.push(i)}),n}static isSuiCoin(t){return zs(t).full_address===X_}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=ws.selectCoinAssetGreaterThanOrEqual(t,r,n),s=i.selectedCoins.map(c=>c.coinObjectId),o=i.remainingCoins,a=i.selectedCoins.map(c=>c.balance.toString());return{objectArray:s,remainCoins:o,amountArray:a}}static selectCoinAssetGreaterThanOrEqual(t,r,n=[]){const i=ws.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=ws.calculateTotalBalance(i);if(s<r)return{selectedCoins:[],remainingCoins:i};if(s===r)return{selectedCoins:i,remainingCoins:[]};let o=BigInt(0);const a=[],c=[...i];for(;o<s;){const u=r-o,l=c.findIndex(h=>h.balance>=u);if(l!==-1){a.push(c[l]),c.splice(l,1);break}const f=c.pop();f.balance>0&&(a.push(f),o+=f.balance)}return{selectedCoins:ws.sortByBalance(a),remainingCoins:ws.sortByBalance(c)}}static sortByBalance(t){return t.sort((r,n)=>r.balance<n.balance?-1:r.balance>n.balance?1:0)}static sortByBalanceDes(t){return t.sort((r,n)=>r.balance>n.balance?-1:r.balance<n.balance?0:1)}static calculateTotalBalance(t){return t.reduce((r,n)=>r+n.balance,BigInt(0))}};function cp(e){switch(e){case 1e4:return"Calculate error";case 10001:return"Input number too large can not fit in target type";case 10002:return"No router";case 10003:return"Insufficient Liquidity";case 10004:return"Target token is detected as a HoneyPot scam";default:return"Unknown error"}}function is(e){const t=e.indexOf("::");if(t===-1)return e;const r=e.substring(0,t),n=e.substring(t);if(!r.startsWith("0x"))return e;const i=r.substring(2);return i.length>64?e:`0x${i.padStart(64,"0")}${n}`}function fR(e,t){e=is(e),t=is(t);const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]>t[n])return!0;if(e[n]<t[n])return!1}return!0}function J_(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function up(e,t,r,n){const i=Vs.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:J_(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(Vs.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(Vs.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=Vs.sortByBalance(i);o.slice(0,3).reduce((f,h)=>f+h.balance,BigInt(0))<BigInt(r)&&(o=Vs.sortByBalanceDes(i));let c=Vs.selectCoinObjectIdGreaterThanOrEqual(o,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(f=>e.object(f))),{targetCoin:e.object(u),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function dR(e,t=!0){return xt(this,null,function*(){console.log("inputs",e.getData().inputs),e.getData().commands.forEach((r,n)=>{t&&console.log(`transaction ${n}: `,JSON.stringify(r,null,2))})})}function hR(e){return!(!e.startsWith("0x")||e.length!==66)}var $o=jo(Ro()),ss=jo(Ro()),tc=jo(Ro()),Ii=new tc.default(0);new tc.default(1);var pR=new tc.default(2);pR.pow(new tc.default(128));var mR=new tc.default("18446744073709551615"),on=1e9;function gR(e,t,r){let n=Ii;return t?n=e.mul(new ss.default(on-r*on)).div(new ss.default(on)):n=e.mul(new ss.default(on+r*on)).div(new ss.default(on)),Number(n.toString())}function vR(e,t,r){let n=Ii;return t?n=e.mul(new ss.default(on-r*on)).div(new ss.default(on)):n=e.mul(new ss.default(on+r*on)).div(new ss.default(on)),n}function yR(e,t,r){return new Gu(e).mul(Gu.pow(2,-64)).pow(2).mul(Gu.pow(10,t-r))}function bR(e,t,r,n){return xt(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,b=is(u),w=is(l),A=new Xj.Transaction,P=fR(b,w),R=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",N=P?b:w,F=P?w:b,L=[N,F];console.log("typeArguments",L,R);for(let C=0;C<y.length;C++){const g=[A.object(y[C]),A.pure.bool(P),A.pure.bool(h),A.pure.u64(f.toString())];A.moveCall({target:`${R}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!hR(r))throw new AggregateError("Aggregator package not set","InvalidWallet");dR(A);const G=yield e.devInspectTransactionBlock({transactionBlock:A,sender:r});if(G.error!=null)throw console.log("simulateRes.error",G.error),new AggregateError("Aggregator package not set","SimulateError");const q=(i=G.events)==null?void 0:i.filter(C=>C.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==y.length)throw new AggregateError("Simulate event result error","simulateEventError");let X=h?Ii:mR,ie=0;for(let C=0;C<q.length;C+=1)if(!q[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new $o.BN(q[C].parsedJson.data.amount_out);g.gt(X)&&(ie=C,X=g)}else{const g=new $o.BN(q[C].parsedJson.data.amount_out);g.lt(X)&&(ie=C,X=g)}const ae=q[ie].parsedJson.data;console.log("event",JSON.stringify(ae,null,2));const ce=ae.step_results[0].current_sqrt_price,[V,D]=yield Promise.all([e.getCoinMetadata({coinType:N}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:F}).then(C=>C==null?void 0:C.decimals)]);if(V==null||D==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=yR(ce,V,D),d=Number(ae.fee_rate)/1e6,m=new $o.BN((s=ae.amount_in)!=null?s:0),x=new $o.BN((o=ae.fee_amount)!=null?o:0),T=m.add(x),E={amountIn:T,amountOut:new $o.BN((a=ae.amount_out)!=null?a:0),routes:[{path:[{id:y[ie],direction:P,provider:"CETUS",from:b,target:w,feeRate:d,amountIn:ae.amount_in,amountOut:ae.amount_out,extendedDetails:{afterSqrtPrice:ae.after_sqrt_price}}],amountIn:T,amountOut:new $o.BN((c=ae.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:ae.is_exceed,routeData:E}})}var wR=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Haedal not support b2a swap");const s="swap_a2b",o=[t.object(r.id),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::haedal::${s}`,typeArguments:[],arguments:o})})}},_R=class{constructor(e){if(e!==0)throw new Error("Afsui only supported on mainnet");this.stakedSuiVault="0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d",this.safe="0xeb685899830dd5837b47007809c76d91a098d52aabbf61e8ac467c59e5cc4610",this.referVault="0x4ce9a19b594599536c53edb25d22532f82f18038dc8ef618afd00fbbfb9845ef",this.validator="0xd30018ec3f5ff1a3c75656abf927a87d7f0529e6dc89c7ddd1bd27ecb05e3db2"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Afsui not support b2a swap");const s="swap_a2b",o=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n];return t.moveCall({target:`${e.publishedAt()}::afsui::${s}`,typeArguments:[],arguments:o})})}},xR=class{constructor(e){if(e!==0)throw new Error("Volo only supported on mainnet");this.nativePool="0x7fa2faa111b8c65bea48a23049bfd81ca8f971a262d981dcd9a17c3825cb5baf",this.metadata="0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Volo not support b2a swap");const s="swap_a2b",o=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::volo::${s}`,typeArguments:[],arguments:o})})}},SR=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.dexInfo),n];return t.moveCall({target:`${e.publishedAt()}::bluemove::${a}`,typeArguments:[c,u],arguments:l})})}},ER=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return xt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];let f;i?f=i:f=J_(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},CR=class{constructor(e){if(e!==0)throw new Error("Scallop only supported on mainnet");this.version=e===0?"0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7":"0x0",this.market=e===0?"0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9":"0x0"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",s,o];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.scallopScoinTreasury==null)throw new Error("Scallop coin treasury not supported");const l=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},TR=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.liquid_staking_pool=e===0?"0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b":"0x0",this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c]=i?["swap_a2b",o]:["swap_b2a",s],u=[t.object(this.liquid_staking_pool),t.object(this.sui_system_state),n];return t.moveCall({target:`${e.publishedAtV2()}::suilend::${a}`,typeArguments:[c],arguments:u})})}},MR=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::bluefin::${a}`,typeArguments:[c,u],arguments:l})})}},AR=class{constructor(e,t){if(e===1){this.connection=new Bu.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new Bu.SuiPythClient(t,n,r)}else{this.connection=new Bu.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new Bu.SuiPythClient(t,n,r)}}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];let l,f;if(r.extendedDetails==null)throw new Error("Extended details not supported haedal pmm");if(!r.extendedDetails.haedalPmmBasePriceSeed||!r.extendedDetails.haedalPmmQuotePriceSeed)throw new Error("Base price seed or quote price seed not supported");l=r.extendedDetails.haedalPmmBasePriceSeed,f=r.extendedDetails.haedalPmmQuotePriceSeed;const h=[l,f],y=yield this.connection.getPriceFeedsUpdateData(h),b=yield this.pythClient.updatePriceFeeds(t,y,h),w=[t.object(r.id),t.object(b[0]),t.object(b[1]),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::haedalpmm::${a}`,typeArguments:[c,u],arguments:w})})}},Y_="CETUS",OR="DEEPBOOK",IR="KRIYA",PR="FLOWX",kR="FLOWXV3",jR="KRIYAV3",Z_="TURBOS",lp="AFTERMATH",RR="HAEDAL",NR="VOLO",DR="AFSUI",$R="BLUEMOVE",Q_="DEEPBOOKV3",ex="SCALLOP",BR="SUILEND",LR="BLUEFIN",tx="HAEDALPMM",FR="https://api-sui.cetus.zone/router_v2",UR=class{constructor(e,t,r,n){this.endpoint=e?VR(e):FR,this.client=r||new T_.SuiClient({url:T_.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return xt(this,null,function*(){if(this.signer==="")throw new Error("Signer is required, but not provided.");let r=null,n=50;if(!t){const s=this.allCoins.get(e);if(s)return s}const i=[];for(;;){const s=yield this.client.getCoins({owner:this.signer,coinType:e,cursor:r,limit:n});for(const o of s.data)i.push({coinAddress:zs(o.coinType).source_address,coinObjectId:o.coinObjectId,balance:BigInt(o.balance)});if(s.data.length<n)break;r=s.data[n-1].coinObjectId}return this.allCoins.set(e,i),i})}findRouters(e){return xt(this,null,function*(){return qR(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return xt(this,null,function*(){if(r.length===0)throw new Error("No router found");const o=r.map(h=>h.amountIn.toString()),a=r[0].path[0].from,c=r[0].path[r[0].path.length-1].target,u=e.splitCoins(t,o),l=[];for(let h=0;h<r.length;h++){if(r[h].path.length===0)throw new Error("Empty path");let y=u[h];for(const b of r[h].path)y=yield this.newDex(b.provider,i).swap(this,e,b,y,s);l.push(y)}return this.transferOrDestoryCoin(e,t,a),this.checkCoinThresholdAndMergeCoin(e,l,c,n)})}expectOutputSwap(e,t,r,n){return xt(this,null,function*(){const i=[],s=[],o=[],a=new G_(this.env,n);for(let u=0;u<r.length;u++){const l=r[u];for(let h=l.path.length-1;h>=0;h--){const y=l.path[h],b=a.flash_swap(this,e,y,!1);i.unshift(b.targetCoin),s.unshift(b.flashReceipt)}let f=t;for(let h=0;h<l.path.length;h++){const y=l.path[h],b=a.repay_flash_swap(this,e,y,f,s[h]);f=i[h],h===0?t=b:this.transferOrDestoryCoin(e,b,y.from),h===l.path.length-1&&o.push(f)}}const c=r[0].path[0].from;if(this.transferOrDestoryCoin(e,t,c),o.length>1){const u=e.makeMoveVec({elements:o.slice(1)});e.moveCall({target:`${Qh.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r[0].path[r[0].path.length-1].target],arguments:[o[0],u]})}return o[0]})}swapInPools(e){return xt(this,null,function*(){let t;try{t=yield bR(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return xt(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,byAmountIn:i,txb:s,partner:o,deepbookv3DeepFee:a}=e,c=t.reduce((y,b)=>y.add(b.amountIn),new ns.default(0)),u=t.reduce((y,b)=>y.add(b.amountOut),new ns.default(0)),l=vR(i?u:c,i,n);if(i)return yield this.expectInputSwap(s,r,t,l,o,a);const f=s.splitCoins(r,[l.toString()]);return this.transferOrDestoryCoin(s,r,t[0].path[0].from),yield this.expectOutputSwap(s,f[0],t,o)})}fastRouterSwap(e){return xt(this,null,function*(){const{routers:t,byAmountIn:r,slippage:n,txb:i,partner:s,isMergeTragetCoin:o,refreshAllCoins:a,payDeepFeeAmount:c}=e,u=t[0].path[0].from;let l=yield this.getCoins(u,a);const f=t[0].path[t[0].path.length-1].target,h=t.reduce((N,F)=>N.add(F.amountIn),new ns.default(0)),y=t.reduce((N,F)=>N.add(F.amountOut),new ns.default(0)),b=gR(r?y:h,r,n),A=up(i,l,BigInt((r?h:b).toString()),u);let P;if(c&&c>0){let N=yield this.getCoins(this.deepbookv3DeepFeeType());P=up(i,N,BigInt(c),this.deepbookv3DeepFeeType()).targetCoin}const R=yield this.routerSwap({routers:t,inputCoin:A.targetCoin,slippage:n,byAmountIn:r,txb:i,partner:s,deepbookv3DeepFee:P});if(o){let N=yield this.getCoins(f,a);const F=up(i,N,BigInt(0),f);i.mergeCoins(F.targetCoin,[R]),F.isMintZeroCoin&&this.transferOrDestoryCoin(i,F.targetCoin,f)}else this.transferOrDestoryCoin(i,R,f)})}publishedAt(){return this.env===0?"0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2(){return this.env===0?"0x347dd58bbd11cd82c8b386b344729717c04a998da73386e82a239cc196d5706b":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(e,t,r){e.moveCall({target:`${this.publishedAt()}::utils::transfer_or_destroy_coin`,typeArguments:[r],arguments:[t]})}checkCoinThresholdAndMergeCoin(e,t,r,n){let i=t[0];if(t.length>1){let s=e.makeMoveVec({elements:t.slice(1)});e.moveCall({target:`${Qh.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r],arguments:[t[0],s]}),i=t[0]}return e.moveCall({target:`${this.publishedAt()}::utils::check_coin_threshold`,typeArguments:[r],arguments:[i,e.pure.u64(n.toString())]}),i}newDex(e,t){switch(e){case Y_:return new G_(this.env,t);case OR:return new tR(this.env);case Q_:return new ER(this.env);case IR:return new rR(this.env);case jR:return new nR(this.env);case PR:return new iR(this.env);case kR:return new sR(this.env);case Z_:return new oR(this.env);case lp:return new eR(this.env);case RR:return new wR(this.env);case DR:return new _R(this.env);case NR:return new xR(this.env);case $R:return new SR(this.env);case ex:return new CR(this.env);case BR:return new TR(this.env);case LR:return new MR(this.env);case tx:return new AR(this.env,this.client);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return xt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return xt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return xt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return xt(this,null,function*(){const e=yield HR(this.endpoint);return e?e.data:null})}};function zR(e){let t=0;for(const n of e.routes)for(const i of n.path)i.extended_details&&i.extended_details.deepbookv3_deep_fee&&(t+=Number(i.extended_details.deepbookv3_deep_fee));return{amountIn:new ns.default(e.amount_in.toString()),amountOut:new ns.default(e.amount_out.toString()),insufficientLiquidity:!1,routes:e.routes.map(n=>({path:n.path.map(i=>{var s,o,a,c,u,l,f;let h;i.provider===lp&&(h=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let y;return(i.provider===Z_||i.provider===lp||i.provider===Y_||i.provider===Q_||i.provider===ex||i.provider===tx)&&(y={aftermathLpSupplyType:(s=i.extended_details)==null?void 0:s.aftermath_lp_supply_type,turbosFeeType:(o=i.extended_details)==null?void 0:o.turbos_fee_type,afterSqrtPrice:(a=i.extended_details)==null?void 0:a.after_sqrt_price,deepbookv3DeepFee:(c=i.extended_details)==null?void 0:c.deepbookv3_deep_fee,scallopScoinTreasury:(u=i.extended_details)==null?void 0:u.scallop_scoin_treasury,haedalPmmBasePriceSeed:(l=i.extended_details)==null?void 0:l.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(f=i.extended_details)==null?void 0:f.haedal_pmm_quote_price_seed}),{id:i.id,direction:i.direction,provider:i.provider,from:i.from,target:i.target,feeRate:i.fee_rate,amountIn:i.amount_in,amountOut:i.amount_out,extendedDetails:y,version:h}}),amountIn:new ns.default(n.amount_in.toString()),amountOut:new ns.default(n.amount_out.toString()),initialPrice:new Gu(n.initial_price.toString())})),totalDeepFee:t}}var ti="0x0000000000000000000000000000000000000000000000000000000000000006";jo(Ro());function VR(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function qR(e,t){return xt(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield GR(e,t):r=yield WR(e,t),!r)return null;if(!r.ok)return{amountIn:Ii,amountOut:Ii,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:cp(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:Ii,amountOut:Ii,routes:[],insufficientLiquidity:i,error:{code:10004,msg:cp(10004)}}:n.data!=null?zR(n.data):{amountIn:Ii,amountOut:Ii,routes:[],insufficientLiquidity:i,error:{code:10003,msg:cp(10003)}}})}function WR(e,t){return xt(this,null,function*(){try{const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l}=t,f=is(r),h=is(n);let y=`${e}/find_routes?from=${f}&target=${h}&amount=${i.toString()}&by_amount_in=${s}`;return o&&(y+=`&depth=${o}`),a&&(y+=`&split_algorithm=${a}`),c&&(y+=`&split_factor=${c}`),u&&(y+=`&split_count=${u}`),l&&l.length>0&&(y+=`&providers=${l.join(",")}`),y+="&v=1000316",yield fetch(y)}catch(r){return console.error(r),null}})}function GR(e,t){return xt(this,null,function*(){const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l,liquidityChanges:f}=t,h=is(r),y=is(n),b=`${e}/find_routes`,w=l==null?void 0:l.join(","),A={from:h,target:y,amount:Number(i.toString()),by_amount_in:s,depth:o,split_algorithm:a,split_factor:c,split_count:u,providers:w,liquidity_changes:f.map(P=>({pool:P.poolID,tick_lower:P.ticklower,tick_upper:P.tickUpper,delta_liquidity:P.deltaLiquidity}))};try{return yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}catch(P){return console.error("Error:",P),null}})}function HR(e){return xt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var rx=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(rx||{}),nx=UR,KR=rx,ix=aR,rc=zs;const sx="0x2::sui::SUI",XR="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function ox(e){return Or(e).full_address===sx}function ax(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function Or(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const u={...Or(r),type_arguments:i.map(l=>Or(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>ox(l)?l:Or(l).source_address),u.source_address=ax(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===sx||r===XR?"0x2":vi(s[0]),module:s[1],name:s[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=ax(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function JR(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const qs=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=vi(n);return t&&(i=JR(i)),`${i}::${r.join("::")}`};/*!
|
|
37
|
+
`):" "+Q2(s[0]):"as no adapter specified";throw new pt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Ph};function jh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Oo(null,e)}function t_(e){return jh(e),e.headers=Mn.from(e.headers),e.data=Oh.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),e_.getAdapter(e.adapter||Th.adapter)(e).then(function(n){return jh(e),n.data=Oh.call(e,e.transformResponse,n),n.headers=Mn.from(n.headers),n},function(n){return z2(n)||(jh(e),n&&n.response&&(n.response.data=Oh.call(e,e.transformResponse,n.response),n.response.headers=Mn.from(n.response.headers))),Promise.reject(n)})}const r_="1.7.9",Au={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Au[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const n_={};Au.transitional=function(t,r,n){function i(s,o){return"[Axios v"+r_+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(t===!1)throw new pt(i(o," has been removed"+(r?" in "+r:"")),pt.ERR_DEPRECATED);return r&&!n_[o]&&(n_[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,o,a):!0}},Au.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function fk(e,t,r){if(typeof e!="object")throw new pt("options must be an object",pt.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const s=n[i],o=t[s];if(o){const a=e[s],c=a===void 0||o(a,s,e);if(c!==!0)throw new pt("option "+s+" must be "+c,pt.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new pt("Unknown option "+s,pt.ERR_BAD_OPTION)}}var Ou={assertOptions:fk,validators:Au};const Qn=Ou.validators;class Iu{constructor(t){this.defaults=t,this.interceptors={request:new B2,response:new B2}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
38
|
+
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Fs(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&Ou.assertOptions(n,{silentJSONParsing:Qn.transitional(Qn.boolean),forcedJSONParsing:Qn.transitional(Qn.boolean),clarifyTimeoutError:Qn.transitional(Qn.boolean)},!1),i!=null&&(fe.isFunction(i)?r.paramsSerializer={serialize:i}:Ou.assertOptions(i,{encode:Qn.function,serialize:Qn.function},!0)),Ou.assertOptions(r,{baseUrl:Qn.spelling("baseURL"),withXsrfToken:Qn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),r.headers=Mn.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(r)===!1||(c=c&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let l,f=0,h;if(!c){const b=[t_.bind(this),void 0];for(b.unshift.apply(b,a),b.push.apply(b,u),h=b.length,l=Promise.resolve(r);f<h;)l=l.then(b[f++],b[f++]);return l}h=a.length;let y=r;for(f=0;f<h;){const b=a[f++],w=a[f++];try{y=b(y)}catch(A){w.call(this,A);break}}try{l=t_.call(this,y)}catch(b){return Promise.reject(b)}for(f=0,h=u.length;f<h;)l=l.then(u[f++],u[f++]);return l}getUri(t){t=Fs(this.defaults,t);const r=G2(t.baseURL,t.url);return $2(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){Iu.prototype[t]=function(r,n){return this.request(Fs(n||{},{method:t,url:r,data:(n||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function r(n){return function(s,o,a){return this.request(Fs(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Iu.prototype[t]=r(),Iu.prototype[t+"Form"]=r(!0)});var Pu=Iu;class kh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},t(function(s,o,a){n.reason||(n.reason=new Oo(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new kh(function(i){t=i}),cancel:t}}}var dk=kh;function hk(e){return function(r){return e.apply(null,r)}}function pk(e){return fe.isObject(e)&&e.isAxiosError===!0}const Nh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Nh).forEach(([e,t])=>{Nh[t]=e});var mk=Nh;function i_(e){const t=new Pu(e),r=_2(Pu.prototype.request,t);return fe.extend(r,Pu.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return i_(Fs(e,i))},r}const ur=i_(Th);ur.Axios=Pu,ur.CanceledError=Oo,ur.CancelToken=dk,ur.isCancel=z2,ur.VERSION=r_,ur.toFormData=xu,ur.AxiosError=pt,ur.Cancel=ur.CanceledError,ur.all=function(t){return Promise.all(t)},ur.spread=hk,ur.isAxiosError=pk,ur.mergeConfig=Fs,ur.AxiosHeaders=Mn,ur.formToJSON=e=>U2(fe.isHTMLForm(e)?new FormData(e):e),ur.getAdapter=e_.getAdapter,ur.HttpStatusCode=mk,ur.default=ur;var s_=ur,Rh={exports:{}},Yr={},o_={exports:{}};(function(e){function t(r){return r&&r.__esModule?r:{default:r}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(o_);var gk=o_.exports,Dh={exports:{}},$h={exports:{}},a_;function ju(){return a_||(a_=1,function(e){function t(r){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}($h)),$h.exports}var c_;function vk(){return c_||(c_=1,function(e){var t=ju().default;function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports.default=e.exports;var n,i={},s=Object.prototype,o=s.hasOwnProperty,a=Object.defineProperty||function(E,O,C){E[O]=C.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function h(E,O,C){return Object.defineProperty(E,O,{value:C,enumerable:!0,configurable:!0,writable:!0}),E[O]}try{h({},"")}catch{h=function(C,g,v){return C[g]=v}}function y(E,O,C,g){var v=O&&O.prototype instanceof U?O:U,j=Object.create(v.prototype),ee=new x(g||[]);return a(j,"_invoke",{value:D(E,C,ee)}),j}function b(E,O,C){try{return{type:"normal",arg:E.call(O,C)}}catch(g){return{type:"throw",arg:g}}}i.wrap=y;var w="suspendedStart",A="suspendedYield",P="executing",N="completed",R={};function U(){}function L(){}function G(){}var q={};h(q,u,function(){return this});var X=Object.getPrototypeOf,ie=X&&X(X(M([])));ie&&ie!==s&&o.call(ie,u)&&(q=ie);var ae=G.prototype=U.prototype=Object.create(q);function ce(E){["next","throw","return"].forEach(function(O){h(E,O,function(C){return this._invoke(O,C)})})}function V(E,O){function C(v,j,ee,se){var he=b(E[v],E,j);if(he.type!=="throw"){var ye=he.arg,Ee=ye.value;return Ee&&t(Ee)=="object"&&o.call(Ee,"__await")?O.resolve(Ee.__await).then(function(Se){C("next",Se,ee,se)},function(Se){C("throw",Se,ee,se)}):O.resolve(Ee).then(function(Se){ye.value=Se,ee(ye)},function(Se){return C("throw",Se,ee,se)})}se(he.arg)}var g;a(this,"_invoke",{value:function(j,ee){function se(){return new O(function(he,ye){C(j,ee,he,ye)})}return g=g?g.then(se,se):se()}})}function D(E,O,C){var g=w;return function(v,j){if(g===P)throw Error("Generator is already running");if(g===N){if(v==="throw")throw j;return{value:n,done:!0}}for(C.method=v,C.arg=j;;){var ee=C.delegate;if(ee){var se=p(ee,C);if(se){if(se===R)continue;return se}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(g===w)throw g=N,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);g=P;var he=b(E,O,C);if(he.type==="normal"){if(g=C.done?N:A,he.arg===R)continue;return{value:he.arg,done:C.done}}he.type==="throw"&&(g=N,C.method="throw",C.arg=he.arg)}}}function p(E,O){var C=O.method,g=E.iterator[C];if(g===n)return O.delegate=null,C==="throw"&&E.iterator.return&&(O.method="return",O.arg=n,p(E,O),O.method==="throw")||C!=="return"&&(O.method="throw",O.arg=new TypeError("The iterator does not provide a '"+C+"' method")),R;var v=b(g,E.iterator,O.arg);if(v.type==="throw")return O.method="throw",O.arg=v.arg,O.delegate=null,R;var j=v.arg;return j?j.done?(O[E.resultName]=j.value,O.next=E.nextLoc,O.method!=="return"&&(O.method="next",O.arg=n),O.delegate=null,R):j:(O.method="throw",O.arg=new TypeError("iterator result is not an object"),O.delegate=null,R)}function d(E){var O={tryLoc:E[0]};1 in E&&(O.catchLoc=E[1]),2 in E&&(O.finallyLoc=E[2],O.afterLoc=E[3]),this.tryEntries.push(O)}function m(E){var O=E.completion||{};O.type="normal",delete O.arg,E.completion=O}function x(E){this.tryEntries=[{tryLoc:"root"}],E.forEach(d,this),this.reset(!0)}function M(E){if(E||E===""){var O=E[u];if(O)return O.call(E);if(typeof E.next=="function")return E;if(!isNaN(E.length)){var C=-1,g=function v(){for(;++C<E.length;)if(o.call(E,C))return v.value=E[C],v.done=!1,v;return v.value=n,v.done=!0,v};return g.next=g}}throw new TypeError(t(E)+" is not iterable")}return L.prototype=G,a(ae,"constructor",{value:G,configurable:!0}),a(G,"constructor",{value:L,configurable:!0}),L.displayName=h(G,f,"GeneratorFunction"),i.isGeneratorFunction=function(E){var O=typeof E=="function"&&E.constructor;return!!O&&(O===L||(O.displayName||O.name)==="GeneratorFunction")},i.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,G):(E.__proto__=G,h(E,f,"GeneratorFunction")),E.prototype=Object.create(ae),E},i.awrap=function(E){return{__await:E}},ce(V.prototype),h(V.prototype,l,function(){return this}),i.AsyncIterator=V,i.async=function(E,O,C,g,v){v===void 0&&(v=Promise);var j=new V(y(E,O,C,g),v);return i.isGeneratorFunction(O)?j:j.next().then(function(ee){return ee.done?ee.value:j.next()})},ce(ae),h(ae,f,"Generator"),h(ae,u,function(){return this}),h(ae,"toString",function(){return"[object Generator]"}),i.keys=function(E){var O=Object(E),C=[];for(var g in O)C.push(g);return C.reverse(),function v(){for(;C.length;){var j=C.pop();if(j in O)return v.value=j,v.done=!1,v}return v.done=!0,v}},i.values=M,x.prototype={constructor:x,reset:function(O){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(m),!O)for(var C in this)C.charAt(0)==="t"&&o.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=n)},stop:function(){this.done=!0;var O=this.tryEntries[0].completion;if(O.type==="throw")throw O.arg;return this.rval},dispatchException:function(O){if(this.done)throw O;var C=this;function g(ye,Ee){return ee.type="throw",ee.arg=O,C.next=ye,Ee&&(C.method="next",C.arg=n),!!Ee}for(var v=this.tryEntries.length-1;v>=0;--v){var j=this.tryEntries[v],ee=j.completion;if(j.tryLoc==="root")return g("end");if(j.tryLoc<=this.prev){var se=o.call(j,"catchLoc"),he=o.call(j,"finallyLoc");if(se&&he){if(this.prev<j.catchLoc)return g(j.catchLoc,!0);if(this.prev<j.finallyLoc)return g(j.finallyLoc)}else if(se){if(this.prev<j.catchLoc)return g(j.catchLoc,!0)}else{if(!he)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return g(j.finallyLoc)}}}},abrupt:function(O,C){for(var g=this.tryEntries.length-1;g>=0;--g){var v=this.tryEntries[g];if(v.tryLoc<=this.prev&&o.call(v,"finallyLoc")&&this.prev<v.finallyLoc){var j=v;break}}j&&(O==="break"||O==="continue")&&j.tryLoc<=C&&C<=j.finallyLoc&&(j=null);var ee=j?j.completion:{};return ee.type=O,ee.arg=C,j?(this.method="next",this.next=j.finallyLoc,R):this.complete(ee)},complete:function(O,C){if(O.type==="throw")throw O.arg;return O.type==="break"||O.type==="continue"?this.next=O.arg:O.type==="return"?(this.rval=this.arg=O.arg,this.method="return",this.next="end"):O.type==="normal"&&C&&(this.next=C),R},finish:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.finallyLoc===O)return this.complete(g.completion,g.afterLoc),m(g),R}},catch:function(O){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc===O){var v=g.completion;if(v.type==="throw"){var j=v.arg;m(g)}return j}}throw Error("illegal catch attempt")},delegateYield:function(O,C,g){return this.delegate={iterator:M(O),resultName:C,nextLoc:g},this.method==="next"&&(this.arg=n),R}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Dh)),Dh.exports}var Bh,u_;function yk(){if(u_)return Bh;u_=1;var e=vk()();Bh=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Bh}var Lh={exports:{}},l_;function bk(){return l_||(l_=1,function(e){function t(n,i,s,o,a,c,u){try{var l=n[c](u),f=l.value}catch(h){return void s(h)}l.done?i(f):Promise.resolve(f).then(o,a)}function r(n){return function(){var i=this,s=arguments;return new Promise(function(o,a){var c=n.apply(i,s);function u(f){t(c,o,a,u,l,"next",f)}function l(f){t(c,o,a,u,l,"throw",f)}u(void 0)})}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Lh)),Lh.exports}var Uh={exports:{}},Fh={exports:{}},zh={exports:{}},f_;function wk(){return f_||(f_=1,function(e){var t=ju().default;function r(n,i){if(t(n)!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var o=s.call(n,i||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(zh)),zh.exports}var d_;function _k(){return d_||(d_=1,function(e){var t=ju().default,r=wk();function n(i){var s=r(i,"string");return t(s)=="symbol"?s:s+""}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Fh)),Fh.exports}var h_;function xk(){return h_||(h_=1,function(e){var t=_k();function r(n,i,s){return(i=t(i))in n?Object.defineProperty(n,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[i]=s,n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Uh)),Uh.exports}var Vh,p_;function Sk(){if(p_)return Vh;p_=1;const e=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);return Vh=t=>!e.has(t&&t.code),Vh}var Qa=gk;Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.isNetworkError=Gh,Yr.isRetryableError=Nu,Yr.isSafeRequestError=y_,Yr.isIdempotentRequestError=Hh,Yr.isNetworkOrIdempotentRequestError=Kh,Yr.exponentialDelay=b_,Yr.default=zs,Yr.DEFAULT_OPTIONS=Yr.namespace=void 0;var ku=Qa(yk()),Ek=Qa(ju()),m_=Qa(bk()),Ck=Qa(xk()),Mk=Qa(Sk());function g_(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?g_(Object(r),!0).forEach(function(n){(0,Ck.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Wh="axios-retry";Yr.namespace=Wh;function Gh(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,Mk.default)(e)}var v_=["get","head","options"],Tk=v_.concat(["put","delete"]);function Nu(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function y_(e){return e.config?Nu(e)&&v_.indexOf(e.config.method)!==-1:!1}function Hh(e){return e.config?Nu(e)&&Tk.indexOf(e.config.method)!==-1:!1}function Kh(e){return Gh(e)||Hh(e)}function Ak(){return 0}function b_(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,r=Math.pow(2,e)*t,n=r*.2*Math.random();return r+n}var w_={retries:3,retryCondition:Kh,retryDelay:Ak,shouldResetTimeout:!1,onRetry:function(){}};Yr.DEFAULT_OPTIONS=w_;function Ok(e,t){return qh(qh(qh({},w_),t),e[Wh])}function __(e,t){var r=Ok(e,t);return r.retryCount=r.retryCount||0,e[Wh]=r,r}function Ik(e,t){e.defaults.agent===t.agent&&delete t.agent,e.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,e.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}function Pk(e,t){return Xh.apply(this,arguments)}function Xh(){return Xh=(0,m_.default)(ku.default.mark(function e(t,r){var n,i,s,o;return ku.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(n=t.retries,i=t.retryCondition,s=t.retryCount<n&&i(r),(0,Ek.default)(s)!=="object"){c.next=13;break}return c.prev=3,c.next=6,s;case 6:return o=c.sent,c.abrupt("return",o!==!1);case 10:return c.prev=10,c.t0=c.catch(3),c.abrupt("return",!1);case 13:return c.abrupt("return",s);case 14:case"end":return c.stop()}},e,null,[[3,10]])})),Xh.apply(this,arguments)}function zs(e,t){var r=e.interceptors.request.use(function(i){var s=__(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,m_.default)(ku.default.mark(function s(o){var a,c,u,l,f,h,y,b;return ku.default.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:if(a=o.config,a){A.next=3;break}return A.abrupt("return",Promise.reject(o));case 3:return c=__(a,t),A.next=6,Pk(c,o);case 6:if(!A.sent){A.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),Ik(e,a),!(!l&&a.timeout&&c.lastRequestTime)){A.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){A.next=16;break}return A.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(P){return P}],A.next=20,f(c.retryCount,o,a);case 20:return A.abrupt("return",new Promise(function(P){return setTimeout(function(){return P(e(a))},h)}));case 21:return A.abrupt("return",Promise.reject(o));case 22:case"end":return A.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}zs.isNetworkError=Gh,zs.isSafeRequestError=y_,zs.isIdempotentRequestError=Hh,zs.isNetworkOrIdempotentRequestError=Kh,zs.exponentialDelay=b_,zs.isRetryableError=Nu;const x_=Yr.default;Rh.exports=x_,Rh.exports.default=x_;var jk=Rh.exports,Ru={},Io=null;typeof WebSocket<"u"?Io=WebSocket:typeof MozWebSocket<"u"?Io=MozWebSocket:typeof kr<"u"?Io=kr.WebSocket||kr.MozWebSocket:typeof window<"u"?Io=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Io=self.WebSocket||self.MozWebSocket);var kk=Io,Nk=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ru,"__esModule",{value:!0}),Ru.ResilientWebSocket=void 0;const Rk=Nk(kk),Dk=3e4+3e3;class $k{constructor(t,r){vt(this,"endpoint");vt(this,"wsClient");vt(this,"wsUserClosed");vt(this,"wsFailedAttempts");vt(this,"pingTimeout");vt(this,"logger");vt(this,"onError");vt(this,"onMessage");vt(this,"onReconnect");this.endpoint=t,this.logger=r,this.wsFailedAttempts=0,this.onError=n=>{var i;(i=this.logger)==null||i.error(n)},this.wsUserClosed=!0,this.onMessage=()=>{},this.onReconnect=()=>{}}async send(t){var r,n,i;(r=this.logger)==null||r.info(`Sending ${t}`),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0?(n=this.logger)==null||n.error("Couldn't connect to the websocket server. Error callback is called."):(i=this.wsClient)==null||i.send(t)}async startWebSocket(){var t;this.wsClient===void 0&&((t=this.logger)==null||t.info("Creating Web Socket client"),this.wsClient=new Rk.default(this.endpoint),this.wsUserClosed=!1,this.wsClient.onopen=()=>{this.wsFailedAttempts=0,this.wsClient.on!==void 0&&this.heartbeat()},this.wsClient.onerror=r=>{this.onError(r.error)},this.wsClient.onmessage=r=>{this.onMessage(r.data)},this.wsClient.onclose=async()=>{var r,n;if(this.pingTimeout!==void 0&&clearInterval(this.pingTimeout),this.wsUserClosed===!1){this.wsFailedAttempts+=1,this.wsClient=void 0;const i=Bk(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await S_(i),this.restartUnexpectedClosedWebsocket()}else(n=this.logger)==null||n.info("The connection has been closed successfully.")},this.wsClient.on!==void 0&&this.wsClient.on("ping",this.heartbeat.bind(this)))}heartbeat(){var t;(t=this.logger)==null||t.info("Heartbeat"),this.pingTimeout!==void 0&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n;(r=this.logger)==null||r.warn("Connection timed out. Reconnecting..."),(n=this.wsClient)==null||n.terminate(),this.restartUnexpectedClosedWebsocket()},Dk)}async waitForMaybeReadyWebSocket(){let t=0;for(;this.wsClient!==void 0&&this.wsClient.readyState!==this.wsClient.OPEN;)if(t>5e3){this.wsClient.close();return}else t+=10,await S_(10)}async restartUnexpectedClosedWebsocket(){var t;if(this.wsUserClosed!==!0){if(await this.startWebSocket(),await this.waitForMaybeReadyWebSocket(),this.wsClient===void 0){(t=this.logger)==null||t.error("Couldn't reconnect to websocket. Error callback is called.");return}this.onReconnect()}}closeWebSocket(){if(this.wsClient!==void 0){const t=this.wsClient;this.wsClient=void 0,t.close()}this.wsUserClosed=!0}}Ru.ResilientWebSocket=$k;async function S_(e){return new Promise(t=>setTimeout(t,e))}function Bk(e){return 2**e*100}var Po={};Object.defineProperty(Po,"__esModule",{value:!0}),Po.removeLeading0xIfExists=Po.makeWebsocketUrl=void 0;function Lk(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}Po.makeWebsocketUrl=Lk;function Uk(e){return e.startsWith("0x")?e.substring(2):e}Po.removeLeading0xIfExists=Uk;var E_=kr&&kr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mu,"__esModule",{value:!0}),mu.PriceServiceConnection=void 0;const Jh=lh,Fk=E_(s_),C_=E_(jk),zk=Ru,Yh=Po;class Vk{constructor(t,r){vt(this,"httpClient");vt(this,"priceFeedCallbacks");vt(this,"wsClient");vt(this,"wsEndpoint");vt(this,"logger");vt(this,"priceFeedRequestConfig");vt(this,"onWsError");var n,i,s;this.httpClient=Fk.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,C_.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:C_.default.exponentialDelay}),this.priceFeedRequestConfig={binary:(n=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:n.binary,verbose:((i=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:i.verbose)??(r==null?void 0:r.verbose),allowOutOfOrder:(s=r==null?void 0:r.priceFeedRequestConfig)==null?void 0:s.allowOutOfOrder},this.priceFeedCallbacks=new Map,this.logger=(r==null?void 0:r.logger)||{trace:()=>{},debug:()=>{},info:()=>{},warn:console.warn,error:console.error},this.onWsError=o=>{this.logger.error(o),typeof mn<"u"&&typeof mn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),mn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Yh.makeWebsocketUrl)(t)}async getLatestPriceFeeds(t){return t.length===0?[]:(await this.httpClient.get("/api/latest_price_feeds",{params:{ids:t,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}})).data.map(i=>Jh.PriceFeed.fromJson(i))}async getLatestVaas(t){return(await this.httpClient.get("/api/latest_vaas",{params:{ids:t}})).data}async getVaa(t,r){const n=await this.httpClient.get("/api/get_vaa",{params:{id:t,publish_time:r}});return[n.data.vaa,n.data.publishTime]}async getPriceFeed(t,r){const n=await this.httpClient.get("/api/get_price_feed",{params:{id:t,publish_time:r,verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary}});return Jh.PriceFeed.fromJson(n.data)}async getPriceFeedIds(){return(await this.httpClient.get("/api/price_feed_ids")).data}async subscribePriceFeedUpdates(t,r){var s;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(o=>(0,Yh.removeLeading0xIfExists)(o));const n=[];for(const o of t)this.priceFeedCallbacks.has(o)||(this.priceFeedCallbacks.set(o,new Set),n.push(o)),this.priceFeedCallbacks.get(o).add(r);const i={ids:n,type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};await((s=this.wsClient)==null?void 0:s.send(JSON.stringify(i)))}async unsubscribePriceFeedUpdates(t,r){var s;this.wsClient===void 0&&await this.startWebSocket(),t=t.map(o=>(0,Yh.removeLeading0xIfExists)(o));const n=[];for(const o of t)if(this.priceFeedCallbacks.has(o)){let a=!1;r===void 0?(this.priceFeedCallbacks.delete(o),a=!0):(this.priceFeedCallbacks.get(o).delete(r),this.priceFeedCallbacks.get(o).size===0&&(this.priceFeedCallbacks.delete(o),a=!0)),a&&n.push(o)}const i={ids:n,type:"unsubscribe"};await((s=this.wsClient)==null?void 0:s.send(JSON.stringify(i))),this.priceFeedCallbacks.size===0&&this.closeWebSocket()}async startWebSocket(){if(this.wsEndpoint===void 0)throw new Error("Websocket endpoint is undefined.");this.wsClient=new zk.ResilientWebSocket(this.wsEndpoint,this.logger),this.wsClient.onError=this.onWsError,this.wsClient.onReconnect=()=>{var t;if(this.priceFeedCallbacks.size>0){const r={ids:Array.from(this.priceFeedCallbacks.keys()),type:"subscribe",verbose:this.priceFeedRequestConfig.verbose,binary:this.priceFeedRequestConfig.binary,allow_out_of_order:this.priceFeedRequestConfig.allowOutOfOrder};this.logger.info("Resubscribing to existing price feeds."),(t=this.wsClient)==null||t.send(JSON.stringify(r))}},this.wsClient.onMessage=t=>{this.logger.info(`Received message ${t.toString()}`);let r;try{r=JSON.parse(t.toString())}catch(n){this.logger.error(`Error parsing message ${t.toString()} as JSON.`),this.logger.error(n),this.onWsError(n);return}if(r.type==="response")r.status==="error"&&(this.logger.error(`Error response from the websocket server ${r.error}.`),this.onWsError(new Error(r.error)));else if(r.type==="price_update"){let n;try{n=Jh.PriceFeed.fromJson(r.price_feed)}catch(i){this.logger.error(`Error parsing price feeds from message ${t.toString()}.`),this.logger.error(i),this.onWsError(i);return}if(this.priceFeedCallbacks.has(n.id))for(const i of this.priceFeedCallbacks.get(n.id))i(n)}else this.logger.warn(`Ignoring unsupported server response ${t.toString()}.`)},await this.wsClient.startWebSocket()}closeWebSocket(){var t;(t=this.wsClient)==null||t.closeWebSocket(),this.wsClient=void 0,this.priceFeedCallbacks.clear()}}mu.PriceServiceConnection=Vk,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=mu;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=lh;Object.defineProperty(e,"PriceFeedMetadata",{enumerable:!0,get:function(){return r.PriceFeedMetadata}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return r.PriceFeed}}),Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return r.Price}}),Object.defineProperty(e,"isAccumulatorUpdateData",{enumerable:!0,get:function(){return r.isAccumulatorUpdateData}}),Object.defineProperty(e,"parseAccumulatorUpdateData",{enumerable:!0,get:function(){return r.parseAccumulatorUpdateData}})}(uh),Object.defineProperty(pu,"__esModule",{value:!0}),pu.SuiPriceServiceConnection=void 0;const qk=uh,Wk=vu();class Gk extends qk.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>Wk.Buffer.from(n,"base64"))}}pu.SuiPriceServiceConnection=Gk;var Du={};Object.defineProperty(Du,"__esModule",{value:!0}),Du.SuiPythClient=void 0;const $u=Ty,jo=Gn,Hk=vu(),Zh=16*1024;class Kk{constructor(t,r,n){vt(this,"provider");vt(this,"pythStateId");vt(this,"wormholeStateId");vt(this,"pythPackageId");vt(this,"wormholePackageId");vt(this,"priceTableInfo");vt(this,"priceFeedObjectIdCache",new Map);vt(this,"baseUpdateFee");this.provider=t,this.pythStateId=r,this.wormholeStateId=n,this.pythPackageId=void 0,this.wormholePackageId=void 0}async getBaseUpdateFee(){if(this.baseUpdateFee===void 0){const t=await this.provider.getObject({id:this.pythStateId,options:{showContent:!0}});if(!t.data||!t.data.content||t.data.content.dataType!=="moveObject")throw new Error("Unable to fetch pyth state object");this.baseUpdateFee=t.data.content.fields.base_update_fee}return this.baseUpdateFee}async getPackageId(t){const r=await this.provider.getObject({id:t,options:{showContent:!0}}).then(n=>{var i,s,o;if(((s=(i=n.data)==null?void 0:i.content)==null?void 0:s.dataType)=="moveObject")return n.data.content.fields;throw console.log((o=n.data)==null?void 0:o.content),new Error(`Cannot fetch package id for object ${t}`)});if("upgrade_cap"in r)return r.upgrade_cap.fields.package;throw new Error("upgrade_cap not found")}async verifyVaas(t,r){const n=await this.getWormholePackageId(),i=[];for(const s of t){const[o]=r.moveCall({target:`${n}::vaa::parse_and_verify`,arguments:[r.object(this.wormholeStateId),r.pure(jo.bcs.vector(jo.bcs.U8).serialize(Array.from(s),{maxSize:Zh}).toBytes()),r.object($u.SUI_CLOCK_OBJECT_ID)]});i.push(o)}return i}async updatePriceFeeds(t,r,n){const i=await this.getPythPackageId();let s;if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const o=this.extractVaaBytesFromAccumulatorMessage(r[0]),a=await this.verifyVaas([o],t);[s]=t.moveCall({target:`${i}::pyth::create_authenticated_price_infos_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(jo.bcs.vector(jo.bcs.U8).serialize(Array.from(r[0]),{maxSize:Zh}).toBytes()),a[0],t.object($u.SUI_CLOCK_OBJECT_ID)]});const c=[],u=await this.getBaseUpdateFee(),l=t.splitCoins(t.gas,n.map(()=>t.pure.u64(u)));let f=0;for(const h of n){const y=await this.getPriceFeedObjectId(h);if(!y)throw new Error(`Price feed ${h} not found, please create it first`);c.push(y),[s]=t.moveCall({target:`${i}::pyth::update_single_price_feed`,arguments:[t.object(this.pythStateId),s,t.object(y),l[f],t.object($u.SUI_CLOCK_OBJECT_ID)]}),f++}return t.moveCall({target:`${i}::hot_potato_vector::destroy`,arguments:[s],typeArguments:[`${i}::price_info::PriceInfo`]}),c}async createPriceFeed(t,r){const n=await this.getPythPackageId();if(r.length>1)throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");const i=this.extractVaaBytesFromAccumulatorMessage(r[0]),s=await this.verifyVaas([i],t);t.moveCall({target:`${n}::pyth::create_price_feeds_using_accumulator`,arguments:[t.object(this.pythStateId),t.pure(jo.bcs.vector(jo.bcs.U8).serialize(Array.from(r[0]),{maxSize:Zh}).toBytes()),s[0],t.object($u.SUI_CLOCK_OBJECT_ID)]})}async getWormholePackageId(){return this.wormholePackageId||(this.wormholePackageId=await this.getPackageId(this.wormholeStateId)),this.wormholePackageId}async getPythPackageId(){return this.pythPackageId||(this.pythPackageId=await this.getPackageId(this.pythStateId)),this.pythPackageId}async getPriceFeedObjectId(t){const r=t.replace("0x","");if(!this.priceFeedObjectIdCache.has(r)){const{id:n,fieldType:i}=await this.getPriceTableInfo(),s=await this.provider.getDynamicFieldObject({parentId:n,name:{type:`${i}::price_identifier::PriceIdentifier`,value:{bytes:Array.from(Hk.Buffer.from(r,"hex"))}}});if(!s.data||!s.data.content)return;if(s.data.content.dataType!=="moveObject")throw new Error("Price feed type mismatch");this.priceFeedObjectIdCache.set(r,s.data.content.fields.value)}return this.priceFeedObjectIdCache.get(r)}async getPriceTableInfo(){if(this.priceTableInfo===void 0){const t=await this.provider.getDynamicFieldObject({parentId:this.pythStateId,name:{type:"vector<u8>",value:"price_info"}});if(!t.data||!t.data.type)throw new Error("Price Table not found, contract may not be initialized");let r=t.data.type.replace("0x2::table::Table<","");r=r.replace("::price_identifier::PriceIdentifier, 0x2::object::ID>",""),this.priceTableInfo={id:t.data.objectId,fieldType:r}}return this.priceTableInfo}extractVaaBytesFromAccumulatorMessage(t){const n=7+t.readUint8(6)+1,i=t.readUint16BE(n),s=n+2;return t.subarray(s,s+i)}}Du.SuiPythClient=Kk,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=pu;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=Du;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=uh;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})}(v2);var M_=pM,Qh=Ty,Xk=Mo,Bu=v2,Jk=Object.create,ep=Object.defineProperty,Yk=Object.defineProperties,Zk=Object.getOwnPropertyDescriptor,Qk=Object.getOwnPropertyDescriptors,T_=Object.getOwnPropertyNames,A_=Object.getOwnPropertySymbols,e9=Object.getPrototypeOf,O_=Object.prototype.hasOwnProperty,t9=Object.prototype.propertyIsEnumerable,I_=(e,t,r)=>t in e?ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,r9=(e,t)=>{for(var r in t||(t={}))O_.call(t,r)&&I_(e,r,t[r]);if(A_)for(var r of A_(t))t9.call(t,r)&&I_(e,r,t[r]);return e},n9=(e,t)=>Yk(e,Qk(t)),i9=(e=>typeof Fn<"u"?Fn:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Fn<"u"?Fn:t)[r]}):e)(function(e){if(typeof Fn<"u")return Fn.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),s9=(e,t)=>function(){return t||(0,e[T_(e)[0]])((t={exports:{}}).exports,t),t.exports},o9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of T_(t))!O_.call(e,i)&&i!==r&&ep(e,i,{get:()=>t[i],enumerable:!(n=Zk(t,i))||n.enumerable});return e},ko=(e,t,r)=>(r=e!=null?Jk(e9(e)):{},o9(!e||!e.__esModule?ep(r,"default",{value:e,enumerable:!0}):r,e)),xt=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{a(r.next(c))}catch(u){i(u)}},o=c=>{try{a(r.throw(c))}catch(u){i(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,o);a((r=r.apply(e,t)).next())}),No=s9({"node_modules/bn.js/lib/bn.js"(e,t){(function(r,n){function i(p,d){if(!p)throw new Error(d||"Assertion failed")}function s(p,d){p.super_=d;var m=function(){};m.prototype=d.prototype,p.prototype=new m,p.prototype.constructor=p}function o(p,d,m){if(o.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((d==="le"||d==="be")&&(m=d,d=10),this._init(p||0,d||10,m||"be"))}typeof r=="object"?r.exports=o:n.BN=o,o.BN=o,o.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=i9("buffer").Buffer}catch{}o.isBN=function(d){return d instanceof o?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===o.wordSize&&Array.isArray(d.words)},o.max=function(d,m){return d.cmp(m)>0?d:m},o.min=function(d,m){return d.cmp(m)<0?d:m},o.prototype._init=function(d,m,x){if(typeof d=="number")return this._initNumber(d,m,x);if(typeof d=="object")return this._initArray(d,m,x);m==="hex"&&(m=16),i(m===(m|0)&&m>=2&&m<=36),d=d.toString().replace(/\s+/g,"");var M=0;d[0]==="-"&&(M++,this.negative=1),M<d.length&&(m===16?this._parseHex(d,M,x):(this._parseBase(d,m,M),x==="le"&&this._initArray(this.toArray(),m,x)))},o.prototype._initNumber=function(d,m,x){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(i(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),m,x)},o.prototype._initArray=function(d,m,x){if(i(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var E,O,C=0;if(x==="be")for(M=d.length-1,E=0;M>=0;M-=3)O=d[M]|d[M-1]<<8|d[M-2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);else if(x==="le")for(M=0,E=0;M<d.length;M+=3)O=d[M]|d[M+1]<<8|d[M+2]<<16,this.words[E]|=O<<C&67108863,this.words[E+1]=O>>>26-C&67108863,C+=24,C>=26&&(C-=26,E++);return this._strip()};function c(p,d){var m=p.charCodeAt(d);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;i(!1,"Invalid character in "+p)}function u(p,d,m){var x=c(p,m);return m-1>=d&&(x|=c(p,m-1)<<4),x}o.prototype._parseHex=function(d,m,x){this.length=Math.ceil((d.length-m)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var E=0,O=0,C;if(x==="be")for(M=d.length-1;M>=m;M-=2)C=u(d,m,M)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8;else{var g=d.length-m;for(M=g%2===0?m+1:m;M<d.length;M+=2)C=u(d,m,M)<<E,this.words[O]|=C&67108863,E>=18?(E-=18,O+=1,this.words[O]|=C>>>26):E+=8}this._strip()};function l(p,d,m,x){for(var M=0,E=0,O=Math.min(p.length,m),C=d;C<O;C++){var g=p.charCodeAt(C)-48;M*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),M+=E}return M}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var M=0,E=1;E<=67108863;E*=m)M++;M--,E=E/m|0;for(var O=d.length-x,C=O%M,g=Math.min(O,O-C)+x,v=0,j=x;j<g;j+=M)v=l(d,j,j+M,m),this.imuln(E),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(C!==0){var ee=1;for(v=l(d,j,d.length,m),j=0;j<C;j++)ee*=m;this.imuln(ee),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},o.prototype.copy=function(d){d.words=new Array(this.length);for(var m=0;m<this.length;m++)d.words[m]=this.words[m];d.length=this.length,d.negative=this.negative,d.red=this.red};function f(p,d){p.words=d.words,p.length=d.length,p.negative=d.negative,p.red=d.red}if(o.prototype._move=function(d){f(d,this)},o.prototype.clone=function(){var d=new o(null);return this.copy(d),d},o.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],b=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(d,m){d=d||10,m=m|0||1;var x;if(d===16||d==="hex"){x="";for(var M=0,E=0,O=0;O<this.length;O++){var C=this.words[O],g=((C<<M|E)&16777215).toString(16);E=C>>>24-M&16777215,M+=2,M>=26&&(M-=26,O--),E!==0||O!==this.length-1?x=y[6-g.length]+g+x:x=g+x}for(E!==0&&(x=E.toString(16)+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(d===(d|0)&&d>=2&&d<=36){var v=b[d],j=w[d];x="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var se=ee.modrn(j).toString(d);ee=ee.idivn(j),ee.isZero()?x=se+x:x=y[v-se.length]+se+x}for(this.isZero()&&(x="0"+x);x.length%m!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(d,m){return this.toArrayLike(a,d,m)}),o.prototype.toArray=function(d,m){return this.toArrayLike(Array,d,m)};var A=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var M=this.byteLength(),E=x||Math.max(1,M);i(M<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=A(d,E),C=m==="le"?"LE":"BE";return this["_toArrayLike"+C](O,M),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;d[x++]=C&255,x<d.length&&(d[x++]=C>>8&255),x<d.length&&(d[x++]=C>>16&255),O===6?(x<d.length&&(d[x++]=C>>24&255),M=0,O=0):(M=C>>>24,O+=2)}if(x<d.length)for(d[x++]=M;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,M=0,E=0,O=0;E<this.length;E++){var C=this.words[E]<<O|M;d[x--]=C&255,x>=0&&(d[x--]=C>>8&255),x>=0&&(d[x--]=C>>16&255),O===6?(x>=0&&(d[x--]=C>>24&255),M=0,O=0):(M=C>>>24,O+=2)}if(x>=0)for(d[x--]=M;x>=0;)d[x--]=0},Math.clz32?o.prototype._countBits=function(d){return 32-Math.clz32(d)}:o.prototype._countBits=function(d){var m=d,x=0;return m>=4096&&(x+=13,m>>>=13),m>=64&&(x+=7,m>>>=7),m>=8&&(x+=4,m>>>=4),m>=2&&(x+=2,m>>>=2),x+m},o.prototype._zeroBits=function(d){if(d===0)return 26;var m=d,x=0;return m&8191||(x+=13,m>>>=13),m&127||(x+=7,m>>>=7),m&15||(x+=4,m>>>=4),m&3||(x+=2,m>>>=2),m&1||x++,x},o.prototype.bitLength=function(){var d=this.words[this.length-1],m=this._countBits(d);return(this.length-1)*26+m};function P(p){for(var d=new Array(p.bitLength()),m=0;m<d.length;m++){var x=m/26|0,M=m%26;d[m]=p.words[x]>>>M&1}return d}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,m=0;m<this.length;m++){var x=this._zeroBits(this.words[m]);if(d+=x,x!==26)break}return d},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},o.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]|d.words[m];return this._strip()},o.prototype.ior=function(d){return i((this.negative|d.negative)===0),this.iuor(d)},o.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},o.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},o.prototype.iuand=function(d){var m;this.length>d.length?m=d:m=this;for(var x=0;x<m.length;x++)this.words[x]=this.words[x]&d.words[x];return this.length=m.length,this._strip()},o.prototype.iand=function(d){return i((this.negative|d.negative)===0),this.iuand(d)},o.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},o.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},o.prototype.iuxor=function(d){var m,x;this.length>d.length?(m=this,x=d):(m=d,x=this);for(var M=0;M<x.length;M++)this.words[M]=m.words[M]^x.words[M];if(this!==m)for(;M<m.length;M++)this.words[M]=m.words[M];return this.length=m.length,this._strip()},o.prototype.ixor=function(d){return i((this.negative|d.negative)===0),this.iuxor(d)},o.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},o.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},o.prototype.inotn=function(d){i(typeof d=="number"&&d>=0);var m=Math.ceil(d/26)|0,x=d%26;this._expand(m),x>0&&m--;for(var M=0;M<m;M++)this.words[M]=~this.words[M]&67108863;return x>0&&(this.words[M]=~this.words[M]&67108863>>26-x),this._strip()},o.prototype.notn=function(d){return this.clone().inotn(d)},o.prototype.setn=function(d,m){i(typeof d=="number"&&d>=0);var x=d/26|0,M=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<M:this.words[x]=this.words[x]&~(1<<M),this._strip()},o.prototype.iadd=function(d){var m;if(this.negative!==0&&d.negative===0)return this.negative=0,m=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,m=this.isub(d),d.negative=1,m._normSign();var x,M;this.length>d.length?(x=this,M=d):(x=d,M=this);for(var E=0,O=0;O<M.length;O++)m=(x.words[O]|0)+(M.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;for(;E!==0&&O<x.length;O++)m=(x.words[O]|0)+E,this.words[O]=m&67108863,E=m>>>26;if(this.length=x.length,E!==0)this.words[this.length]=E,this.length++;else if(x!==this)for(;O<x.length;O++)this.words[O]=x.words[O];return this},o.prototype.add=function(d){var m;return d.negative!==0&&this.negative===0?(d.negative=0,m=this.sub(d),d.negative^=1,m):d.negative===0&&this.negative!==0?(this.negative=0,m=d.sub(this),this.negative=1,m):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},o.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var m=this.iadd(d);return d.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var x=this.cmp(d);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,E;x>0?(M=this,E=d):(M=d,E=this);for(var O=0,C=0;C<E.length;C++)m=(M.words[C]|0)-(E.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;for(;O!==0&&C<M.length;C++)m=(M.words[C]|0)+O,O=m>>26,this.words[C]=m&67108863;if(O===0&&C<M.length&&M!==this)for(;C<M.length;C++)this.words[C]=M.words[C];return this.length=Math.max(this.length,C),M!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(d){return this.clone().isub(d)};function N(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var M=p.words[0]|0,E=d.words[0]|0,O=M*E,C=O&67108863,g=O/67108864|0;m.words[0]=C;for(var v=1;v<x;v++){for(var j=g>>>26,ee=g&67108863,se=Math.min(v,d.length-1),he=Math.max(0,v-p.length+1);he<=se;he++){var ye=v-he|0;M=p.words[ye]|0,E=d.words[he]|0,O=M*E+ee,j+=O/67108864|0,ee=O&67108863}m.words[v]=ee|0,g=j|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var R=function(d,m,x){var M=d.words,E=m.words,O=x.words,C=0,g,v,j,ee=M[0]|0,se=ee&8191,he=ee>>>13,ye=M[1]|0,Ee=ye&8191,Se=ye>>>13,We=M[2]|0,Fe=We&8191,lt=We>>>13,ht=M[3]|0,$e=ht&8191,mt=ht>>>13,_e=M[4]|0,ge=_e&8191,Ae=_e>>>13,Ge=M[5]|0,De=Ge&8191,Oe=Ge>>>13,Ie=M[6]|0,Ue=Ie&8191,ft=Ie>>>13,dt=M[7]|0,He=dt&8191,jt=dt>>>13,St=M[8]|0,et=St&8191,At=St>>>13,$t=M[9]|0,nt=$t&8191,Et=$t>>>13,Ot=E[0]|0,st=Ot&8191,kt=Ot>>>13,It=E[1]|0,it=It&8191,wt=It>>>13,Mt=E[2]|0,Ye=Mt&8191,gt=Mt>>>13,Pt=E[3]|0,ot=Pt&8191,_t=Pt>>>13,Ft=E[4]|0,k=Ft&8191,S=Ft>>>13,T=E[5]|0,B=T&8191,K=T>>>13,Z=E[6]|0,re=Z&8191,Be=Z>>>13,rt=E[7]|0,Re=rt&8191,z=rt>>>13,oe=E[8]|0,pe=oe&8191,ke=oe>>>13,Ke=E[9]|0,Ne=Ke&8191,ze=Ke>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(se,st),v=Math.imul(se,kt),v=v+Math.imul(he,st)|0,j=Math.imul(he,kt);var ut=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ut>>>26)|0,ut&=67108863,g=Math.imul(Ee,st),v=Math.imul(Ee,kt),v=v+Math.imul(Se,st)|0,j=Math.imul(Se,kt),g=g+Math.imul(se,it)|0,v=v+Math.imul(se,wt)|0,v=v+Math.imul(he,it)|0,j=j+Math.imul(he,wt)|0;var Jt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(Fe,st),v=Math.imul(Fe,kt),v=v+Math.imul(lt,st)|0,j=Math.imul(lt,kt),g=g+Math.imul(Ee,it)|0,v=v+Math.imul(Ee,wt)|0,v=v+Math.imul(Se,it)|0,j=j+Math.imul(Se,wt)|0,g=g+Math.imul(se,Ye)|0,v=v+Math.imul(se,gt)|0,v=v+Math.imul(he,Ye)|0,j=j+Math.imul(he,gt)|0;var Nt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,g=Math.imul($e,st),v=Math.imul($e,kt),v=v+Math.imul(mt,st)|0,j=Math.imul(mt,kt),g=g+Math.imul(Fe,it)|0,v=v+Math.imul(Fe,wt)|0,v=v+Math.imul(lt,it)|0,j=j+Math.imul(lt,wt)|0,g=g+Math.imul(Ee,Ye)|0,v=v+Math.imul(Ee,gt)|0,v=v+Math.imul(Se,Ye)|0,j=j+Math.imul(Se,gt)|0,g=g+Math.imul(se,ot)|0,v=v+Math.imul(se,_t)|0,v=v+Math.imul(he,ot)|0,j=j+Math.imul(he,_t)|0;var Bt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,g=Math.imul(ge,st),v=Math.imul(ge,kt),v=v+Math.imul(Ae,st)|0,j=Math.imul(Ae,kt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,wt)|0,v=v+Math.imul(mt,it)|0,j=j+Math.imul(mt,wt)|0,g=g+Math.imul(Fe,Ye)|0,v=v+Math.imul(Fe,gt)|0,v=v+Math.imul(lt,Ye)|0,j=j+Math.imul(lt,gt)|0,g=g+Math.imul(Ee,ot)|0,v=v+Math.imul(Ee,_t)|0,v=v+Math.imul(Se,ot)|0,j=j+Math.imul(Se,_t)|0,g=g+Math.imul(se,k)|0,v=v+Math.imul(se,S)|0,v=v+Math.imul(he,k)|0,j=j+Math.imul(he,S)|0;var ir=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(ir>>>26)|0,ir&=67108863,g=Math.imul(De,st),v=Math.imul(De,kt),v=v+Math.imul(Oe,st)|0,j=Math.imul(Oe,kt),g=g+Math.imul(ge,it)|0,v=v+Math.imul(ge,wt)|0,v=v+Math.imul(Ae,it)|0,j=j+Math.imul(Ae,wt)|0,g=g+Math.imul($e,Ye)|0,v=v+Math.imul($e,gt)|0,v=v+Math.imul(mt,Ye)|0,j=j+Math.imul(mt,gt)|0,g=g+Math.imul(Fe,ot)|0,v=v+Math.imul(Fe,_t)|0,v=v+Math.imul(lt,ot)|0,j=j+Math.imul(lt,_t)|0,g=g+Math.imul(Ee,k)|0,v=v+Math.imul(Ee,S)|0,v=v+Math.imul(Se,k)|0,j=j+Math.imul(Se,S)|0,g=g+Math.imul(se,B)|0,v=v+Math.imul(se,K)|0,v=v+Math.imul(he,B)|0,j=j+Math.imul(he,K)|0;var Sr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,kt),v=v+Math.imul(ft,st)|0,j=Math.imul(ft,kt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(Oe,it)|0,j=j+Math.imul(Oe,wt)|0,g=g+Math.imul(ge,Ye)|0,v=v+Math.imul(ge,gt)|0,v=v+Math.imul(Ae,Ye)|0,j=j+Math.imul(Ae,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,_t)|0,v=v+Math.imul(mt,ot)|0,j=j+Math.imul(mt,_t)|0,g=g+Math.imul(Fe,k)|0,v=v+Math.imul(Fe,S)|0,v=v+Math.imul(lt,k)|0,j=j+Math.imul(lt,S)|0,g=g+Math.imul(Ee,B)|0,v=v+Math.imul(Ee,K)|0,v=v+Math.imul(Se,B)|0,j=j+Math.imul(Se,K)|0,g=g+Math.imul(se,re)|0,v=v+Math.imul(se,Be)|0,v=v+Math.imul(he,re)|0,j=j+Math.imul(he,Be)|0;var or=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(or>>>26)|0,or&=67108863,g=Math.imul(He,st),v=Math.imul(He,kt),v=v+Math.imul(jt,st)|0,j=Math.imul(jt,kt),g=g+Math.imul(Ue,it)|0,v=v+Math.imul(Ue,wt)|0,v=v+Math.imul(ft,it)|0,j=j+Math.imul(ft,wt)|0,g=g+Math.imul(De,Ye)|0,v=v+Math.imul(De,gt)|0,v=v+Math.imul(Oe,Ye)|0,j=j+Math.imul(Oe,gt)|0,g=g+Math.imul(ge,ot)|0,v=v+Math.imul(ge,_t)|0,v=v+Math.imul(Ae,ot)|0,j=j+Math.imul(Ae,_t)|0,g=g+Math.imul($e,k)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,k)|0,j=j+Math.imul(mt,S)|0,g=g+Math.imul(Fe,B)|0,v=v+Math.imul(Fe,K)|0,v=v+Math.imul(lt,B)|0,j=j+Math.imul(lt,K)|0,g=g+Math.imul(Ee,re)|0,v=v+Math.imul(Ee,Be)|0,v=v+Math.imul(Se,re)|0,j=j+Math.imul(Se,Be)|0,g=g+Math.imul(se,Re)|0,v=v+Math.imul(se,z)|0,v=v+Math.imul(he,Re)|0,j=j+Math.imul(he,z)|0;var Yt=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(et,st),v=Math.imul(et,kt),v=v+Math.imul(At,st)|0,j=Math.imul(At,kt),g=g+Math.imul(He,it)|0,v=v+Math.imul(He,wt)|0,v=v+Math.imul(jt,it)|0,j=j+Math.imul(jt,wt)|0,g=g+Math.imul(Ue,Ye)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(ft,Ye)|0,j=j+Math.imul(ft,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,_t)|0,v=v+Math.imul(Oe,ot)|0,j=j+Math.imul(Oe,_t)|0,g=g+Math.imul(ge,k)|0,v=v+Math.imul(ge,S)|0,v=v+Math.imul(Ae,k)|0,j=j+Math.imul(Ae,S)|0,g=g+Math.imul($e,B)|0,v=v+Math.imul($e,K)|0,v=v+Math.imul(mt,B)|0,j=j+Math.imul(mt,K)|0,g=g+Math.imul(Fe,re)|0,v=v+Math.imul(Fe,Be)|0,v=v+Math.imul(lt,re)|0,j=j+Math.imul(lt,Be)|0,g=g+Math.imul(Ee,Re)|0,v=v+Math.imul(Ee,z)|0,v=v+Math.imul(Se,Re)|0,j=j+Math.imul(Se,z)|0,g=g+Math.imul(se,pe)|0,v=v+Math.imul(se,ke)|0,v=v+Math.imul(he,pe)|0,j=j+Math.imul(he,ke)|0;var yr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(yr>>>26)|0,yr&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,kt),v=v+Math.imul(Et,st)|0,j=Math.imul(Et,kt),g=g+Math.imul(et,it)|0,v=v+Math.imul(et,wt)|0,v=v+Math.imul(At,it)|0,j=j+Math.imul(At,wt)|0,g=g+Math.imul(He,Ye)|0,v=v+Math.imul(He,gt)|0,v=v+Math.imul(jt,Ye)|0,j=j+Math.imul(jt,gt)|0,g=g+Math.imul(Ue,ot)|0,v=v+Math.imul(Ue,_t)|0,v=v+Math.imul(ft,ot)|0,j=j+Math.imul(ft,_t)|0,g=g+Math.imul(De,k)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,k)|0,j=j+Math.imul(Oe,S)|0,g=g+Math.imul(ge,B)|0,v=v+Math.imul(ge,K)|0,v=v+Math.imul(Ae,B)|0,j=j+Math.imul(Ae,K)|0,g=g+Math.imul($e,re)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(mt,re)|0,j=j+Math.imul(mt,Be)|0,g=g+Math.imul(Fe,Re)|0,v=v+Math.imul(Fe,z)|0,v=v+Math.imul(lt,Re)|0,j=j+Math.imul(lt,z)|0,g=g+Math.imul(Ee,pe)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Se,pe)|0,j=j+Math.imul(Se,ke)|0,g=g+Math.imul(se,Ne)|0,v=v+Math.imul(se,ze)|0,v=v+Math.imul(he,Ne)|0,j=j+Math.imul(he,ze)|0;var Rn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,wt),v=v+Math.imul(Et,it)|0,j=Math.imul(Et,wt),g=g+Math.imul(et,Ye)|0,v=v+Math.imul(et,gt)|0,v=v+Math.imul(At,Ye)|0,j=j+Math.imul(At,gt)|0,g=g+Math.imul(He,ot)|0,v=v+Math.imul(He,_t)|0,v=v+Math.imul(jt,ot)|0,j=j+Math.imul(jt,_t)|0,g=g+Math.imul(Ue,k)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(ft,k)|0,j=j+Math.imul(ft,S)|0,g=g+Math.imul(De,B)|0,v=v+Math.imul(De,K)|0,v=v+Math.imul(Oe,B)|0,j=j+Math.imul(Oe,K)|0,g=g+Math.imul(ge,re)|0,v=v+Math.imul(ge,Be)|0,v=v+Math.imul(Ae,re)|0,j=j+Math.imul(Ae,Be)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,z)|0,v=v+Math.imul(mt,Re)|0,j=j+Math.imul(mt,z)|0,g=g+Math.imul(Fe,pe)|0,v=v+Math.imul(Fe,ke)|0,v=v+Math.imul(lt,pe)|0,j=j+Math.imul(lt,ke)|0,g=g+Math.imul(Ee,Ne)|0,v=v+Math.imul(Ee,ze)|0,v=v+Math.imul(Se,Ne)|0,j=j+Math.imul(Se,ze)|0;var Hr=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,g=Math.imul(nt,Ye),v=Math.imul(nt,gt),v=v+Math.imul(Et,Ye)|0,j=Math.imul(Et,gt),g=g+Math.imul(et,ot)|0,v=v+Math.imul(et,_t)|0,v=v+Math.imul(At,ot)|0,j=j+Math.imul(At,_t)|0,g=g+Math.imul(He,k)|0,v=v+Math.imul(He,S)|0,v=v+Math.imul(jt,k)|0,j=j+Math.imul(jt,S)|0,g=g+Math.imul(Ue,B)|0,v=v+Math.imul(Ue,K)|0,v=v+Math.imul(ft,B)|0,j=j+Math.imul(ft,K)|0,g=g+Math.imul(De,re)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(Oe,re)|0,j=j+Math.imul(Oe,Be)|0,g=g+Math.imul(ge,Re)|0,v=v+Math.imul(ge,z)|0,v=v+Math.imul(Ae,Re)|0,j=j+Math.imul(Ae,z)|0,g=g+Math.imul($e,pe)|0,v=v+Math.imul($e,ke)|0,v=v+Math.imul(mt,pe)|0,j=j+Math.imul(mt,ke)|0,g=g+Math.imul(Fe,Ne)|0,v=v+Math.imul(Fe,ze)|0,v=v+Math.imul(lt,Ne)|0,j=j+Math.imul(lt,ze)|0;var Dn=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,_t),v=v+Math.imul(Et,ot)|0,j=Math.imul(Et,_t),g=g+Math.imul(et,k)|0,v=v+Math.imul(et,S)|0,v=v+Math.imul(At,k)|0,j=j+Math.imul(At,S)|0,g=g+Math.imul(He,B)|0,v=v+Math.imul(He,K)|0,v=v+Math.imul(jt,B)|0,j=j+Math.imul(jt,K)|0,g=g+Math.imul(Ue,re)|0,v=v+Math.imul(Ue,Be)|0,v=v+Math.imul(ft,re)|0,j=j+Math.imul(ft,Be)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,z)|0,v=v+Math.imul(Oe,Re)|0,j=j+Math.imul(Oe,z)|0,g=g+Math.imul(ge,pe)|0,v=v+Math.imul(ge,ke)|0,v=v+Math.imul(Ae,pe)|0,j=j+Math.imul(Ae,ke)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,ze)|0,v=v+Math.imul(mt,Ne)|0,j=j+Math.imul(mt,ze)|0;var Ui=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,g=Math.imul(nt,k),v=Math.imul(nt,S),v=v+Math.imul(Et,k)|0,j=Math.imul(Et,S),g=g+Math.imul(et,B)|0,v=v+Math.imul(et,K)|0,v=v+Math.imul(At,B)|0,j=j+Math.imul(At,K)|0,g=g+Math.imul(He,re)|0,v=v+Math.imul(He,Be)|0,v=v+Math.imul(jt,re)|0,j=j+Math.imul(jt,Be)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,z)|0,v=v+Math.imul(ft,Re)|0,j=j+Math.imul(ft,z)|0,g=g+Math.imul(De,pe)|0,v=v+Math.imul(De,ke)|0,v=v+Math.imul(Oe,pe)|0,j=j+Math.imul(Oe,ke)|0,g=g+Math.imul(ge,Ne)|0,v=v+Math.imul(ge,ze)|0,v=v+Math.imul(Ae,Ne)|0,j=j+Math.imul(Ae,ze)|0;var Fi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(Et,B)|0,j=Math.imul(Et,K),g=g+Math.imul(et,re)|0,v=v+Math.imul(et,Be)|0,v=v+Math.imul(At,re)|0,j=j+Math.imul(At,Be)|0,g=g+Math.imul(He,Re)|0,v=v+Math.imul(He,z)|0,v=v+Math.imul(jt,Re)|0,j=j+Math.imul(jt,z)|0,g=g+Math.imul(Ue,pe)|0,v=v+Math.imul(Ue,ke)|0,v=v+Math.imul(ft,pe)|0,j=j+Math.imul(ft,ke)|0,g=g+Math.imul(De,Ne)|0,v=v+Math.imul(De,ze)|0,v=v+Math.imul(Oe,Ne)|0,j=j+Math.imul(Oe,ze)|0;var $n=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+($n>>>26)|0,$n&=67108863,g=Math.imul(nt,re),v=Math.imul(nt,Be),v=v+Math.imul(Et,re)|0,j=Math.imul(Et,Be),g=g+Math.imul(et,Re)|0,v=v+Math.imul(et,z)|0,v=v+Math.imul(At,Re)|0,j=j+Math.imul(At,z)|0,g=g+Math.imul(He,pe)|0,v=v+Math.imul(He,ke)|0,v=v+Math.imul(jt,pe)|0,j=j+Math.imul(jt,ke)|0,g=g+Math.imul(Ue,Ne)|0,v=v+Math.imul(Ue,ze)|0,v=v+Math.imul(ft,Ne)|0,j=j+Math.imul(ft,ze)|0;var zi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(zi>>>26)|0,zi&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,z),v=v+Math.imul(Et,Re)|0,j=Math.imul(Et,z),g=g+Math.imul(et,pe)|0,v=v+Math.imul(et,ke)|0,v=v+Math.imul(At,pe)|0,j=j+Math.imul(At,ke)|0,g=g+Math.imul(He,Ne)|0,v=v+Math.imul(He,ze)|0,v=v+Math.imul(jt,Ne)|0,j=j+Math.imul(jt,ze)|0;var Vi=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,g=Math.imul(nt,pe),v=Math.imul(nt,ke),v=v+Math.imul(Et,pe)|0,j=Math.imul(Et,ke),g=g+Math.imul(et,Ne)|0,v=v+Math.imul(et,ze)|0,v=v+Math.imul(At,Ne)|0,j=j+Math.imul(At,ze)|0;var $=(C+g|0)+((v&8191)<<13)|0;C=(j+(v>>>13)|0)+($>>>26)|0,$&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,ze),v=v+Math.imul(Et,Ne)|0,j=Math.imul(Et,ze);var H=(C+g|0)+((v&8191)<<13)|0;return C=(j+(v>>>13)|0)+(H>>>26)|0,H&=67108863,O[0]=ut,O[1]=Jt,O[2]=Nt,O[3]=Bt,O[4]=ir,O[5]=Sr,O[6]=or,O[7]=Yt,O[8]=yr,O[9]=Rn,O[10]=Hr,O[11]=Dn,O[12]=Ui,O[13]=Fi,O[14]=$n,O[15]=zi,O[16]=Vi,O[17]=$,O[18]=H,C!==0&&(O[19]=C,x.length++),x};Math.imul||(R=N);function U(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,M=0,E=0;E<m.length-1;E++){var O=M;M=0;for(var C=x&67108863,g=Math.min(E,d.length-1),v=Math.max(0,E-p.length+1);v<=g;v++){var j=E-v,ee=p.words[j]|0,se=d.words[v]|0,he=ee*se,ye=he&67108863;O=O+(he/67108864|0)|0,ye=ye+C|0,C=ye&67108863,O=O+(ye>>>26)|0,M+=O>>>26,O&=67108863}m.words[E]=C,x=O,O=M}return x!==0?m.words[E]=x:m.length--,m._strip()}function L(p,d,m){return U(p,d,m)}o.prototype.mulTo=function(d,m){var x,M=this.length+d.length;return this.length===10&&d.length===10?x=R(this,d,m):M<63?x=N(this,d,m):M<1024?x=U(this,d,m):x=L(this,d,m),x},o.prototype.mul=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),this.mulTo(d,m)},o.prototype.mulf=function(d){var m=new o(null);return m.words=new Array(this.length+d.length),L(this,d,m)},o.prototype.imul=function(d){return this.clone().mulTo(d,this)},o.prototype.imuln=function(d){var m=d<0;m&&(d=-d),i(typeof d=="number"),i(d<67108864);for(var x=0,M=0;M<this.length;M++){var E=(this.words[M]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[M]=O&67108863}return x!==0&&(this.words[M]=x,this.length++),m?this.ineg():this},o.prototype.muln=function(d){return this.clone().imuln(d)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(d){var m=P(d);if(m.length===0)return new o(1);for(var x=this,M=0;M<m.length&&m[M]===0;M++,x=x.sqr());if(++M<m.length)for(var E=x.sqr();M<m.length;M++,E=E.sqr())m[M]!==0&&(x=x.mul(E));return x},o.prototype.iushln=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,M=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var C=this.words[E]&M,g=(this.words[E]|0)-C<<m;this.words[E]=g|O,O=C>>>26-m}O&&(this.words[E]=O,this.length++)}if(x!==0){for(E=this.length-1;E>=0;E--)this.words[E+x]=this.words[E];for(E=0;E<x;E++)this.words[E]=0;this.length+=x}return this._strip()},o.prototype.ishln=function(d){return i(this.negative===0),this.iushln(d)},o.prototype.iushrn=function(d,m,x){i(typeof d=="number"&&d>=0);var M;m?M=(m-m%26)/26:M=0;var E=d%26,O=Math.min((d-E)/26,this.length),C=67108863^67108863>>>E<<E,g=x;if(M-=O,M=Math.max(0,M),g){for(var v=0;v<O;v++)g.words[v]=this.words[v];g.length=O}if(O!==0)if(this.length>O)for(this.length-=O,v=0;v<this.length;v++)this.words[v]=this.words[v+O];else this.words[0]=0,this.length=1;var j=0;for(v=this.length-1;v>=0&&(j!==0||v>=M);v--){var ee=this.words[v]|0;this.words[v]=j<<26-E|ee>>>E,j=ee&C}return g&&j!==0&&(g.words[g.length++]=j),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(d,m,x){return i(this.negative===0),this.iushrn(d,m,x)},o.prototype.shln=function(d){return this.clone().ishln(d)},o.prototype.ushln=function(d){return this.clone().iushln(d)},o.prototype.shrn=function(d){return this.clone().ishrn(d)},o.prototype.ushrn=function(d){return this.clone().iushrn(d)},o.prototype.testn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,M=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&M)},o.prototype.imaskn=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(m!==0&&x++,this.length=Math.min(x,this.length),m!==0){var M=67108863^67108863>>>m<<m;this.words[this.length-1]&=M}return this._strip()},o.prototype.maskn=function(d){return this.clone().imaskn(d)},o.prototype.iaddn=function(d){return i(typeof d=="number"),i(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<=d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},o.prototype._iaddn=function(d){this.words[0]+=d;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(d){if(i(typeof d=="number"),i(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this._strip()},o.prototype.addn=function(d){return this.clone().iaddn(d)},o.prototype.subn=function(d){return this.clone().isubn(d)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(d,m,x){var M=d.length+x,E;this._expand(M);var O,C=0;for(E=0;E<d.length;E++){O=(this.words[E+x]|0)+C;var g=(d.words[E]|0)*m;O-=g&67108863,C=(O>>26)-(g/67108864|0),this.words[E+x]=O&67108863}for(;E<this.length-x;E++)O=(this.words[E+x]|0)+C,C=O>>26,this.words[E+x]=O&67108863;if(C===0)return this._strip();for(i(C===-1),C=0,E=0;E<this.length;E++)O=-(this.words[E]|0)+C,C=O>>26,this.words[E]=O&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,m){var x=this.length-d.length,M=this.clone(),E=d,O=E.words[E.length-1]|0,C=this._countBits(O);x=26-C,x!==0&&(E=E.ushln(x),M.iushln(x),O=E.words[E.length-1]|0);var g=M.length-E.length,v;if(m!=="mod"){v=new o(null),v.length=g+1,v.words=new Array(v.length);for(var j=0;j<v.length;j++)v.words[j]=0}var ee=M.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(M=ee,v&&(v.words[g]=1));for(var se=g-1;se>=0;se--){var he=(M.words[E.length+se]|0)*67108864+(M.words[E.length+se-1]|0);for(he=Math.min(he/O|0,67108863),M._ishlnsubmul(E,he,se);M.negative!==0;)he--,M.negative=0,M._ishlnsubmul(E,1,se),M.isZero()||(M.negative^=1);v&&(v.words[se]=he)}return v&&v._strip(),M._strip(),m!=="div"&&x!==0&&M.iushrn(x),{div:v||null,mod:M}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var M,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(M=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:M,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(M=O.div.neg()),{div:M,mod:O.mod}):this.negative&d.negative?(O=this.neg().divmod(d.neg(),m),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.isub(d)),{div:O.div,mod:E}):d.length>this.length||this.cmp(d)<0?{div:new o(0),mod:this}:d.length===1?m==="div"?{div:this.divn(d.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new o(this.modrn(d.words[0]))}:this._wordDiv(d,m)},o.prototype.div=function(d){return this.divmod(d,"div",!1).div},o.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},o.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},o.prototype.divRound=function(d){var m=this.divmod(d);if(m.mod.isZero())return m.div;var x=m.div.negative!==0?m.mod.isub(d):m.mod,M=d.ushrn(1),E=d.andln(1),O=x.cmp(M);return O<0||E===1&&O===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=(1<<26)%d,M=0,E=this.length-1;E>=0;E--)M=(x*M+(this.words[E]|0))%d;return m?-M:M},o.prototype.modn=function(d){return this.modrn(d)},o.prototype.idivn=function(d){var m=d<0;m&&(d=-d),i(d<=67108863);for(var x=0,M=this.length-1;M>=0;M--){var E=(this.words[M]|0)+x*67108864;this.words[M]=E/d|0,x=E%d}return this._strip(),m?this.ineg():this},o.prototype.divn=function(d){return this.clone().idivn(d)},o.prototype.egcd=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var M=new o(1),E=new o(0),O=new o(0),C=new o(1),g=0;m.isEven()&&x.isEven();)m.iushrn(1),x.iushrn(1),++g;for(var v=x.clone(),j=m.clone();!m.isZero();){for(var ee=0,se=1;!(m.words[0]&se)&&ee<26;++ee,se<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(M.isOdd()||E.isOdd())&&(M.iadd(v),E.isub(j)),M.iushrn(1),E.iushrn(1);for(var he=0,ye=1;!(x.words[0]&ye)&&he<26;++he,ye<<=1);if(he>0)for(x.iushrn(he);he-- >0;)(O.isOdd()||C.isOdd())&&(O.iadd(v),C.isub(j)),O.iushrn(1),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),M.isub(O),E.isub(C)):(x.isub(m),O.isub(M),C.isub(E))}return{a:O,b:C,gcd:x.iushln(g)}},o.prototype._invmp=function(d){i(d.negative===0),i(!d.isZero());var m=this,x=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var M=new o(1),E=new o(0),O=x.clone();m.cmpn(1)>0&&x.cmpn(1)>0;){for(var C=0,g=1;!(m.words[0]&g)&&C<26;++C,g<<=1);if(C>0)for(m.iushrn(C);C-- >0;)M.isOdd()&&M.iadd(O),M.iushrn(1);for(var v=0,j=1;!(x.words[0]&j)&&v<26;++v,j<<=1);if(v>0)for(x.iushrn(v);v-- >0;)E.isOdd()&&E.iadd(O),E.iushrn(1);m.cmp(x)>=0?(m.isub(x),M.isub(E)):(x.isub(m),E.isub(M))}var ee;return m.cmpn(1)===0?ee=M:ee=E,ee.cmpn(0)<0&&ee.iadd(d),ee},o.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var m=this.clone(),x=d.clone();m.negative=0,x.negative=0;for(var M=0;m.isEven()&&x.isEven();M++)m.iushrn(1),x.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;x.isEven();)x.iushrn(1);var E=m.cmp(x);if(E<0){var O=m;m=x,x=O}else if(E===0||x.cmpn(1)===0)break;m.isub(x)}while(!0);return x.iushln(M)},o.prototype.invm=function(d){return this.egcd(d).a.umod(d)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(d){return this.words[0]&d},o.prototype.bincn=function(d){i(typeof d=="number");var m=d%26,x=(d-m)/26,M=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=M,this;for(var E=M,O=x;E!==0&&O<this.length;O++){var C=this.words[O]|0;C+=E,E=C>>>26,C&=67108863,this.words[O]=C}return E!==0&&(this.words[O]=E,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(d){var m=d<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var x;if(this.length>1)x=1;else{m&&(d=-d),i(d<=67108863,"Number is too big");var M=this.words[0]|0;x=M===d?0:M<d?-1:1}return this.negative!==0?-x|0:x},o.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var m=this.ucmp(d);return this.negative!==0?-m|0:m},o.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var m=0,x=this.length-1;x>=0;x--){var M=this.words[x]|0,E=d.words[x]|0;if(M!==E){M<E?m=-1:M>E&&(m=1);break}}return m},o.prototype.gtn=function(d){return this.cmpn(d)===1},o.prototype.gt=function(d){return this.cmp(d)===1},o.prototype.gten=function(d){return this.cmpn(d)>=0},o.prototype.gte=function(d){return this.cmp(d)>=0},o.prototype.ltn=function(d){return this.cmpn(d)===-1},o.prototype.lt=function(d){return this.cmp(d)===-1},o.prototype.lten=function(d){return this.cmpn(d)<=0},o.prototype.lte=function(d){return this.cmp(d)<=0},o.prototype.eqn=function(d){return this.cmpn(d)===0},o.prototype.eq=function(d){return this.cmp(d)===0},o.red=function(d){return new V(d)},o.prototype.toRed=function(d){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(d){return this.red=d,this},o.prototype.forceRed=function(d){return i(!this.red,"Already a number in reduction context"),this._forceRed(d)},o.prototype.redAdd=function(d){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},o.prototype.redIAdd=function(d){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},o.prototype.redSub=function(d){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},o.prototype.redISub=function(d){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},o.prototype.redShl=function(d){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},o.prototype.redMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},o.prototype.redIMul=function(d){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(d){return i(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var G={k256:null,p224:null,p192:null,p25519:null};function q(p,d){this.name=p,this.p=new o(d,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}q.prototype._tmp=function(){var d=new o(null);return d.words=new Array(Math.ceil(this.n/13)),d},q.prototype.ireduce=function(d){var m=d,x;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),x=m.bitLength();while(x>this.n);var M=x<this.n?-1:m.ucmp(this.p);return M===0?(m.words[0]=0,m.length=1):M>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},q.prototype.split=function(d,m){d.iushrn(this.n,0,m)},q.prototype.imulK=function(d){return d.imul(this.k)};function X(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(X,q),X.prototype.split=function(d,m){for(var x=4194303,M=Math.min(d.length,9),E=0;E<M;E++)m.words[E]=d.words[E];if(m.length=M,d.length<=9){d.words[0]=0,d.length=1;return}var O=d.words[9];for(m.words[m.length++]=O&x,E=10;E<d.length;E++){var C=d.words[E]|0;d.words[E-10]=(C&x)<<4|O>>>22,O=C}O>>>=22,d.words[E-10]=O,O===0&&d.length>10?d.length-=10:d.length-=9},X.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var m=0,x=0;x<d.length;x++){var M=d.words[x]|0;m+=M*977,d.words[x]=m&67108863,m=M*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function ie(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ie,q);function ae(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(ae,q);function ce(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(ce,q),ce.prototype.imulK=function(d){for(var m=0,x=0;x<d.length;x++){var M=(d.words[x]|0)*19+m,E=M&67108863;M>>>=26,d.words[x]=E,m=M}return m!==0&&(d.words[d.length++]=m),d},o._prime=function(d){if(G[d])return G[d];var m;if(d==="k256")m=new X;else if(d==="p224")m=new ie;else if(d==="p192")m=new ae;else if(d==="p25519")m=new ce;else throw new Error("Unknown prime "+d);return G[d]=m,m};function V(p){if(typeof p=="string"){var d=o._prime(p);this.m=d.p,this.prime=d}else i(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}V.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},V.prototype._verify2=function(d,m){i((d.negative|m.negative)===0,"red works only with positives"),i(d.red&&d.red===m.red,"red works only with red numbers")},V.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},V.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},V.prototype.add=function(d,m){this._verify2(d,m);var x=d.add(m);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},V.prototype.iadd=function(d,m){this._verify2(d,m);var x=d.iadd(m);return x.cmp(this.m)>=0&&x.isub(this.m),x},V.prototype.sub=function(d,m){this._verify2(d,m);var x=d.sub(m);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},V.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},V.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},V.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},V.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},V.prototype.isqr=function(d){return this.imul(d,d.clone())},V.prototype.sqr=function(d){return this.mul(d,d)},V.prototype.sqrt=function(d){if(d.isZero())return d.clone();var m=this.m.andln(3);if(i(m%2===1),m===3){var x=this.m.add(new o(1)).iushrn(2);return this.pow(d,x)}for(var M=this.m.subn(1),E=0;!M.isZero()&&M.andln(1)===0;)E++,M.iushrn(1);i(!M.isZero());var O=new o(1).toRed(this),C=O.redNeg(),g=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new o(2*v*v).toRed(this);this.pow(v,g).cmp(C)!==0;)v.redIAdd(C);for(var j=this.pow(v,M),ee=this.pow(d,M.addn(1).iushrn(1)),se=this.pow(d,M),he=E;se.cmp(O)!==0;){for(var ye=se,Ee=0;ye.cmp(O)!==0;Ee++)ye=ye.redSqr();i(Ee<he);var Se=this.pow(j,new o(1).iushln(he-Ee-1));ee=ee.redMul(Se),j=Se.redSqr(),se=se.redMul(j),he=Ee}return ee},V.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},V.prototype.pow=function(d,m){if(m.isZero())return new o(1).toRed(this);if(m.cmpn(1)===0)return d.clone();var x=4,M=new Array(1<<x);M[0]=new o(1).toRed(this),M[1]=d;for(var E=2;E<M.length;E++)M[E]=this.mul(M[E-1],d);var O=M[0],C=0,g=0,v=m.bitLength()%26;for(v===0&&(v=26),E=m.length-1;E>=0;E--){for(var j=m.words[E],ee=v-1;ee>=0;ee--){var se=j>>ee&1;if(O!==M[0]&&(O=this.sqr(O)),se===0&&C===0){g=0;continue}C<<=1,C|=se,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,M[C]),g=0,C=0)}v=26}return O},V.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},V.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new D(d)};function D(p){V.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(D,V),D.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},D.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},D.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var x=d.imul(m),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),M=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(M).iushrn(this.shift),O=E;return E.cmp(this.m)>=0?O=E.isub(this.m):E.cmpn(0)<0&&(O=E.iadd(this.m)),O._forceRed(this)},D.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),Ro=9e15,es=1e9,tp="0123456789abcdef",Lu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Uu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",rp={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ro,maxE:Ro,crypto:!1},P_,Oi,at=!0,Fu="[DecimalError] ",ts=Fu+"Invalid argument: ",j_=Fu+"Precision limit exceeded",k_=Fu+"crypto unavailable",N_="[object Decimal]",Ar=Math.floor,pr=Math.pow,a9=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,c9=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,u9=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,R_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Tn=1e7,Ze=7,l9=9007199254740991,f9=Lu.length-1,np=Uu.length-1,be={toStringTag:N_};be.absoluteValue=be.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)},be.ceil=function(){return Xe(new this.constructor(this),this.e+1,2)},be.clampedTo=be.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(ts+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},be.comparedTo=be.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},be.cosine=be.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ze,n.rounding=1,r=d9(n,F_(n,r)),n.precision=e,n.rounding=t,Xe(Oi==2||Oi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},be.cubeRoot=be.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(at=!1,s=l.s*pr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=br(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=pr(r,1/3),e=Ar((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=qt(u.plus(l).times(a),u.plus(c),o+2,1),br(a.d).slice(0,o)===(r=br(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Xe(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Xe(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return at=!0,Xe(n,e,f.rounding,t)},be.decimalPlaces=be.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ar(this.e/Ze))*Ze,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},be.dividedBy=be.div=function(e){return qt(this,new this.constructor(e))},be.dividedToIntegerBy=be.divToInt=function(e){var t=this,r=t.constructor;return Xe(qt(t,new r(e),0,1,1),r.precision,r.rounding)},be.equals=be.eq=function(e){return this.cmp(e)===0},be.floor=function(){return Xe(new this.constructor(this),this.e+1,3)},be.greaterThan=be.gt=function(e){return this.cmp(e)>0},be.greaterThanOrEqualTo=be.gte=function(e){var t=this.cmp(e);return t==1||t===0},be.hyperbolicCosine=be.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/Wu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Do(o,1,s.times(t),new o(1),!0);for(var c,u=e,l=new o(8);u--;)c=s.times(s),s=a.minus(c.times(l.minus(c.times(l))));return Xe(s,o.precision=r,o.rounding=n,!0)},be.hyperbolicSine=be.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Do(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Wu(5,e)),i=Do(s,2,i,i,!0);for(var o,a=new s(5),c=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(a.plus(o.times(c.times(o).plus(u))))}return s.precision=t,s.rounding=r,Xe(i,t,r,!0)},be.hyperbolicTangent=be.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,qt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},be.inverseCosine=be.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?An(r,i,s):new r(0):new r(NaN):t.isZero()?An(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=An(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},be.inverseHyperbolicCosine=be.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},be.inverseHyperbolicSine=be.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln())},be.inverseHyperbolicTangent=be.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Xe(new s(i),e,t,!0):(s.precision=r=n-i.e,i=qt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},be.inverseSine=be.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=An(s,r+4,n).times(.5),e.s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},be.inverseTangent=be.atan=function(){var e,t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=np)return o=An(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=np)return o=An(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/Ze+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(at=!1,t=Math.ceil(a/Ze),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),at=!0,Xe(o,l.precision=f,l.rounding=h,!0)},be.isFinite=function(){return!!this.d},be.isInteger=be.isInt=function(){return!!this.d&&Ar(this.e/Ze)>this.d.length-2},be.isNaN=function(){return!this.s},be.isNegative=be.isNeg=function(){return this.s<0},be.isPositive=be.isPos=function(){return this.s>0},be.isZero=function(){return!!this.d&&this.d[0]===0},be.lessThan=be.lt=function(e){return this.cmp(e)<0},be.lessThanOrEqualTo=be.lte=function(e){return this.cmp(e)<1},be.logarithm=be.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(at=!1,a=f+y,o=ns(u,a),n=t?qu(l,a+10):ns(e,a),c=qt(o,n,a,1),ec(c.d,i=f,h))do if(a+=10,o=ns(u,a),n=t?qu(l,a+10):ns(e,a),c=qt(o,n,a,1),!s){+br(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(ec(c.d,i+=10,h));return at=!0,Xe(c,f,h)},be.minus=be.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return at?Xe(e,a,c):e}if(r=Ar(e.e/Ze),l=Ar(y.e/Ze),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Ze),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=Tn-1;--u[i],u[n]+=Tn}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Vu(u,r),at?Xe(e,a,c):e):new b(c===3?-0:0)},be.modulo=be.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Xe(new n(r),n.precision,n.rounding):(at=!1,n.modulo==9?(t=qt(r,e.abs(),0,3,1),t.s*=e.s):t=qt(r,e,0,n.modulo,1),t=t.times(e),at=!0,r.minus(t))},be.naturalExponential=be.exp=function(){return ip(this)},be.naturalLogarithm=be.ln=function(){return ns(this)},be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(e)},be.plus=be.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),at?Xe(e,a,c):e;if(s=Ar(f.e/Ze),n=Ar(e.e/Ze),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Ze),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/Tn|0,u[i]%=Tn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Vu(u,n),at?Xe(e,a,c):e},be.precision=be.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ts+e);return r.d?(t=D_(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},be.round=function(){var e=this,t=e.constructor;return Xe(new t(e),e.e+1,t.rounding)},be.sine=be.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ze,n.rounding=1,r=p9(n,F_(n,r)),n.precision=e,n.rounding=t,Xe(Oi>2?r.neg():r,e,t,!0)):new n(NaN)},be.squareRoot=be.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(at=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=br(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ar((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(s=n,n=s.plus(qt(o,s,r+2,1)).times(.5),br(s.d).slice(0,r)===(t=br(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Xe(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Xe(n,c+1,1),e=!n.times(n).eq(o));break}return at=!0,Xe(n,c,l.rounding,e)},be.tangent=be.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=qt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(Oi==2||Oi==4?r.neg():r,e,t,!0)):new n(NaN)},be.times=be.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Ar(l.e/Ze)+Ar(e.e/Ze),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%Tn|0,t=a/Tn|0;s[i]=(s[i]+t)%Tn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Vu(s,r),at?Xe(e,f.precision,f.rounding):e},be.toBinary=function(e,t){return op(this,2,e,t)},be.toDecimalPlaces=be.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Vr(e,0,es),t===void 0?t=n.rounding:Vr(t,0,8),Xe(r,e+r.e+1,t))},be.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,!0):(Vr(e,0,es),t===void 0?t=i.rounding:Vr(t,0,8),n=Xe(new i(n),e+1,t),r=ei(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},be.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=ei(i):(Vr(e,0,es),t===void 0?t=s.rounding:Vr(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=ei(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},be.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=D_(b)-y.e-1,o=s%Ze,t.d[0]=pr(10,o<0?Ze+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(ts+a);e=a.gt(t)?s>0?t:u:a}for(at=!1,a=new w(br(b)),l=w.precision,w.precision=s=b.length*Ze*2;f=qt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=qt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=qt(u,n,s,1).minus(y).abs().cmp(qt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,at=!0,h},be.toHexadecimal=be.toHex=function(e,t){return op(this,16,e,t)},be.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:Vr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(at=!1,r=qt(r,e,0,t,1).times(e),at=!0,Xe(r)):(e.s=r.s,r=e),r},be.toNumber=function(){return+this},be.toOctal=function(e,t){return op(this,8,e,t)},be.toPower=be.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(pr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Xe(a,n,s);if(t=Ar(e.e/Ze),t>=e.d.length-1&&(r=u<0?-u:u)<=l9)return i=$_(c,a,r,n),e.s<0?new c(1).div(i):Xe(i,n,s);if(o=a.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=pr(+a,u),t=r==0||!isFinite(r)?Ar(u*(Math.log("0."+br(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(at=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=ip(e.times(ns(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),ec(i.d,n,s)&&(t=n+10,i=Xe(ip(e.times(ns(a,t+r)),t),t+5,1),+br(i.d).slice(n+1,n+15)+1==1e14&&(i=Xe(i,n+1,0)))),i.s=o,at=!0,c.rounding=s,Xe(i,n,s))},be.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ei(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Vr(e,1,es),t===void 0?t=i.rounding:Vr(t,0,8),n=Xe(new i(n),e,t),r=ei(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},be.toSignificantDigits=be.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Vr(e,1,es),t===void 0?t=n.rounding:Vr(t,0,8)),Xe(new n(r),e,t)},be.toString=function(){var e=this,t=e.constructor,r=ei(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},be.truncated=be.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)},be.valueOf=be.toJSON=function(){var e=this,t=e.constructor,r=ei(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function br(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Ze-n.length,r&&(s+=rs(r)),s+=n;o=e[t],n=o+"",r=Ze-n.length,r&&(s+=rs(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Vr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(ts+e)}function ec(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Ze,i=0):(i=Math.ceil((t+1)/Ze),t%=Ze),s=pr(10,Ze-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==pr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==pr(10,t-3)-1,o}function zu(e,t,r){for(var n,i=[0],s,o=0,a=e.length;o<a;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=tp.indexOf(e.charAt(o++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function d9(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Wu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Do(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var qt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,A,P,N,R,U,L,G,q,X,ie,ae,ce,V,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=Tn,y=Ze,l=Ar(n.e/y)-Ar(i.e/y)),ce=m.length,ie=d.length,P=new D(p),N=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=D.precision,o=D.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)N.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ie||h)&&G--;f++)q=h*c+(d[f]||0),N[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,R=d.slice(0,ce),U=R.length;U<ce;)R[U++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,R,ce,U),u<0?(L=R[0],ce!=U&&(L=L*c+(R[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,U=R.length,u=t(w,R,A,U),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<U&&w.unshift(0),r(R,w,U,c),u==-1&&(U=R.length,u=t(m,R,ce,U),u<1&&(h++,r(R,ce<U?V:m,U,c))),U=R.length):u===0&&(h++,R=[0]),N[f++]=h,u&&R[0]?R[U++]=d[X]||0:(R=[d[X]],U=1);while((X++<ie||R[0]!==void 0)&&G--);b=R[0]!==void 0}N[0]||N.shift()}if(y==1)P.e=l,P_=b;else{for(f=1,h=N[0];h>=10;h/=10)f++;P.e=f+l*y-1,Xe(P,a?s+P.e+1:s,o,b)}return P}}();function Xe(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,a=f[0];a>=10;a/=10)i++;if(s=t-i,s<0)s+=Ze,o=t,l=f[h=0],c=l/pr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Ze),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Ze,o=s-Ze+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Ze,o=s-Ze+i,c=o<0?0:l/pr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%pr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/pr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=pr(10,(Ze-t%Ze)%Ze),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=pr(10,Ze-s),f[h]=o>0?(l/pr(10,i-o)%pr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==Tn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=Tn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return at&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ei(e,t,r){if(!e.isFinite())return U_(e);var n,i=e.e,s=br(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+rs(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+rs(-i-1)+s,r&&(n=r-o)>0&&(s+=rs(n))):i>=o?(s+=rs(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+rs(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=rs(n))),s}function Vu(e,t){var r=e[0];for(t*=Ze;r>=10;r/=10)t++;return t}function qu(e,t,r){if(t>f9)throw at=!0,r&&(e.precision=r),Error(j_);return Xe(new e(Lu),t,1,!0)}function An(e,t,r){if(t>np)throw Error(j_);return Xe(new e(Uu),t,r,!0)}function D_(e){var t=e.length-1,r=t*Ze+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function rs(e){for(var t="";e--;)t+="0";return t}function $_(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Ze+4);for(at=!1;;){if(r%2&&(s=s.times(t),z_(s.d,o)&&(i=!0)),r=Ar(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),z_(t.d,o)}return at=!0,s}function B_(e){return e.d[e.d.length-1]&1}function L_(e,t,r){for(var n,i=new e(t[0]),s=0;++s<t.length;)if(n=new e(t[s]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function ip(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(at=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(pr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Xe(s.times(e),c,1),r=r.times(++l),a=o.plus(qt(s,r,c,1)),br(a.d).slice(0,c)===br(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&ec(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Xe(o,h.precision=b,y,at=!0);else return h.precision=b,o}o=a}}function ns(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,N=P.rounding,R=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(at=!1,l=R):l=t,P.precision=l+=b,r=br(A),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=br(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new P("0."+r),s++):w=new P(n+"."+r.slice(1))}else return u=qu(P,l+2,R).times(s+""),w=ns(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=R,t==null?Xe(w,R,N,at=!0):w;for(f=w,c=o=w=qt(w.minus(1),w.plus(1),l,1),h=Xe(w.times(w),l,1),i=3;;){if(o=Xe(o.times(h),l,1),u=c.plus(qt(o,new P(i),l,1)),br(u.d).slice(0,l)===br(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(qu(P,l+2,R).times(s+""))),c=qt(c,new P(y),l,1),t==null)if(ec(c.d,l-b,N,a))P.precision=l+=b,u=o=w=qt(f.minus(1),f.plus(1),l,1),h=Xe(w.times(w),l,1),i=a=1;else return Xe(c,P.precision=R,N,at=!0);else return P.precision=R,c;c=u,i+=2}}function U_(e){return String(e.s*e.s/0)}function sp(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Ze,r<0&&(n+=Ze),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Ze;n<i;)e.d.push(+t.slice(n,n+=Ze));t=t.slice(n),n=Ze-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),at&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function h9(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),R_.test(t))return sp(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(c9.test(t))r=16,t=t.toLowerCase();else if(a9.test(t))r=2;else if(u9.test(t))r=8;else throw Error(ts+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=$_(n,new n(r),s,s*2)),u=zu(t,r,Tn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Vu(u,l),e.d=u,at=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?pr(2,c):tc.pow(2,c))),at=!0,e)}function p9(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Do(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Wu(5,r)),t=Do(e,2,t,t);for(var i,s=new e(5),o=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(a))));return t}function Do(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Ze);for(at=!1,c=r.times(r),a=new e(n);;){if(o=qt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=qt(o.times(c),new e(t++*t++),u,1),o=a.plus(n),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return at=!0,o.d.length=l+1,o}function Wu(e,t){for(var r=e;--t;)r*=e;return r}function F_(e,t){var r,n=t.s<0,i=An(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Oi=n?4:1,t;if(r=t.divToInt(i),r.isZero())Oi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Oi=B_(r)?n?2:3:n?4:1,t;Oi=B_(r)?n?1:4:n?3:2}return t.minus(i).abs()}function op(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Vr(r,1,es),n===void 0?n=y.rounding:Vr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=U_(e);else{for(l=ei(e),o=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(l=l.replace(".",""),h=new y(1),h.e=l.length-o,h.d=zu(ei(h),10,i),h.e=h.d.length),f=zu(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=qt(e,h,r,n,0,i),f=e.d,s=e.e,u=P_),o=f[r],a=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>a||o===a&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++s,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=tp.charAt(f[o]);if(b){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=zu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=tp.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>c)for(s-=c;s--;)l+="0";else s<c&&(l=l.slice(0,s)+"."+l.slice(s))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function z_(e,t){if(e.length>t)return e.length=t,!0}function m9(e){return new this(e).abs()}function g9(e){return new this(e).acos()}function v9(e){return new this(e).acosh()}function y9(e,t){return new this(e).plus(t)}function b9(e){return new this(e).asin()}function w9(e){return new this(e).asinh()}function _9(e){return new this(e).atan()}function x9(e){return new this(e).atanh()}function S9(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=An(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?An(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=An(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(qt(e,t,s,1)),t=An(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(qt(e,t,s,1)),r}function E9(e){return new this(e).cbrt()}function C9(e){return Xe(e=new this(e),e.e+1,2)}function M9(e,t,r){return new this(e).clamp(t,r)}function T9(e){if(!e||typeof e!="object")throw Error(Fu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,es,"rounding",0,8,"toExpNeg",-Ro,0,"toExpPos",0,Ro,"maxE",0,Ro,"minE",-Ro,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=rp[r]),(n=e[r])!==void 0)if(Ar(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(ts+r+": "+n);if(r="crypto",i&&(this[r]=rp[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(k_);else this[r]=!1;else throw Error(ts+r+": "+n);return this}function A9(e){return new this(e).cos()}function O9(e){return new this(e).cosh()}function V_(e){var t,r,n;function i(s){var o,a,c,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,q_(s)){u.s=s.s,at?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;at?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return sp(u,s.toString())}else if(c!=="string")throw Error(ts+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),R_.test(s)?sp(u,s):h9(u,s)}if(i.prototype=be,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=T9,i.clone=V_,i.isDecimal=q_,i.abs=m9,i.acos=g9,i.acosh=v9,i.add=y9,i.asin=b9,i.asinh=w9,i.atan=_9,i.atanh=x9,i.atan2=S9,i.cbrt=E9,i.ceil=C9,i.clamp=M9,i.cos=A9,i.cosh=O9,i.div=I9,i.exp=P9,i.floor=j9,i.hypot=k9,i.ln=N9,i.log=R9,i.log10=$9,i.log2=D9,i.max=B9,i.min=L9,i.mod=U9,i.mul=F9,i.pow=z9,i.random=V9,i.round=q9,i.sign=W9,i.sin=G9,i.sinh=H9,i.sqrt=K9,i.sub=X9,i.sum=J9,i.tan=Y9,i.tanh=Z9,i.trunc=Q9,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function I9(e,t){return new this(e).div(t)}function P9(e){return new this(e).exp()}function j9(e){return Xe(e=new this(e),e.e+1,3)}function k9(){var e,t,r=new this(0);for(at=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return at=!0,new this(1/0);r=t}return at=!0,r.sqrt()}function q_(e){return e instanceof tc||e&&e.toStringTag===N_||!1}function N9(e){return new this(e).ln()}function R9(e,t){return new this(e).log(t)}function D9(e){return new this(e).log(2)}function $9(e){return new this(e).log(10)}function B9(){return L_(this,arguments,"lt")}function L9(){return L_(this,arguments,"gt")}function U9(e,t){return new this(e).mod(t)}function F9(e,t){return new this(e).mul(t)}function z9(e,t){return new this(e).pow(t)}function V9(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Vr(e,1,es),n=Math.ceil(e/Ze),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(k_);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Ze,n&&e&&(i=pr(10,Ze-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Ze)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Ze&&(r-=Ze-n)}return o.e=r,o.d=a,o}function q9(e){return Xe(e=new this(e),e.e+1,this.rounding)}function W9(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function G9(e){return new this(e).sin()}function H9(e){return new this(e).sinh()}function K9(e){return new this(e).sqrt()}function X9(e,t){return new this(e).sub(t)}function J9(){var e=0,t=arguments,r=new this(t[e]);for(at=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return at=!0,Xe(r,this.precision,this.rounding)}function Y9(e){return new this(e).tan()}function Z9(e){return new this(e).tanh()}function Q9(e){return Xe(e=new this(e),e.e+1,1)}be[Symbol.for("nodejs.util.inspect.custom")]=be.toString,be[Symbol.toStringTag]="Decimal";var tc=be.constructor=V_(rp);Lu=new tc(Lu),Uu=new tc(Uu);var Gu=tc,is=ko(No()),ap=ko(No()),eN=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet");this.slippage="900000000000000000",this.poolRegistry="0xfcc774493db2c45c79f688f88d28023a3e7d98e4ee9f48bbf5c7990f651577ae",this.protocolFeeVault="0xf194d9b1bcad972e45a7dd67dd49b3ee1e3357a00a50850c52cd51bb450e13b4",this.treasury="0x28e499dff5e864a2eafe476269a4f5035f1c16f338da7be18b103499abf271ce",this.insuranceFund="0xf0c40d67b078000e18032334c3325c47b9ec9f3d9ae4128be820d54663d14e3b",this.referrealVault="0x35d35b0e5b177593d8c3a801462485572fc30861e6ce96a55af6dc4730709278"}amountLimit(e){return new ap.default(e).mul(new ap.default(this.slippage)).div(new ap.default("1000000000000000000")).toString()}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.aftermathLpSupplyType==null)throw new Error("LP supply type not supported");const l=[t.object(r.id),t.object(this.poolRegistry),t.object(this.protocolFeeVault),t.object(this.treasury),t.object(this.insuranceFund),t.object(this.referrealVault),t.pure.u64(this.amountLimit(r.amountOut)),t.pure.u64(this.slippage),n];return t.moveCall({target:`${e.publishedAt()}::aftermath::${a}`,typeArguments:[c,u,r.extendedDetails.aftermathLpSupplyType],arguments:l})})}},W_="0x000000000000000000000000000000000000000000000000000000000000dee9",tN=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return xt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:W_,module:"custodian_v2"}}});if(i!=null&&i.data!=null){if(i.data.length!==0)return i.data[0].data.objectId;if(i.data.length<50)break}else break}return null})}getOrCreateAccountCap(e,t,r){return xt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${W_}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=yield this.getOrCreateAccountCap(t,e.client,e.signer),f=[t.object(r.id),n,l.accountCap,t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},rN=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n];return t.moveCall({target:`${e.publishedAt()}::kriya_amm::${a}`,typeArguments:[c,u],arguments:l})})}},nN=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(r.id),n,t.object(this.version),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},iN=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.container),n];return t.moveCall({target:`${e.publishedAt()}::flowx_amm::${a}`,typeArguments:[c,u],arguments:l})})}},sN=class{constructor(e){if(e!==0)throw new Error("Flowx clmm only supported on mainnet");this.versioned="0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656",this.poolRegistry="0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.poolRegistry),t.pure.u64(r.feeRate*1e6),n,t.object(this.versioned),t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},oN=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.turbosFeeType==null)throw new Error("Turbos fee type not supported");const l=[t.object(r.id),n,t.object(ti),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},G_=class{constructor(e,t){this.globalConfig=e===0?"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f":"0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e",this.partner=t??(e===0?"0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b":"0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5")}flash_swap(e,t,r,n){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["flash_swap_a2b",s,o]:["flash_swap_b2a",o,s];let l=n?r.amountIn:r.amountOut;const f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),t.pure.u64(l),t.pure.bool(n),t.object(ti)],h=t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:f});return{targetCoin:h[0],flashReceipt:h[1],payAmount:h[2]}}repay_flash_swap(e,t,r,n,i){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["repay_flash_swap_a2b",o,a]:["repay_flash_swap_b2a",a,o],f=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,i];return t.moveCall({target:`${e.publishedAt()}::cetus::${c}`,typeArguments:[u,l],arguments:f})[0]}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),t.object(this.partner),n,t.object(ti)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function H_(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function aN(e){return e.split("::")[0]}function Vs(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const c=Vs(r),u=n9(r9({},c),{type_arguments:i.map(l=>Vs(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>qs.isSuiCoin(l)?l:Vs(l).source_address),u.source_address=H_(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===X_||r===lN?"0x2":Qh.normalizeSuiObjectId(s[0]),module:s[1],name:s[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=H_(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function K_(e){return Vs(e).source_address}var cN="0x2::coin::Coin",uN=/^0x2::coin::Coin<(.+)>$/,X_="0x2::sui::SUI",lN="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",qs=class _s{static getCoinTypeArg(t){const r=t.type.match(uN);return r?r[1]:null}static isSUI(t){const r=_s.getCoinTypeArg(t);return r?_s.getCoinSymbol(r)==="SUI":!1}static getCoinSymbol(t){return t.substring(t.lastIndexOf(":")+1)}static getBalance(t){return BigInt(t.fields.balance)}static totalBalance(t,r){let n=BigInt(0);return t.forEach(i=>{r===i.coinAddress&&(n+=BigInt(i.balance))}),n}static getID(t){return t.fields.id.id}static getCoinTypeFromArg(t){return`${cN}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{K_(i.coinAddress)===K_(t)&&n.push(i)}),n}static isSuiCoin(t){return Vs(t).full_address===X_}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=_s.selectCoinAssetGreaterThanOrEqual(t,r,n),s=i.selectedCoins.map(c=>c.coinObjectId),o=i.remainingCoins,a=i.selectedCoins.map(c=>c.balance.toString());return{objectArray:s,remainCoins:o,amountArray:a}}static selectCoinAssetGreaterThanOrEqual(t,r,n=[]){const i=_s.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=_s.calculateTotalBalance(i);if(s<r)return{selectedCoins:[],remainingCoins:i};if(s===r)return{selectedCoins:i,remainingCoins:[]};let o=BigInt(0);const a=[],c=[...i];for(;o<s;){const u=r-o,l=c.findIndex(h=>h.balance>=u);if(l!==-1){a.push(c[l]),c.splice(l,1);break}const f=c.pop();f.balance>0&&(a.push(f),o+=f.balance)}return{selectedCoins:_s.sortByBalance(a),remainingCoins:_s.sortByBalance(c)}}static sortByBalance(t){return t.sort((r,n)=>r.balance<n.balance?-1:r.balance>n.balance?1:0)}static sortByBalanceDes(t){return t.sort((r,n)=>r.balance>n.balance?-1:r.balance<n.balance?0:1)}static calculateTotalBalance(t){return t.reduce((r,n)=>r+n.balance,BigInt(0))}};function cp(e){switch(e){case 1e4:return"Calculate error";case 10001:return"Input number too large can not fit in target type";case 10002:return"No router";case 10003:return"Insufficient Liquidity";case 10004:return"Target token is detected as a HoneyPot scam";default:return"Unknown error"}}function ss(e){const t=e.indexOf("::");if(t===-1)return e;const r=e.substring(0,t),n=e.substring(t);if(!r.startsWith("0x"))return e;const i=r.substring(2);return i.length>64?e:`0x${i.padStart(64,"0")}${n}`}function fN(e,t){e=ss(e),t=ss(t);const r=Math.min(e.length,t.length);for(let n=0;n<r;n++){if(e[n]>t[n])return!0;if(e[n]<t[n])return!1}return!0}function J_(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function up(e,t,r,n){const i=qs.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:J_(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(qs.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(qs.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=qs.sortByBalance(i);o.slice(0,3).reduce((h,y)=>h+y.balance,BigInt(0))<BigInt(r)&&(o=qs.sortByBalanceDes(i));let c=qs.selectCoinObjectIdGreaterThanOrEqual(o,r);const[u,...l]=c.objectArray;return l.length>0&&e.mergeCoins(u,l.map(h=>e.object(h))),{targetCoin:e.splitCoins(e.object(u),[e.pure.u64(r.toString())]),isMintZeroCoin:!1,targetCoinAmount:Number(r.toString())}}function dN(e,t=!0){return xt(this,null,function*(){console.log("inputs",e.getData().inputs),e.getData().commands.forEach((r,n)=>{t&&console.log(`transaction ${n}: `,JSON.stringify(r,null,2))})})}function hN(e){return!(!e.startsWith("0x")||e.length!==66)}var $o=ko(No()),os=ko(No()),rc=ko(No()),Ii=new rc.default(0);new rc.default(1);var pN=new rc.default(2);pN.pow(new rc.default(128));var mN=new rc.default("18446744073709551615"),cn=1e9;function gN(e,t,r){let n=Ii;return t?n=e.mul(new os.default(cn-r*cn)).div(new os.default(cn)):n=e.mul(new os.default(cn+r*cn)).div(new os.default(cn)),Number(n.toString())}function vN(e,t,r){let n=Ii;return t?n=e.mul(new os.default(cn-r*cn)).div(new os.default(cn)):n=e.mul(new os.default(cn+r*cn)).div(new os.default(cn)),n}function yN(e,t,r){return new Gu(e).mul(Gu.pow(2,-64)).pow(2).mul(Gu.pow(10,t-r))}function bN(e,t,r,n){return xt(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,b=ss(u),w=ss(l),A=new Xk.Transaction,P=fN(b,w),N=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",R=P?b:w,U=P?w:b,L=[R,U];console.log("typeArguments",L,N);for(let C=0;C<y.length;C++){const g=[A.object(y[C]),A.pure.bool(P),A.pure.bool(h),A.pure.u64(f.toString())];A.moveCall({target:`${N}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:L})}if(!hN(r))throw new AggregateError("Aggregator package not set","InvalidWallet");dN(A);const G=yield e.devInspectTransactionBlock({transactionBlock:A,sender:r});if(G.error!=null)throw console.log("simulateRes.error",G.error),new AggregateError("Aggregator package not set","SimulateError");const q=(i=G.events)==null?void 0:i.filter(C=>C.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==y.length)throw new AggregateError("Simulate event result error","simulateEventError");let X=h?Ii:mN,ie=0;for(let C=0;C<q.length;C+=1)if(!q[C].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new $o.BN(q[C].parsedJson.data.amount_out);g.gt(X)&&(ie=C,X=g)}else{const g=new $o.BN(q[C].parsedJson.data.amount_out);g.lt(X)&&(ie=C,X=g)}const ae=q[ie].parsedJson.data;console.log("event",JSON.stringify(ae,null,2));const ce=ae.step_results[0].current_sqrt_price,[V,D]=yield Promise.all([e.getCoinMetadata({coinType:R}).then(C=>C==null?void 0:C.decimals),e.getCoinMetadata({coinType:U}).then(C=>C==null?void 0:C.decimals)]);if(V==null||D==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=yN(ce,V,D),d=Number(ae.fee_rate)/1e6,m=new $o.BN((s=ae.amount_in)!=null?s:0),x=new $o.BN((o=ae.fee_amount)!=null?o:0),M=m.add(x),E={amountIn:M,amountOut:new $o.BN((a=ae.amount_out)!=null?a:0),routes:[{path:[{id:y[ie],direction:P,provider:"CETUS",from:b,target:w,feeRate:d,amountIn:ae.amount_in,amountOut:ae.amount_out,extendedDetails:{afterSqrtPrice:ae.after_sqrt_price}}],amountIn:M,amountOut:new $o.BN((c=ae.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:ae.is_exceed,routeData:E}})}var wN=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Haedal not support b2a swap");const s="swap_a2b",o=[t.object(r.id),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::haedal::${s}`,typeArguments:[],arguments:o})})}},_N=class{constructor(e){if(e!==0)throw new Error("Afsui only supported on mainnet");this.stakedSuiVault="0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d",this.safe="0xeb685899830dd5837b47007809c76d91a098d52aabbf61e8ac467c59e5cc4610",this.referVault="0x4ce9a19b594599536c53edb25d22532f82f18038dc8ef618afd00fbbfb9845ef",this.validator="0xd30018ec3f5ff1a3c75656abf927a87d7f0529e6dc89c7ddd1bd27ecb05e3db2"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Afsui not support b2a swap");const s="swap_a2b",o=[t.object(this.stakedSuiVault),t.object(this.safe),t.object("0x5"),t.object(this.referVault),t.object(this.validator),n];return t.moveCall({target:`${e.publishedAt()}::afsui::${s}`,typeArguments:[],arguments:o})})}},xN=class{constructor(e){if(e!==0)throw new Error("Volo only supported on mainnet");this.nativePool="0x7fa2faa111b8c65bea48a23049bfd81ca8f971a262d981dcd9a17c3825cb5baf",this.metadata="0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i}=r;if(!i)throw new Error("Volo not support b2a swap");const s="swap_a2b",o=[t.object(this.nativePool),t.object(this.metadata),t.object("0x5"),n];return t.moveCall({target:`${e.publishedAt()}::volo::${s}`,typeArguments:[],arguments:o})})}},SN=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.dexInfo),n];return t.moveCall({target:`${e.publishedAt()}::bluemove::${a}`,typeArguments:[c,u],arguments:l})})}},EN=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return xt(this,null,function*(){const{direction:s,from:o,target:a}=r,[c,u,l]=s?["swap_a2b",o,a]:["swap_b2a",a,o];let f;i?f=i:f=J_(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},CN=class{constructor(e){if(e!==0)throw new Error("Scallop only supported on mainnet");this.version=e===0?"0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7":"0x0",this.market=e===0?"0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9":"0x0"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",s,o];if(r.extendedDetails==null)throw new Error("Extended details not supported");if(r.extendedDetails.scallopScoinTreasury==null)throw new Error("Scallop coin treasury not supported");const l=[t.object(this.version),t.object(this.market),t.object(r.extendedDetails.scallopScoinTreasury),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},MN=class{constructor(e){if(e!==0)throw new Error("Suilend only supported on mainnet");this.liquid_staking_pool=e===0?"0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b":"0x0",this.sui_system_state=e===0?"0x0000000000000000000000000000000000000000000000000000000000000005":"0x0"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c]=i?["swap_a2b",o]:["swap_b2a",s],u=[t.object(this.liquid_staking_pool),t.object(this.sui_system_state),n];return t.moveCall({target:`${e.publishedAtV2()}::suilend::${a}`,typeArguments:[c],arguments:u})})}},TN=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s],l=[t.object(this.globalConfig),t.object(r.id),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::bluefin::${a}`,typeArguments:[c,u],arguments:l})})}},AN=class{constructor(e,t){if(e===1){this.connection=new Bu.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new Bu.SuiPythClient(t,n,r)}else{this.connection=new Bu.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new Bu.SuiPythClient(t,n,r)}}swap(e,t,r,n){return xt(this,null,function*(){const{direction:i,from:s,target:o}=r,[a,c,u]=i?["swap_a2b",s,o]:["swap_b2a",o,s];let l,f;if(r.extendedDetails==null)throw new Error("Extended details not supported haedal pmm");if(!r.extendedDetails.haedalPmmBasePriceSeed||!r.extendedDetails.haedalPmmQuotePriceSeed)throw new Error("Base price seed or quote price seed not supported");l=r.extendedDetails.haedalPmmBasePriceSeed,f=r.extendedDetails.haedalPmmQuotePriceSeed;const h=[l,f],y=yield this.connection.getPriceFeedsUpdateData(h),b=yield this.pythClient.updatePriceFeeds(t,y,h),w=[t.object(r.id),t.object(b[0]),t.object(b[1]),n,t.object(ti)];return t.moveCall({target:`${e.publishedAtV2()}::haedalpmm::${a}`,typeArguments:[c,u],arguments:w})})}},Y_="CETUS",ON="DEEPBOOK",IN="KRIYA",PN="FLOWX",jN="FLOWXV3",kN="KRIYAV3",Z_="TURBOS",lp="AFTERMATH",NN="HAEDAL",RN="VOLO",DN="AFSUI",$N="BLUEMOVE",Q_="DEEPBOOKV3",ex="SCALLOP",BN="SUILEND",LN="BLUEFIN",tx="HAEDALPMM",UN="https://api-sui.cetus.zone/router_v2",FN=class{constructor(e,t,r,n){this.endpoint=e?VN(e):UN,this.client=r||new M_.SuiClient({url:M_.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return xt(this,null,function*(){if(this.signer==="")throw new Error("Signer is required, but not provided.");let r=null,n=50;if(!t){const s=this.allCoins.get(e);if(s)return s}const i=[];for(;;){const s=yield this.client.getCoins({owner:this.signer,coinType:e,cursor:r,limit:n});for(const o of s.data)i.push({coinAddress:Vs(o.coinType).source_address,coinObjectId:o.coinObjectId,balance:BigInt(o.balance)});if(s.data.length<n)break;r=s.data[n-1].coinObjectId}return this.allCoins.set(e,i),i})}findRouters(e){return xt(this,null,function*(){return qN(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return xt(this,null,function*(){if(r.length===0)throw new Error("No router found");const o=r.map(h=>h.amountIn.toString()),a=r[0].path[0].from,c=r[0].path[r[0].path.length-1].target,u=e.splitCoins(t,o),l=[];for(let h=0;h<r.length;h++){if(r[h].path.length===0)throw new Error("Empty path");let y=u[h];for(const b of r[h].path)y=yield this.newDex(b.provider,i).swap(this,e,b,y,s);l.push(y)}return this.transferOrDestoryCoin(e,t,a),this.checkCoinThresholdAndMergeCoin(e,l,c,n)})}expectOutputSwap(e,t,r,n){return xt(this,null,function*(){const i=[],s=[],o=[],a=new G_(this.env,n);for(let u=0;u<r.length;u++){const l=r[u];for(let h=l.path.length-1;h>=0;h--){const y=l.path[h],b=a.flash_swap(this,e,y,!1);i.unshift(b.targetCoin),s.unshift(b.flashReceipt)}let f=t;for(let h=0;h<l.path.length;h++){const y=l.path[h],b=a.repay_flash_swap(this,e,y,f,s[h]);f=i[h],h===0?t=b:this.transferOrDestoryCoin(e,b,y.from),h===l.path.length-1&&o.push(f)}}const c=r[0].path[0].from;if(this.transferOrDestoryCoin(e,t,c),o.length>1){const u=e.makeMoveVec({elements:o.slice(1)});e.moveCall({target:`${Qh.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r[0].path[r[0].path.length-1].target],arguments:[o[0],u]})}return o[0]})}swapInPools(e){return xt(this,null,function*(){let t;try{t=yield bN(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return xt(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,byAmountIn:i,txb:s,partner:o,deepbookv3DeepFee:a}=e,c=t.reduce((y,b)=>y.add(b.amountIn),new is.default(0)),u=t.reduce((y,b)=>y.add(b.amountOut),new is.default(0)),l=vN(i?u:c,i,n);if(i)return yield this.expectInputSwap(s,r,t,l,o,a);const f=s.splitCoins(r,[l.toString()]);return this.transferOrDestoryCoin(s,r,t[0].path[0].from),yield this.expectOutputSwap(s,f[0],t,o)})}fastRouterSwap(e){return xt(this,null,function*(){const{routers:t,byAmountIn:r,slippage:n,txb:i,partner:s,isMergeTragetCoin:o,refreshAllCoins:a,payDeepFeeAmount:c}=e,u=t[0].path[0].from;let l=yield this.getCoins(u,a);const f=t[0].path[t[0].path.length-1].target,h=t.reduce((R,U)=>R.add(U.amountIn),new is.default(0)),y=t.reduce((R,U)=>R.add(U.amountOut),new is.default(0)),b=gN(r?y:h,r,n),A=up(i,l,BigInt((r?h:b).toString()),u);let P;if(c&&c>0){let R=yield this.getCoins(this.deepbookv3DeepFeeType());P=up(i,R,BigInt(c),this.deepbookv3DeepFeeType()).targetCoin}const N=yield this.routerSwap({routers:t,inputCoin:A.targetCoin,slippage:n,byAmountIn:r,txb:i,partner:s,deepbookv3DeepFee:P});if(o){let R=yield this.getCoins(f,a);const U=up(i,R,BigInt(0),f);i.mergeCoins(U.targetCoin,[N]),U.isMintZeroCoin&&this.transferOrDestoryCoin(i,U.targetCoin,f)}else this.transferOrDestoryCoin(i,N,f)})}publishedAt(){return this.env===0?"0x3fb42ddf908af45f9fc3c59eab227888ff24ba2e137b3b55bf80920fd47e11af":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2(){return this.env===0?"0x347dd58bbd11cd82c8b386b344729717c04a998da73386e82a239cc196d5706b":"0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"}deepbookv3DeepFeeType(){return this.env===0?"0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":"0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"}transferOrDestoryCoin(e,t,r){e.moveCall({target:`${this.publishedAt()}::utils::transfer_or_destroy_coin`,typeArguments:[r],arguments:[t]})}checkCoinThresholdAndMergeCoin(e,t,r,n){let i=t[0];if(t.length>1){let s=e.makeMoveVec({elements:t.slice(1)});e.moveCall({target:`${Qh.SUI_FRAMEWORK_ADDRESS}::pay::join_vec`,typeArguments:[r],arguments:[t[0],s]}),i=t[0]}return e.moveCall({target:`${this.publishedAt()}::utils::check_coin_threshold`,typeArguments:[r],arguments:[i,e.pure.u64(n.toString())]}),i}newDex(e,t){switch(e){case Y_:return new G_(this.env,t);case ON:return new tN(this.env);case Q_:return new EN(this.env);case IN:return new rN(this.env);case kN:return new nN(this.env);case PN:return new iN(this.env);case jN:return new sN(this.env);case Z_:return new oN(this.env);case lp:return new eN(this.env);case NN:return new wN(this.env);case DN:return new _N(this.env);case RN:return new xN(this.env);case $N:return new SN(this.env);case ex:return new CN(this.env);case BN:return new MN(this.env);case LN:return new TN(this.env);case tx:return new AN(this.env,this.client);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return xt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return xt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return xt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return xt(this,null,function*(){const e=yield HN(this.endpoint);return e?e.data:null})}};function zN(e){let t=0;for(const n of e.routes)for(const i of n.path)i.extended_details&&i.extended_details.deepbookv3_deep_fee&&(t+=Number(i.extended_details.deepbookv3_deep_fee));return{amountIn:new is.default(e.amount_in.toString()),amountOut:new is.default(e.amount_out.toString()),insufficientLiquidity:!1,routes:e.routes.map(n=>({path:n.path.map(i=>{var s,o,a,c,u,l,f;let h;i.provider===lp&&(h=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let y;return(i.provider===Z_||i.provider===lp||i.provider===Y_||i.provider===Q_||i.provider===ex||i.provider===tx)&&(y={aftermathLpSupplyType:(s=i.extended_details)==null?void 0:s.aftermath_lp_supply_type,turbosFeeType:(o=i.extended_details)==null?void 0:o.turbos_fee_type,afterSqrtPrice:(a=i.extended_details)==null?void 0:a.after_sqrt_price,deepbookv3DeepFee:(c=i.extended_details)==null?void 0:c.deepbookv3_deep_fee,scallopScoinTreasury:(u=i.extended_details)==null?void 0:u.scallop_scoin_treasury,haedalPmmBasePriceSeed:(l=i.extended_details)==null?void 0:l.haedal_pmm_base_price_seed,haedalPmmQuotePriceSeed:(f=i.extended_details)==null?void 0:f.haedal_pmm_quote_price_seed}),{id:i.id,direction:i.direction,provider:i.provider,from:i.from,target:i.target,feeRate:i.fee_rate,amountIn:i.amount_in,amountOut:i.amount_out,extendedDetails:y,version:h}}),amountIn:new is.default(n.amount_in.toString()),amountOut:new is.default(n.amount_out.toString()),initialPrice:new Gu(n.initial_price.toString())})),totalDeepFee:t}}var ti="0x0000000000000000000000000000000000000000000000000000000000000006";ko(No());function VN(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function qN(e,t){return xt(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield GN(e,t):r=yield WN(e,t),!r)return null;if(!r.ok)return{amountIn:Ii,amountOut:Ii,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:cp(10001)}};const n=yield r.json(),i=n.msg==="liquidity is not enough";return n.msg&&n.msg.indexOf("HoneyPot scam")>-1?{amountIn:Ii,amountOut:Ii,routes:[],insufficientLiquidity:i,error:{code:10004,msg:cp(10004)}}:n.data!=null?zN(n.data):{amountIn:Ii,amountOut:Ii,routes:[],insufficientLiquidity:i,error:{code:10003,msg:cp(10003)}}})}function WN(e,t){return xt(this,null,function*(){try{const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l}=t,f=ss(r),h=ss(n);let y=`${e}/find_routes?from=${f}&target=${h}&amount=${i.toString()}&by_amount_in=${s}`;return o&&(y+=`&depth=${o}`),a&&(y+=`&split_algorithm=${a}`),c&&(y+=`&split_factor=${c}`),u&&(y+=`&split_count=${u}`),l&&l.length>0&&(y+=`&providers=${l.join(",")}`),y+="&v=1000317",yield fetch(y)}catch(r){return console.error(r),null}})}function GN(e,t){return xt(this,null,function*(){const{from:r,target:n,amount:i,byAmountIn:s,depth:o,splitAlgorithm:a,splitFactor:c,splitCount:u,providers:l,liquidityChanges:f}=t,h=ss(r),y=ss(n),b=`${e}/find_routes`,w=l==null?void 0:l.join(","),A={from:h,target:y,amount:Number(i.toString()),by_amount_in:s,depth:o,split_algorithm:a,split_factor:c,split_count:u,providers:w,liquidity_changes:f.map(P=>({pool:P.poolID,tick_lower:P.ticklower,tick_upper:P.tickUpper,delta_liquidity:P.deltaLiquidity}))};try{return yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}catch(P){return console.error("Error:",P),null}})}function HN(e){return xt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var rx=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(rx||{}),nx=FN,KN=rx,ix=aN,nc=Vs;const sx="0x2::sui::SUI",XN="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function ox(e){return Or(e).full_address===sx}function ax(e,...t){const r=Array.isArray(t[t.length-1])?t.pop():[];let i=[e,...t].filter(Boolean).join("::");return r&&r.length&&(i+=`<${r.join(", ")}>`),i}function Or(e){var t;try{let r=e.replace(/\s/g,"");const n=r.match(/(<.+>)$/),i=(t=n==null?void 0:n[0])==null?void 0:t.match(/(\w+::\w+::\w+)(?:<.*?>(?!>))?/g);if(i){r=r.slice(0,r.indexOf("<"));const u={...Or(r),type_arguments:i.map(l=>Or(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>ox(l)?l:Or(l).source_address),u.source_address=ax(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===sx||r===XN?"0x2":vi(s[0]),module:s[1],name:s[2],type_arguments:[],source_address:""};return a.full_address=`${a.address}::${a.module}::${a.name}`,a.source_address=ax(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function JN(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const Pi=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=vi(n);return t&&(i=JN(i)),`${i}::${r.join("::")}`};/*!
|
|
39
39
|
* decimal.js v10.4.3
|
|
40
40
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
41
41
|
* https://github.com/MikeMcl/decimal.js
|
|
42
42
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
43
43
|
* MIT Licence
|
|
44
|
-
*/var Bo=9e15,os=1e9,fp="0123456789abcdef",Hu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ku="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",dp={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Bo,maxE:Bo,crypto:!1},cx,Pi,ct=!0,Xu="[DecimalError] ",as=Xu+"Invalid argument: ",ux=Xu+"Precision limit exceeded",lx=Xu+"crypto unavailable",fx="[object Decimal]",Ir=Math.floor,mr=Math.pow,YR=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ZR=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,QR=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,dx=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,On=1e7,Qe=7,eN=9007199254740991,tN=Hu.length-1,hp=Ku.length-1,we={toStringTag:fx};we.absoluteValue=we.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Je(e)},we.ceil=function(){return Je(new this.constructor(this),this.e+1,2)},we.clampedTo=we.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(as+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},we.comparedTo=we.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},we.cosine=we.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=rN(n,yx(n,r)),n.precision=e,n.rounding=t,Je(Pi==2||Pi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},we.cubeRoot=we.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(ct=!1,s=l.s*mr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=wr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=mr(r,1/3),e=Ir((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Wt(u.plus(l).times(a),u.plus(c),o+2,1),wr(a.d).slice(0,o)===(r=wr(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Je(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Je(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ct=!0,Je(n,e,f.rounding,t)},we.decimalPlaces=we.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ir(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},we.dividedBy=we.div=function(e){return Wt(this,new this.constructor(e))},we.dividedToIntegerBy=we.divToInt=function(e){var t=this,r=t.constructor;return Je(Wt(t,new r(e),0,1,1),r.precision,r.rounding)},we.equals=we.eq=function(e){return this.cmp(e)===0},we.floor=function(){return Je(new this.constructor(this),this.e+1,3)},we.greaterThan=we.gt=function(e){return this.cmp(e)>0},we.greaterThanOrEqualTo=we.gte=function(e){var t=this.cmp(e);return t==1||t===0},we.hyperbolicCosine=we.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/Qu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Lo(o,1,s.times(t),new o(1),!0);for(var c,u=e,l=new o(8);u--;)c=s.times(s),s=a.minus(c.times(l.minus(c.times(l))));return Je(s,o.precision=r,o.rounding=n,!0)},we.hyperbolicSine=we.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Lo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Qu(5,e)),i=Lo(s,2,i,i,!0);for(var o,a=new s(5),c=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(a.plus(o.times(c.times(o).plus(u))))}return s.precision=t,s.rounding=r,Je(i,t,r,!0)},we.hyperbolicTangent=we.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Wt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},we.inverseCosine=we.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?In(r,i,s):new r(0):new r(NaN):t.isZero()?In(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=In(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},we.inverseHyperbolicCosine=we.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,ct=!1,r=r.times(r).minus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},we.inverseHyperbolicSine=we.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,ct=!1,r=r.times(r).plus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln())},we.inverseHyperbolicTangent=we.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Je(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Wt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},we.inverseSine=we.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=In(s,r+4,n).times(.5),e.s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},we.inverseTangent=we.atan=function(){var e,t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=hp)return o=In(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=hp)return o=In(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/Qe+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ct=!1,t=Math.ceil(a/Qe),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),ct=!0,Je(o,l.precision=f,l.rounding=h,!0)},we.isFinite=function(){return!!this.d},we.isInteger=we.isInt=function(){return!!this.d&&Ir(this.e/Qe)>this.d.length-2},we.isNaN=function(){return!this.s},we.isNegative=we.isNeg=function(){return this.s<0},we.isPositive=we.isPos=function(){return this.s>0},we.isZero=function(){return!!this.d&&this.d[0]===0},we.lessThan=we.lt=function(e){return this.cmp(e)<0},we.lessThanOrEqualTo=we.lte=function(e){return this.cmp(e)<1},we.logarithm=we.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(ct=!1,a=f+y,o=us(u,a),n=t?Zu(l,a+10):us(e,a),c=Wt(o,n,a,1),nc(c.d,i=f,h))do if(a+=10,o=us(u,a),n=t?Zu(l,a+10):us(e,a),c=Wt(o,n,a,1),!s){+wr(c.d).slice(i+1,i+15)+1==1e14&&(c=Je(c,f+1,0));break}while(nc(c.d,i+=10,h));return ct=!0,Je(c,f,h)},we.minus=we.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return ct?Je(e,a,c):e}if(r=Ir(e.e/Qe),l=Ir(y.e/Qe),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Qe),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=On-1;--u[i],u[n]+=On}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Yu(u,r),ct?Je(e,a,c):e):new b(c===3?-0:0)},we.modulo=we.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Je(new n(r),n.precision,n.rounding):(ct=!1,n.modulo==9?(t=Wt(r,e.abs(),0,3,1),t.s*=e.s):t=Wt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))},we.naturalExponential=we.exp=function(){return pp(this)},we.naturalLogarithm=we.ln=function(){return us(this)},we.negated=we.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Je(e)},we.plus=we.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),ct?Je(e,a,c):e;if(s=Ir(f.e/Qe),n=Ir(e.e/Qe),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Qe),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/On|0,u[i]%=On;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Yu(u,n),ct?Je(e,a,c):e},we.precision=we.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(as+e);return r.d?(t=hx(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},we.round=function(){var e=this,t=e.constructor;return Je(new t(e),e.e+1,t.rounding)},we.sine=we.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=iN(n,yx(n,r)),n.precision=e,n.rounding=t,Je(Pi>2?r.neg():r,e,t,!0)):new n(NaN)},we.squareRoot=we.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(ct=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=wr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ir((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(s=n,n=s.plus(Wt(o,s,r+2,1)).times(.5),wr(s.d).slice(0,r)===(t=wr(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Je(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Je(n,c+1,1),e=!n.times(n).eq(o));break}return ct=!0,Je(n,c,l.rounding,e)},we.tangent=we.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Wt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Je(Pi==2||Pi==4?r.neg():r,e,t,!0)):new n(NaN)},we.times=we.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Ir(l.e/Qe)+Ir(e.e/Qe),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%On|0,t=a/On|0;s[i]=(s[i]+t)%On|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Yu(s,r),ct?Je(e,f.precision,f.rounding):e},we.toBinary=function(e,t){return gp(this,2,e,t)},we.toDecimalPlaces=we.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(zr(e,0,os),t===void 0?t=n.rounding:zr(t,0,8),Je(r,e+r.e+1,t))},we.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,!0):(zr(e,0,os),t===void 0?t=i.rounding:zr(t,0,8),n=Je(new i(n),e+1,t),r=ri(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=ri(i):(zr(e,0,os),t===void 0?t=s.rounding:zr(t,0,8),n=Je(new s(i),e+i.e+1,t),r=ri(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},we.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=hx(b)-y.e-1,o=s%Qe,t.d[0]=mr(10,o<0?Qe+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(as+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new w(wr(b)),l=w.precision,w.precision=s=b.length*Qe*2;f=Wt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=Wt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=Wt(u,n,s,1).minus(y).abs().cmp(Wt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h},we.toHexadecimal=we.toHex=function(e,t){return gp(this,16,e,t)},we.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:zr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(ct=!1,r=Wt(r,e,0,t,1).times(e),ct=!0,Je(r)):(e.s=r.s,r=e),r},we.toNumber=function(){return+this},we.toOctal=function(e,t){return gp(this,8,e,t)},we.toPower=we.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(mr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Je(a,n,s);if(t=Ir(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=eN)return i=px(c,a,r,n),e.s<0?new c(1).div(i):Je(i,n,s);if(o=a.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=mr(+a,u),t=r==0||!isFinite(r)?Ir(u*(Math.log("0."+wr(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(ct=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=pp(e.times(us(a,n+r)),n),i.d&&(i=Je(i,n+5,1),nc(i.d,n,s)&&(t=n+10,i=Je(pp(e.times(us(a,t+r)),t),t+5,1),+wr(i.d).slice(n+1,n+15)+1==1e14&&(i=Je(i,n+1,0)))),i.s=o,ct=!0,c.rounding=s,Je(i,n,s))},we.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(zr(e,1,os),t===void 0?t=i.rounding:zr(t,0,8),n=Je(new i(n),e,t),r=ri(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toSignificantDigits=we.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(zr(e,1,os),t===void 0?t=n.rounding:zr(t,0,8)),Je(new n(r),e,t)},we.toString=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},we.truncated=we.trunc=function(){return Je(new this.constructor(this),this.e+1,1)},we.valueOf=we.toJSON=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function wr(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Qe-n.length,r&&(s+=cs(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=cs(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function zr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(as+e)}function nc(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Qe,i=0):(i=Math.ceil((t+1)/Qe),t%=Qe),s=mr(10,Qe-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==mr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==mr(10,t-3)-1,o}function Ju(e,t,r){for(var n,i=[0],s,o=0,a=e.length;o<a;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=fp.indexOf(e.charAt(o++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function rN(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Qu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Lo(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var Wt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,A,P,R,N,F,L,G,q,X,ie,ae,ce,V,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=On,y=Qe,l=Ir(n.e/y)-Ir(i.e/y)),ce=m.length,ie=d.length,P=new D(p),R=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=D.precision,o=D.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)R.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ie||h)&&G--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,N=d.slice(0,ce),F=N.length;F<ce;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,ce,F),u<0?(L=N[0],ce!=F&&(L=L*c+(N[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,F=N.length,u=t(w,N,A,F),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<F&&w.unshift(0),r(N,w,F,c),u==-1&&(F=N.length,u=t(m,N,ce,F),u<1&&(h++,r(N,ce<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[F++]=d[X]||0:(N=[d[X]],F=1);while((X++<ie||N[0]!==void 0)&&G--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,cx=b;else{for(f=1,h=R[0];h>=10;h/=10)f++;P.e=f+l*y-1,Je(P,a?s+P.e+1:s,o,b)}return P}}();function Je(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,a=f[0];a>=10;a/=10)i++;if(s=t-i,s<0)s+=Qe,o=t,l=f[h=0],c=l/mr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Qe),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Qe,o=s-Qe+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Qe,o=s-Qe+i,c=o<0?0:l/mr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%mr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/mr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=mr(10,(Qe-t%Qe)%Qe),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=mr(10,Qe-s),f[h]=o>0?(l/mr(10,i-o)%mr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==On&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=On)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return ct&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ri(e,t,r){if(!e.isFinite())return vx(e);var n,i=e.e,s=wr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+cs(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+cs(-i-1)+s,r&&(n=r-o)>0&&(s+=cs(n))):i>=o?(s+=cs(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+cs(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=cs(n))),s}function Yu(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function Zu(e,t,r){if(t>tN)throw ct=!0,r&&(e.precision=r),Error(ux);return Je(new e(Hu),t,1,!0)}function In(e,t,r){if(t>hp)throw Error(ux);return Je(new e(Ku),t,r,!0)}function hx(e){var t=e.length-1,r=t*Qe+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function cs(e){for(var t="";e--;)t+="0";return t}function px(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Qe+4);for(ct=!1;;){if(r%2&&(s=s.times(t),bx(s.d,o)&&(i=!0)),r=Ir(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),bx(t.d,o)}return ct=!0,s}function mx(e){return e.d[e.d.length-1]&1}function gx(e,t,r){for(var n,i=new e(t[0]),s=0;++s<t.length;)if(n=new e(t[s]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function pp(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ct=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(mr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Je(s.times(e),c,1),r=r.times(++l),a=o.plus(Wt(s,r,c,1)),wr(a.d).slice(0,c)===wr(o.d).slice(0,c)){for(i=f;i--;)o=Je(o.times(o),c,1);if(t==null)if(u<3&&nc(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Je(o,h.precision=b,y,ct=!0);else return h.precision=b,o}o=a}}function us(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ct=!1,l=N):l=t,P.precision=l+=b,r=wr(A),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=wr(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new P("0."+r),s++):w=new P(n+"."+r.slice(1))}else return u=Zu(P,l+2,N).times(s+""),w=us(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Je(w,N,R,ct=!0):w;for(f=w,c=o=w=Wt(w.minus(1),w.plus(1),l,1),h=Je(w.times(w),l,1),i=3;;){if(o=Je(o.times(h),l,1),u=c.plus(Wt(o,new P(i),l,1)),wr(u.d).slice(0,l)===wr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Zu(P,l+2,N).times(s+""))),c=Wt(c,new P(y),l,1),t==null)if(nc(c.d,l-b,R,a))P.precision=l+=b,u=o=w=Wt(f.minus(1),f.plus(1),l,1),h=Je(w.times(w),l,1),i=a=1;else return Je(c,P.precision=N,R,ct=!0);else return P.precision=N,c;c=u,i+=2}}function vx(e){return String(e.s*e.s/0)}function mp(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Qe,r<0&&(n+=Qe),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Qe;n<i;)e.d.push(+t.slice(n,n+=Qe));t=t.slice(n),n=Qe-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ct&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function nN(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),dx.test(t))return mp(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ZR.test(t))r=16,t=t.toLowerCase();else if(YR.test(t))r=2;else if(QR.test(t))r=8;else throw Error(as+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=px(n,new n(r),s,s*2)),u=Ju(t,r,On),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Yu(u,l),e.d=u,ct=!1,o&&(e=Wt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?mr(2,c):an.pow(2,c))),ct=!0,e)}function iN(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Lo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Qu(5,r)),t=Lo(e,2,t,t);for(var i,s=new e(5),o=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(a))));return t}function Lo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Qe);for(ct=!1,c=r.times(r),a=new e(n);;){if(o=Wt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Wt(o.times(c),new e(t++*t++),u,1),o=a.plus(n),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return ct=!0,o.d.length=l+1,o}function Qu(e,t){for(var r=e;--t;)r*=e;return r}function yx(e,t){var r,n=t.s<0,i=In(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return Pi=n?4:1,t;if(r=t.divToInt(i),r.isZero())Pi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return Pi=mx(r)?n?2:3:n?4:1,t;Pi=mx(r)?n?1:4:n?3:2}return t.minus(i).abs()}function gp(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(zr(r,1,os),n===void 0?n=y.rounding:zr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=vx(e);else{for(l=ri(e),o=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(l=l.replace(".",""),h=new y(1),h.e=l.length-o,h.d=Ju(ri(h),10,i),h.e=h.d.length),f=Ju(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=Wt(e,h,r,n,0,i),f=e.d,s=e.e,u=cx),o=f[r],a=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>a||o===a&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++s,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=fp.charAt(f[o]);if(b){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=Ju(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=fp.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>c)for(s-=c;s--;)l+="0";else s<c&&(l=l.slice(0,s)+"."+l.slice(s))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function bx(e,t){if(e.length>t)return e.length=t,!0}function sN(e){return new this(e).abs()}function oN(e){return new this(e).acos()}function aN(e){return new this(e).acosh()}function cN(e,t){return new this(e).plus(t)}function uN(e){return new this(e).asin()}function lN(e){return new this(e).asinh()}function fN(e){return new this(e).atan()}function dN(e){return new this(e).atanh()}function hN(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=In(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?In(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=In(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Wt(e,t,s,1)),t=In(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Wt(e,t,s,1)),r}function pN(e){return new this(e).cbrt()}function mN(e){return Je(e=new this(e),e.e+1,2)}function gN(e,t,r){return new this(e).clamp(t,r)}function vN(e){if(!e||typeof e!="object")throw Error(Xu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,os,"rounding",0,8,"toExpNeg",-Bo,0,"toExpPos",0,Bo,"maxE",0,Bo,"minE",-Bo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=dp[r]),(n=e[r])!==void 0)if(Ir(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(as+r+": "+n);if(r="crypto",i&&(this[r]=dp[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(lx);else this[r]=!1;else throw Error(as+r+": "+n);return this}function yN(e){return new this(e).cos()}function bN(e){return new this(e).cosh()}function wx(e){var t,r,n;function i(s){var o,a,c,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,_x(s)){u.s=s.s,ct?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;ct?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return mp(u,s.toString())}else if(c!=="string")throw Error(as+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),dx.test(s)?mp(u,s):nN(u,s)}if(i.prototype=we,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=vN,i.clone=wx,i.isDecimal=_x,i.abs=sN,i.acos=oN,i.acosh=aN,i.add=cN,i.asin=uN,i.asinh=lN,i.atan=fN,i.atanh=dN,i.atan2=hN,i.cbrt=pN,i.ceil=mN,i.clamp=gN,i.cos=yN,i.cosh=bN,i.div=wN,i.exp=_N,i.floor=xN,i.hypot=SN,i.ln=EN,i.log=CN,i.log10=MN,i.log2=TN,i.max=AN,i.min=ON,i.mod=IN,i.mul=PN,i.pow=kN,i.random=jN,i.round=RN,i.sign=NN,i.sin=DN,i.sinh=$N,i.sqrt=BN,i.sub=LN,i.sum=FN,i.tan=UN,i.tanh=zN,i.trunc=VN,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function wN(e,t){return new this(e).div(t)}function _N(e){return new this(e).exp()}function xN(e){return Je(e=new this(e),e.e+1,3)}function SN(){var e,t,r=new this(0);for(ct=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return ct=!0,new this(1/0);r=t}return ct=!0,r.sqrt()}function _x(e){return e instanceof an||e&&e.toStringTag===fx||!1}function EN(e){return new this(e).ln()}function CN(e,t){return new this(e).log(t)}function TN(e){return new this(e).log(2)}function MN(e){return new this(e).log(10)}function AN(){return gx(this,arguments,"lt")}function ON(){return gx(this,arguments,"gt")}function IN(e,t){return new this(e).mod(t)}function PN(e,t){return new this(e).mul(t)}function kN(e,t){return new this(e).pow(t)}function jN(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:zr(e,1,os),n=Math.ceil(e/Qe),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(lx);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=mr(10,Qe-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Qe)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Qe&&(r-=Qe-n)}return o.e=r,o.d=a,o}function RN(e){return Je(e=new this(e),e.e+1,this.rounding)}function NN(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function DN(e){return new this(e).sin()}function $N(e){return new this(e).sinh()}function BN(e){return new this(e).sqrt()}function LN(e,t){return new this(e).sub(t)}function FN(){var e=0,t=arguments,r=new this(t[e]);for(ct=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ct=!0,Je(r,this.precision,this.rounding)}function UN(e){return new this(e).tan()}function zN(e){return new this(e).tanh()}function VN(e){return Je(e=new this(e),e.e+1,1)}we[Symbol.for("nodejs.util.inspect.custom")]=we.toString,we[Symbol.toStringTag]="Decimal";var an=we.constructor=wx(dp);Hu=new an(Hu),Ku=new an(Ku),an.config({precision:256,rounding:an.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const cn=(e,t,r,n=an.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Le(e).equals(0))return"0";if(t!==void 0){const u=Ws(e,t,n);if(!Le(u).equals(0))return r?u:Fo(u)}const i=Le(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(Le(o).gt(0))!a||Le(o.length).gte(9)?c=Ws(i,0,n):Le(o.length).gte(4)?c=Ws(i,2,n):c=Ws(i,4,n);else{Ws(i,6,n);const u=KN(a);if(u<6)c=Ws(i,u+6,n);else{if(u>30)return"0";c=Ws(i,9+(u-6),n)}}return r||Le(o).lt(1)?c:Fo(c)},qN=(e,t=2)=>{if(typeof e>"u"||e==="undefined"||e!==0&&!e)return"--";if(Le(e).abs().gt(100))return"> 100%";if(Number(e)>=0&&Number(e)<=Math.pow(10,-t))return`<${Math.pow(10,-t)}%`;if(Number(e)<0&&Number(e)*-1<=Math.pow(10,-t))return` < -${Math.pow(10,-t)}%`;const r=HN(e,t);return Number(r)>0?`+${r}%`:`${r}%`},xx=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=cn(e,t,!0,an.ROUND_DOWN).toString();if(Le(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Fo(i).toString();return o.includes("e")&&(o=n?i:Fo(i).toString()),!r&&Number(i)<Math.pow(10,-t)?s?`-$${o.slice(1)}`:`<$${Math.pow(10,-t).toFixed(t)}`:s?`-$${o.slice(1)}`:`$${o}`}catch(i){return console.log("🚀 ~ formatCurrency ~ error:",i),"$--"}},WN=(e,t,r=!0)=>{if(`${e}`=="0")return!parseFloat(t)||!r?"0":"0.".padEnd(t+2,"0");if(!e)return"--";const n=parseFloat(e),i=e.toString(),s=n<0;let o=i;if(i.toLowerCase().includes("e")){const a=i.match(/(\d+?)(?:\.(\d*))?e([+-])(\d+)/),c=a[1],u=a[2],l=a[3],f=a[4];let h="",y=u?u.substr(f):"";if(y&&(y=`.${y}`),l!=="-"){for(let b=0;b<f;b+=1){const w=u[b]||"0";h+=w}o=c+h+y}else{let b="0";for(let w=0;w<f;w+=1)h=(c[c.length-w-1]||"0")+h;c.length>f&&(b=c.substr(0,c.length-f)),o=`${b}.${h}${u}`}}if(t&&r){let a=`${o.split(".")[0]}.`;const c=o.split(".")[1]||"";for(let u=0;u<t;u+=1)a+=c[u]||"0";o=a}if(o.length>14){const a=o.split(".");a[0].length>14?o=`${a[0].slice(0,14)}+`:(o=o.slice(0,13),o.indexOf(".")===12&&(o=o.slice(0,12)))}return`${s?"-":""}${o}`},Le=e=>an.isDecimal(e)?e:new an(typeof e>"u"||e==="undefined"||!e?0:e);function GN(e,t){return t===void 0?"":Le(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const Ws=(e,t,r)=>Le(e).toDP(t,r).toString(),HN=(e,t)=>{try{return Le(e).toDP(t,an.ROUND_DOWN).toString()}catch{return String(e)}},Fo=e=>{const[t,r]=e.split(".");let n="";for(let i=t.length-1,s=0;i>=0;i--,s++)n=t[i]+n,s%3===2&&i!==0&&(n=","+n);return r?`${n}.${r}`:n};function KN(e){let t=0;if(e)for(;t<e.length;){if(Le(e[t]).gt(0))return t+1;t++}return 0}function XN(e,t){const r=Sx(Le(t));return Number(Le(e).mul(r))}function JN(e,t){const r=Sx(Le(t));return Number(Le(e).div(r))}function Sx(e){return Le(10).pow(Le(e).abs())}function vp(e,t){const r=JN(e,t);return YN(r.toString(),Number(t))}function YN(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return WN(r,t);const[n,i]=r.split("e");let s=n;const o=Math.abs(parseInt(i,10));let a="",c=s.length;if(n.includes(".")){const[u,l]=n.split(".");s=u+l,c=u.length}for(let u=0;u<o-c;u++)a+="0";return`0.${a}${s}`.slice(0,t+2)}return e}function el(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Gs=(e,t="")=>t=="long"?e&&e.length>40?e.substring(0,40)+"...":e&&e.length<40?e:"":e?e.substring(0,6)+"..."+e.substring(e.length-4):"",yp=(e,t)=>{if(e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r)if(!yp(e[i],t[i]))return!1;return!0};function Ex(e){return!e||Object.keys(e).length===0}function Cx(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const Tx=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function ZN(e,t,r=!1){var a;const n=e.balanceChanges,i=(a=e.effects)==null?void 0:a.gasUsed,s={};let o="0";return i&&(o=Le(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=rc(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===Pf;let f=c.amount;l&&(f=r?f:Le(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function Mx(e,t){if(t){const r=e[rc(t.coin_type).full_address];if(r)return vp(Le(r.amount).abs().toFixed(0),t.decimals)}}function Ft(e){return`https://archive.cetus.zone/assets/terminal${e}`}const un=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Le(t).gt(0)?`${e.slice(0,t)}...`:e,tl=(e,t)=>qs(e||"")===qs(t||""),QN=async function(e,t,r=3e4){const n=[];let i="";if(t){for(const c in t){const u=`${c}=${t[c]}`;n.push(u)}const a=n.join("&");i=`${e}?${a}`}else i=e;const s=new AbortController,o=setTimeout(()=>{s.abort()},r);try{const a=await fetch(i,{signal:s.signal});if(clearTimeout(o),!a.ok)throw new Error("Request failed");const c=await a.json();return(c==null?void 0:c.data)||c}catch(a){throw clearTimeout(o),a.name==="AbortError"?new Error("request time out"):a}},eD=async function(e,t,r=3e4){const n=new AbortController,i=setTimeout(()=>{n.abort()},r);try{const s=await fetch(e,{body:JSON.stringify(t),method:"POST",signal:n.signal});if(clearTimeout(i),!s.ok)throw new Error("Request failed");return s.json()}catch(s){throw clearTimeout(i),s.name==="AbortError"?new Error("request time out"):s}},bp="tokenMap",Ax="trustedTokenList",Ox="collectTokenMap",Ix="importTokenList";var Px={exports:{}};/*!
|
|
44
|
+
*/var Bo=9e15,as=1e9,fp="0123456789abcdef",Hu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ku="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",dp={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Bo,maxE:Bo,crypto:!1},cx,ji,ct=!0,Xu="[DecimalError] ",cs=Xu+"Invalid argument: ",ux=Xu+"Precision limit exceeded",lx=Xu+"crypto unavailable",fx="[object Decimal]",Ir=Math.floor,mr=Math.pow,YN=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ZN=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,QN=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,dx=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,On=1e7,Qe=7,eR=9007199254740991,tR=Hu.length-1,hp=Ku.length-1,we={toStringTag:fx};we.absoluteValue=we.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Je(e)},we.ceil=function(){return Je(new this.constructor(this),this.e+1,2)},we.clampedTo=we.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(cs+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)},we.comparedTo=we.cmp=function(e){var t,r,n,i,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,u=e.s;if(!o||!a)return!c||!u?NaN:c!==u?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-u:0;if(c!==u)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(o[t]!==a[t])return o[t]>a[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},we.cosine=we.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=rR(n,yx(n,r)),n.precision=e,n.rounding=t,Je(ji==2||ji==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)},we.cubeRoot=we.cbrt=function(){var e,t,r,n,i,s,o,a,c,u,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(ct=!1,s=l.s*mr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=wr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=mr(r,1/3),e=Ir((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new f(r),n.s=l.s):n=new f(s.toString()),o=(e=f.precision)+3;;)if(a=n,c=a.times(a).times(a),u=c.plus(l),n=Wt(u.plus(l).times(a),u.plus(c),o+2,1),wr(a.d).slice(0,o)===(r=wr(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Je(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}o+=4,i=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(Je(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ct=!0,Je(n,e,f.rounding,t)},we.decimalPlaces=we.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ir(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},we.dividedBy=we.div=function(e){return Wt(this,new this.constructor(e))},we.dividedToIntegerBy=we.divToInt=function(e){var t=this,r=t.constructor;return Je(Wt(t,new r(e),0,1,1),r.precision,r.rounding)},we.equals=we.eq=function(e){return this.cmp(e)===0},we.floor=function(){return Je(new this.constructor(this),this.e+1,3)},we.greaterThan=we.gt=function(e){return this.cmp(e)>0},we.greaterThanOrEqualTo=we.gte=function(e){var t=this.cmp(e);return t==1||t===0},we.hyperbolicCosine=we.cosh=function(){var e,t,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,i=s.d.length,i<32?(e=Math.ceil(i/3),t=(1/Qu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Lo(o,1,s.times(t),new o(1),!0);for(var c,u=e,l=new o(8);u--;)c=s.times(s),s=a.minus(c.times(l.minus(c.times(l))));return Je(s,o.precision=r,o.rounding=n,!0)},we.hyperbolicSine=we.sinh=function(){var e,t,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(t=s.precision,r=s.rounding,s.precision=t+Math.max(i.e,i.sd())+4,s.rounding=1,n=i.d.length,n<3)i=Lo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Qu(5,e)),i=Lo(s,2,i,i,!0);for(var o,a=new s(5),c=new s(16),u=new s(20);e--;)o=i.times(i),i=i.times(a.plus(o.times(c.times(o).plus(u))))}return s.precision=t,s.rounding=r,Je(i,t,r,!0)},we.hyperbolicTangent=we.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Wt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},we.inverseCosine=we.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,s=r.rounding;return n!==-1?n===0?t.isNeg()?In(r,i,s):new r(0):new r(NaN):t.isZero()?In(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=In(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))},we.inverseHyperbolicCosine=we.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,ct=!1,r=r.times(r).minus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},we.inverseHyperbolicSine=we.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,ct=!1,r=r.times(r).plus(1).sqrt().plus(r),ct=!0,n.precision=e,n.rounding=t,r.ln())},we.inverseHyperbolicTangent=we.atanh=function(){var e,t,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=s.precision,t=s.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Je(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Wt(i.plus(1),new s(1).minus(i),r+e,1),s.precision=e+4,s.rounding=1,i=i.ln(),s.precision=e,s.rounding=t,i.times(.5))):new s(NaN)},we.inverseSine=we.asin=function(){var e,t,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(t=i.abs().cmp(1),r=s.precision,n=s.rounding,t!==-1?t===0?(e=In(s,r+4,n).times(.5),e.s=i.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},we.inverseTangent=we.atan=function(){var e,t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&f+4<=hp)return o=In(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=hp)return o=In(l,f+4,h).times(.5),o.s=u.s,o}for(l.precision=a=f+10,l.rounding=1,r=Math.min(28,a/Qe+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ct=!1,t=Math.ceil(a/Qe),n=1,c=u.times(u),o=new l(u),i=u;e!==-1;)if(i=i.times(c),s=o.minus(i.div(n+=2)),i=i.times(c),o=s.plus(i.div(n+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),ct=!0,Je(o,l.precision=f,l.rounding=h,!0)},we.isFinite=function(){return!!this.d},we.isInteger=we.isInt=function(){return!!this.d&&Ir(this.e/Qe)>this.d.length-2},we.isNaN=function(){return!this.s},we.isNegative=we.isNeg=function(){return this.s<0},we.isPositive=we.isPos=function(){return this.s>0},we.isZero=function(){return!!this.d&&this.d[0]===0},we.lessThan=we.lt=function(e){return this.cmp(e)<0},we.lessThanOrEqualTo=we.lte=function(e){return this.cmp(e)<1},we.logarithm=we.log=function(e){var t,r,n,i,s,o,a,c,u=this,l=u.constructor,f=l.precision,h=l.rounding,y=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:u.s!=1?NaN:r?0:1/0);if(t)if(r.length>1)s=!0;else{for(i=r[0];i%10===0;)i/=10;s=i!==1}if(ct=!1,a=f+y,o=ls(u,a),n=t?Zu(l,a+10):ls(e,a),c=Wt(o,n,a,1),ic(c.d,i=f,h))do if(a+=10,o=ls(u,a),n=t?Zu(l,a+10):ls(e,a),c=Wt(o,n,a,1),!s){+wr(c.d).slice(i+1,i+15)+1==1e14&&(c=Je(c,f+1,0));break}while(ic(c.d,i+=10,h));return ct=!0,Je(c,f,h)},we.minus=we.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.constructor;if(e=new b(e),!y.d||!e.d)return!y.s||!e.s?e=new b(NaN):y.d?e.s=-e.s:e=new b(e.d||y.s!==e.s?y:NaN),e;if(y.s!=e.s)return e.s=-e.s,y.plus(e);if(u=y.d,h=e.d,a=b.precision,c=b.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new b(y);else return new b(c===3?-0:0);return ct?Je(e,a,c):e}if(r=Ir(e.e/Qe),l=Ir(y.e/Qe),u=u.slice(),s=l-r,s){for(f=s<0,f?(t=u,s=-s,o=h.length):(t=h,r=l,o=u.length),n=Math.max(Math.ceil(a/Qe),o)+2,s>n&&(s=n,t.length=1),t.reverse(),n=s;n--;)t.push(0);t.reverse()}else{for(n=u.length,o=h.length,f=n<o,f&&(o=n),n=0;n<o;n++)if(u[n]!=h[n]){f=u[n]<h[n];break}s=0}for(f&&(t=u,u=h,h=t,e.s=-e.s),o=u.length,n=h.length-o;n>0;--n)u[o++]=0;for(n=h.length;n>s;){if(u[--n]<h[n]){for(i=n;i&&u[--i]===0;)u[i]=On-1;--u[i],u[n]+=On}u[n]-=h[n]}for(;u[--o]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(e.d=u,e.e=Yu(u,r),ct?Je(e,a,c):e):new b(c===3?-0:0)},we.modulo=we.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Je(new n(r),n.precision,n.rounding):(ct=!1,n.modulo==9?(t=Wt(r,e.abs(),0,3,1),t.s*=e.s):t=Wt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))},we.naturalExponential=we.exp=function(){return pp(this)},we.naturalLogarithm=we.ln=function(){return ls(this)},we.negated=we.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Je(e)},we.plus=we.add=function(e){var t,r,n,i,s,o,a,c,u,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(u=f.d,l=e.d,a=h.precision,c=h.rounding,!u[0]||!l[0])return l[0]||(e=new h(f)),ct?Je(e,a,c):e;if(s=Ir(f.e/Qe),n=Ir(e.e/Qe),u=u.slice(),i=s-n,i){for(i<0?(r=u,i=-i,o=l.length):(r=l,n=s,o=u.length),s=Math.ceil(a/Qe),o=s>o?s+1:o+1,i>o&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(o=u.length,i=l.length,o-i<0&&(i=o,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/On|0,u[i]%=On;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Yu(u,n),ct?Je(e,a,c):e},we.precision=we.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(cs+e);return r.d?(t=hx(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},we.round=function(){var e=this,t=e.constructor;return Je(new t(e),e.e+1,t.rounding)},we.sine=we.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Qe,n.rounding=1,r=iR(n,yx(n,r)),n.precision=e,n.rounding=t,Je(ji>2?r.neg():r,e,t,!0)):new n(NaN)},we.squareRoot=we.sqrt=function(){var e,t,r,n,i,s,o=this,a=o.d,c=o.e,u=o.s,l=o.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);for(ct=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=wr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Ir((c+1)/2)-(c<0||c%2),u==1/0?t="5e"+c:(t=u.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new l(t)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(s=n,n=s.plus(Wt(o,s,r+2,1)).times(.5),wr(s.d).slice(0,r)===(t=wr(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Je(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(Je(n,c+1,1),e=!n.times(n).eq(o));break}return ct=!0,Je(n,c,l.rounding,e)},we.tangent=we.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Wt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Je(ji==2||ji==4?r.neg():r,e,t,!0)):new n(NaN)},we.times=we.mul=function(e){var t,r,n,i,s,o,a,c,u,l=this,f=l.constructor,h=l.d,y=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!y||!y[0])return new f(!e.s||h&&!h[0]&&!y||y&&!y[0]&&!h?NaN:!h||!y?e.s/0:e.s*0);for(r=Ir(l.e/Qe)+Ir(e.e/Qe),c=h.length,u=y.length,c<u&&(s=h,h=y,y=s,o=c,c=u,u=o),s=[],o=c+u,n=o;n--;)s.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=s[i]+y[n]*h[i-n-1]+t,s[i--]=a%On|0,t=a/On|0;s[i]=(s[i]+t)%On|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Yu(s,r),ct?Je(e,f.precision,f.rounding):e},we.toBinary=function(e,t){return gp(this,2,e,t)},we.toDecimalPlaces=we.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(qr(e,0,as),t===void 0?t=n.rounding:qr(t,0,8),Je(r,e+r.e+1,t))},we.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,!0):(qr(e,0,as),t===void 0?t=i.rounding:qr(t,0,8),n=Je(new i(n),e+1,t),r=ri(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=ri(i):(qr(e,0,as),t===void 0?t=s.rounding:qr(t,0,8),n=Je(new s(i),e+i.e+1,t),r=ri(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},we.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,b=y.d,w=y.constructor;if(!b)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=hx(b)-y.e-1,o=s%Qe,t.d[0]=mr(10,o<0?Qe+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(cs+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new w(wr(b)),l=w.precision,w.precision=s=b.length*Qe*2;f=Wt(a,t,0,1,1),i=r.plus(f.times(n)),i.cmp(e)!=1;)r=n,n=i,i=u,u=c.plus(f.times(i)),c=i,i=t,t=a.minus(f.times(i)),a=i;return i=Wt(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=y.s,h=Wt(u,n,s,1).minus(y).abs().cmp(Wt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h},we.toHexadecimal=we.toHex=function(e,t){return gp(this,16,e,t)},we.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),t===void 0?t=n.rounding:qr(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(ct=!1,r=Wt(r,e,0,t,1).times(e),ct=!0,Je(r)):(e.s=r.s,r=e),r},we.toNumber=function(){return+this},we.toOctal=function(e,t){return gp(this,8,e,t)},we.toPower=we.pow=function(e){var t,r,n,i,s,o,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(mr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Je(a,n,s);if(t=Ir(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=eR)return i=px(c,a,r,n),e.s<0?new c(1).div(i):Je(i,n,s);if(o=a.s,o<0){if(t<e.d.length-1)return new c(NaN);if(e.d[t]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=mr(+a,u),t=r==0||!isFinite(r)?Ir(u*(Math.log("0."+wr(a.d))/Math.LN10+a.e+1)):new c(r+"").e,t>c.maxE+1||t<c.minE-1?new c(t>0?o/0:0):(ct=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=pp(e.times(ls(a,n+r)),n),i.d&&(i=Je(i,n+5,1),ic(i.d,n,s)&&(t=n+10,i=Je(pp(e.times(ls(a,t+r)),t),t+5,1),+wr(i.d).slice(n+1,n+15)+1==1e14&&(i=Je(i,n+1,0)))),i.s=o,ct=!0,c.rounding=s,Je(i,n,s))},we.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=ri(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(qr(e,1,as),t===void 0?t=i.rounding:qr(t,0,8),n=Je(new i(n),e,t),r=ri(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},we.toSignificantDigits=we.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(qr(e,1,as),t===void 0?t=n.rounding:qr(t,0,8)),Je(new n(r),e,t)},we.toString=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},we.truncated=we.trunc=function(){return Je(new this.constructor(this),this.e+1,1)},we.valueOf=we.toJSON=function(){var e=this,t=e.constructor,r=ri(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function wr(e){var t,r,n,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;t<i;t++)n=e[t]+"",r=Qe-n.length,r&&(s+=us(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=us(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function qr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(cs+e)}function ic(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=Qe,i=0):(i=Math.ceil((t+1)/Qe),t%=Qe),s=mr(10,Qe-t),a=e[i]%s|0,n==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[i+1]/s/100|0)==mr(10,t-2)-1||(a==s/2||a==0)&&(e[i+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[i+1]/s/1e3|0)==mr(10,t-3)-1,o}function Ju(e,t,r){for(var n,i=[0],s,o=0,a=e.length;o<a;){for(s=i.length;s--;)i[s]*=t;for(i[0]+=fp.indexOf(e.charAt(o++)),n=0;n<i.length;n++)i[n]>r-1&&(i[n+1]===void 0&&(i[n+1]=0),i[n+1]+=i[n]/r|0,i[n]%=r)}return i.reverse()}function rR(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Qu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Lo(e,1,t.times(i),new e(1));for(var s=r;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}var Wt=function(){function e(n,i,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*i+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function t(n,i,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=i[a]){c=n[a]>i[a]?1:-1;break}return c}function r(n,i,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<i[s]?1:0,n[s]=a*o+n[s]-i[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,s,o,a,c){var u,l,f,h,y,b,w,A,P,N,R,U,L,G,q,X,ie,ae,ce,V,D=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new D(!n.s||!i.s||(d?m&&d[0]==m[0]:!m)?NaN:d&&d[0]==0||!m?p*0:p/0);for(c?(y=1,l=n.e-i.e):(c=On,y=Qe,l=Ir(n.e/y)-Ir(i.e/y)),ce=m.length,ie=d.length,P=new D(p),N=P.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(G=s=D.precision,o=D.rounding):a?G=s+(n.e-i.e)+1:G=s,G<0)N.push(1),b=!0;else{if(G=G/y+2|0,f=0,ce==1){for(h=0,m=m[0],G++;(f<ie||h)&&G--;f++)q=h*c+(d[f]||0),N[f]=q/m|0,h=q%m|0;b=h||f<ie}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),ce=m.length,ie=d.length),X=ce,R=d.slice(0,ce),U=R.length;U<ce;)R[U++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,R,ce,U),u<0?(L=R[0],ce!=U&&(L=L*c+(R[1]||0)),h=L/ae|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),A=w.length,U=R.length,u=t(w,R,A,U),u==1&&(h--,r(w,ce<A?V:m,A,c))):(h==0&&(u=h=1),w=m.slice()),A=w.length,A<U&&w.unshift(0),r(R,w,U,c),u==-1&&(U=R.length,u=t(m,R,ce,U),u<1&&(h++,r(R,ce<U?V:m,U,c))),U=R.length):u===0&&(h++,R=[0]),N[f++]=h,u&&R[0]?R[U++]=d[X]||0:(R=[d[X]],U=1);while((X++<ie||R[0]!==void 0)&&G--);b=R[0]!==void 0}N[0]||N.shift()}if(y==1)P.e=l,cx=b;else{for(f=1,h=N[0];h>=10;h/=10)f++;P.e=f+l*y-1,Je(P,a?s+P.e+1:s,o,b)}return P}}();function Je(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(i=1,a=f[0];a>=10;a/=10)i++;if(s=t-i,s<0)s+=Qe,o=t,l=f[h=0],c=l/mr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/Qe),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=Qe,o=s-Qe+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=Qe,o=s-Qe+i,c=o<0?0:l/mr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%mr(10,i-o-1)),u=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?l/mr(10,i-o):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,u?(t-=e.e+1,f[0]=mr(10,(Qe-t%Qe)%Qe),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=mr(10,Qe-s),f[h]=o>0?(l/mr(10,i-o)%mr(10,o)|0)*a:0),u)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==On&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=On)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return ct&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function ri(e,t,r){if(!e.isFinite())return vx(e);var n,i=e.e,s=wr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+us(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+us(-i-1)+s,r&&(n=r-o)>0&&(s+=us(n))):i>=o?(s+=us(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+us(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=us(n))),s}function Yu(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function Zu(e,t,r){if(t>tR)throw ct=!0,r&&(e.precision=r),Error(ux);return Je(new e(Hu),t,1,!0)}function In(e,t,r){if(t>hp)throw Error(ux);return Je(new e(Ku),t,r,!0)}function hx(e){var t=e.length-1,r=t*Qe+1;if(t=e[t],t){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function us(e){for(var t="";e--;)t+="0";return t}function px(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Qe+4);for(ct=!1;;){if(r%2&&(s=s.times(t),bx(s.d,o)&&(i=!0)),r=Ir(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),bx(t.d,o)}return ct=!0,s}function mx(e){return e.d[e.d.length-1]&1}function gx(e,t,r){for(var n,i=new e(t[0]),s=0;++s<t.length;)if(n=new e(t[s]),n.s)i[r](n)&&(i=n);else{i=n;break}return i}function pp(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,b=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(ct=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(mr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Je(s.times(e),c,1),r=r.times(++l),a=o.plus(Wt(s,r,c,1)),wr(a.d).slice(0,c)===wr(o.d).slice(0,c)){for(i=f;i--;)o=Je(o.times(o),c,1);if(t==null)if(u<3&&ic(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Je(o,h.precision=b,y,ct=!0);else return h.precision=b,o}o=a}}function ls(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,A=w.d,P=w.constructor,N=P.rounding,R=P.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new P(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ct=!1,l=R):l=t,P.precision=l+=b,r=wr(A),n=r.charAt(0),Math.abs(s=w.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)w=w.times(e),r=wr(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new P("0."+r),s++):w=new P(n+"."+r.slice(1))}else return u=Zu(P,l+2,R).times(s+""),w=ls(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=R,t==null?Je(w,R,N,ct=!0):w;for(f=w,c=o=w=Wt(w.minus(1),w.plus(1),l,1),h=Je(w.times(w),l,1),i=3;;){if(o=Je(o.times(h),l,1),u=c.plus(Wt(o,new P(i),l,1)),wr(u.d).slice(0,l)===wr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Zu(P,l+2,R).times(s+""))),c=Wt(c,new P(y),l,1),t==null)if(ic(c.d,l-b,N,a))P.precision=l+=b,u=o=w=Wt(f.minus(1),f.plus(1),l,1),h=Je(w.times(w),l,1),i=a=1;else return Je(c,P.precision=R,N,ct=!0);else return P.precision=R,c;c=u,i+=2}}function vx(e){return String(e.s*e.s/0)}function mp(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;n++);for(i=t.length;t.charCodeAt(i-1)===48;--i);if(t=t.slice(n,i),t){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%Qe,r<0&&(n+=Qe),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=Qe;n<i;)e.d.push(+t.slice(n,n+=Qe));t=t.slice(n),n=Qe-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ct&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function nR(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),dx.test(t))return mp(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ZN.test(t))r=16,t=t.toLowerCase();else if(YN.test(t))r=2;else if(QN.test(t))r=8;else throw Error(cs+t);for(s=t.search(/p/i),s>0?(c=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,n=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,i=px(n,new n(r),s,s*2)),u=Ju(t,r,On),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Yu(u,l),e.d=u,ct=!1,o&&(e=Wt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?mr(2,c):$r.pow(2,c))),ct=!0,e)}function iR(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Lo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Qu(5,r)),t=Lo(e,2,t,t);for(var i,s=new e(5),o=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(a))));return t}function Lo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Qe);for(ct=!1,c=r.times(r),a=new e(n);;){if(o=Wt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Wt(o.times(c),new e(t++*t++),u,1),o=a.plus(n),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return ct=!0,o.d.length=l+1,o}function Qu(e,t){for(var r=e;--t;)r*=e;return r}function yx(e,t){var r,n=t.s<0,i=In(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return ji=n?4:1,t;if(r=t.divToInt(i),r.isZero())ji=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return ji=mx(r)?n?2:3:n?4:1,t;ji=mx(r)?n?1:4:n?3:2}return t.minus(i).abs()}function gp(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(qr(r,1,as),n===void 0?n=y.rounding:qr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=vx(e);else{for(l=ri(e),o=l.indexOf("."),b?(i=2,t==16?r=r*4-3:t==8&&(r=r*3-2)):i=t,o>=0&&(l=l.replace(".",""),h=new y(1),h.e=l.length-o,h.d=Ju(ri(h),10,i),h.e=h.d.length),f=Ju(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=b?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=Wt(e,h,r,n,0,i),f=e.d,s=e.e,u=cx),o=f[r],a=i/2,u=u||f[r+1]!==void 0,u=n<4?(o!==void 0||u)&&(n===0||n===(e.s<0?3:2)):o>a||o===a&&(n===4||u||n===6&&f[r-1]&1||n===(e.s<0?8:7)),f.length=r,u)for(;++f[--r]>i-1;)f[r]=0,r||(++s,f.unshift(1));for(c=f.length;!f[c-1];--c);for(o=0,l="";o<c;o++)l+=fp.charAt(f[o]);if(b){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=Ju(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=fp.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>c)for(s-=c;s--;)l+="0";else s<c&&(l=l.slice(0,s)+"."+l.slice(s))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function bx(e,t){if(e.length>t)return e.length=t,!0}function sR(e){return new this(e).abs()}function oR(e){return new this(e).acos()}function aR(e){return new this(e).acosh()}function cR(e,t){return new this(e).plus(t)}function uR(e){return new this(e).asin()}function lR(e){return new this(e).asinh()}function fR(e){return new this(e).atan()}function dR(e){return new this(e).atanh()}function hR(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,s=n+4;return!e.s||!t.s?r=new this(NaN):!e.d&&!t.d?(r=In(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?In(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=In(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Wt(e,t,s,1)),t=In(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Wt(e,t,s,1)),r}function pR(e){return new this(e).cbrt()}function mR(e){return Je(e=new this(e),e.e+1,2)}function gR(e,t,r){return new this(e).clamp(t,r)}function vR(e){if(!e||typeof e!="object")throw Error(Xu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,as,"rounding",0,8,"toExpNeg",-Bo,0,"toExpPos",0,Bo,"maxE",0,Bo,"minE",-Bo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=dp[r]),(n=e[r])!==void 0)if(Ir(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(cs+r+": "+n);if(r="crypto",i&&(this[r]=dp[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(lx);else this[r]=!1;else throw Error(cs+r+": "+n);return this}function yR(e){return new this(e).cos()}function bR(e){return new this(e).cosh()}function wx(e){var t,r,n;function i(s){var o,a,c,u=this;if(!(u instanceof i))return new i(s);if(u.constructor=i,_x(s)){u.s=s.s,ct?!s.d||s.e>i.maxE?(u.e=NaN,u.d=null):s.e<i.minE?(u.e=0,u.d=[0]):(u.e=s.e,u.d=s.d.slice()):(u.e=s.e,u.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){u.s=1/s<0?-1:1,u.e=0,u.d=[0];return}if(s<0?(s=-s,u.s=-1):u.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;ct?o>i.maxE?(u.e=NaN,u.d=null):o<i.minE?(u.e=0,u.d=[0]):(u.e=o,u.d=[s]):(u.e=o,u.d=[s]);return}else if(s*0!==0){s||(u.s=NaN),u.e=NaN,u.d=null;return}return mp(u,s.toString())}else if(c!=="string")throw Error(cs+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),dx.test(s)?mp(u,s):nR(u,s)}if(i.prototype=we,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=vR,i.clone=wx,i.isDecimal=_x,i.abs=sR,i.acos=oR,i.acosh=aR,i.add=cR,i.asin=uR,i.asinh=lR,i.atan=fR,i.atanh=dR,i.atan2=hR,i.cbrt=pR,i.ceil=mR,i.clamp=gR,i.cos=yR,i.cosh=bR,i.div=wR,i.exp=_R,i.floor=xR,i.hypot=SR,i.ln=ER,i.log=CR,i.log10=TR,i.log2=MR,i.max=AR,i.min=OR,i.mod=IR,i.mul=PR,i.pow=jR,i.random=kR,i.round=NR,i.sign=RR,i.sin=DR,i.sinh=$R,i.sqrt=BR,i.sub=LR,i.sum=UR,i.tan=FR,i.tanh=zR,i.trunc=VR,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function wR(e,t){return new this(e).div(t)}function _R(e){return new this(e).exp()}function xR(e){return Je(e=new this(e),e.e+1,3)}function SR(){var e,t,r=new this(0);for(ct=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return ct=!0,new this(1/0);r=t}return ct=!0,r.sqrt()}function _x(e){return e instanceof $r||e&&e.toStringTag===fx||!1}function ER(e){return new this(e).ln()}function CR(e,t){return new this(e).log(t)}function MR(e){return new this(e).log(2)}function TR(e){return new this(e).log(10)}function AR(){return gx(this,arguments,"lt")}function OR(){return gx(this,arguments,"gt")}function IR(e,t){return new this(e).mod(t)}function PR(e,t){return new this(e).mul(t)}function jR(e,t){return new this(e).pow(t)}function kR(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:qr(e,1,as),n=Math.ceil(e/Qe),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));s<n;)i=t[s],i>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);s<n;)i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=n/4}else throw Error(lx);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=mr(10,Qe-e),a[s]=(n/i|0)*i);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=Qe)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<Qe&&(r-=Qe-n)}return o.e=r,o.d=a,o}function NR(e){return Je(e=new this(e),e.e+1,this.rounding)}function RR(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function DR(e){return new this(e).sin()}function $R(e){return new this(e).sinh()}function BR(e){return new this(e).sqrt()}function LR(e,t){return new this(e).sub(t)}function UR(){var e=0,t=arguments,r=new this(t[e]);for(ct=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ct=!0,Je(r,this.precision,this.rounding)}function FR(e){return new this(e).tan()}function zR(e){return new this(e).tanh()}function VR(e){return Je(e=new this(e),e.e+1,1)}we[Symbol.for("nodejs.util.inspect.custom")]=we.toString,we[Symbol.toStringTag]="Decimal";var $r=we.constructor=wx(dp);Hu=new $r(Hu),Ku=new $r(Ku),$r.config({precision:256,rounding:$r.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const Pr=(e,t,r,n=$r.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Le(e).equals(0))return"0";if(t!==void 0){const u=Ws(e,t,n);if(!Le(u).equals(0))return r?u:Uo(u)}const i=Le(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(Le(o).gt(0))!a||Le(o.length).gte(9)?c=Ws(i,0,n):Le(o.length).gte(4)?c=Ws(i,2,n):c=Ws(i,4,n);else{Ws(i,6,n);const u=GR(a);if(u<6)c=Ws(i,u+6,n);else{if(u>30)return"0";c=Ws(i,9+(u-6),n)}}return r||Le(o).lt(1)?c:Uo(c)},xx=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=Pr(e,t,!0,$r.ROUND_DOWN).toString();if(Le(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Uo(i).toString();return o.includes("e")&&(o=n?i:Uo(i).toString()),!r&&Number(i)<Math.pow(10,-t)?s?`-$${o.slice(1)}`:`<$${Math.pow(10,-t).toFixed(t)}`:s?`-$${o.slice(1)}`:`$${o}`}catch{return"$--"}},qR=(e,t,r=!0)=>{if(`${e}`=="0")return!parseFloat(t)||!r?"0":"0.".padEnd(t+2,"0");if(!e)return"--";const n=parseFloat(e),i=e.toString(),s=n<0;let o=i;if(i.toLowerCase().includes("e")){const a=i.match(/(\d+?)(?:\.(\d*))?e([+-])(\d+)/),c=a[1],u=a[2],l=a[3],f=a[4];let h="",y=u?u.substr(f):"";if(y&&(y=`.${y}`),l!=="-"){for(let b=0;b<f;b+=1){const w=u[b]||"0";h+=w}o=c+h+y}else{let b="0";for(let w=0;w<f;w+=1)h=(c[c.length-w-1]||"0")+h;c.length>f&&(b=c.substr(0,c.length-f)),o=`${b}.${h}${u}`}}if(t&&r){let a=`${o.split(".")[0]}.`;const c=o.split(".")[1]||"";for(let u=0;u<t;u+=1)a+=c[u]||"0";o=a}if(o.length>14){const a=o.split(".");a[0].length>14?o=`${a[0].slice(0,14)}+`:(o=o.slice(0,13),o.indexOf(".")===12&&(o=o.slice(0,12)))}return`${s?"-":""}${o}`},Le=e=>$r.isDecimal(e)?e:new $r(typeof e>"u"||e==="undefined"||!e?0:e);function WR(e,t){return t===void 0?"":Le(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const Ws=(e,t,r)=>Le(e).toDP(t,r).toString(),Uo=e=>{const[t,r]=e.split(".");let n="";for(let i=t.length-1,s=0;i>=0;i--,s++)n=t[i]+n,s%3===2&&i!==0&&(n=","+n);return r?`${n}.${r}`:n};function GR(e){let t=0;if(e)for(;t<e.length;){if(Le(e[t]).gt(0))return t+1;t++}return 0}function HR(e,t){const r=Sx(Le(t));return Number(Le(e).mul(r))}function KR(e,t){const r=Sx(Le(t));return Number(Le(e).div(r))}function Sx(e){return Le(10).pow(Le(e).abs())}function vp(e,t){const r=KR(e,t);return XR(r.toString(),Number(t))}function XR(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return qR(r,t);const[n,i]=r.split("e");let s=n;const o=Math.abs(parseInt(i,10));let a="",c=s.length;if(n.includes(".")){const[u,l]=n.split(".");s=u+l,c=u.length}for(let u=0;u<o-c;u++)a+="0";return`0.${a}${s}`.slice(0,t+2)}return e}function el(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Gs=(e,t="")=>t=="long"?e&&e.length>40?e.substring(0,40)+"...":e&&e.length<40?e:"":e?e.substring(0,6)+"..."+e.substring(e.length-4):"",yp=(e,t)=>{if(e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r)if(!yp(e[i],t[i]))return!1;return!0};function Ex(e){return!e||Object.keys(e).length===0}function Cx(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const Mx=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function JR(e,t,r=!1){var a;const n=e.balanceChanges,i=(a=e.effects)==null?void 0:a.gasUsed,s={};let o="0";return i&&(o=Le(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=nc(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===Pf;let f=c.amount;l&&(f=r?f:Le(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function Tx(e,t){if(t){const r=e[nc(t.coin_type).full_address];if(r)return vp(Le(r.amount).abs().toFixed(0),t.decimals)}}function Ut(e){return`https://archive.cetus.zone/assets/terminal${e}`}const un=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Le(t).gt(0)?`${e.slice(0,t)}...`:e,tl=(e,t)=>Pi(e||"")===Pi(t||""),YR=async function(e,t,r=3e4){const n=[];let i="";if(t){for(const c in t){const u=`${c}=${t[c]}`;n.push(u)}const a=n.join("&");i=`${e}?${a}`}else i=e;const s=new AbortController,o=setTimeout(()=>{s.abort()},r);try{const a=await fetch(i,{signal:s.signal});if(clearTimeout(o),!a.ok)throw new Error("Request failed");const c=await a.json();return(c==null?void 0:c.data)||c}catch(a){throw clearTimeout(o),a.name==="AbortError"?new Error("request time out"):a}},ZR=async function(e,t,r=3e4){const n=new AbortController,i=setTimeout(()=>{n.abort()},r);try{const s=await fetch(e,{body:JSON.stringify(t),method:"POST",signal:n.signal});if(clearTimeout(i),!s.ok)throw new Error("Request failed");return s.json()}catch(s){throw clearTimeout(i),s.name==="AbortError"?new Error("request time out"):s}},bp="tokenMap",Ax="trustedTokenList",Ox="collectTokenMap",Ix="importTokenList";var Px={exports:{}};/*!
|
|
45
45
|
localForage -- Offline Storage, Improved
|
|
46
46
|
Version 1.10.0
|
|
47
47
|
https://localforage.github.io/localForage
|
|
48
48
|
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
49
|
-
*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,s){function o(u,l){if(!i[u]){if(!n[u]){var f=typeof Un=="function"&&Un;if(!l&&f)return f(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var y=i[u]={exports:{}};n[u][0].call(y.exports,function(b){var w=n[u][1][b];return o(w||b)},y,y.exports,r,n,i,s)}return i[u].exports}for(var a=typeof Un=="function"&&Un,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(r,n,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var c=0,u=new o(b),l=s.document.createTextNode("");u.observe(l,{characterData:!0}),a=function(){l.data=c=++c%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var A=s.document.createElement("script");A.onreadystatechange=function(){b(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},s.document.documentElement.appendChild(A)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var A,P,R=y.length;R;){for(P=y,y=[],A=-1;++A<R;)P[A]();R=y.length}h=!1}n.exports=w;function w(A){y.push(A)===1&&!h&&a()}}).call(this,typeof kr<"u"?kr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,n,i){var s=r(1);function o(){}var a={},c=["REJECTED"],u=["FULFILLED"],l=["PENDING"];n.exports=f;function f(L){if(typeof L!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,L!==o&&w(this,L)}f.prototype.catch=function(L){return this.then(null,L)},f.prototype.then=function(L,G){if(typeof L!="function"&&this.state===u||typeof G!="function"&&this.state===c)return this;var q=new this.constructor(o);if(this.state!==l){var X=this.state===u?L:G;y(q,X,this.outcome)}else this.queue.push(new h(q,L,G));return q};function h(L,G,q){this.promise=L,typeof G=="function"&&(this.onFulfilled=G,this.callFulfilled=this.otherCallFulfilled),typeof q=="function"&&(this.onRejected=q,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(L){a.resolve(this.promise,L)},h.prototype.otherCallFulfilled=function(L){y(this.promise,this.onFulfilled,L)},h.prototype.callRejected=function(L){a.reject(this.promise,L)},h.prototype.otherCallRejected=function(L){y(this.promise,this.onRejected,L)};function y(L,G,q){s(function(){var X;try{X=G(q)}catch(ie){return a.reject(L,ie)}X===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,X)})}a.resolve=function(L,G){var q=A(b,G);if(q.status==="error")return a.reject(L,q.value);var X=q.value;if(X)w(L,X);else{L.state=u,L.outcome=G;for(var ie=-1,ae=L.queue.length;++ie<ae;)L.queue[ie].callFulfilled(G)}return L},a.reject=function(L,G){L.state=c,L.outcome=G;for(var q=-1,X=L.queue.length;++q<X;)L.queue[q].callRejected(G);return L};function b(L){var G=L&&L.then;if(L&&(typeof L=="object"||typeof L=="function")&&typeof G=="function")return function(){G.apply(L,arguments)}}function w(L,G){var q=!1;function X(V){q||(q=!0,a.reject(L,V))}function ie(V){q||(q=!0,a.resolve(L,V))}function ae(){G(ie,X)}var ce=A(ae);ce.status==="error"&&X(ce.value)}function A(L,G){var q={};try{q.value=L(G),q.status="success"}catch(X){q.status="error",q.value=X}return q}f.resolve=P;function P(L){return L instanceof this?L:a.resolve(new this(o),L)}f.reject=R;function R(L){var G=new this(o);return a.reject(G,L)}f.all=N;function N(L){var G=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=new Array(q),ae=0,ce=-1,V=new this(o);++ce<q;)D(L[ce],ce);return V;function D(p,d){G.resolve(p).then(m,function(x){X||(X=!0,a.reject(V,x))});function m(x){ie[d]=x,++ae===q&&!X&&(X=!0,a.resolve(V,ie))}}}f.race=F;function F(L){var G=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=-1,ae=new this(o);++ie<q;)ce(L[ie]);return ae;function ce(V){G.resolve(V).then(function(D){X||(X=!0,a.resolve(ae,D))},function(D){X||(X=!0,a.reject(ae,D))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof kr<"u"?kr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $};function o($,H){if(!($ instanceof H))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var c=a();function u(){try{if(!c||!c.open)return!1;var $=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),H=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!$||H)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l($,H){$=$||[],H=H||{};try{return new Blob($,H)}catch(J){if(J.name!=="TypeError")throw J;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,Y=new U,Q=0;Q<$.length;Q+=1)Y.append($[Q]);return Y.getBlob(H.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h($,H){H&&$.then(function(U){H(null,U)},function(U){H(U)})}function y($,H,U){typeof H=="function"&&$.then(H),typeof U=="function"&&$.catch(U)}function b($){return typeof $!="string"&&(console.warn($+" used as a key, but it is not a string."),$=String($)),$}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",P=void 0,R={},N=Object.prototype.toString,F="readonly",L="readwrite";function G($){for(var H=$.length,U=new ArrayBuffer(H),Y=new Uint8Array(U),Q=0;Q<H;Q++)Y[Q]=$.charCodeAt(Q);return U}function q($){return new f(function(H){var U=$.transaction(A,L),Y=l([""]);U.objectStore(A).put(Y,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),H(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),J=navigator.userAgent.match(/Edge\//);H(J||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function X($){return typeof P=="boolean"?f.resolve(P):q($).then(function(H){return P=H,P})}function ie($){var H=R[$.name],U={};U.promise=new f(function(Y,Q){U.resolve=Y,U.reject=Q}),H.deferredOperations.push(U),H.dbReady?H.dbReady=H.dbReady.then(function(){return U.promise}):H.dbReady=U.promise}function ae($){var H=R[$.name],U=H.deferredOperations.pop();if(U)return U.resolve(),U.promise}function ce($,H){var U=R[$.name],Y=U.deferredOperations.pop();if(Y)return Y.reject(H),Y.promise}function V($,H){return new f(function(U,Y){if(R[$.name]=R[$.name]||g(),$.db)if(H)ie($),$.db.close();else return U($.db);var Q=[$.name];H&&Q.push($.version);var J=c.open.apply(c,Q);H&&(J.onupgradeneeded=function(me){var xe=J.result;try{xe.createObjectStore($.storeName),me.oldVersion<=1&&xe.createObjectStore(A)}catch(Ce){if(Ce.name==="ConstraintError")console.warn('The database "'+$.name+'" has been upgraded from version '+me.oldVersion+" to version "+me.newVersion+', but the storage "'+$.storeName+'" already exists.');else throw Ce}}),J.onerror=function(me){me.preventDefault(),Y(J.error)},J.onsuccess=function(){var me=J.result;me.onversionchange=function(xe){xe.target.close()},U(me),ae($)}})}function D($){return V($,!1)}function p($){return V($,!0)}function d($,H){if(!$.db)return!0;var U=!$.db.objectStoreNames.contains($.storeName),Y=$.version<$.db.version,Q=$.version>$.db.version;if(Y&&($.version!==H&&console.warn('The database "'+$.name+`" can't be downgraded from version `+$.db.version+" to version "+$.version+"."),$.version=$.db.version),Q||U){if(U){var J=$.db.version+1;J>$.version&&($.version=J)}return!0}return!1}function m($){return new f(function(H,U){var Y=new FileReader;Y.onerror=U,Y.onloadend=function(Q){var J=btoa(Q.target.result||"");H({__local_forage_encoded_blob:!0,data:J,type:$.type})},Y.readAsBinaryString($)})}function x($){var H=G(atob($.data));return l([H],{type:$.type})}function T($){return $&&$.__local_forage_encoded_blob}function E($){var H=this,U=H._initReady().then(function(){var Y=R[H._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(U,$,$),U}function O($){ie($);for(var H=R[$.name],U=H.forages,Y=0;Y<U.length;Y++){var Q=U[Y];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return $.db=null,D($).then(function(J){return $.db=J,d($)?p($):J}).then(function(J){$.db=H.db=J;for(var me=0;me<U.length;me++)U[me]._dbInfo.db=J}).catch(function(J){throw ce($,J),J})}function C($,H,U,Y){Y===void 0&&(Y=1);try{var Q=$.db.transaction($.storeName,H);U(null,Q)}catch(J){if(Y>0&&(!$.db||J.name==="InvalidStateError"||J.name==="NotFoundError"))return f.resolve().then(function(){if(!$.db||J.name==="NotFoundError"&&!$.db.objectStoreNames.contains($.storeName)&&$.version<=$.db.version)return $.db&&($.version=$.db.version+1),p($)}).then(function(){return O($).then(function(){C($,H,U,Y-1)})}).catch(U);U(J)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v($){var H=this,U={db:null};if($)for(var Y in $)U[Y]=$[Y];var Q=R[U.name];Q||(Q=g(),R[U.name]=Q),Q.forages.push(H),H._initReady||(H._initReady=H.ready,H.ready=E);var J=[];function me(){return f.resolve()}for(var xe=0;xe<Q.forages.length;xe++){var Ce=Q.forages[xe];Ce!==H&&J.push(Ce._initReady().catch(me))}var Te=Q.forages.slice(0);return f.all(J).then(function(){return U.db=Q.db,D(U)}).then(function(Me){return U.db=Me,d(U,H._defaultConfig.version)?p(U):Me}).then(function(Me){U.db=Q.db=Me,H._dbInfo=U;for(var Ve=0;Ve<Te.length;Ve++){var yt=Te[Ve];yt!==H&&(yt._dbInfo.db=U.db,yt._dbInfo.version=U.version)}})}function k($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Te=Ce.get($);Te.onsuccess=function(){var Me=Te.result;Me===void 0&&(Me=null),T(Me)&&(Me=x(Me)),Q(Me)},Te.onerror=function(){J(Te.error)}}catch(Me){J(Me)}})}).catch(J)});return h(Y,H),Y}function ee($,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Te=Ce.openCursor(),Me=1;Te.onsuccess=function(){var Ve=Te.result;if(Ve){var yt=Ve.value;T(yt)&&(yt=x(yt));var Lt=$(yt,Ve.key,Me++);Lt!==void 0?Q(Lt):Ve.continue()}else Q()},Te.onerror=function(){J(Te.error)}}catch(Ve){J(Ve)}})}).catch(J)});return h(Y,H),Y}function se($,H,U){var Y=this;$=b($);var Q=new f(function(J,me){var xe;Y.ready().then(function(){return xe=Y._dbInfo,N.call(H)==="[object Blob]"?X(xe.db).then(function(Ce){return Ce?H:m(H)}):H}).then(function(Ce){C(Y._dbInfo,L,function(Te,Me){if(Te)return me(Te);try{var Ve=Me.objectStore(Y._dbInfo.storeName);Ce===null&&(Ce=void 0);var yt=Ve.put(Ce,$);Me.oncomplete=function(){Ce===void 0&&(Ce=null),J(Ce)},Me.onabort=Me.onerror=function(){var Lt=yt.error?yt.error:yt.transaction.error;me(Lt)}}catch(Lt){me(Lt)}})}).catch(me)});return h(Q,U),Q}function he($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){C(U._dbInfo,L,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Te=Ce.delete($);xe.oncomplete=function(){Q()},xe.onerror=function(){J(Te.error)},xe.onabort=function(){var Me=Te.error?Te.error:Te.transaction.error;J(Me)}}catch(Me){J(Me)}})}).catch(J)});return h(Y,H),Y}function ye($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,L,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.clear();me.oncomplete=function(){Y()},me.onabort=me.onerror=function(){var Te=Ce.error?Ce.error:Ce.transaction.error;Q(Te)}}catch(Te){Q(Te)}})}).catch(Q)});return h(U,$),U}function Ee($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.count();Ce.onsuccess=function(){Y(Ce.result)},Ce.onerror=function(){Q(Ce.error)}}catch(Te){Q(Te)}})}).catch(Q)});return h(U,$),U}function Se($,H){var U=this,Y=new f(function(Q,J){if($<0){Q(null);return}U.ready().then(function(){C(U._dbInfo,F,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(U._dbInfo.storeName),Te=!1,Me=Ce.openKeyCursor();Me.onsuccess=function(){var Ve=Me.result;if(!Ve){Q(null);return}$===0||Te?Q(Ve.key):(Te=!0,Ve.advance($))},Me.onerror=function(){J(Me.error)}}catch(Ve){J(Ve)}})}).catch(J)});return h(Y,H),Y}function Ge($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,F,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.openKeyCursor(),Te=[];Ce.onsuccess=function(){var Me=Ce.result;if(!Me){Y(Te);return}Te.push(Me.key),Me.continue()},Ce.onerror=function(){Q(Ce.error)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,$),U}function Ue($,H){H=w.apply(this,arguments);var U=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||U.name,$.storeName=$.storeName||U.storeName);var Y=this,Q;if(!$.name)Q=f.reject("Invalid arguments");else{var J=$.name===U.name&&Y._dbInfo.db,me=J?f.resolve(Y._dbInfo.db):D($).then(function(xe){var Ce=R[$.name],Te=Ce.forages;Ce.db=xe;for(var Me=0;Me<Te.length;Me++)Te[Me]._dbInfo.db=xe;return xe});$.storeName?Q=me.then(function(xe){if(xe.objectStoreNames.contains($.storeName)){var Ce=xe.version+1;ie($);var Te=R[$.name],Me=Te.forages;xe.close();for(var Ve=0;Ve<Me.length;Ve++){var yt=Me[Ve];yt._dbInfo.db=null,yt._dbInfo.version=Ce}var Lt=new f(function(zt,lr){var ar=c.open($.name,Ce);ar.onerror=function(pn){var kc=ar.result;kc.close(),lr(pn)},ar.onupgradeneeded=function(){var pn=ar.result;pn.deleteObjectStore($.storeName)},ar.onsuccess=function(){var pn=ar.result;pn.close(),zt(pn)}});return Lt.then(function(zt){Te.db=zt;for(var lr=0;lr<Me.length;lr++){var ar=Me[lr];ar._dbInfo.db=zt,ae(ar._dbInfo)}}).catch(function(zt){throw(ce($,zt)||f.resolve()).catch(function(){}),zt})}}):Q=me.then(function(xe){ie($);var Ce=R[$.name],Te=Ce.forages;xe.close();for(var Me=0;Me<Te.length;Me++){var Ve=Te[Me];Ve._dbInfo.db=null}var yt=new f(function(Lt,zt){var lr=c.deleteDatabase($.name);lr.onerror=function(){var ar=lr.result;ar&&ar.close(),zt(lr.error)},lr.onblocked=function(){console.warn('dropInstance blocked for database "'+$.name+'" until all open connections are closed')},lr.onsuccess=function(){var ar=lr.result;ar&&ar.close(),Lt(ar)}});return yt.then(function(Lt){Ce.db=Lt;for(var zt=0;zt<Te.length;zt++){var lr=Te[zt];ae(lr._dbInfo)}}).catch(function(Lt){throw(ce($,Lt)||f.resolve()).catch(function(){}),Lt})})}return h(Q,H),Q}var lt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:k,setItem:se,removeItem:he,clear:ye,length:Ee,key:Se,keys:Ge,dropInstance:Ue};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",_e=/^~~local_forage_type~([^~]+)~/,ge="__lfsc__:",Ae=ge.length,We="arbf",De="blob",Oe="si08",Ie="ui08",Fe="uic8",ft="si16",dt="si32",He="ur16",kt="ui32",St="fl32",et="fl64",At=Ae+We.length,$t=Object.prototype.toString;function nt($){var H=$.length*.75,U=$.length,Y,Q=0,J,me,xe,Ce;$[$.length-1]==="="&&(H--,$[$.length-2]==="="&&H--);var Te=new ArrayBuffer(H),Me=new Uint8Array(Te);for(Y=0;Y<U;Y+=4)J=$e.indexOf($[Y]),me=$e.indexOf($[Y+1]),xe=$e.indexOf($[Y+2]),Ce=$e.indexOf($[Y+3]),Me[Q++]=J<<2|me>>4,Me[Q++]=(me&15)<<4|xe>>2,Me[Q++]=(xe&3)<<6|Ce&63;return Te}function Et($){var H=new Uint8Array($),U="",Y;for(Y=0;Y<H.length;Y+=3)U+=$e[H[Y]>>2],U+=$e[(H[Y]&3)<<4|H[Y+1]>>4],U+=$e[(H[Y+1]&15)<<2|H[Y+2]>>6],U+=$e[H[Y+2]&63];return H.length%3===2?U=U.substring(0,U.length-1)+"=":H.length%3===1&&(U=U.substring(0,U.length-2)+"=="),U}function Ot($,H){var U="";if($&&(U=$t.call($)),$&&(U==="[object ArrayBuffer]"||$.buffer&&$t.call($.buffer)==="[object ArrayBuffer]")){var Y,Q=ge;$ instanceof ArrayBuffer?(Y=$,Q+=We):(Y=$.buffer,U==="[object Int8Array]"?Q+=Oe:U==="[object Uint8Array]"?Q+=Ie:U==="[object Uint8ClampedArray]"?Q+=Fe:U==="[object Int16Array]"?Q+=ft:U==="[object Uint16Array]"?Q+=He:U==="[object Int32Array]"?Q+=dt:U==="[object Uint32Array]"?Q+=kt:U==="[object Float32Array]"?Q+=St:U==="[object Float64Array]"?Q+=et:H(new Error("Failed to get type for BinaryArray"))),H(Q+Et(Y))}else if(U==="[object Blob]"){var J=new FileReader;J.onload=function(){var me=mt+$.type+"~"+Et(this.result);H(ge+De+me)},J.readAsArrayBuffer($)}else try{H(JSON.stringify($))}catch(me){console.error("Couldn't convert value into a JSON string: ",$),H(null,me)}}function st($){if($.substring(0,Ae)!==ge)return JSON.parse($);var H=$.substring(At),U=$.substring(Ae,At),Y;if(U===De&&_e.test(H)){var Q=H.match(_e);Y=Q[1],H=H.substring(Q[0].length)}var J=nt(H);switch(U){case We:return J;case De:return l([J],{type:Y});case Oe:return new Int8Array(J);case Ie:return new Uint8Array(J);case Fe:return new Uint8ClampedArray(J);case ft:return new Int16Array(J);case He:return new Uint16Array(J);case dt:return new Int32Array(J);case kt:return new Uint32Array(J);case St:return new Float32Array(J);case et:return new Float64Array(J);default:throw new Error("Unkown type: "+U)}}var jt={serialize:Ot,deserialize:st,stringToBuffer:nt,bufferToString:Et};function It($,H,U,Y){$.executeSql("CREATE TABLE IF NOT EXISTS "+H.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,Y)}function it($){var H=this,U={db:null};if($)for(var Y in $)U[Y]=typeof $[Y]!="string"?$[Y].toString():$[Y];var Q=new f(function(J,me){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(xe){return me(xe)}U.db.transaction(function(xe){It(xe,U,function(){H._dbInfo=U,J()},function(Ce,Te){me(Te)})},me)});return U.serializer=jt,Q}function wt($,H,U,Y,Q,J){$.executeSql(U,Y,Q,function(me,xe){xe.code===xe.SYNTAX_ERR?me.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[H.storeName],function(Ce,Te){Te.rows.length?J(Ce,xe):It(Ce,H,function(){Ce.executeSql(U,Y,Q,J)},J)},J):J(me,xe)},J)}function Tt($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT * FROM "+me.storeName+" WHERE key = ? LIMIT 1",[$],function(Ce,Te){var Me=Te.rows.length?Te.rows.item(0).value:null;Me&&(Me=me.serializer.deserialize(Me)),Q(Me)},function(Ce,Te){J(Te)})})}).catch(J)});return h(Y,H),Y}function Ye($,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT * FROM "+me.storeName,[],function(Ce,Te){for(var Me=Te.rows,Ve=Me.length,yt=0;yt<Ve;yt++){var Lt=Me.item(yt),zt=Lt.value;if(zt&&(zt=me.serializer.deserialize(zt)),zt=$(zt,Lt.key,yt+1),zt!==void 0){Q(zt);return}}Q()},function(Ce,Te){J(Te)})})}).catch(J)});return h(Y,H),Y}function gt($,H,U,Y){var Q=this;$=b($);var J=new f(function(me,xe){Q.ready().then(function(){H===void 0&&(H=null);var Ce=H,Te=Q._dbInfo;Te.serializer.serialize(H,function(Me,Ve){Ve?xe(Ve):Te.db.transaction(function(yt){wt(yt,Te,"INSERT OR REPLACE INTO "+Te.storeName+" (key, value) VALUES (?, ?)",[$,Me],function(){me(Ce)},function(Lt,zt){xe(zt)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){me(gt.apply(Q,[$,Ce,U,Y-1]));return}xe(yt)}})})}).catch(xe)});return h(J,U),J}function Pt($,H,U){return gt.apply(this,[$,H,U,1])}function ot($,H){var U=this;$=b($);var Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"DELETE FROM "+me.storeName+" WHERE key = ?",[$],function(){Q()},function(Ce,Te){J(Te)})})}).catch(J)});return h(Y,H),Y}function _t($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"DELETE FROM "+J.storeName,[],function(){Y()},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,$),U}function Ut($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"SELECT COUNT(key) as c FROM "+J.storeName,[],function(xe,Ce){var Te=Ce.rows.item(0).c;Y(Te)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,$),U}function j($,H){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var me=U._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT key FROM "+me.storeName+" WHERE id = ? LIMIT 1",[$+1],function(Ce,Te){var Me=Te.rows.length?Te.rows.item(0).key:null;Q(Me)},function(Ce,Te){J(Te)})})}).catch(J)});return h(Y,H),Y}function S($){var H=this,U=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"SELECT key FROM "+J.storeName,[],function(xe,Ce){for(var Te=[],Me=0;Me<Ce.rows.length;Me++)Te.push(Ce.rows.item(Me).key);Y(Te)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(U,$),U}function M($){return new f(function(H,U){$.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,J){for(var me=[],xe=0;xe<J.rows.length;xe++)me.push(J.rows.item(xe).name);H({db:$,storeNames:me})},function(Q,J){U(J)})},function(Y){U(Y)})})}function B($,H){H=w.apply(this,arguments);var U=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||U.name,$.storeName=$.storeName||U.storeName);var Y=this,Q;return $.name?Q=new f(function(J){var me;$.name===U.name?me=Y._dbInfo.db:me=openDatabase($.name,"","",0),$.storeName?J({db:me,storeNames:[$.storeName]}):J(M(me))}).then(function(J){return new f(function(me,xe){J.db.transaction(function(Ce){function Te(Lt){return new f(function(zt,lr){Ce.executeSql("DROP TABLE IF EXISTS "+Lt,[],function(){zt()},function(ar,pn){lr(pn)})})}for(var Me=[],Ve=0,yt=J.storeNames.length;Ve<yt;Ve++)Me.push(Te(J.storeNames[Ve]));f.all(Me).then(function(){me()}).catch(function(Lt){xe(Lt)})},function(Ce){xe(Ce)})})}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Ye,getItem:Tt,setItem:Pt,removeItem:ot,clear:_t,length:Ut,key:j,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function re($,H){var U=$.name+"/";return $.storeName!==H.storeName&&(U+=$.storeName+"/"),U}function Be(){var $="_localforage_support_test";try{return localStorage.setItem($,!0),localStorage.removeItem($),!1}catch{return!0}}function rt(){return!Be()||localStorage.length>0}function Ne($){var H=this,U={};if($)for(var Y in $)U[Y]=$[Y];return U.keyPrefix=re($,H._defaultConfig),rt()?(H._dbInfo=U,U.serializer=jt,f.resolve()):f.reject()}function z($){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var J=localStorage.key(Q);J.indexOf(Y)===0&&localStorage.removeItem(J)}});return h(U,$),U}function oe($,H){var U=this;$=b($);var Y=U.ready().then(function(){var Q=U._dbInfo,J=localStorage.getItem(Q.keyPrefix+$);return J&&(J=Q.serializer.deserialize(J)),J});return h(Y,H),Y}function pe($,H){var U=this,Y=U.ready().then(function(){for(var Q=U._dbInfo,J=Q.keyPrefix,me=J.length,xe=localStorage.length,Ce=1,Te=0;Te<xe;Te++){var Me=localStorage.key(Te);if(Me.indexOf(J)===0){var Ve=localStorage.getItem(Me);if(Ve&&(Ve=Q.serializer.deserialize(Ve)),Ve=$(Ve,Me.substring(me),Ce++),Ve!==void 0)return Ve}}});return h(Y,H),Y}function je($,H){var U=this,Y=U.ready().then(function(){var Q=U._dbInfo,J;try{J=localStorage.key($)}catch{J=null}return J&&(J=J.substring(Q.keyPrefix.length)),J});return h(Y,H),Y}function Ke($){var H=this,U=H.ready().then(function(){for(var Y=H._dbInfo,Q=localStorage.length,J=[],me=0;me<Q;me++){var xe=localStorage.key(me);xe.indexOf(Y.keyPrefix)===0&&J.push(xe.substring(Y.keyPrefix.length))}return J});return h(U,$),U}function Re($){var H=this,U=H.keys().then(function(Y){return Y.length});return h(U,$),U}function ze($,H){var U=this;$=b($);var Y=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+$)});return h(Y,H),Y}function ut($,H,U){var Y=this;$=b($);var Q=Y.ready().then(function(){H===void 0&&(H=null);var J=H;return new f(function(me,xe){var Ce=Y._dbInfo;Ce.serializer.serialize(H,function(Te,Me){if(Me)xe(Me);else try{localStorage.setItem(Ce.keyPrefix+$,Te),me(J)}catch(Ve){(Ve.name==="QuotaExceededError"||Ve.name==="NS_ERROR_DOM_QUOTA_REACHED")&&xe(Ve),xe(Ve)}})})});return h(Q,U),Q}function Jt($,H){if(H=w.apply(this,arguments),$=typeof $!="function"&&$||{},!$.name){var U=this.config();$.name=$.name||U.name,$.storeName=$.storeName||U.storeName}var Y=this,Q;return $.name?Q=new f(function(J){$.storeName?J(re($,Y._defaultConfig)):J($.name+"/")}).then(function(J){for(var me=localStorage.length-1;me>=0;me--){var xe=localStorage.key(me);xe.indexOf(J)===0&&localStorage.removeItem(xe)}}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var Rt={_driver:"localStorageWrapper",_initStorage:Ne,_support:Z(),iterate:pe,getItem:oe,setItem:ut,removeItem:ze,clear:z,length:Re,key:je,keys:Ke,dropInstance:Jt},Bt=function(H,U){return H===U||typeof H=="number"&&typeof U=="number"&&isNaN(H)&&isNaN(U)},ir=function(H,U){for(var Y=H.length,Q=0;Q<Y;){if(Bt(H[Q],U))return!0;Q++}return!1},Sr=Array.isArray||function($){return Object.prototype.toString.call($)==="[object Array]"},or={},Yt={},yr={INDEXEDDB:lt,WEBSQL:K,LOCALSTORAGE:Rt},Nn=[yr.INDEXEDDB._driver,yr.WEBSQL._driver,yr.LOCALSTORAGE._driver],Wr=["dropInstance"],Dn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Wr),Li={description:"",driver:Nn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Fi($,H){$[H]=function(){var U=arguments;return $.ready().then(function(){return $[H].apply($,U)})}}function $n(){for(var $=1;$<arguments.length;$++){var H=arguments[$];if(H)for(var U in H)H.hasOwnProperty(U)&&(Sr(H[U])?arguments[0][U]=H[U].slice():arguments[0][U]=H[U])}return arguments[0]}var Ui=function(){function $(H){o(this,$);for(var U in yr)if(yr.hasOwnProperty(U)){var Y=yr[U],Q=Y._driver;this[U]=Q,or[Q]||this.defineDriver(Y)}this._defaultConfig=$n({},Li),this._config=$n({},this._defaultConfig,H),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return $.prototype.config=function(U){if((typeof U>"u"?"undefined":s(U))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var Y in U){if(Y==="storeName"&&(U[Y]=U[Y].replace(/\W/g,"_")),Y==="version"&&typeof U[Y]!="number")return new Error("Database version must be a number.");this._config[Y]=U[Y]}return"driver"in U&&U.driver?this.setDriver(this._config.driver):!0}else return typeof U=="string"?this._config[U]:this._config},$.prototype.defineDriver=function(U,Y,Q){var J=new f(function(me,xe){try{var Ce=U._driver,Te=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){xe(Te);return}for(var Me=Dn.concat("_initStorage"),Ve=0,yt=Me.length;Ve<yt;Ve++){var Lt=Me[Ve],zt=!ir(Wr,Lt);if((zt||U[Lt])&&typeof U[Lt]!="function"){xe(Te);return}}var lr=function(){for(var kc=function(gX){return function(){var vX=new Error("Method "+gX+" is not implemented by the current driver"),N3=f.reject(vX);return h(N3,arguments[arguments.length-1]),N3}},J0=0,mX=Wr.length;J0<mX;J0++){var Y0=Wr[J0];U[Y0]||(U[Y0]=kc(Y0))}};lr();var ar=function(kc){or[Ce]&&console.info("Redefining LocalForage driver: "+Ce),or[Ce]=U,Yt[Ce]=kc,me()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(ar,xe):ar(!!U._support):ar(!0)}catch(pn){xe(pn)}});return y(J,Y,Q),J},$.prototype.driver=function(){return this._driver||null},$.prototype.getDriver=function(U,Y,Q){var J=or[U]?f.resolve(or[U]):f.reject(new Error("Driver not found."));return y(J,Y,Q),J},$.prototype.getSerializer=function(U){var Y=f.resolve(jt);return y(Y,U),Y},$.prototype.ready=function(U){var Y=this,Q=Y._driverSet.then(function(){return Y._ready===null&&(Y._ready=Y._initDriver()),Y._ready});return y(Q,U,U),Q},$.prototype.setDriver=function(U,Y,Q){var J=this;Sr(U)||(U=[U]);var me=this._getSupportedDrivers(U);function xe(){J._config.driver=J.driver()}function Ce(Ve){return J._extend(Ve),xe(),J._ready=J._initStorage(J._config),J._ready}function Te(Ve){return function(){var yt=0;function Lt(){for(;yt<Ve.length;){var zt=Ve[yt];return yt++,J._dbInfo=null,J._ready=null,J.getDriver(zt).then(Ce).catch(Lt)}xe();var lr=new Error("No available storage method found.");return J._driverSet=f.reject(lr),J._driverSet}return Lt()}}var Me=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Me.then(function(){var Ve=me[0];return J._dbInfo=null,J._ready=null,J.getDriver(Ve).then(function(yt){J._driver=yt._driver,xe(),J._wrapLibraryMethodsWithReady(),J._initDriver=Te(me)})}).catch(function(){xe();var Ve=new Error("No available storage method found.");return J._driverSet=f.reject(Ve),J._driverSet}),y(this._driverSet,Y,Q),this._driverSet},$.prototype.supports=function(U){return!!Yt[U]},$.prototype._extend=function(U){$n(this,U)},$.prototype._getSupportedDrivers=function(U){for(var Y=[],Q=0,J=U.length;Q<J;Q++){var me=U[Q];this.supports(me)&&Y.push(me)}return Y},$.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,Y=Dn.length;U<Y;U++)Fi(this,Dn[U])},$.prototype.createInstance=function(U){return new $(U)},$}(),zi=new Ui;n.exports=zi},{3:3}]},{},[4])(4)})})(Px);var tD=Px.exports;const ic=ha(tD);ic.config({name:"CetusSite",storeName:"tokens"});class ki{static async setItem(t,r){try{await ic.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await ic.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await ic.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await ic.clear()}catch(t){console.error("Failed to clear storage",t)}}}const rl=[{name:"SuiVision",link:"https://suivision.xyz",img:Ft("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:Ft("/images/logo_suiscan@2x.png"),isCustom:!1}],nl=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],rD=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],il={mainnet:{env:"mainnet",fullRpcUrl:"https://fullnode.mainnet.sui.io",simulationAccount:"0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb",api:"https://api-sui.cetus.zone",aggregatorUrl:"https://api-sui.cetus.zone/router_v2"}}["mainnet"],nD=Ft("/images/birdeye-logo.png"),iD=Ft("/images/img-logo@2x.png"),sD=Ft("/images/logo_CoinGecko@2x.png"),oD=Ft("/images/logo_pyth.png");var sc=(e=>(e.CETUS="CETUS",e.KRIYA="KRIYA",e.KRIYAV3="KRIYAV3",e.FLOWX="FLOWX",e.FLOWXV3="FLOWXV3",e.AFTERMATH="AFTERMATH",e.HAEDAL="HAEDAL",e.VOLO="VOLO",e.AFSUI="AFSUI",e.DEEPBOOKV3="DEEPBOOKV3",e.SCALLOP="SCALLOP",e.BLUEMOVE="BLUEMOVE",e.TURBOS="TURBOS",e.SUILEND="SUILEND",e.BLUEFIN="BLUEFIN",e.HAEDALPMM="HAEDALPMM",e))(sc||{});const kx={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},aD={pyth:oD,coingecko:sD,birdeye:nD,Cetus:iD},vr={CETUS:Ft("/images/aggregator-source/cetus.png"),KRIYA:Ft("/images/aggregator-source/kriya.png"),FLOWX:Ft("/images/aggregator-source/flowx.png"),AFTERMATH:Ft("/images/aggregator-source/aftermath.png"),TURBOS:Ft("/images/aggregator-source/turbos.png"),HAEDAL:Ft("/images/aggregator-source/haedal.png"),VOLO:Ft("/images/aggregator-source/volo.png"),AFSUI:Ft("/images/aggregator-source/aftermath.png"),BLUEMOVE:Ft("/images/aggregator-source/bluemove.png"),KRIYAV3:Ft("/images/aggregator-source/kriya.png"),FLOWXV3:Ft("/images/aggregator-source/flowx.png"),DEEPBOOKV3:Ft("/images/aggregator-source/deepbook.png"),SCALLOP:Ft("/images/aggregator-source/scallop.png"),SUILEND:Ft("/images/aggregator-source/suilend.png"),BLUEFIN:Ft("/images/aggregator-source/bluefin.png"),HAEDALPMM:Ft("/images/aggregator-source/haedal.png")},jx={CETUS:{name:"Cetus",id:"CETUS",logo:vr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:vr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:vr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:vr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:vr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:vr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:vr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:vr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:vr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:vr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:vr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:vr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:vr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:vr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:vr.SCALLOP,type:"other",sort:70},SUILEND:{name:"SpringSui",id:"SUILEND",logo:vr.SUILEND,type:"other",sort:60}},Rx=e=>{let t;const r=new Set,n=(u,l)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=l??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(y=>y(t,h))}},i=()=>t,a={setState:n,getState:i,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(n,i,a);return a},cD=e=>e?Rx(e):Rx,uD=e=>e;function lD(e,t=uD){const r=te.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return te.useDebugValue(r),r}const Nx=e=>{const t=cD(e),r=n=>lD(t,n);return Object.assign(r,t),r},ji=e=>e?Nx(e):Nx;function fD(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,t==null?void 0:t.reviver),a=(s=r.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,t==null?void 0:t.replacer)),removeItem:i=>r.removeItem(i)}}const wp=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return wp(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return wp(n)(r)}}}},Dr=ji(((e,t)=>(r,n,i)=>{let s={storage:fD(()=>localStorage),partialize:w=>w,version:0,merge:(w,A)=>({...A,...w}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...w)},n,i);const l=()=>{const w=s.partialize({...n()});return u.setItem(s.name,{state:w,version:s.version})},f=i.setState;i.setState=(w,A)=>{f(w,A),l()};const h=e((...w)=>{r(...w),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var w,A;if(!u)return;o=!1,a.forEach(R=>{var N;return R((N=n())!=null?N:h)});const P=((A=s.onRehydrateStorage)==null?void 0:A.call(s,(w=n())!=null?w:h))||void 0;return wp(u.getItem.bind(u))(s.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==s.version){if(s.migrate){const N=s.migrate(R.state,R.version);return N instanceof Promise?N.then(F=>[!0,F]):[!0,N]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,R.state];return[!1,void 0]}).then(R=>{var N;const[F,L]=R;if(y=s.merge(L,(N=n())!=null?N:h),r(y,!0),F)return l()}).then(()=>{P==null||P(y,void 0),y=n(),o=!0,c.forEach(R=>R(y))}).catch(R=>{P==null||P(void 0,R)})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(u=w.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:w=>(a.add(w),()=>{a.delete(w)}),onFinishHydration:w=>(c.add(w),()=>{c.delete(w)})},s.skipHydration||b(),y||h})((e,t)=>({ignoreWarnTokenMap:{},currentExplorer:rl[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:nl,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:nl[0],customRpc:"",setCurrentRpc:r=>{e(()=>({currentRpc:r}))},setCustomRpc:r=>{e(()=>({customRpc:r}))},slippage:"0.5",setSlippage:r=>{e(()=>({slippage:r}))},isOpenSlippageDialog:!1,setIsOpenSlippageDialog:r=>{e(()=>({isOpenSlippageDialog:r}))},providers:Object.values(sc),setProviders:r=>{e(()=>({providers:r}))},poolApiMap:{},setPoolApiMap:(r,n)=>{const i=t().poolApiMap;i[r]=n,e(()=>({poolApiMap:{...i}}))},mevProtect:!0,setMevProtect:r=>{e(()=>({mevProtect:r}))},setIgnoreWarnToken:r=>{const n=t().ignoreWarnTokenMap;n[qs(r)]=!0,e(()=>({ignoreWarnTokenMap:{...n}}))}}),{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}}}));function Uo(){const{currentExplorer:e}=Dr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${hD(n)}/${r}`:s=`${i}/${dD(n)}/${r}`,s}}}const dD=e=>{switch(e){case"account":return"address";case"token":return"object";case"tx":return"tx";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}},hD=e=>{switch(e){case"account":return"account";case"token":return"object";case"tx":return"txblock";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}};function Dx(e){const{text:t,keywords:r,onKeywordClick:n,text_highlight_color:i="var(--cs-primary)",text_size:s="12px",text_color:o="var(--cs-btn-disabled-text)"}=e,a=new RegExp(`(${r.join("|")})`,"gi"),c=t.split(a);return _.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const f=r.includes(u);return _.jsx("span",{style:{lineHeight:"20px",fontSize:s,color:f?i:o,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var $x={exports:{}};/*!
|
|
49
|
+
*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,i,s){function o(u,l){if(!i[u]){if(!n[u]){var f=typeof Fn=="function"&&Fn;if(!l&&f)return f(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var y=i[u]={exports:{}};n[u][0].call(y.exports,function(b){var w=n[u][1][b];return o(w||b)},y,y.exports,r,n,i,s)}return i[u].exports}for(var a=typeof Fn=="function"&&Fn,c=0;c<s.length;c++)o(s[c]);return o}({1:[function(r,n,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var c=0,u=new o(b),l=s.document.createTextNode("");u.observe(l,{characterData:!0}),a=function(){l.data=c=++c%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var A=s.document.createElement("script");A.onreadystatechange=function(){b(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},s.document.documentElement.appendChild(A)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var A,P,N=y.length;N;){for(P=y,y=[],A=-1;++A<N;)P[A]();N=y.length}h=!1}n.exports=w;function w(A){y.push(A)===1&&!h&&a()}}).call(this,typeof kr<"u"?kr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(r,n,i){var s=r(1);function o(){}var a={},c=["REJECTED"],u=["FULFILLED"],l=["PENDING"];n.exports=f;function f(L){if(typeof L!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,L!==o&&w(this,L)}f.prototype.catch=function(L){return this.then(null,L)},f.prototype.then=function(L,G){if(typeof L!="function"&&this.state===u||typeof G!="function"&&this.state===c)return this;var q=new this.constructor(o);if(this.state!==l){var X=this.state===u?L:G;y(q,X,this.outcome)}else this.queue.push(new h(q,L,G));return q};function h(L,G,q){this.promise=L,typeof G=="function"&&(this.onFulfilled=G,this.callFulfilled=this.otherCallFulfilled),typeof q=="function"&&(this.onRejected=q,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(L){a.resolve(this.promise,L)},h.prototype.otherCallFulfilled=function(L){y(this.promise,this.onFulfilled,L)},h.prototype.callRejected=function(L){a.reject(this.promise,L)},h.prototype.otherCallRejected=function(L){y(this.promise,this.onRejected,L)};function y(L,G,q){s(function(){var X;try{X=G(q)}catch(ie){return a.reject(L,ie)}X===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,X)})}a.resolve=function(L,G){var q=A(b,G);if(q.status==="error")return a.reject(L,q.value);var X=q.value;if(X)w(L,X);else{L.state=u,L.outcome=G;for(var ie=-1,ae=L.queue.length;++ie<ae;)L.queue[ie].callFulfilled(G)}return L},a.reject=function(L,G){L.state=c,L.outcome=G;for(var q=-1,X=L.queue.length;++q<X;)L.queue[q].callRejected(G);return L};function b(L){var G=L&&L.then;if(L&&(typeof L=="object"||typeof L=="function")&&typeof G=="function")return function(){G.apply(L,arguments)}}function w(L,G){var q=!1;function X(V){q||(q=!0,a.reject(L,V))}function ie(V){q||(q=!0,a.resolve(L,V))}function ae(){G(ie,X)}var ce=A(ae);ce.status==="error"&&X(ce.value)}function A(L,G){var q={};try{q.value=L(G),q.status="success"}catch(X){q.status="error",q.value=X}return q}f.resolve=P;function P(L){return L instanceof this?L:a.resolve(new this(o),L)}f.reject=N;function N(L){var G=new this(o);return a.reject(G,L)}f.all=R;function R(L){var G=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=new Array(q),ae=0,ce=-1,V=new this(o);++ce<q;)D(L[ce],ce);return V;function D(p,d){G.resolve(p).then(m,function(x){X||(X=!0,a.reject(V,x))});function m(x){ie[d]=x,++ae===q&&!X&&(X=!0,a.resolve(V,ie))}}}f.race=U;function U(L){var G=this;if(Object.prototype.toString.call(L)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=L.length,X=!1;if(!q)return this.resolve([]);for(var ie=-1,ae=new this(o);++ie<q;)ce(L[ie]);return ae;function ce(V){G.resolve(V).then(function(D){X||(X=!0,a.resolve(ae,D))},function(D){X||(X=!0,a.reject(ae,D))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof kr<"u"?kr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(r,n,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $};function o($,H){if(!($ instanceof H))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var c=a();function u(){try{if(!c||!c.open)return!1;var $=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),H=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!$||H)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l($,H){$=$||[],H=H||{};try{return new Blob($,H)}catch(J){if(J.name!=="TypeError")throw J;for(var F=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,Y=new F,Q=0;Q<$.length;Q+=1)Y.append($[Q]);return Y.getBlob(H.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h($,H){H&&$.then(function(F){H(null,F)},function(F){H(F)})}function y($,H,F){typeof H=="function"&&$.then(H),typeof F=="function"&&$.catch(F)}function b($){return typeof $!="string"&&(console.warn($+" used as a key, but it is not a string."),$=String($)),$}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",P=void 0,N={},R=Object.prototype.toString,U="readonly",L="readwrite";function G($){for(var H=$.length,F=new ArrayBuffer(H),Y=new Uint8Array(F),Q=0;Q<H;Q++)Y[Q]=$.charCodeAt(Q);return F}function q($){return new f(function(H){var F=$.transaction(A,L),Y=l([""]);F.objectStore(A).put(Y,"key"),F.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),H(!1)},F.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),J=navigator.userAgent.match(/Edge\//);H(J||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function X($){return typeof P=="boolean"?f.resolve(P):q($).then(function(H){return P=H,P})}function ie($){var H=N[$.name],F={};F.promise=new f(function(Y,Q){F.resolve=Y,F.reject=Q}),H.deferredOperations.push(F),H.dbReady?H.dbReady=H.dbReady.then(function(){return F.promise}):H.dbReady=F.promise}function ae($){var H=N[$.name],F=H.deferredOperations.pop();if(F)return F.resolve(),F.promise}function ce($,H){var F=N[$.name],Y=F.deferredOperations.pop();if(Y)return Y.reject(H),Y.promise}function V($,H){return new f(function(F,Y){if(N[$.name]=N[$.name]||g(),$.db)if(H)ie($),$.db.close();else return F($.db);var Q=[$.name];H&&Q.push($.version);var J=c.open.apply(c,Q);H&&(J.onupgradeneeded=function(me){var xe=J.result;try{xe.createObjectStore($.storeName),me.oldVersion<=1&&xe.createObjectStore(A)}catch(Ce){if(Ce.name==="ConstraintError")console.warn('The database "'+$.name+'" has been upgraded from version '+me.oldVersion+" to version "+me.newVersion+', but the storage "'+$.storeName+'" already exists.');else throw Ce}}),J.onerror=function(me){me.preventDefault(),Y(J.error)},J.onsuccess=function(){var me=J.result;me.onversionchange=function(xe){xe.target.close()},F(me),ae($)}})}function D($){return V($,!1)}function p($){return V($,!0)}function d($,H){if(!$.db)return!0;var F=!$.db.objectStoreNames.contains($.storeName),Y=$.version<$.db.version,Q=$.version>$.db.version;if(Y&&($.version!==H&&console.warn('The database "'+$.name+`" can't be downgraded from version `+$.db.version+" to version "+$.version+"."),$.version=$.db.version),Q||F){if(F){var J=$.db.version+1;J>$.version&&($.version=J)}return!0}return!1}function m($){return new f(function(H,F){var Y=new FileReader;Y.onerror=F,Y.onloadend=function(Q){var J=btoa(Q.target.result||"");H({__local_forage_encoded_blob:!0,data:J,type:$.type})},Y.readAsBinaryString($)})}function x($){var H=G(atob($.data));return l([H],{type:$.type})}function M($){return $&&$.__local_forage_encoded_blob}function E($){var H=this,F=H._initReady().then(function(){var Y=N[H._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(F,$,$),F}function O($){ie($);for(var H=N[$.name],F=H.forages,Y=0;Y<F.length;Y++){var Q=F[Y];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return $.db=null,D($).then(function(J){return $.db=J,d($)?p($):J}).then(function(J){$.db=H.db=J;for(var me=0;me<F.length;me++)F[me]._dbInfo.db=J}).catch(function(J){throw ce($,J),J})}function C($,H,F,Y){Y===void 0&&(Y=1);try{var Q=$.db.transaction($.storeName,H);F(null,Q)}catch(J){if(Y>0&&(!$.db||J.name==="InvalidStateError"||J.name==="NotFoundError"))return f.resolve().then(function(){if(!$.db||J.name==="NotFoundError"&&!$.db.objectStoreNames.contains($.storeName)&&$.version<=$.db.version)return $.db&&($.version=$.db.version+1),p($)}).then(function(){return O($).then(function(){C($,H,F,Y-1)})}).catch(F);F(J)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v($){var H=this,F={db:null};if($)for(var Y in $)F[Y]=$[Y];var Q=N[F.name];Q||(Q=g(),N[F.name]=Q),Q.forages.push(H),H._initReady||(H._initReady=H.ready,H.ready=E);var J=[];function me(){return f.resolve()}for(var xe=0;xe<Q.forages.length;xe++){var Ce=Q.forages[xe];Ce!==H&&J.push(Ce._initReady().catch(me))}var Me=Q.forages.slice(0);return f.all(J).then(function(){return F.db=Q.db,D(F)}).then(function(Te){return F.db=Te,d(F,H._defaultConfig.version)?p(F):Te}).then(function(Te){F.db=Q.db=Te,H._dbInfo=F;for(var Ve=0;Ve<Me.length;Ve++){var yt=Me[Ve];yt!==H&&(yt._dbInfo.db=F.db,yt._dbInfo.version=F.version)}})}function j($,H){var F=this;$=b($);var Y=new f(function(Q,J){F.ready().then(function(){C(F._dbInfo,U,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(F._dbInfo.storeName),Me=Ce.get($);Me.onsuccess=function(){var Te=Me.result;Te===void 0&&(Te=null),M(Te)&&(Te=x(Te)),Q(Te)},Me.onerror=function(){J(Me.error)}}catch(Te){J(Te)}})}).catch(J)});return h(Y,H),Y}function ee($,H){var F=this,Y=new f(function(Q,J){F.ready().then(function(){C(F._dbInfo,U,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(F._dbInfo.storeName),Me=Ce.openCursor(),Te=1;Me.onsuccess=function(){var Ve=Me.result;if(Ve){var yt=Ve.value;M(yt)&&(yt=x(yt));var Lt=$(yt,Ve.key,Te++);Lt!==void 0?Q(Lt):Ve.continue()}else Q()},Me.onerror=function(){J(Me.error)}}catch(Ve){J(Ve)}})}).catch(J)});return h(Y,H),Y}function se($,H,F){var Y=this;$=b($);var Q=new f(function(J,me){var xe;Y.ready().then(function(){return xe=Y._dbInfo,R.call(H)==="[object Blob]"?X(xe.db).then(function(Ce){return Ce?H:m(H)}):H}).then(function(Ce){C(Y._dbInfo,L,function(Me,Te){if(Me)return me(Me);try{var Ve=Te.objectStore(Y._dbInfo.storeName);Ce===null&&(Ce=void 0);var yt=Ve.put(Ce,$);Te.oncomplete=function(){Ce===void 0&&(Ce=null),J(Ce)},Te.onabort=Te.onerror=function(){var Lt=yt.error?yt.error:yt.transaction.error;me(Lt)}}catch(Lt){me(Lt)}})}).catch(me)});return h(Q,F),Q}function he($,H){var F=this;$=b($);var Y=new f(function(Q,J){F.ready().then(function(){C(F._dbInfo,L,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(F._dbInfo.storeName),Me=Ce.delete($);xe.oncomplete=function(){Q()},xe.onerror=function(){J(Me.error)},xe.onabort=function(){var Te=Me.error?Me.error:Me.transaction.error;J(Te)}}catch(Te){J(Te)}})}).catch(J)});return h(Y,H),Y}function ye($){var H=this,F=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,L,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.clear();me.oncomplete=function(){Y()},me.onabort=me.onerror=function(){var Me=Ce.error?Ce.error:Ce.transaction.error;Q(Me)}}catch(Me){Q(Me)}})}).catch(Q)});return h(F,$),F}function Ee($){var H=this,F=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,U,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.count();Ce.onsuccess=function(){Y(Ce.result)},Ce.onerror=function(){Q(Ce.error)}}catch(Me){Q(Me)}})}).catch(Q)});return h(F,$),F}function Se($,H){var F=this,Y=new f(function(Q,J){if($<0){Q(null);return}F.ready().then(function(){C(F._dbInfo,U,function(me,xe){if(me)return J(me);try{var Ce=xe.objectStore(F._dbInfo.storeName),Me=!1,Te=Ce.openKeyCursor();Te.onsuccess=function(){var Ve=Te.result;if(!Ve){Q(null);return}$===0||Me?Q(Ve.key):(Me=!0,Ve.advance($))},Te.onerror=function(){J(Te.error)}}catch(Ve){J(Ve)}})}).catch(J)});return h(Y,H),Y}function We($){var H=this,F=new f(function(Y,Q){H.ready().then(function(){C(H._dbInfo,U,function(J,me){if(J)return Q(J);try{var xe=me.objectStore(H._dbInfo.storeName),Ce=xe.openKeyCursor(),Me=[];Ce.onsuccess=function(){var Te=Ce.result;if(!Te){Y(Me);return}Me.push(Te.key),Te.continue()},Ce.onerror=function(){Q(Ce.error)}}catch(Te){Q(Te)}})}).catch(Q)});return h(F,$),F}function Fe($,H){H=w.apply(this,arguments);var F=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||F.name,$.storeName=$.storeName||F.storeName);var Y=this,Q;if(!$.name)Q=f.reject("Invalid arguments");else{var J=$.name===F.name&&Y._dbInfo.db,me=J?f.resolve(Y._dbInfo.db):D($).then(function(xe){var Ce=N[$.name],Me=Ce.forages;Ce.db=xe;for(var Te=0;Te<Me.length;Te++)Me[Te]._dbInfo.db=xe;return xe});$.storeName?Q=me.then(function(xe){if(xe.objectStoreNames.contains($.storeName)){var Ce=xe.version+1;ie($);var Me=N[$.name],Te=Me.forages;xe.close();for(var Ve=0;Ve<Te.length;Ve++){var yt=Te[Ve];yt._dbInfo.db=null,yt._dbInfo.version=Ce}var Lt=new f(function(zt,lr){var ar=c.open($.name,Ce);ar.onerror=function(pn){var jc=ar.result;jc.close(),lr(pn)},ar.onupgradeneeded=function(){var pn=ar.result;pn.deleteObjectStore($.storeName)},ar.onsuccess=function(){var pn=ar.result;pn.close(),zt(pn)}});return Lt.then(function(zt){Me.db=zt;for(var lr=0;lr<Te.length;lr++){var ar=Te[lr];ar._dbInfo.db=zt,ae(ar._dbInfo)}}).catch(function(zt){throw(ce($,zt)||f.resolve()).catch(function(){}),zt})}}):Q=me.then(function(xe){ie($);var Ce=N[$.name],Me=Ce.forages;xe.close();for(var Te=0;Te<Me.length;Te++){var Ve=Me[Te];Ve._dbInfo.db=null}var yt=new f(function(Lt,zt){var lr=c.deleteDatabase($.name);lr.onerror=function(){var ar=lr.result;ar&&ar.close(),zt(lr.error)},lr.onblocked=function(){console.warn('dropInstance blocked for database "'+$.name+'" until all open connections are closed')},lr.onsuccess=function(){var ar=lr.result;ar&&ar.close(),Lt(ar)}});return yt.then(function(Lt){Ce.db=Lt;for(var zt=0;zt<Me.length;zt++){var lr=Me[zt];ae(lr._dbInfo)}}).catch(function(Lt){throw(ce($,Lt)||f.resolve()).catch(function(){}),Lt})})}return h(Q,H),Q}var lt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:j,setItem:se,removeItem:he,clear:ye,length:Ee,key:Se,keys:We,dropInstance:Fe};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",_e=/^~~local_forage_type~([^~]+)~/,ge="__lfsc__:",Ae=ge.length,Ge="arbf",De="blob",Oe="si08",Ie="ui08",Ue="uic8",ft="si16",dt="si32",He="ur16",jt="ui32",St="fl32",et="fl64",At=Ae+Ge.length,$t=Object.prototype.toString;function nt($){var H=$.length*.75,F=$.length,Y,Q=0,J,me,xe,Ce;$[$.length-1]==="="&&(H--,$[$.length-2]==="="&&H--);var Me=new ArrayBuffer(H),Te=new Uint8Array(Me);for(Y=0;Y<F;Y+=4)J=$e.indexOf($[Y]),me=$e.indexOf($[Y+1]),xe=$e.indexOf($[Y+2]),Ce=$e.indexOf($[Y+3]),Te[Q++]=J<<2|me>>4,Te[Q++]=(me&15)<<4|xe>>2,Te[Q++]=(xe&3)<<6|Ce&63;return Me}function Et($){var H=new Uint8Array($),F="",Y;for(Y=0;Y<H.length;Y+=3)F+=$e[H[Y]>>2],F+=$e[(H[Y]&3)<<4|H[Y+1]>>4],F+=$e[(H[Y+1]&15)<<2|H[Y+2]>>6],F+=$e[H[Y+2]&63];return H.length%3===2?F=F.substring(0,F.length-1)+"=":H.length%3===1&&(F=F.substring(0,F.length-2)+"=="),F}function Ot($,H){var F="";if($&&(F=$t.call($)),$&&(F==="[object ArrayBuffer]"||$.buffer&&$t.call($.buffer)==="[object ArrayBuffer]")){var Y,Q=ge;$ instanceof ArrayBuffer?(Y=$,Q+=Ge):(Y=$.buffer,F==="[object Int8Array]"?Q+=Oe:F==="[object Uint8Array]"?Q+=Ie:F==="[object Uint8ClampedArray]"?Q+=Ue:F==="[object Int16Array]"?Q+=ft:F==="[object Uint16Array]"?Q+=He:F==="[object Int32Array]"?Q+=dt:F==="[object Uint32Array]"?Q+=jt:F==="[object Float32Array]"?Q+=St:F==="[object Float64Array]"?Q+=et:H(new Error("Failed to get type for BinaryArray"))),H(Q+Et(Y))}else if(F==="[object Blob]"){var J=new FileReader;J.onload=function(){var me=mt+$.type+"~"+Et(this.result);H(ge+De+me)},J.readAsArrayBuffer($)}else try{H(JSON.stringify($))}catch(me){console.error("Couldn't convert value into a JSON string: ",$),H(null,me)}}function st($){if($.substring(0,Ae)!==ge)return JSON.parse($);var H=$.substring(At),F=$.substring(Ae,At),Y;if(F===De&&_e.test(H)){var Q=H.match(_e);Y=Q[1],H=H.substring(Q[0].length)}var J=nt(H);switch(F){case Ge:return J;case De:return l([J],{type:Y});case Oe:return new Int8Array(J);case Ie:return new Uint8Array(J);case Ue:return new Uint8ClampedArray(J);case ft:return new Int16Array(J);case He:return new Uint16Array(J);case dt:return new Int32Array(J);case jt:return new Uint32Array(J);case St:return new Float32Array(J);case et:return new Float64Array(J);default:throw new Error("Unkown type: "+F)}}var kt={serialize:Ot,deserialize:st,stringToBuffer:nt,bufferToString:Et};function It($,H,F,Y){$.executeSql("CREATE TABLE IF NOT EXISTS "+H.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],F,Y)}function it($){var H=this,F={db:null};if($)for(var Y in $)F[Y]=typeof $[Y]!="string"?$[Y].toString():$[Y];var Q=new f(function(J,me){try{F.db=openDatabase(F.name,String(F.version),F.description,F.size)}catch(xe){return me(xe)}F.db.transaction(function(xe){It(xe,F,function(){H._dbInfo=F,J()},function(Ce,Me){me(Me)})},me)});return F.serializer=kt,Q}function wt($,H,F,Y,Q,J){$.executeSql(F,Y,Q,function(me,xe){xe.code===xe.SYNTAX_ERR?me.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[H.storeName],function(Ce,Me){Me.rows.length?J(Ce,xe):It(Ce,H,function(){Ce.executeSql(F,Y,Q,J)},J)},J):J(me,xe)},J)}function Mt($,H){var F=this;$=b($);var Y=new f(function(Q,J){F.ready().then(function(){var me=F._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT * FROM "+me.storeName+" WHERE key = ? LIMIT 1",[$],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).value:null;Te&&(Te=me.serializer.deserialize(Te)),Q(Te)},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function Ye($,H){var F=this,Y=new f(function(Q,J){F.ready().then(function(){var me=F._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT * FROM "+me.storeName,[],function(Ce,Me){for(var Te=Me.rows,Ve=Te.length,yt=0;yt<Ve;yt++){var Lt=Te.item(yt),zt=Lt.value;if(zt&&(zt=me.serializer.deserialize(zt)),zt=$(zt,Lt.key,yt+1),zt!==void 0){Q(zt);return}}Q()},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function gt($,H,F,Y){var Q=this;$=b($);var J=new f(function(me,xe){Q.ready().then(function(){H===void 0&&(H=null);var Ce=H,Me=Q._dbInfo;Me.serializer.serialize(H,function(Te,Ve){Ve?xe(Ve):Me.db.transaction(function(yt){wt(yt,Me,"INSERT OR REPLACE INTO "+Me.storeName+" (key, value) VALUES (?, ?)",[$,Te],function(){me(Ce)},function(Lt,zt){xe(zt)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){me(gt.apply(Q,[$,Ce,F,Y-1]));return}xe(yt)}})})}).catch(xe)});return h(J,F),J}function Pt($,H,F){return gt.apply(this,[$,H,F,1])}function ot($,H){var F=this;$=b($);var Y=new f(function(Q,J){F.ready().then(function(){var me=F._dbInfo;me.db.transaction(function(xe){wt(xe,me,"DELETE FROM "+me.storeName+" WHERE key = ?",[$],function(){Q()},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function _t($){var H=this,F=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"DELETE FROM "+J.storeName,[],function(){Y()},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(F,$),F}function Ft($){var H=this,F=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"SELECT COUNT(key) as c FROM "+J.storeName,[],function(xe,Ce){var Me=Ce.rows.item(0).c;Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(F,$),F}function k($,H){var F=this,Y=new f(function(Q,J){F.ready().then(function(){var me=F._dbInfo;me.db.transaction(function(xe){wt(xe,me,"SELECT key FROM "+me.storeName+" WHERE id = ? LIMIT 1",[$+1],function(Ce,Me){var Te=Me.rows.length?Me.rows.item(0).key:null;Q(Te)},function(Ce,Me){J(Me)})})}).catch(J)});return h(Y,H),Y}function S($){var H=this,F=new f(function(Y,Q){H.ready().then(function(){var J=H._dbInfo;J.db.transaction(function(me){wt(me,J,"SELECT key FROM "+J.storeName,[],function(xe,Ce){for(var Me=[],Te=0;Te<Ce.rows.length;Te++)Me.push(Ce.rows.item(Te).key);Y(Me)},function(xe,Ce){Q(Ce)})})}).catch(Q)});return h(F,$),F}function T($){return new f(function(H,F){$.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,J){for(var me=[],xe=0;xe<J.rows.length;xe++)me.push(J.rows.item(xe).name);H({db:$,storeNames:me})},function(Q,J){F(J)})},function(Y){F(Y)})})}function B($,H){H=w.apply(this,arguments);var F=this.config();$=typeof $!="function"&&$||{},$.name||($.name=$.name||F.name,$.storeName=$.storeName||F.storeName);var Y=this,Q;return $.name?Q=new f(function(J){var me;$.name===F.name?me=Y._dbInfo.db:me=openDatabase($.name,"","",0),$.storeName?J({db:me,storeNames:[$.storeName]}):J(T(me))}).then(function(J){return new f(function(me,xe){J.db.transaction(function(Ce){function Me(Lt){return new f(function(zt,lr){Ce.executeSql("DROP TABLE IF EXISTS "+Lt,[],function(){zt()},function(ar,pn){lr(pn)})})}for(var Te=[],Ve=0,yt=J.storeNames.length;Ve<yt;Ve++)Te.push(Me(J.storeNames[Ve]));f.all(Te).then(function(){me()}).catch(function(Lt){xe(Lt)})},function(Ce){xe(Ce)})})}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Ye,getItem:Mt,setItem:Pt,removeItem:ot,clear:_t,length:Ft,key:k,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function re($,H){var F=$.name+"/";return $.storeName!==H.storeName&&(F+=$.storeName+"/"),F}function Be(){var $="_localforage_support_test";try{return localStorage.setItem($,!0),localStorage.removeItem($),!1}catch{return!0}}function rt(){return!Be()||localStorage.length>0}function Re($){var H=this,F={};if($)for(var Y in $)F[Y]=$[Y];return F.keyPrefix=re($,H._defaultConfig),rt()?(H._dbInfo=F,F.serializer=kt,f.resolve()):f.reject()}function z($){var H=this,F=H.ready().then(function(){for(var Y=H._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var J=localStorage.key(Q);J.indexOf(Y)===0&&localStorage.removeItem(J)}});return h(F,$),F}function oe($,H){var F=this;$=b($);var Y=F.ready().then(function(){var Q=F._dbInfo,J=localStorage.getItem(Q.keyPrefix+$);return J&&(J=Q.serializer.deserialize(J)),J});return h(Y,H),Y}function pe($,H){var F=this,Y=F.ready().then(function(){for(var Q=F._dbInfo,J=Q.keyPrefix,me=J.length,xe=localStorage.length,Ce=1,Me=0;Me<xe;Me++){var Te=localStorage.key(Me);if(Te.indexOf(J)===0){var Ve=localStorage.getItem(Te);if(Ve&&(Ve=Q.serializer.deserialize(Ve)),Ve=$(Ve,Te.substring(me),Ce++),Ve!==void 0)return Ve}}});return h(Y,H),Y}function ke($,H){var F=this,Y=F.ready().then(function(){var Q=F._dbInfo,J;try{J=localStorage.key($)}catch{J=null}return J&&(J=J.substring(Q.keyPrefix.length)),J});return h(Y,H),Y}function Ke($){var H=this,F=H.ready().then(function(){for(var Y=H._dbInfo,Q=localStorage.length,J=[],me=0;me<Q;me++){var xe=localStorage.key(me);xe.indexOf(Y.keyPrefix)===0&&J.push(xe.substring(Y.keyPrefix.length))}return J});return h(F,$),F}function Ne($){var H=this,F=H.keys().then(function(Y){return Y.length});return h(F,$),F}function ze($,H){var F=this;$=b($);var Y=F.ready().then(function(){var Q=F._dbInfo;localStorage.removeItem(Q.keyPrefix+$)});return h(Y,H),Y}function ut($,H,F){var Y=this;$=b($);var Q=Y.ready().then(function(){H===void 0&&(H=null);var J=H;return new f(function(me,xe){var Ce=Y._dbInfo;Ce.serializer.serialize(H,function(Me,Te){if(Te)xe(Te);else try{localStorage.setItem(Ce.keyPrefix+$,Me),me(J)}catch(Ve){(Ve.name==="QuotaExceededError"||Ve.name==="NS_ERROR_DOM_QUOTA_REACHED")&&xe(Ve),xe(Ve)}})})});return h(Q,F),Q}function Jt($,H){if(H=w.apply(this,arguments),$=typeof $!="function"&&$||{},!$.name){var F=this.config();$.name=$.name||F.name,$.storeName=$.storeName||F.storeName}var Y=this,Q;return $.name?Q=new f(function(J){$.storeName?J(re($,Y._defaultConfig)):J($.name+"/")}).then(function(J){for(var me=localStorage.length-1;me>=0;me--){var xe=localStorage.key(me);xe.indexOf(J)===0&&localStorage.removeItem(xe)}}):Q=f.reject("Invalid arguments"),h(Q,H),Q}var Nt={_driver:"localStorageWrapper",_initStorage:Re,_support:Z(),iterate:pe,getItem:oe,setItem:ut,removeItem:ze,clear:z,length:Ne,key:ke,keys:Ke,dropInstance:Jt},Bt=function(H,F){return H===F||typeof H=="number"&&typeof F=="number"&&isNaN(H)&&isNaN(F)},ir=function(H,F){for(var Y=H.length,Q=0;Q<Y;){if(Bt(H[Q],F))return!0;Q++}return!1},Sr=Array.isArray||function($){return Object.prototype.toString.call($)==="[object Array]"},or={},Yt={},yr={INDEXEDDB:lt,WEBSQL:K,LOCALSTORAGE:Nt},Rn=[yr.INDEXEDDB._driver,yr.WEBSQL._driver,yr.LOCALSTORAGE._driver],Hr=["dropInstance"],Dn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Hr),Ui={description:"",driver:Rn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Fi($,H){$[H]=function(){var F=arguments;return $.ready().then(function(){return $[H].apply($,F)})}}function $n(){for(var $=1;$<arguments.length;$++){var H=arguments[$];if(H)for(var F in H)H.hasOwnProperty(F)&&(Sr(H[F])?arguments[0][F]=H[F].slice():arguments[0][F]=H[F])}return arguments[0]}var zi=function(){function $(H){o(this,$);for(var F in yr)if(yr.hasOwnProperty(F)){var Y=yr[F],Q=Y._driver;this[F]=Q,or[Q]||this.defineDriver(Y)}this._defaultConfig=$n({},Ui),this._config=$n({},this._defaultConfig,H),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return $.prototype.config=function(F){if((typeof F>"u"?"undefined":s(F))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var Y in F){if(Y==="storeName"&&(F[Y]=F[Y].replace(/\W/g,"_")),Y==="version"&&typeof F[Y]!="number")return new Error("Database version must be a number.");this._config[Y]=F[Y]}return"driver"in F&&F.driver?this.setDriver(this._config.driver):!0}else return typeof F=="string"?this._config[F]:this._config},$.prototype.defineDriver=function(F,Y,Q){var J=new f(function(me,xe){try{var Ce=F._driver,Me=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!F._driver){xe(Me);return}for(var Te=Dn.concat("_initStorage"),Ve=0,yt=Te.length;Ve<yt;Ve++){var Lt=Te[Ve],zt=!ir(Hr,Lt);if((zt||F[Lt])&&typeof F[Lt]!="function"){xe(Me);return}}var lr=function(){for(var jc=function(pX){return function(){var mX=new Error("Method "+pX+" is not implemented by the current driver"),R3=f.reject(mX);return h(R3,arguments[arguments.length-1]),R3}},J0=0,hX=Hr.length;J0<hX;J0++){var Y0=Hr[J0];F[Y0]||(F[Y0]=jc(Y0))}};lr();var ar=function(jc){or[Ce]&&console.info("Redefining LocalForage driver: "+Ce),or[Ce]=F,Yt[Ce]=jc,me()};"_support"in F?F._support&&typeof F._support=="function"?F._support().then(ar,xe):ar(!!F._support):ar(!0)}catch(pn){xe(pn)}});return y(J,Y,Q),J},$.prototype.driver=function(){return this._driver||null},$.prototype.getDriver=function(F,Y,Q){var J=or[F]?f.resolve(or[F]):f.reject(new Error("Driver not found."));return y(J,Y,Q),J},$.prototype.getSerializer=function(F){var Y=f.resolve(kt);return y(Y,F),Y},$.prototype.ready=function(F){var Y=this,Q=Y._driverSet.then(function(){return Y._ready===null&&(Y._ready=Y._initDriver()),Y._ready});return y(Q,F,F),Q},$.prototype.setDriver=function(F,Y,Q){var J=this;Sr(F)||(F=[F]);var me=this._getSupportedDrivers(F);function xe(){J._config.driver=J.driver()}function Ce(Ve){return J._extend(Ve),xe(),J._ready=J._initStorage(J._config),J._ready}function Me(Ve){return function(){var yt=0;function Lt(){for(;yt<Ve.length;){var zt=Ve[yt];return yt++,J._dbInfo=null,J._ready=null,J.getDriver(zt).then(Ce).catch(Lt)}xe();var lr=new Error("No available storage method found.");return J._driverSet=f.reject(lr),J._driverSet}return Lt()}}var Te=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Te.then(function(){var Ve=me[0];return J._dbInfo=null,J._ready=null,J.getDriver(Ve).then(function(yt){J._driver=yt._driver,xe(),J._wrapLibraryMethodsWithReady(),J._initDriver=Me(me)})}).catch(function(){xe();var Ve=new Error("No available storage method found.");return J._driverSet=f.reject(Ve),J._driverSet}),y(this._driverSet,Y,Q),this._driverSet},$.prototype.supports=function(F){return!!Yt[F]},$.prototype._extend=function(F){$n(this,F)},$.prototype._getSupportedDrivers=function(F){for(var Y=[],Q=0,J=F.length;Q<J;Q++){var me=F[Q];this.supports(me)&&Y.push(me)}return Y},$.prototype._wrapLibraryMethodsWithReady=function(){for(var F=0,Y=Dn.length;F<Y;F++)Fi(this,Dn[F])},$.prototype.createInstance=function(F){return new $(F)},$}(),Vi=new zi;n.exports=Vi},{3:3}]},{},[4])(4)})})(Px);var QR=Px.exports;const sc=pa(QR);sc.config({name:"CetusSite",storeName:"tokens"});class ki{static async setItem(t,r){try{await sc.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await sc.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await sc.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await sc.clear()}catch(t){console.error("Failed to clear storage",t)}}}const rl=[{name:"SuiVision",link:"https://suivision.xyz",img:Ut("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:Ut("/images/logo_suiscan@2x.png"),isCustom:!1}],nl=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],eD=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],il={mainnet:{env:"mainnet",fullRpcUrl:"https://fullnode.mainnet.sui.io",simulationAccount:"0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb",api:"https://api-sui.cetus.zone",aggregatorUrl:"https://api-sui.cetus.zone/router_v2"}}["mainnet"],tD=Ut("/images/birdeye-logo.png"),rD=Ut("/images/img-logo@2x.png"),nD=Ut("/images/logo_CoinGecko@2x.png"),iD=Ut("/images/logo_pyth.png");var oc=(e=>(e.CETUS="CETUS",e.KRIYA="KRIYA",e.KRIYAV3="KRIYAV3",e.FLOWX="FLOWX",e.FLOWXV3="FLOWXV3",e.AFTERMATH="AFTERMATH",e.HAEDAL="HAEDAL",e.VOLO="VOLO",e.AFSUI="AFSUI",e.DEEPBOOKV3="DEEPBOOKV3",e.SCALLOP="SCALLOP",e.BLUEMOVE="BLUEMOVE",e.TURBOS="TURBOS",e.SUILEND="SUILEND",e.BLUEFIN="BLUEFIN",e.HAEDALPMM="HAEDALPMM",e))(oc||{});const jx={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},sD={pyth:iD,coingecko:nD,birdeye:tD,Cetus:rD},vr={CETUS:Ut("/images/aggregator-source/cetus.png"),KRIYA:Ut("/images/aggregator-source/kriya.png"),FLOWX:Ut("/images/aggregator-source/flowx.png"),AFTERMATH:Ut("/images/aggregator-source/aftermath.png"),TURBOS:Ut("/images/aggregator-source/turbos.png"),HAEDAL:Ut("/images/aggregator-source/haedal.png"),VOLO:Ut("/images/aggregator-source/volo.png"),AFSUI:Ut("/images/aggregator-source/aftermath.png"),BLUEMOVE:Ut("/images/aggregator-source/bluemove.png"),KRIYAV3:Ut("/images/aggregator-source/kriya.png"),FLOWXV3:Ut("/images/aggregator-source/flowx.png"),DEEPBOOKV3:Ut("/images/aggregator-source/deepbook.png"),SCALLOP:Ut("/images/aggregator-source/scallop.png"),SUILEND:Ut("/images/aggregator-source/suilend.png"),BLUEFIN:Ut("/images/aggregator-source/bluefin.png"),HAEDALPMM:Ut("/images/aggregator-source/haedal.png")},kx={CETUS:{name:"Cetus",id:"CETUS",logo:vr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:vr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:vr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:vr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:vr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:vr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:vr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:vr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:vr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:vr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:vr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:vr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:vr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:vr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:vr.SCALLOP,type:"other",sort:70},SUILEND:{name:"SpringSui",id:"SUILEND",logo:vr.SUILEND,type:"other",sort:60}},Nx=e=>{let t;const r=new Set,n=(u,l)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=l??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(y=>y(t,h))}},i=()=>t,a={setState:n,getState:i,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(n,i,a);return a},oD=e=>e?Nx(e):Nx,aD=e=>e;function cD(e,t=aD){const r=te.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return te.useDebugValue(r),r}const Rx=e=>{const t=oD(e),r=n=>cD(t,n);return Object.assign(r,t),r},Ni=e=>e?Rx(e):Rx;function uD(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,t==null?void 0:t.reviver),a=(s=r.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,t==null?void 0:t.replacer)),removeItem:i=>r.removeItem(i)}}const wp=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return wp(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return wp(n)(r)}}}},Br=Ni(((e,t)=>(r,n,i)=>{let s={storage:uD(()=>localStorage),partialize:w=>w,version:0,merge:(w,A)=>({...A,...w}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...w)},n,i);const l=()=>{const w=s.partialize({...n()});return u.setItem(s.name,{state:w,version:s.version})},f=i.setState;i.setState=(w,A)=>{f(w,A),l()};const h=e((...w)=>{r(...w),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var w,A;if(!u)return;o=!1,a.forEach(N=>{var R;return N((R=n())!=null?R:h)});const P=((A=s.onRehydrateStorage)==null?void 0:A.call(s,(w=n())!=null?w:h))||void 0;return wp(u.getItem.bind(u))(s.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==s.version){if(s.migrate){const R=s.migrate(N.state,N.version);return R instanceof Promise?R.then(U=>[!0,U]):[!0,R]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var R;const[U,L]=N;if(y=s.merge(L,(R=n())!=null?R:h),r(y,!0),U)return l()}).then(()=>{P==null||P(y,void 0),y=n(),o=!0,c.forEach(N=>N(y))}).catch(N=>{P==null||P(void 0,N)})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(u=w.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:w=>(a.add(w),()=>{a.delete(w)}),onFinishHydration:w=>(c.add(w),()=>{c.delete(w)})},s.skipHydration||b(),y||h})((e,t)=>({ignoreWarnTokenMap:{},currentExplorer:rl[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:nl,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:nl[0],customRpc:"",setCurrentRpc:r=>{e(()=>({currentRpc:r}))},setCustomRpc:r=>{e(()=>({customRpc:r}))},slippage:"0.5",setSlippage:r=>{e(()=>({slippage:r}))},isOpenSlippageDialog:!1,setIsOpenSlippageDialog:r=>{e(()=>({isOpenSlippageDialog:r}))},providers:Object.values(oc),setProviders:r=>{e(()=>({providers:r}))},poolApiMap:{},setPoolApiMap:(r,n)=>{const i=t().poolApiMap;i[r]=n,e(()=>({poolApiMap:{...i}}))},mevProtect:!0,setMevProtect:r=>{e(()=>({mevProtect:r}))},setIgnoreWarnToken:r=>{const n=t().ignoreWarnTokenMap;n[Pi(r)]=!0,e(()=>({ignoreWarnTokenMap:{...n}}))}}),{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o,ignoreWarnTokenMap:a}}}));function Fo(){const{currentExplorer:e}=Br();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${fD(n)}/${r}`:s=`${i}/${lD(n)}/${r}`,s}}}const lD=e=>{switch(e){case"account":return"address";case"token":return"object";case"tx":return"tx";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}},fD=e=>{switch(e){case"account":return"account";case"token":return"object";case"tx":return"txblock";case"poolAddress":return"object";case"nftAddress":return"object";case"coin":return"coin"}};function Dx(e){const{text:t,keywords:r,onKeywordClick:n,text_highlight_color:i="var(--cs-primary)",text_size:s="12px",text_color:o="var(--cs-btn-disabled-text)"}=e,a=new RegExp(`(${r.join("|")})`,"gi"),c=t.split(a);return _.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const f=r.includes(u);return _.jsx("span",{style:{lineHeight:"20px",fontSize:s,color:f?i:o,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var $x={exports:{}};/*!
|
|
50
50
|
Copyright (c) 2018 Jed Watson.
|
|
51
51
|
Licensed under the MIT License (MIT), see
|
|
52
52
|
http://jedwatson.github.io/classnames
|
|
53
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,n(a)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return r.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})($x);var pD=$x.exports;const Kt=ha(pD);function tt(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function mD(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function sl(...e){return t=>e.forEach(r=>mD(r,t))}function Qt(...e){return I.useCallback(sl(...e),e)}function zo(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];const u=f=>{var P;const{scope:h,children:y,...b}=f,w=((P=h==null?void 0:h[e])==null?void 0:P[c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})};u.displayName=s+"Provider";function l(f,h){var w;const y=((w=h==null?void 0:h[e])==null?void 0:w[c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,gD(i,...t)]}function gD(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Ri=I.forwardRef((e,t)=>{const{children:r,...n}=e,i=I.Children.toArray(r),s=i.find(vD);if(s){const o=s.props.children,a=i.map(c=>c===s?I.Children.count(o)>1?I.Children.only(null):I.isValidElement(o)?o.props.children:null:c);return _.jsx(_p,{...n,ref:t,children:I.isValidElement(o)?I.cloneElement(o,void 0,a):null})}return _.jsx(_p,{...n,ref:t,children:r})});Ri.displayName="Slot";var _p=I.forwardRef((e,t)=>{const{children:r,...n}=e;if(I.isValidElement(r)){const i=bD(r);return I.cloneElement(r,{...yD(n,r.props),ref:t?sl(t,i):i})}return I.Children.count(r)>1?I.Children.only(null):null});_p.displayName="SlotClone";var Vo=({children:e})=>_.jsx(_.Fragment,{children:e});function vD(e){return I.isValidElement(e)&&e.type===Vo}function yD(e,t){const r={...t};for(const n in t){const i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}function bD(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var wD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gt=wD.reduce((e,t)=>{const r=I.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?Ri:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Bx(e,t){e&&em.flushSync(()=>e.dispatchEvent(t))}function gr(e){const t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function _D(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e);I.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var xD="DismissableLayer",xp="dismissableLayer.update",SD="dismissableLayer.pointerDownOutside",ED="dismissableLayer.focusOutside",Lx,Fx=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sp=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=I.useContext(Fx),[l,f]=I.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=I.useState({}),b=Qt(t,q=>f(q)),w=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),P=w.indexOf(A),R=l?w.indexOf(l):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,F=R>=P,L=MD(q=>{const X=q.target,ie=[...u.branches].some(ae=>ae.contains(X));!F||ie||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),G=AD(q=>{const X=q.target;[...u.branches].some(ae=>ae.contains(X))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return _D(q=>{R===u.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&a&&(q.preventDefault(),a()))},h),I.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Lx=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),Ux(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Lx)}},[l,h,r,u]),I.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),Ux())},[l,u]),I.useEffect(()=>{const q=()=>y({});return document.addEventListener(xp,q),()=>document.removeEventListener(xp,q)},[]),_.jsx(Gt.div,{...c,ref:b,style:{pointerEvents:N?F?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,G.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,G.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,L.onPointerDownCapture)})});Sp.displayName=xD;var CD="DismissableLayerBranch",TD=I.forwardRef((e,t)=>{const r=I.useContext(Fx),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),_.jsx(Gt.div,{...e,ref:i})});TD.displayName=CD;function MD(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e),n=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){zx(SD,r,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function AD(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e),n=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!n.current&&zx(ED,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Ux(){const e=new CustomEvent(xp);document.dispatchEvent(e)}function zx(e,t,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?Bx(i,s):i.dispatchEvent(s)}var ls=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},OD=I["useId".toString()]||(()=>{}),ID=0;function oc(e){const[t,r]=I.useState(OD());return ls(()=>{e||r(n=>n??String(ID++))},[e]),e||(t?`radix-${t}`:"")}const PD=["top","right","bottom","left"],fs=Math.min,Jr=Math.max,ol=Math.round,al=Math.floor,ni=e=>({x:e,y:e}),kD={left:"right",right:"left",bottom:"top",top:"bottom"},jD={start:"end",end:"start"};function Ep(e,t,r){return Jr(e,fs(t,r))}function Ni(e,t){return typeof e=="function"?e(t):e}function Di(e){return e.split("-")[0]}function qo(e){return e.split("-")[1]}function Cp(e){return e==="x"?"y":"x"}function Tp(e){return e==="y"?"height":"width"}function ds(e){return["top","bottom"].includes(Di(e))?"y":"x"}function Mp(e){return Cp(ds(e))}function RD(e,t,r){r===void 0&&(r=!1);const n=qo(e),i=Mp(e),s=Tp(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=cl(o)),[o,cl(o)]}function ND(e){const t=cl(e);return[Ap(e),t,Ap(t)]}function Ap(e){return e.replace(/start|end/g,t=>jD[t])}function DD(e,t,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:n:t?n:i;case"left":case"right":return t?s:o;default:return[]}}function $D(e,t,r,n){const i=qo(e);let s=DD(Di(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Ap)))),s}function cl(e){return e.replace(/left|right|bottom|top/g,t=>kD[t])}function BD(e){return{top:0,right:0,bottom:0,left:0,...e}}function Vx(e){return typeof e!="number"?BD(e):{top:e,right:e,bottom:e,left:e}}function ul(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function qx(e,t,r){let{reference:n,floating:i}=e;const s=ds(t),o=Mp(t),a=Tp(o),c=Di(t),u=s==="y",l=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let y;switch(c){case"top":y={x:l,y:n.y-i.height};break;case"bottom":y={x:l,y:n.y+n.height};break;case"right":y={x:n.x+n.width,y:f};break;case"left":y={x:n.x-i.width,y:f};break;default:y={x:n.x,y:n.y}}switch(qo(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const LD=async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:f}=qx(u,n,c),h=n,y={},b=0;for(let w=0;w<a.length;w++){const{name:A,fn:P}=a[w],{x:R,y:N,data:F,reset:L}=await P({x:l,y:f,initialPlacement:n,placement:h,strategy:i,middlewareData:y,rects:u,platform:o,elements:{reference:e,floating:t}});l=R??l,f=N??f,y={...y,[A]:{...y[A],...F}},L&&b<=50&&(b++,typeof L=="object"&&(L.placement&&(h=L.placement),L.rects&&(u=L.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:l,y:f}=qx(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function ac(e,t){var r;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:h=!1,padding:y=0}=Ni(t,e),b=Vx(y),A=a[h?f==="floating"?"reference":"floating":f],P=ul(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(A)))==null||r?A:A.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),R=f==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),F=await(s.isElement==null?void 0:s.isElement(N))?await(s.getScale==null?void 0:s.getScale(N))||{x:1,y:1}:{x:1,y:1},L=ul(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:N,strategy:c}):R);return{top:(P.top-L.top+b.top)/F.y,bottom:(L.bottom-P.bottom+b.bottom)/F.y,left:(P.left-L.left+b.left)/F.x,right:(L.right-P.right+b.right)/F.x}}const FD=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:l=0}=Ni(e,t)||{};if(u==null)return{};const f=Vx(l),h={x:r,y:n},y=Mp(i),b=Tp(y),w=await o.getDimensions(u),A=y==="y",P=A?"top":"left",R=A?"bottom":"right",N=A?"clientHeight":"clientWidth",F=s.reference[b]+s.reference[y]-h[y]-s.floating[b],L=h[y]-s.reference[y],G=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let q=G?G[N]:0;(!q||!await(o.isElement==null?void 0:o.isElement(G)))&&(q=a.floating[N]||s.floating[b]);const X=F/2-L/2,ie=q/2-w[b]/2-1,ae=fs(f[P],ie),ce=fs(f[R],ie),V=ae,D=q-w[b]-ce,p=q/2-w[b]/2+X,d=Ep(V,p,D),m=!c.arrow&&qo(i)!=null&&p!==d&&s.reference[b]/2-(p<V?ae:ce)-w[b]/2<0,x=m?p<V?p-V:p-D:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),UD=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...A}=Ni(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const P=Di(i),R=ds(a),N=Di(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(N||!w?[cl(a)]:ND(a)),G=b!=="none";!h&&G&&L.push(...$D(a,w,b,F));const q=[a,...L],X=await ac(t,A),ie=[];let ae=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&ie.push(X[P]),f){const p=RD(i,o,F);ie.push(X[p[0]],X[p[1]])}if(ae=[...ae,{placement:i,overflows:ie}],!ie.every(p=>p<=0)){var ce,V;const p=(((ce=s.flip)==null?void 0:ce.index)||0)+1,d=q[p];if(d)return{data:{index:p,overflows:ae},reset:{placement:d}};let m=(V=ae.filter(x=>x.overflows[0]<=0).sort((x,T)=>x.overflows[1]-T.overflows[1])[0])==null?void 0:V.placement;if(!m)switch(y){case"bestFit":{var D;const x=(D=ae.filter(T=>{if(G){const E=ds(T.placement);return E===R||E==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((T,E)=>T[1]-E[1])[0])==null?void 0:D[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function Wx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gx(e){return PD.some(t=>e[t]>=0)}const zD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Ni(e,t);switch(n){case"referenceHidden":{const s=await ac(t,{...i,elementContext:"reference"}),o=Wx(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Gx(o)}}}case"escaped":{const s=await ac(t,{...i,altBoundary:!0}),o=Wx(s,r.floating);return{data:{escapedOffsets:o,escaped:Gx(o)}}}default:return{}}}}};async function VD(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Di(r),a=qo(r),c=ds(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Ni(t,e);let{mainAxis:h,crossAxis:y,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(y=a==="end"?b*-1:b),c?{x:y*l,y:h*u}:{x:h*u,y:y*l}}const qD=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=t,c=await VD(t,e);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},WD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:A=>{let{x:P,y:R}=A;return{x:P,y:R}}},...c}=Ni(e,t),u={x:r,y:n},l=await ac(t,c),f=ds(Di(i)),h=Cp(f);let y=u[h],b=u[f];if(s){const A=h==="y"?"top":"left",P=h==="y"?"bottom":"right",R=y+l[A],N=y-l[P];y=Ep(R,y,N)}if(o){const A=f==="y"?"top":"left",P=f==="y"?"bottom":"right",R=b+l[A],N=b-l[P];b=Ep(R,b,N)}const w=a.fn({...t,[h]:y,[f]:b});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[h]:s,[f]:o}}}}}},GD=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ni(e,t),l={x:r,y:n},f=ds(i),h=Cp(f);let y=l[h],b=l[f];const w=Ni(a,t),A=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const N=h==="y"?"height":"width",F=s.reference[h]-s.floating[N]+A.mainAxis,L=s.reference[h]+s.reference[N]-A.mainAxis;y<F?y=F:y>L&&(y=L)}if(u){var P,R;const N=h==="y"?"width":"height",F=["top","left"].includes(Di(i)),L=s.reference[f]-s.floating[N]+(F&&((P=o.offset)==null?void 0:P[f])||0)+(F?0:A.crossAxis),G=s.reference[f]+s.reference[N]+(F?0:((R=o.offset)==null?void 0:R[f])||0)-(F?A.crossAxis:0);b<L?b=L:b>G&&(b=G)}return{[h]:y,[f]:b}}}},HD=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:c=()=>{},...u}=Ni(e,t),l=await ac(t,u),f=Di(i),h=qo(i),y=ds(i)==="y",{width:b,height:w}=s.floating;let A,P;f==="top"||f==="bottom"?(A=f,P=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(P=f,A=h==="end"?"top":"bottom");const R=w-l.top-l.bottom,N=b-l.left-l.right,F=fs(w-l[A],R),L=fs(b-l[P],N),G=!t.middlewareData.shift;let q=F,X=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(X=N),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=R),G&&!h){const ae=Jr(l.left,0),ce=Jr(l.right,0),V=Jr(l.top,0),D=Jr(l.bottom,0);y?X=b-2*(ae!==0||ce!==0?ae+ce:Jr(l.left,l.right)):q=w-2*(V!==0||D!==0?V+D:Jr(l.top,l.bottom))}await c({...t,availableWidth:X,availableHeight:q});const ie=await o.getDimensions(a.floating);return b!==ie.width||w!==ie.height?{reset:{rects:!0}}:{}}}};function ll(){return typeof window<"u"}function Wo(e){return Hx(e)?(e.nodeName||"").toLowerCase():"#document"}function Yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ii(e){var t;return(t=(Hx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Hx(e){return ll()?e instanceof Node||e instanceof Yr(e).Node:!1}function Pn(e){return ll()?e instanceof Element||e instanceof Yr(e).Element:!1}function si(e){return ll()?e instanceof HTMLElement||e instanceof Yr(e).HTMLElement:!1}function Kx(e){return!ll()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Yr(e).ShadowRoot}function cc(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=kn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function KD(e){return["table","td","th"].includes(Wo(e))}function fl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Op(e){const t=Ip(),r=Pn(e)?kn(e):e;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function XD(e){let t=hs(e);for(;si(t)&&!Go(t);){if(Op(t))return t;if(fl(t))return null;t=hs(t)}return null}function Ip(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Go(e){return["html","body","#document"].includes(Wo(e))}function kn(e){return Yr(e).getComputedStyle(e)}function dl(e){return Pn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hs(e){if(Wo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Kx(e)&&e.host||ii(e);return Kx(t)?t.host:t}function Xx(e){const t=hs(e);return Go(t)?e.ownerDocument?e.ownerDocument.body:e.body:si(t)&&cc(t)?t:Xx(t)}function uc(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=Xx(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Yr(i);if(s){const a=Pp(o);return t.concat(o,o.visualViewport||[],cc(i)?i:[],a&&r?uc(a):[])}return t.concat(i,uc(i,[],r))}function Pp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jx(e){const t=kn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=si(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=ol(r)!==s||ol(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function kp(e){return Pn(e)?e:e.contextElement}function Ho(e){const t=kp(e);if(!si(t))return ni(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=Jx(t);let o=(s?ol(r.width):r.width)/n,a=(s?ol(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const JD=ni(0);function Yx(e){const t=Yr(e);return!Ip()||!t.visualViewport?JD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function YD(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Yr(e)?!1:t}function Hs(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=kp(e);let o=ni(1);t&&(n?Pn(n)&&(o=Ho(n)):o=Ho(e));const a=YD(s,r,n)?Yx(s):ni(0);let c=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,l=i.width/o.x,f=i.height/o.y;if(s){const h=Yr(s),y=n&&Pn(n)?Yr(n):n;let b=h,w=Pp(b);for(;w&&n&&y!==b;){const A=Ho(w),P=w.getBoundingClientRect(),R=kn(w),N=P.left+(w.clientLeft+parseFloat(R.paddingLeft))*A.x,F=P.top+(w.clientTop+parseFloat(R.paddingTop))*A.y;c*=A.x,u*=A.y,l*=A.x,f*=A.y,c+=N,u+=F,b=Yr(w),w=Pp(b)}}return ul({width:l,height:f,x:c,y:u})}function jp(e,t){const r=dl(e).scrollLeft;return t?t.left+r:Hs(ii(e)).left+r}function Zx(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:jp(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function ZD(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=ii(n),a=t?fl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=ni(1);const l=ni(0),f=si(n);if((f||!f&&!s)&&((Wo(n)!=="body"||cc(o))&&(c=dl(n)),si(n))){const y=Hs(n);u=Ho(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?Zx(o,c,!0):ni(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x+h.x,y:r.y*u.y-c.scrollTop*u.y+l.y+h.y}}function QD(e){return Array.from(e.getClientRects())}function e$(e){const t=ii(e),r=dl(e),n=e.ownerDocument.body,i=Jr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Jr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+jp(e);const a=-r.scrollTop;return kn(n).direction==="rtl"&&(o+=Jr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function t$(e,t){const r=Yr(e),n=ii(e),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const u=Ip();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function r$(e,t){const r=Hs(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=si(e)?Ho(e):ni(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,c=i*s.x,u=n*s.y;return{width:o,height:a,x:c,y:u}}function Qx(e,t,r){let n;if(t==="viewport")n=t$(e,r);else if(t==="document")n=e$(ii(e));else if(Pn(t))n=r$(t,r);else{const i=Yx(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ul(n)}function e4(e,t){const r=hs(e);return r===t||!Pn(r)||Go(r)?!1:kn(r).position==="fixed"||e4(r,t)}function n$(e,t){const r=t.get(e);if(r)return r;let n=uc(e,[],!1).filter(a=>Pn(a)&&Wo(a)!=="body"),i=null;const s=kn(e).position==="fixed";let o=s?hs(e):e;for(;Pn(o)&&!Go(o);){const a=kn(o),c=Op(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||cc(o)&&!c&&e4(e,o))?n=n.filter(l=>l!==o):i=a,o=hs(o)}return t.set(e,n),n}function i$(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?fl(t)?[]:n$(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=Qx(t,l,i);return u.top=Jr(f.top,u.top),u.right=fs(f.right,u.right),u.bottom=fs(f.bottom,u.bottom),u.left=Jr(f.left,u.left),u},Qx(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function s$(e){const{width:t,height:r}=Jx(e);return{width:t,height:r}}function o$(e,t,r){const n=si(t),i=ii(t),s=r==="fixed",o=Hs(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=ni(0);if(n||!n&&!s)if((Wo(t)!=="body"||cc(i))&&(a=dl(t)),n){const h=Hs(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=jp(i));const u=i&&!n&&!s?Zx(i,a):ni(0),l=o.left+a.scrollLeft-c.x-u.x,f=o.top+a.scrollTop-c.y-u.y;return{x:l,y:f,width:o.width,height:o.height}}function Rp(e){return kn(e).position==="static"}function t4(e,t){if(!si(e)||kn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ii(e)===r&&(r=r.ownerDocument.body),r}function r4(e,t){const r=Yr(e);if(fl(e))return r;if(!si(e)){let i=hs(e);for(;i&&!Go(i);){if(Pn(i)&&!Rp(i))return i;i=hs(i)}return r}let n=t4(e,t);for(;n&&KD(n)&&Rp(n);)n=t4(n,t);return n&&Go(n)&&Rp(n)&&!Op(n)?r:n||XD(e)||r}const a$=async function(e){const t=this.getOffsetParent||r4,r=this.getDimensions,n=await r(e.floating);return{reference:o$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function c$(e){return kn(e).direction==="rtl"}const u$={convertOffsetParentRelativeRectToViewportRelativeRect:ZD,getDocumentElement:ii,getClippingRect:i$,getOffsetParent:r4,getElementRects:a$,getClientRects:QD,getDimensions:s$,getScale:Ho,isElement:Pn,isRTL:c$};function l$(e,t){let r=null,n;const i=ii(e);function s(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const{left:u,top:l,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const y=al(l),b=al(i.clientWidth-(u+f)),w=al(i.clientHeight-(l+h)),A=al(u),R={rootMargin:-y+"px "+-b+"px "+-w+"px "+-A+"px",threshold:Jr(0,fs(1,c))||1};let N=!0;function F(L){const G=L[0].intersectionRatio;if(G!==c){if(!N)return o();G?o(!1,G):n=setTimeout(()=>{o(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(F,{...R,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,R)}r.observe(e)}return o(!0),s}function f$(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=kp(e),l=i||s?[...u?uc(u):[],...uc(t)]:[];l.forEach(P=>{i&&P.addEventListener("scroll",r,{passive:!0}),s&&P.addEventListener("resize",r)});const f=u&&a?l$(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(P=>{let[R]=P;R&&R.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,w=c?Hs(e):null;c&&A();function A(){const P=Hs(e);w&&(P.x!==w.x||P.y!==w.y||P.width!==w.width||P.height!==w.height)&&r(),w=P,b=requestAnimationFrame(A)}return r(),()=>{var P;l.forEach(R=>{i&&R.removeEventListener("scroll",r),s&&R.removeEventListener("resize",r)}),f==null||f(),(P=y)==null||P.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const d$=qD,h$=WD,p$=UD,m$=HD,g$=zD,n4=FD,v$=GD,y$=(e,t,r)=>{const n=new Map,i={platform:u$,...r},s={...i.platform,_c:n};return LD(e,t,{...i,platform:s})};var hl=typeof document<"u"?te.useLayoutEffect:te.useEffect;function pl(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 r,n,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!pl(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&e.$$typeof)&&!pl(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function i4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s4(e,t){const r=i4(e);return Math.round(t*r)/r}function Np(e){const t=I.useRef(e);return hl(()=>{t.current=e}),t}function b$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,f]=I.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,y]=I.useState(n);pl(h,n)||y(n);const[b,w]=I.useState(null),[A,P]=I.useState(null),R=I.useCallback(T=>{T!==G.current&&(G.current=T,w(T))},[]),N=I.useCallback(T=>{T!==q.current&&(q.current=T,P(T))},[]),F=s||b,L=o||A,G=I.useRef(null),q=I.useRef(null),X=I.useRef(l),ie=c!=null,ae=Np(c),ce=Np(i),V=Np(u),D=I.useCallback(()=>{if(!G.current||!q.current)return;const T={placement:t,strategy:r,middleware:h};ce.current&&(T.platform=ce.current),y$(G.current,q.current,T).then(E=>{const O={...E,isPositioned:V.current!==!1};p.current&&!pl(X.current,O)&&(X.current=O,em.flushSync(()=>{f(O)}))})},[h,t,r,ce,V]);hl(()=>{u===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[u]);const p=I.useRef(!1);hl(()=>(p.current=!0,()=>{p.current=!1}),[]),hl(()=>{if(F&&(G.current=F),L&&(q.current=L),F&&L){if(ae.current)return ae.current(F,L,D);D()}},[F,L,D,ae,ie]);const d=I.useMemo(()=>({reference:G,floating:q,setReference:R,setFloating:N}),[R,N]),m=I.useMemo(()=>({reference:F,floating:L}),[F,L]),x=I.useMemo(()=>{const T={position:r,left:0,top:0};if(!m.floating)return T;const E=s4(m.floating,l.x),O=s4(m.floating,l.y);return a?{...T,transform:"translate("+E+"px, "+O+"px)",...i4(m.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:E,top:O}},[r,a,m.floating,l.x,l.y]);return I.useMemo(()=>({...l,update:D,refs:d,elements:m,floatingStyles:x}),[l,D,d,m,x])}const w$=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:i}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?n4({element:n.current,padding:i}).fn(r):{}:n?n4({element:n,padding:i}).fn(r):{}}}},_$=(e,t)=>({...d$(e),options:[e,t]}),x$=(e,t)=>({...h$(e),options:[e,t]}),S$=(e,t)=>({...v$(e),options:[e,t]}),E$=(e,t)=>({...p$(e),options:[e,t]}),C$=(e,t)=>({...m$(e),options:[e,t]}),T$=(e,t)=>({...g$(e),options:[e,t]}),M$=(e,t)=>({...w$(e),options:[e,t]});var A$="Arrow",o4=I.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...s}=e;return _.jsx(Gt.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:_.jsx("polygon",{points:"0,0 30,0 15,10"})})});o4.displayName=A$;var O$=o4;function I$(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,P$(i,...t)]}function P$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function Dp(e){const[t,r]=I.useState(void 0);return ls(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;r({width:o,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var $p="Popper",[a4,ml]=I$($p),[k$,c4]=a4($p),u4=e=>{const{__scopePopper:t,children:r}=e,[n,i]=I.useState(null);return _.jsx(k$,{scope:t,anchor:n,onAnchorChange:i,children:r})};u4.displayName=$p;var l4="PopperAnchor",f4=I.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=c4(l4,r),o=I.useRef(null),a=Qt(t,o);return I.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:_.jsx(Gt.div,{...i,ref:a})});f4.displayName=l4;var Bp="PopperContent",[j$,R$]=a4(Bp),d4=I.forwardRef((e,t)=>{var he,ye,Ee,Se,Ge,Ue;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:l=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:y="optimized",onPlaced:b,...w}=e,A=c4(Bp,r),[P,R]=I.useState(null),N=Qt(t,lt=>R(lt)),[F,L]=I.useState(null),G=Dp(F),q=(G==null?void 0:G.width)??0,X=(G==null?void 0:G.height)??0,ie=n+(s!=="center"?"-"+s:""),ae=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ce=Array.isArray(u)?u:[u],V=ce.length>0,D={padding:ae,boundary:ce.filter(D$),altBoundary:V},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:T}=b$({strategy:"fixed",placement:ie,whileElementsMounted:(...lt)=>f$(...lt,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[_$({mainAxis:i+X,alignmentAxis:o}),c&&x$({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?S$():void 0,...D}),c&&E$({...D}),C$({...D,apply:({elements:lt,rects:ht,availableWidth:$e,availableHeight:mt})=>{const{width:_e,height:ge}=ht.reference,Ae=lt.floating.style;Ae.setProperty("--radix-popper-available-width",`${$e}px`),Ae.setProperty("--radix-popper-available-height",`${mt}px`),Ae.setProperty("--radix-popper-anchor-width",`${_e}px`),Ae.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),F&&M$({element:F,padding:a}),$$({arrowWidth:q,arrowHeight:X}),h&&T$({strategy:"referenceHidden",...D})]}),[E,O]=m4(m),C=gr(b);ls(()=>{x&&(C==null||C())},[x,C]);const g=(he=T.arrow)==null?void 0:he.x,v=(ye=T.arrow)==null?void 0:ye.y,k=((Ee=T.arrow)==null?void 0:Ee.centerOffset)!==0,[ee,se]=I.useState();return ls(()=>{P&&se(window.getComputedStyle(P).zIndex)},[P]),_.jsx("div",{ref:p.setFloating,"data-radix-popper-content-wrapper":"",style:{...d,transform:x?d.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(Se=T.transformOrigin)==null?void 0:Se.x,(Ge=T.transformOrigin)==null?void 0:Ge.y].join(" "),...((Ue=T.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:_.jsx(j$,{scope:r,placedSide:E,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:k,children:_.jsx(Gt.div,{"data-side":E,"data-align":O,...w,ref:N,style:{...w.style,animation:x?void 0:"none"}})})})});d4.displayName=Bp;var h4="PopperArrow",N$={top:"bottom",right:"left",bottom:"top",left:"right"},p4=I.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=R$(h4,n),o=N$[s.placedSide];return _.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:_.jsx(O$,{...i,ref:r,style:{...i.style,display:"block"}})})});p4.displayName=h4;function D$(e){return e!==null}var $$=e=>({name:"transformOrigin",options:e,fn(t){var A,P,R;const{placement:r,rects:n,middlewareData:i}=t,o=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=m4(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((P=i.arrow)==null?void 0:P.x)??0)+a/2,y=(((R=i.arrow)==null?void 0:R.y)??0)+c/2;let b="",w="";return u==="bottom"?(b=o?f:`${h}px`,w=`${-c}px`):u==="top"?(b=o?f:`${h}px`,w=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,w=o?f:`${y}px`):u==="left"&&(b=`${n.floating.width+c}px`,w=o?f:`${y}px`),{data:{x:b,y:w}}}});function m4(e){const[t,r="center"]=e.split("-");return[t,r]}var g4=u4,v4=f4,y4=d4,b4=p4,B$="Portal",w4=I.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=I.useState(!1);ls(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Bn.createPortal(_.jsx(Gt.div,{...n,ref:t}),o):null});w4.displayName=B$;function L$(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var jn=e=>{const{present:t,children:r}=e,n=F$(t),i=typeof r=="function"?r({present:n.isPresent}):I.Children.only(r),s=Qt(n.ref,U$(i));return typeof r=="function"||n.isPresent?I.cloneElement(i,{ref:s}):null};jn.displayName="Presence";function F$(e){const[t,r]=I.useState(),n=I.useRef({}),i=I.useRef(e),s=I.useRef("none"),o=e?"mounted":"unmounted",[a,c]=L$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const u=gl(n.current);s.current=a==="mounted"?u:"none"},[a]),ls(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=gl(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(l&&h!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),ls(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=gl(n.current).includes(y.animationName);if(y.target===t&&w&&(c("ANIMATION_END"),!i.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},h=y=>{y.target===t&&(s.current=gl(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{l.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:I.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function gl(e){return(e==null?void 0:e.animationName)||"none"}function U$(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function lc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=z$({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=gr(r),c=I.useCallback(u=>{if(s){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else i(u)},[s,e,i,a]);return[o,c]}function z$({defaultProp:e,onChange:t}){const r=I.useState(e),[n]=r,i=I.useRef(n),s=gr(t);return I.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var V$="VisuallyHidden",_4=I.forwardRef((e,t)=>_.jsx(Gt.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));_4.displayName=V$;var q$=_4,[vl,zX]=zo("Tooltip",[ml]),Lp=ml(),x4="TooltipProvider",W$=700,S4="tooltip.open",[G$,E4]=vl(x4),C4=e=>{const{__scopeTooltip:t,delayDuration:r=W$,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:s}=e,[o,a]=I.useState(!0),c=I.useRef(!1),u=I.useRef(0);return I.useEffect(()=>{const l=u.current;return()=>window.clearTimeout(l)},[]),_.jsx(G$,{scope:t,isOpenDelayed:o,delayDuration:r,onOpen:I.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:I.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:I.useCallback(l=>{c.current=l},[]),disableHoverableContent:i,children:s})};C4.displayName=x4;var T4="Tooltip",[VX,yl]=vl(T4),Fp="TooltipTrigger",H$=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=yl(Fp,r),s=E4(Fp,r),o=Lp(r),a=I.useRef(null),c=Qt(t,a,i.onTriggerChange),u=I.useRef(!1),l=I.useRef(!1),f=I.useCallback(()=>u.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),_.jsx(v4,{asChild:!0,...o,children:_.jsx(Gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:tt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:tt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:tt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:tt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:tt(e.onBlur,i.onClose),onClick:tt(e.onClick,i.onClose)})})});H$.displayName=Fp;var K$="TooltipPortal",[qX,X$]=vl(K$,{forceMount:void 0}),Ko="TooltipContent",J$=I.forwardRef((e,t)=>{const r=X$(Ko,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=yl(Ko,e.__scopeTooltip);return _.jsx(jn,{present:n||o.open,children:o.disableHoverableContent?_.jsx(M4,{side:i,...s,ref:t}):_.jsx(Y$,{side:i,...s,ref:t})})}),Y$=I.forwardRef((e,t)=>{const r=yl(Ko,e.__scopeTooltip),n=E4(Ko,e.__scopeTooltip),i=I.useRef(null),s=Qt(t,i),[o,a]=I.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:f}=n,h=I.useCallback(()=>{a(null),f(!1)},[f]),y=I.useCallback((b,w)=>{const A=b.currentTarget,P={x:b.clientX,y:b.clientY},R=tB(P,A.getBoundingClientRect()),N=rB(P,R),F=nB(w.getBoundingClientRect()),L=sB([...N,...F]);a(L),f(!0)},[f]);return I.useEffect(()=>()=>h(),[h]),I.useEffect(()=>{if(c&&l){const b=A=>y(A,l),w=A=>y(A,c);return c.addEventListener("pointerleave",b),l.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",w)}}},[c,l,y,h]),I.useEffect(()=>{if(o){const b=w=>{const A=w.target,P={x:w.clientX,y:w.clientY},R=(c==null?void 0:c.contains(A))||(l==null?void 0:l.contains(A)),N=!iB(P,o);R?h():N&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),_.jsx(M4,{...e,ref:s})}),[Z$,Q$]=vl(T4,{isInside:!1}),M4=I.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=yl(Ko,r),u=Lp(r),{onClose:l}=c;return I.useEffect(()=>(document.addEventListener(S4,l),()=>document.removeEventListener(S4,l)),[l]),I.useEffect(()=>{if(c.trigger){const f=h=>{const y=h.target;y!=null&&y.contains(c.trigger)&&l()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,l]),_.jsx(Sp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:_.jsxs(y4,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[_.jsx(Vo,{children:n}),_.jsx(Z$,{scope:r,isInside:!0,children:_.jsx(q$,{id:c.contentId,role:"tooltip",children:i||n})})]})})});J$.displayName=Ko;var A4="TooltipArrow",eB=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Lp(r);return Q$(A4,r).isInside?null:_.jsx(b4,{...i,...n,ref:t})});eB.displayName=A4;function tB(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,i,s)){case s:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function rB(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function nB(e){const{top:t,right:r,bottom:n,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:n},{x:i,y:n}]}function iB(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,c=t[s].y,u=t[o].x,l=t[o].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function sB(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),oB(t)}function oB(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const i=e[n];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const i=e[n];for(;r.length>=2;){const s=r[r.length-1],o=r[r.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))r.pop();else break}r.push(i)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var aB=C4,O4=I.createContext(void 0),cB=e=>{const{dir:t,children:r}=e;return _.jsx(O4.Provider,{value:t,children:r})};function Up(e){const t=I.useContext(O4);return e||t||"ltr"}const uB=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],lB=["sky","mint","lime","yellow","amber"],fB=["gold","bronze"],dB=[...uB,...lB,...fB],hB=["gray",...["mauve","slate","sage","olive","sand"]];function pB(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand"}}const mB=["inherit","light","dark"],gB=[...dB,"gray"],vB=[...hB,"auto"],$r={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:mB,default:"inherit"},accentColor:{type:"enum",values:gB,default:"indigo"},grayColor:{type:"enum",values:vB,default:"auto"},panelBackground:{type:"enum",values:["solid","translucent"],default:"translucent"},radius:{type:"enum",values:["none","small","medium","large","full"],default:"medium"},scaling:{type:"enum",values:["90%","95%","100%","105%","110%"],default:"100%"}};function I4(e){return e==="gray"?"gray":pB(e)}const Xo=()=>{},bl=I.createContext(void 0);function yB(){const e=I.useContext(bl);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const wl=I.forwardRef((e,t)=>I.useContext(bl)===void 0?I.createElement(aB,null,I.createElement(cB,{dir:"ltr"},I.createElement(P4,{...e,ref:t}))):I.createElement(zp,{...e,ref:t}));wl.displayName="Theme";const P4=I.forwardRef((e,t)=>{const{appearance:r=$r.appearance.default,accentColor:n=$r.accentColor.default,grayColor:i=$r.grayColor.default,panelBackground:s=$r.panelBackground.default,radius:o=$r.radius.default,scaling:a=$r.scaling.default,hasBackground:c=$r.hasBackground.default,...u}=e,[l,f]=I.useState(r);I.useEffect(()=>f(r),[r]);const[h,y]=I.useState(n);I.useEffect(()=>y(n),[n]);const[b,w]=I.useState(i);I.useEffect(()=>w(i),[i]);const[A,P]=I.useState(s);I.useEffect(()=>P(s),[s]);const[R,N]=I.useState(o);I.useEffect(()=>N(o),[o]);const[F,L]=I.useState(a);I.useEffect(()=>L(a),[a]);const G=I.memo(({appearance:X})=>I.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${X}';c.add('${X}');}catch(e){}})();`}}),()=>!0);G.displayName="ExplicitRootAppearanceScript",I.useEffect(()=>bB(r),[r]);const q=b==="auto"?I4(h):b;return I.createElement(I.Fragment,null,l!=="inherit"&&I.createElement(G,{appearance:l}),c&&I.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
53
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,n(a)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return r.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(r.default=r,e.exports=r):window.classNames=r})()})($x);var dD=$x.exports;const Kt=pa(dD);function tt(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function hD(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function sl(...e){return t=>e.forEach(r=>hD(r,t))}function Qt(...e){return I.useCallback(sl(...e),e)}function zo(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];const u=f=>{var P;const{scope:h,children:y,...b}=f,w=((P=h==null?void 0:h[e])==null?void 0:P[c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})};u.displayName=s+"Provider";function l(f,h){var w;const y=((w=h==null?void 0:h[e])==null?void 0:w[c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,pD(i,...t)]}function pD(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Ri=I.forwardRef((e,t)=>{const{children:r,...n}=e,i=I.Children.toArray(r),s=i.find(mD);if(s){const o=s.props.children,a=i.map(c=>c===s?I.Children.count(o)>1?I.Children.only(null):I.isValidElement(o)?o.props.children:null:c);return _.jsx(_p,{...n,ref:t,children:I.isValidElement(o)?I.cloneElement(o,void 0,a):null})}return _.jsx(_p,{...n,ref:t,children:r})});Ri.displayName="Slot";var _p=I.forwardRef((e,t)=>{const{children:r,...n}=e;if(I.isValidElement(r)){const i=vD(r);return I.cloneElement(r,{...gD(n,r.props),ref:t?sl(t,i):i})}return I.Children.count(r)>1?I.Children.only(null):null});_p.displayName="SlotClone";var Vo=({children:e})=>_.jsx(_.Fragment,{children:e});function mD(e){return I.isValidElement(e)&&e.type===Vo}function gD(e,t){const r={...t};for(const n in t){const i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}function vD(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var yD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gt=yD.reduce((e,t)=>{const r=I.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?Ri:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),_.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Bx(e,t){e&&em.flushSync(()=>e.dispatchEvent(t))}function gr(e){const t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function bD(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e);I.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var wD="DismissableLayer",xp="dismissableLayer.update",_D="dismissableLayer.pointerDownOutside",xD="dismissableLayer.focusOutside",Lx,Ux=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sp=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=I.useContext(Ux),[l,f]=I.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=I.useState({}),b=Qt(t,q=>f(q)),w=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),P=w.indexOf(A),N=l?w.indexOf(l):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,U=N>=P,L=CD(q=>{const X=q.target,ie=[...u.branches].some(ae=>ae.contains(X));!U||ie||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),G=MD(q=>{const X=q.target;[...u.branches].some(ae=>ae.contains(X))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return bD(q=>{N===u.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&a&&(q.preventDefault(),a()))},h),I.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Lx=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),Fx(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Lx)}},[l,h,r,u]),I.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),Fx())},[l,u]),I.useEffect(()=>{const q=()=>y({});return document.addEventListener(xp,q),()=>document.removeEventListener(xp,q)},[]),_.jsx(Gt.div,{...c,ref:b,style:{pointerEvents:R?U?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,G.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,G.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,L.onPointerDownCapture)})});Sp.displayName=wD;var SD="DismissableLayerBranch",ED=I.forwardRef((e,t)=>{const r=I.useContext(Ux),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),_.jsx(Gt.div,{...e,ref:i})});ED.displayName=SD;function CD(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e),n=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){zx(_D,r,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function MD(e,t=globalThis==null?void 0:globalThis.document){const r=gr(e),n=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!n.current&&zx(xD,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Fx(){const e=new CustomEvent(xp);document.dispatchEvent(e)}function zx(e,t,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?Bx(i,s):i.dispatchEvent(s)}var fs=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},TD=I["useId".toString()]||(()=>{}),AD=0;function ac(e){const[t,r]=I.useState(TD());return fs(()=>{e||r(n=>n??String(AD++))},[e]),e||(t?`radix-${t}`:"")}const OD=["top","right","bottom","left"],ds=Math.min,Zr=Math.max,ol=Math.round,al=Math.floor,ni=e=>({x:e,y:e}),ID={left:"right",right:"left",bottom:"top",top:"bottom"},PD={start:"end",end:"start"};function Ep(e,t,r){return Zr(e,ds(t,r))}function Di(e,t){return typeof e=="function"?e(t):e}function $i(e){return e.split("-")[0]}function qo(e){return e.split("-")[1]}function Cp(e){return e==="x"?"y":"x"}function Mp(e){return e==="y"?"height":"width"}function hs(e){return["top","bottom"].includes($i(e))?"y":"x"}function Tp(e){return Cp(hs(e))}function jD(e,t,r){r===void 0&&(r=!1);const n=qo(e),i=Tp(e),s=Mp(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=cl(o)),[o,cl(o)]}function kD(e){const t=cl(e);return[Ap(e),t,Ap(t)]}function Ap(e){return e.replace(/start|end/g,t=>PD[t])}function ND(e,t,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:n:t?n:i;case"left":case"right":return t?s:o;default:return[]}}function RD(e,t,r,n){const i=qo(e);let s=ND($i(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Ap)))),s}function cl(e){return e.replace(/left|right|bottom|top/g,t=>ID[t])}function DD(e){return{top:0,right:0,bottom:0,left:0,...e}}function Vx(e){return typeof e!="number"?DD(e):{top:e,right:e,bottom:e,left:e}}function ul(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function qx(e,t,r){let{reference:n,floating:i}=e;const s=hs(t),o=Tp(t),a=Mp(o),c=$i(t),u=s==="y",l=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,h=n[a]/2-i[a]/2;let y;switch(c){case"top":y={x:l,y:n.y-i.height};break;case"bottom":y={x:l,y:n.y+n.height};break;case"right":y={x:n.x+n.width,y:f};break;case"left":y={x:n.x-i.width,y:f};break;default:y={x:n.x,y:n.y}}switch(qo(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const $D=async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:f}=qx(u,n,c),h=n,y={},b=0;for(let w=0;w<a.length;w++){const{name:A,fn:P}=a[w],{x:N,y:R,data:U,reset:L}=await P({x:l,y:f,initialPlacement:n,placement:h,strategy:i,middlewareData:y,rects:u,platform:o,elements:{reference:e,floating:t}});l=N??l,f=R??f,y={...y,[A]:{...y[A],...U}},L&&b<=50&&(b++,typeof L=="object"&&(L.placement&&(h=L.placement),L.rects&&(u=L.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:l,y:f}=qx(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function cc(e,t){var r;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:h=!1,padding:y=0}=Di(t,e),b=Vx(y),A=a[h?f==="floating"?"reference":"floating":f],P=ul(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(A)))==null||r?A:A.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),N=f==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),U=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},L=ul(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:N,offsetParent:R,strategy:c}):N);return{top:(P.top-L.top+b.top)/U.y,bottom:(L.bottom-P.bottom+b.bottom)/U.y,left:(P.left-L.left+b.left)/U.x,right:(L.right-P.right+b.right)/U.x}}const BD=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:c}=t,{element:u,padding:l=0}=Di(e,t)||{};if(u==null)return{};const f=Vx(l),h={x:r,y:n},y=Tp(i),b=Mp(y),w=await o.getDimensions(u),A=y==="y",P=A?"top":"left",N=A?"bottom":"right",R=A?"clientHeight":"clientWidth",U=s.reference[b]+s.reference[y]-h[y]-s.floating[b],L=h[y]-s.reference[y],G=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let q=G?G[R]:0;(!q||!await(o.isElement==null?void 0:o.isElement(G)))&&(q=a.floating[R]||s.floating[b]);const X=U/2-L/2,ie=q/2-w[b]/2-1,ae=ds(f[P],ie),ce=ds(f[N],ie),V=ae,D=q-w[b]-ce,p=q/2-w[b]/2+X,d=Ep(V,p,D),m=!c.arrow&&qo(i)!=null&&p!==d&&s.reference[b]/2-(p<V?ae:ce)-w[b]/2<0,x=m?p<V?p-V:p-D:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),LD=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...A}=Di(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const P=$i(i),N=hs(a),R=$i(a)===a,U=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(R||!w?[cl(a)]:kD(a)),G=b!=="none";!h&&G&&L.push(...RD(a,w,b,U));const q=[a,...L],X=await cc(t,A),ie=[];let ae=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&ie.push(X[P]),f){const p=jD(i,o,U);ie.push(X[p[0]],X[p[1]])}if(ae=[...ae,{placement:i,overflows:ie}],!ie.every(p=>p<=0)){var ce,V;const p=(((ce=s.flip)==null?void 0:ce.index)||0)+1,d=q[p];if(d)return{data:{index:p,overflows:ae},reset:{placement:d}};let m=(V=ae.filter(x=>x.overflows[0]<=0).sort((x,M)=>x.overflows[1]-M.overflows[1])[0])==null?void 0:V.placement;if(!m)switch(y){case"bestFit":{var D;const x=(D=ae.filter(M=>{if(G){const E=hs(M.placement);return E===N||E==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((M,E)=>M[1]-E[1])[0])==null?void 0:D[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function Wx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gx(e){return OD.some(t=>e[t]>=0)}const UD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Di(e,t);switch(n){case"referenceHidden":{const s=await cc(t,{...i,elementContext:"reference"}),o=Wx(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Gx(o)}}}case"escaped":{const s=await cc(t,{...i,altBoundary:!0}),o=Wx(s,r.floating);return{data:{escapedOffsets:o,escaped:Gx(o)}}}default:return{}}}}};async function FD(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=$i(r),a=qo(r),c=hs(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Di(t,e);let{mainAxis:h,crossAxis:y,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(y=a==="end"?b*-1:b),c?{x:y*l,y:h*u}:{x:h*u,y:y*l}}const zD=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:s,placement:o,middlewareData:a}=t,c=await FD(t,e);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},VD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:A=>{let{x:P,y:N}=A;return{x:P,y:N}}},...c}=Di(e,t),u={x:r,y:n},l=await cc(t,c),f=hs($i(i)),h=Cp(f);let y=u[h],b=u[f];if(s){const A=h==="y"?"top":"left",P=h==="y"?"bottom":"right",N=y+l[A],R=y-l[P];y=Ep(N,y,R)}if(o){const A=f==="y"?"top":"left",P=f==="y"?"bottom":"right",N=b+l[A],R=b-l[P];b=Ep(N,b,R)}const w=a.fn({...t,[h]:y,[f]:b});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[h]:s,[f]:o}}}}}},qD=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Di(e,t),l={x:r,y:n},f=hs(i),h=Cp(f);let y=l[h],b=l[f];const w=Di(a,t),A=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const R=h==="y"?"height":"width",U=s.reference[h]-s.floating[R]+A.mainAxis,L=s.reference[h]+s.reference[R]-A.mainAxis;y<U?y=U:y>L&&(y=L)}if(u){var P,N;const R=h==="y"?"width":"height",U=["top","left"].includes($i(i)),L=s.reference[f]-s.floating[R]+(U&&((P=o.offset)==null?void 0:P[f])||0)+(U?0:A.crossAxis),G=s.reference[f]+s.reference[R]+(U?0:((N=o.offset)==null?void 0:N[f])||0)-(U?A.crossAxis:0);b<L?b=L:b>G&&(b=G)}return{[h]:y,[f]:b}}}},WD=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:c=()=>{},...u}=Di(e,t),l=await cc(t,u),f=$i(i),h=qo(i),y=hs(i)==="y",{width:b,height:w}=s.floating;let A,P;f==="top"||f==="bottom"?(A=f,P=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(P=f,A=h==="end"?"top":"bottom");const N=w-l.top-l.bottom,R=b-l.left-l.right,U=ds(w-l[A],N),L=ds(b-l[P],R),G=!t.middlewareData.shift;let q=U,X=L;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(X=R),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=N),G&&!h){const ae=Zr(l.left,0),ce=Zr(l.right,0),V=Zr(l.top,0),D=Zr(l.bottom,0);y?X=b-2*(ae!==0||ce!==0?ae+ce:Zr(l.left,l.right)):q=w-2*(V!==0||D!==0?V+D:Zr(l.top,l.bottom))}await c({...t,availableWidth:X,availableHeight:q});const ie=await o.getDimensions(a.floating);return b!==ie.width||w!==ie.height?{reset:{rects:!0}}:{}}}};function ll(){return typeof window<"u"}function Wo(e){return Hx(e)?(e.nodeName||"").toLowerCase():"#document"}function Qr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ii(e){var t;return(t=(Hx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Hx(e){return ll()?e instanceof Node||e instanceof Qr(e).Node:!1}function Pn(e){return ll()?e instanceof Element||e instanceof Qr(e).Element:!1}function si(e){return ll()?e instanceof HTMLElement||e instanceof Qr(e).HTMLElement:!1}function Kx(e){return!ll()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qr(e).ShadowRoot}function uc(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=jn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function GD(e){return["table","td","th"].includes(Wo(e))}function fl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Op(e){const t=Ip(),r=Pn(e)?jn(e):e;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function HD(e){let t=ps(e);for(;si(t)&&!Go(t);){if(Op(t))return t;if(fl(t))return null;t=ps(t)}return null}function Ip(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Go(e){return["html","body","#document"].includes(Wo(e))}function jn(e){return Qr(e).getComputedStyle(e)}function dl(e){return Pn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ps(e){if(Wo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Kx(e)&&e.host||ii(e);return Kx(t)?t.host:t}function Xx(e){const t=ps(e);return Go(t)?e.ownerDocument?e.ownerDocument.body:e.body:si(t)&&uc(t)?t:Xx(t)}function lc(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=Xx(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Qr(i);if(s){const a=Pp(o);return t.concat(o,o.visualViewport||[],uc(i)?i:[],a&&r?lc(a):[])}return t.concat(i,lc(i,[],r))}function Pp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jx(e){const t=jn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=si(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=ol(r)!==s||ol(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function jp(e){return Pn(e)?e:e.contextElement}function Ho(e){const t=jp(e);if(!si(t))return ni(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=Jx(t);let o=(s?ol(r.width):r.width)/n,a=(s?ol(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const KD=ni(0);function Yx(e){const t=Qr(e);return!Ip()||!t.visualViewport?KD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function XD(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Qr(e)?!1:t}function Hs(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=jp(e);let o=ni(1);t&&(n?Pn(n)&&(o=Ho(n)):o=Ho(e));const a=XD(s,r,n)?Yx(s):ni(0);let c=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,l=i.width/o.x,f=i.height/o.y;if(s){const h=Qr(s),y=n&&Pn(n)?Qr(n):n;let b=h,w=Pp(b);for(;w&&n&&y!==b;){const A=Ho(w),P=w.getBoundingClientRect(),N=jn(w),R=P.left+(w.clientLeft+parseFloat(N.paddingLeft))*A.x,U=P.top+(w.clientTop+parseFloat(N.paddingTop))*A.y;c*=A.x,u*=A.y,l*=A.x,f*=A.y,c+=R,u+=U,b=Qr(w),w=Pp(b)}}return ul({width:l,height:f,x:c,y:u})}function kp(e,t){const r=dl(e).scrollLeft;return t?t.left+r:Hs(ii(e)).left+r}function Zx(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:kp(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function JD(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=ii(n),a=t?fl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=ni(1);const l=ni(0),f=si(n);if((f||!f&&!s)&&((Wo(n)!=="body"||uc(o))&&(c=dl(n)),si(n))){const y=Hs(n);u=Ho(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?Zx(o,c,!0):ni(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+l.x+h.x,y:r.y*u.y-c.scrollTop*u.y+l.y+h.y}}function YD(e){return Array.from(e.getClientRects())}function ZD(e){const t=ii(e),r=dl(e),n=e.ownerDocument.body,i=Zr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Zr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+kp(e);const a=-r.scrollTop;return jn(n).direction==="rtl"&&(o+=Zr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function QD(e,t){const r=Qr(e),n=ii(e),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,c=0;if(i){s=i.width,o=i.height;const u=Ip();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function e$(e,t){const r=Hs(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=si(e)?Ho(e):ni(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,c=i*s.x,u=n*s.y;return{width:o,height:a,x:c,y:u}}function Qx(e,t,r){let n;if(t==="viewport")n=QD(e,r);else if(t==="document")n=ZD(ii(e));else if(Pn(t))n=e$(t,r);else{const i=Yx(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ul(n)}function e4(e,t){const r=ps(e);return r===t||!Pn(r)||Go(r)?!1:jn(r).position==="fixed"||e4(r,t)}function t$(e,t){const r=t.get(e);if(r)return r;let n=lc(e,[],!1).filter(a=>Pn(a)&&Wo(a)!=="body"),i=null;const s=jn(e).position==="fixed";let o=s?ps(e):e;for(;Pn(o)&&!Go(o);){const a=jn(o),c=Op(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||uc(o)&&!c&&e4(e,o))?n=n.filter(l=>l!==o):i=a,o=ps(o)}return t.set(e,n),n}function r$(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?fl(t)?[]:t$(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=Qx(t,l,i);return u.top=Zr(f.top,u.top),u.right=ds(f.right,u.right),u.bottom=ds(f.bottom,u.bottom),u.left=Zr(f.left,u.left),u},Qx(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function n$(e){const{width:t,height:r}=Jx(e);return{width:t,height:r}}function i$(e,t,r){const n=si(t),i=ii(t),s=r==="fixed",o=Hs(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=ni(0);if(n||!n&&!s)if((Wo(t)!=="body"||uc(i))&&(a=dl(t)),n){const h=Hs(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=kp(i));const u=i&&!n&&!s?Zx(i,a):ni(0),l=o.left+a.scrollLeft-c.x-u.x,f=o.top+a.scrollTop-c.y-u.y;return{x:l,y:f,width:o.width,height:o.height}}function Np(e){return jn(e).position==="static"}function t4(e,t){if(!si(e)||jn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ii(e)===r&&(r=r.ownerDocument.body),r}function r4(e,t){const r=Qr(e);if(fl(e))return r;if(!si(e)){let i=ps(e);for(;i&&!Go(i);){if(Pn(i)&&!Np(i))return i;i=ps(i)}return r}let n=t4(e,t);for(;n&&GD(n)&&Np(n);)n=t4(n,t);return n&&Go(n)&&Np(n)&&!Op(n)?r:n||HD(e)||r}const s$=async function(e){const t=this.getOffsetParent||r4,r=this.getDimensions,n=await r(e.floating);return{reference:i$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function o$(e){return jn(e).direction==="rtl"}const a$={convertOffsetParentRelativeRectToViewportRelativeRect:JD,getDocumentElement:ii,getClippingRect:r$,getOffsetParent:r4,getElementRects:s$,getClientRects:YD,getDimensions:n$,getScale:Ho,isElement:Pn,isRTL:o$};function c$(e,t){let r=null,n;const i=ii(e);function s(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const{left:u,top:l,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const y=al(l),b=al(i.clientWidth-(u+f)),w=al(i.clientHeight-(l+h)),A=al(u),N={rootMargin:-y+"px "+-b+"px "+-w+"px "+-A+"px",threshold:Zr(0,ds(1,c))||1};let R=!0;function U(L){const G=L[0].intersectionRatio;if(G!==c){if(!R)return o();G?o(!1,G):n=setTimeout(()=>{o(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(U,{...N,root:i.ownerDocument})}catch{r=new IntersectionObserver(U,N)}r.observe(e)}return o(!0),s}function u$(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=jp(e),l=i||s?[...u?lc(u):[],...lc(t)]:[];l.forEach(P=>{i&&P.addEventListener("scroll",r,{passive:!0}),s&&P.addEventListener("resize",r)});const f=u&&a?c$(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(P=>{let[N]=P;N&&N.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,w=c?Hs(e):null;c&&A();function A(){const P=Hs(e);w&&(P.x!==w.x||P.y!==w.y||P.width!==w.width||P.height!==w.height)&&r(),w=P,b=requestAnimationFrame(A)}return r(),()=>{var P;l.forEach(N=>{i&&N.removeEventListener("scroll",r),s&&N.removeEventListener("resize",r)}),f==null||f(),(P=y)==null||P.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const l$=zD,f$=VD,d$=LD,h$=WD,p$=UD,n4=BD,m$=qD,g$=(e,t,r)=>{const n=new Map,i={platform:a$,...r},s={...i.platform,_c:n};return $D(e,t,{...i,platform:s})};var hl=typeof document<"u"?te.useLayoutEffect:te.useEffect;function pl(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 r,n,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!pl(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&e.$$typeof)&&!pl(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function i4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s4(e,t){const r=i4(e);return Math.round(t*r)/r}function Rp(e){const t=I.useRef(e);return hl(()=>{t.current=e}),t}function v$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,f]=I.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,y]=I.useState(n);pl(h,n)||y(n);const[b,w]=I.useState(null),[A,P]=I.useState(null),N=I.useCallback(M=>{M!==G.current&&(G.current=M,w(M))},[]),R=I.useCallback(M=>{M!==q.current&&(q.current=M,P(M))},[]),U=s||b,L=o||A,G=I.useRef(null),q=I.useRef(null),X=I.useRef(l),ie=c!=null,ae=Rp(c),ce=Rp(i),V=Rp(u),D=I.useCallback(()=>{if(!G.current||!q.current)return;const M={placement:t,strategy:r,middleware:h};ce.current&&(M.platform=ce.current),g$(G.current,q.current,M).then(E=>{const O={...E,isPositioned:V.current!==!1};p.current&&!pl(X.current,O)&&(X.current=O,em.flushSync(()=>{f(O)}))})},[h,t,r,ce,V]);hl(()=>{u===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[u]);const p=I.useRef(!1);hl(()=>(p.current=!0,()=>{p.current=!1}),[]),hl(()=>{if(U&&(G.current=U),L&&(q.current=L),U&&L){if(ae.current)return ae.current(U,L,D);D()}},[U,L,D,ae,ie]);const d=I.useMemo(()=>({reference:G,floating:q,setReference:N,setFloating:R}),[N,R]),m=I.useMemo(()=>({reference:U,floating:L}),[U,L]),x=I.useMemo(()=>{const M={position:r,left:0,top:0};if(!m.floating)return M;const E=s4(m.floating,l.x),O=s4(m.floating,l.y);return a?{...M,transform:"translate("+E+"px, "+O+"px)",...i4(m.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:E,top:O}},[r,a,m.floating,l.x,l.y]);return I.useMemo(()=>({...l,update:D,refs:d,elements:m,floatingStyles:x}),[l,D,d,m,x])}const y$=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:i}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?n4({element:n.current,padding:i}).fn(r):{}:n?n4({element:n,padding:i}).fn(r):{}}}},b$=(e,t)=>({...l$(e),options:[e,t]}),w$=(e,t)=>({...f$(e),options:[e,t]}),_$=(e,t)=>({...m$(e),options:[e,t]}),x$=(e,t)=>({...d$(e),options:[e,t]}),S$=(e,t)=>({...h$(e),options:[e,t]}),E$=(e,t)=>({...p$(e),options:[e,t]}),C$=(e,t)=>({...y$(e),options:[e,t]});var M$="Arrow",o4=I.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...s}=e;return _.jsx(Gt.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:_.jsx("polygon",{points:"0,0 30,0 15,10"})})});o4.displayName=M$;var T$=o4;function A$(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,O$(i,...t)]}function O$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function Dp(e){const[t,r]=I.useState(void 0);return fs(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;r({width:o,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var $p="Popper",[a4,ml]=A$($p),[I$,c4]=a4($p),u4=e=>{const{__scopePopper:t,children:r}=e,[n,i]=I.useState(null);return _.jsx(I$,{scope:t,anchor:n,onAnchorChange:i,children:r})};u4.displayName=$p;var l4="PopperAnchor",f4=I.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=c4(l4,r),o=I.useRef(null),a=Qt(t,o);return I.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:_.jsx(Gt.div,{...i,ref:a})});f4.displayName=l4;var Bp="PopperContent",[P$,j$]=a4(Bp),d4=I.forwardRef((e,t)=>{var he,ye,Ee,Se,We,Fe;const{__scopePopper:r,side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:l=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:y="optimized",onPlaced:b,...w}=e,A=c4(Bp,r),[P,N]=I.useState(null),R=Qt(t,lt=>N(lt)),[U,L]=I.useState(null),G=Dp(U),q=(G==null?void 0:G.width)??0,X=(G==null?void 0:G.height)??0,ie=n+(s!=="center"?"-"+s:""),ae=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},ce=Array.isArray(u)?u:[u],V=ce.length>0,D={padding:ae,boundary:ce.filter(N$),altBoundary:V},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:M}=v$({strategy:"fixed",placement:ie,whileElementsMounted:(...lt)=>u$(...lt,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[b$({mainAxis:i+X,alignmentAxis:o}),c&&w$({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?_$():void 0,...D}),c&&x$({...D}),S$({...D,apply:({elements:lt,rects:ht,availableWidth:$e,availableHeight:mt})=>{const{width:_e,height:ge}=ht.reference,Ae=lt.floating.style;Ae.setProperty("--radix-popper-available-width",`${$e}px`),Ae.setProperty("--radix-popper-available-height",`${mt}px`),Ae.setProperty("--radix-popper-anchor-width",`${_e}px`),Ae.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),U&&C$({element:U,padding:a}),R$({arrowWidth:q,arrowHeight:X}),h&&E$({strategy:"referenceHidden",...D})]}),[E,O]=m4(m),C=gr(b);fs(()=>{x&&(C==null||C())},[x,C]);const g=(he=M.arrow)==null?void 0:he.x,v=(ye=M.arrow)==null?void 0:ye.y,j=((Ee=M.arrow)==null?void 0:Ee.centerOffset)!==0,[ee,se]=I.useState();return fs(()=>{P&&se(window.getComputedStyle(P).zIndex)},[P]),_.jsx("div",{ref:p.setFloating,"data-radix-popper-content-wrapper":"",style:{...d,transform:x?d.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(Se=M.transformOrigin)==null?void 0:Se.x,(We=M.transformOrigin)==null?void 0:We.y].join(" "),...((Fe=M.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:_.jsx(P$,{scope:r,placedSide:E,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:j,children:_.jsx(Gt.div,{"data-side":E,"data-align":O,...w,ref:R,style:{...w.style,animation:x?void 0:"none"}})})})});d4.displayName=Bp;var h4="PopperArrow",k$={top:"bottom",right:"left",bottom:"top",left:"right"},p4=I.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=j$(h4,n),o=k$[s.placedSide];return _.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:_.jsx(T$,{...i,ref:r,style:{...i.style,display:"block"}})})});p4.displayName=h4;function N$(e){return e!==null}var R$=e=>({name:"transformOrigin",options:e,fn(t){var A,P,N;const{placement:r,rects:n,middlewareData:i}=t,o=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=m4(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((P=i.arrow)==null?void 0:P.x)??0)+a/2,y=(((N=i.arrow)==null?void 0:N.y)??0)+c/2;let b="",w="";return u==="bottom"?(b=o?f:`${h}px`,w=`${-c}px`):u==="top"?(b=o?f:`${h}px`,w=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,w=o?f:`${y}px`):u==="left"&&(b=`${n.floating.width+c}px`,w=o?f:`${y}px`),{data:{x:b,y:w}}}});function m4(e){const[t,r="center"]=e.split("-");return[t,r]}var g4=u4,v4=f4,y4=d4,b4=p4,D$="Portal",w4=I.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=I.useState(!1);fs(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Bn.createPortal(_.jsx(Gt.div,{...n,ref:t}),o):null});w4.displayName=D$;function $$(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var kn=e=>{const{present:t,children:r}=e,n=B$(t),i=typeof r=="function"?r({present:n.isPresent}):I.Children.only(r),s=Qt(n.ref,L$(i));return typeof r=="function"||n.isPresent?I.cloneElement(i,{ref:s}):null};kn.displayName="Presence";function B$(e){const[t,r]=I.useState(),n=I.useRef({}),i=I.useRef(e),s=I.useRef("none"),o=e?"mounted":"unmounted",[a,c]=$$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const u=gl(n.current);s.current=a==="mounted"?u:"none"},[a]),fs(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=gl(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(l&&h!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),fs(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=gl(n.current).includes(y.animationName);if(y.target===t&&w&&(c("ANIMATION_END"),!i.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},h=y=>{y.target===t&&(s.current=gl(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{l.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:I.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function gl(e){return(e==null?void 0:e.animationName)||"none"}function L$(e){var n,i;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function fc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=U$({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=gr(r),c=I.useCallback(u=>{if(s){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else i(u)},[s,e,i,a]);return[o,c]}function U$({defaultProp:e,onChange:t}){const r=I.useState(e),[n]=r,i=I.useRef(n),s=gr(t);return I.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var F$="VisuallyHidden",_4=I.forwardRef((e,t)=>_.jsx(Gt.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));_4.displayName=F$;var z$=_4,[vl,UX]=zo("Tooltip",[ml]),Lp=ml(),x4="TooltipProvider",V$=700,S4="tooltip.open",[q$,E4]=vl(x4),C4=e=>{const{__scopeTooltip:t,delayDuration:r=V$,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:s}=e,[o,a]=I.useState(!0),c=I.useRef(!1),u=I.useRef(0);return I.useEffect(()=>{const l=u.current;return()=>window.clearTimeout(l)},[]),_.jsx(q$,{scope:t,isOpenDelayed:o,delayDuration:r,onOpen:I.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:I.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:I.useCallback(l=>{c.current=l},[]),disableHoverableContent:i,children:s})};C4.displayName=x4;var M4="Tooltip",[FX,yl]=vl(M4),Up="TooltipTrigger",W$=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=yl(Up,r),s=E4(Up,r),o=Lp(r),a=I.useRef(null),c=Qt(t,a,i.onTriggerChange),u=I.useRef(!1),l=I.useRef(!1),f=I.useCallback(()=>u.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),_.jsx(v4,{asChild:!0,...o,children:_.jsx(Gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:tt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:tt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:tt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:tt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:tt(e.onBlur,i.onClose),onClick:tt(e.onClick,i.onClose)})})});W$.displayName=Up;var G$="TooltipPortal",[zX,H$]=vl(G$,{forceMount:void 0}),Ko="TooltipContent",K$=I.forwardRef((e,t)=>{const r=H$(Ko,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=yl(Ko,e.__scopeTooltip);return _.jsx(kn,{present:n||o.open,children:o.disableHoverableContent?_.jsx(T4,{side:i,...s,ref:t}):_.jsx(X$,{side:i,...s,ref:t})})}),X$=I.forwardRef((e,t)=>{const r=yl(Ko,e.__scopeTooltip),n=E4(Ko,e.__scopeTooltip),i=I.useRef(null),s=Qt(t,i),[o,a]=I.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:f}=n,h=I.useCallback(()=>{a(null),f(!1)},[f]),y=I.useCallback((b,w)=>{const A=b.currentTarget,P={x:b.clientX,y:b.clientY},N=Q$(P,A.getBoundingClientRect()),R=eB(P,N),U=tB(w.getBoundingClientRect()),L=nB([...R,...U]);a(L),f(!0)},[f]);return I.useEffect(()=>()=>h(),[h]),I.useEffect(()=>{if(c&&l){const b=A=>y(A,l),w=A=>y(A,c);return c.addEventListener("pointerleave",b),l.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",b),l.removeEventListener("pointerleave",w)}}},[c,l,y,h]),I.useEffect(()=>{if(o){const b=w=>{const A=w.target,P={x:w.clientX,y:w.clientY},N=(c==null?void 0:c.contains(A))||(l==null?void 0:l.contains(A)),R=!rB(P,o);N?h():R&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),_.jsx(T4,{...e,ref:s})}),[J$,Y$]=vl(M4,{isInside:!1}),T4=I.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=yl(Ko,r),u=Lp(r),{onClose:l}=c;return I.useEffect(()=>(document.addEventListener(S4,l),()=>document.removeEventListener(S4,l)),[l]),I.useEffect(()=>{if(c.trigger){const f=h=>{const y=h.target;y!=null&&y.contains(c.trigger)&&l()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,l]),_.jsx(Sp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:_.jsxs(y4,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[_.jsx(Vo,{children:n}),_.jsx(J$,{scope:r,isInside:!0,children:_.jsx(z$,{id:c.contentId,role:"tooltip",children:i||n})})]})})});K$.displayName=Ko;var A4="TooltipArrow",Z$=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Lp(r);return Y$(A4,r).isInside?null:_.jsx(b4,{...i,...n,ref:t})});Z$.displayName=A4;function Q$(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,i,s)){case s:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function eB(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function tB(e){const{top:t,right:r,bottom:n,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:n},{x:i,y:n}]}function rB(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,c=t[s].y,u=t[o].x,l=t[o].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function nB(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),iB(t)}function iB(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const i=e[n];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const i=e[n];for(;r.length>=2;){const s=r[r.length-1],o=r[r.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))r.pop();else break}r.push(i)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var sB=C4,O4=I.createContext(void 0),oB=e=>{const{dir:t,children:r}=e;return _.jsx(O4.Provider,{value:t,children:r})};function Fp(e){const t=I.useContext(O4);return e||t||"ltr"}const aB=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],cB=["sky","mint","lime","yellow","amber"],uB=["gold","bronze"],lB=[...aB,...cB,...uB],fB=["gray",...["mauve","slate","sage","olive","sand"]];function dB(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand"}}const hB=["inherit","light","dark"],pB=[...lB,"gray"],mB=[...fB,"auto"],Lr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:hB,default:"inherit"},accentColor:{type:"enum",values:pB,default:"indigo"},grayColor:{type:"enum",values:mB,default:"auto"},panelBackground:{type:"enum",values:["solid","translucent"],default:"translucent"},radius:{type:"enum",values:["none","small","medium","large","full"],default:"medium"},scaling:{type:"enum",values:["90%","95%","100%","105%","110%"],default:"100%"}};function I4(e){return e==="gray"?"gray":dB(e)}const Xo=()=>{},bl=I.createContext(void 0);function gB(){const e=I.useContext(bl);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const wl=I.forwardRef((e,t)=>I.useContext(bl)===void 0?I.createElement(sB,null,I.createElement(oB,{dir:"ltr"},I.createElement(P4,{...e,ref:t}))):I.createElement(zp,{...e,ref:t}));wl.displayName="Theme";const P4=I.forwardRef((e,t)=>{const{appearance:r=Lr.appearance.default,accentColor:n=Lr.accentColor.default,grayColor:i=Lr.grayColor.default,panelBackground:s=Lr.panelBackground.default,radius:o=Lr.radius.default,scaling:a=Lr.scaling.default,hasBackground:c=Lr.hasBackground.default,...u}=e,[l,f]=I.useState(r);I.useEffect(()=>f(r),[r]);const[h,y]=I.useState(n);I.useEffect(()=>y(n),[n]);const[b,w]=I.useState(i);I.useEffect(()=>w(i),[i]);const[A,P]=I.useState(s);I.useEffect(()=>P(s),[s]);const[N,R]=I.useState(o);I.useEffect(()=>R(o),[o]);const[U,L]=I.useState(a);I.useEffect(()=>L(a),[a]);const G=I.memo(({appearance:X})=>I.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${X}';c.add('${X}');}catch(e){}})();`}}),()=>!0);G.displayName="ExplicitRootAppearanceScript",I.useEffect(()=>vB(r),[r]);const q=b==="auto"?I4(h):b;return I.createElement(I.Fragment,null,l!=="inherit"&&I.createElement(G,{appearance:l}),c&&I.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
54
54
|
:root, .light, .light-theme { --color-page-background: white; }
|
|
55
55
|
.dark, .dark-theme { --color-page-background: var(--${q}-1); }
|
|
56
56
|
body { background-color: var(--color-page-background); }
|
|
57
|
-
`}}),I.createElement(zp,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:A,radius:R,scaling:F,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:P,onRadiusChange:N,onScalingChange:L}))});P4.displayName="ThemeRoot";const zp=I.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=I.useContext(bl),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:$r.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:$r.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:$r.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:$r.panelBackground.default,radius:A=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:$r.radius.default,scaling:P=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:$r.scaling.default,onAppearanceChange:R=Xo,onAccentColorChange:N=Xo,onGrayColorChange:F=Xo,onPanelBackgroundChange:L=Xo,onRadiusChange:G=Xo,onScalingChange:q=Xo,...X}=e,ie=u?Ri:"div",ae=b==="auto"?I4(y):b,ce=e.appearance!==void 0&&e.appearance!=="inherit",V=e.grayColor!==void 0,D=!l&&(f===!0||f!==!1&&(ce||V));return I.createElement(bl.Provider,{value:I.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:ae,panelBackground:w,radius:A,scaling:P,onAppearanceChange:R,onAccentColorChange:N,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:G,onScalingChange:q}),[h,y,b,ae,w,A,P,R,N,F,L,G,q])},I.createElement(ie,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ae,"data-has-background":D?"true":"false","data-panel-background":w,"data-radius":A,"data-scaling":P,ref:t,...X,className:Kt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},X.className)}))});zp.displayName="ThemeImpl";function bB(e){if(e==="inherit")return;const t=document.documentElement;(t.classList.contains("light-theme")||t.classList.contains("dark-theme"))&&(t.classList.remove("light-theme","dark-theme"),t.style.colorScheme=e,t.classList.add(`${e}-theme`)),(t.classList.contains("light")||t.classList.contains("dark"))&&(t.classList.remove("light","dark"),t.style.colorScheme=e,t.classList.add(e))}const fc={type:"enum",values:$r.accentColor.values,default:void 0},_l={type:"boolean",default:void 0};function bt(e,t="",r){var n,i,s,o;const a=[];if(typeof e=="object"){for(const c of Object.keys(e))if(c in e){const u=(n=e[c])===null||n===void 0?void 0:n.toString(),l=u==null?void 0:u.startsWith("-"),f=t===""?"":"-",h=l?`-${t}`:t,y=l?u==null?void 0:u.substring(1):u;if(y===void 0)continue;const b=(i=r==null?void 0:r[y])!==null&&i!==void 0?i:y,w=c==="initial"?`${h}${f}${b}`:`${c}:${h}${f}${b}`;a.push(w)}}if(typeof e=="string"){const c=e.startsWith("-"),u=t===""?"":"-",l=c?`-${t}`:t,f=c?e.substring(1):e,h=(s=r==null?void 0:r[f])!==null&&s!==void 0?s:f;a.push(`${l}${u}${h}`)}if(typeof e=="boolean"){const c=t===""?"":"-",u=e.toString(),l=(o=r==null?void 0:r[u])!==null&&o!==void 0?o:u;a.push(`${t}${c}${l}`)}return a.join(" ")}const Ks=["0","1","2","3","4","5","6","7","8","9"],wB={p:{type:"enum",values:Ks,default:void 0,responsive:!0},px:{type:"enum",values:Ks,default:void 0,responsive:!0},py:{type:"enum",values:Ks,default:void 0,responsive:!0},pt:{type:"enum",values:Ks,default:void 0,responsive:!0},pr:{type:"enum",values:Ks,default:void 0,responsive:!0},pb:{type:"enum",values:Ks,default:void 0,responsive:!0},pl:{type:"enum",values:Ks,default:void 0,responsive:!0}};function _B(e){const{p:t=_r.p.default,px:r=_r.px.default,py:n=_r.py.default,pt:i=_r.pt.default,pr:s=_r.pr.default,pb:o=_r.pb.default,pl:a=_r.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function xB(e){return[bt(e.p,"rt-r-p"),bt(e.px,"rt-r-px"),bt(e.py,"rt-r-py"),bt(e.pt,"rt-r-pt"),bt(e.pr,"rt-r-pr"),bt(e.pb,"rt-r-pb"),bt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const SB=["static","relative","absolute","fixed","sticky"],dc=["auto","0","50%","100%"],k4=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],_r={...wB,position:{type:"enum",values:SB,default:void 0,responsive:!0},inset:{type:"enum",values:dc,default:void 0,responsive:!0},top:{type:"enum",values:dc,default:void 0,responsive:!0},right:{type:"enum",values:dc,default:void 0,responsive:!0},bottom:{type:"enum",values:dc,default:void 0,responsive:!0},left:{type:"enum",values:dc,default:void 0,responsive:!0},width:{type:"enum",values:k4,default:void 0,responsive:!0},height:{type:"enum",values:k4,default:void 0,responsive:!0},shrink:{type:"enum",values:["0","1"],default:void 0,responsive:!0},grow:{type:"enum",values:["0","1"],default:void 0,responsive:!0}};function EB(e){const{rest:t,...r}=_B(e),{position:n=_r.position.default,width:i=_r.width.default,height:s=_r.height.default,inset:o=_r.inset.default,top:a=_r.top.default,bottom:c=_r.bottom.default,left:u=_r.left.default,right:l=_r.right.default,shrink:f=_r.shrink.default,grow:h=_r.grow.default,...y}=t;return{...r,position:n,width:i,height:s,inset:o,top:a,bottom:c,left:u,right:l,shrink:f,grow:h,rest:y}}function CB(e){return[xB(e),bt(e.position,"rt-r-position"),bt(e.shrink,"rt-r-fs"),bt(e.grow,"rt-r-fg"),bt(e.width,"rt-r-w"),bt(e.height,"rt-r-h"),bt(e.inset,"rt-r-inset"),bt(e.top,"rt-r-top"),bt(e.bottom,"rt-r-bottom"),bt(e.left,"rt-r-left"),bt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Xs=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Js={m:{type:"enum",values:Xs,default:void 0,responsive:!0},mx:{type:"enum",values:Xs,default:void 0,responsive:!0},my:{type:"enum",values:Xs,default:void 0,responsive:!0},mt:{type:"enum",values:Xs,default:void 0,responsive:!0},mr:{type:"enum",values:Xs,default:void 0,responsive:!0},mb:{type:"enum",values:Xs,default:void 0,responsive:!0},ml:{type:"enum",values:Xs,default:void 0,responsive:!0}};function Jo(e){const{m:t=Js.m.default,mx:r=Js.mx.default,my:n=Js.my.default,mt:i=Js.mt.default,mr:s=Js.mr.default,mb:o=Js.mb.default,ml:a=Js.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function Yo(e){return[bt(e.m,"rt-r-m"),bt(e.mx,"rt-r-mx"),bt(e.my,"rt-r-my"),bt(e.mt,"rt-r-mt"),bt(e.mr,"rt-r-mr"),bt(e.mb,"rt-r-mb"),bt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const Vp={type:"enum",values:$r.radius.values,default:void 0},Zo={display:{type:"enum",values:["none","inline-flex","flex"],default:"flex",responsive:!0},direction:{type:"enum",values:["row","column","row-reverse","column-reverse"],default:void 0,responsive:!0},align:{type:"enum",values:["start","center","end","baseline","stretch"],default:void 0,responsive:!0},justify:{type:"enum",values:["start","center","end","between"],default:"start",responsive:!0},wrap:{type:"enum",values:["nowrap","wrap","wrap-reverse"],default:void 0,responsive:!0},gap:{type:"enum",values:["0","1","2","3","4","5","6","7","8","9"],default:void 0,responsive:!0}},j4=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{rest:i,...s}=EB(r),{className:o,asChild:a,display:c=Zo.display.default,direction:u=Zo.direction.default,align:l=Zo.align.default,justify:f=Zo.justify.default,wrap:h=Zo.wrap.default,gap:y=Zo.gap.default,...b}=i,w=a?Ri:"div";return I.createElement(w,{...b,ref:t,className:Kt("rt-Flex",o,bt(c,"rt-r-display"),bt(u,"rt-r-fd"),bt(l,"rt-r-ai"),bt(f,"rt-r-jc",{between:"space-between"}),bt(h,"rt-r-fw"),bt(y,"rt-r-gap"),CB(s),Yo(n))})});j4.displayName="Flex";function R4(e){const t=I.useRef({value:e,previous:e});return I.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var qp="Checkbox",[TB,iJ]=zo(qp),[MB,AB]=TB(qp),N4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,F=>y(F)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,R]=lc({prop:i,defaultProp:s,onChange:u}),N=I.useRef(P);return I.useEffect(()=>{const F=h==null?void 0:h.form;if(F){const L=()=>R(N.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[h,R]),_.jsxs(MB,{scope:r,state:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":ps(P)?"mixed":P,"aria-required":o,"data-state":B4(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:tt(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:tt(e.onClick,F=>{R(L=>ps(L)?!0:!L),A&&(w.current=F.isPropagationStopped(),w.current||F.stopPropagation())})}),A&&_.jsx(OB,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:ps(s)?!1:s})]})});N4.displayName=qp;var D4="CheckboxIndicator",$4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=AB(D4,r);return _.jsx(jn,{present:n||ps(s.state)||s.state===!0,children:_.jsx(Gt.span,{"data-state":B4(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});$4.displayName=D4;var OB=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=I.useRef(null),a=R4(r),c=Dp(t);I.useEffect(()=>{const l=o.current,f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==r&&y){const b=new Event("click",{bubbles:n});l.indeterminate=ps(r),y.call(l,ps(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=I.useRef(ps(r)?!1:r);return _.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...s,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ps(e){return e==="indeterminate"}function B4(e){return ps(e)?"indeterminate":e?"checked":"unchecked"}var IB=N4,PB=$4;const xl={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:fc,highContrast:_l},Sl=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));Sl.displayName="ThickCheckIcon";const kB=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));kB.displayName="ChevronDownIcon";const L4=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));L4.displayName="ThickChevronRightIcon";const jB=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:e,fillRule:"evenodd",clipRule:"evenodd"})));jB.displayName="InfoCircledIcon";const El=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,style:s,size:o=xl.size.default,variant:a=xl.variant.default,color:c=xl.color.default,highContrast:u=xl.highContrast.default,...l}=r;return I.createElement("span",{className:Kt("rt-CheckboxRoot",i,bt(o,"rt-r-size"),Yo(n)),style:s},I.createElement(IB,{"data-accent-color":c,...l,ref:t,className:Kt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},I.createElement(PB,{className:"rt-CheckboxIndicator"},I.createElement(Sl,{className:"rt-CheckboxIndicatorIcon"}))))});El.displayName="Checkbox";function RB(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,NB(i,...t)]}function NB(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function F4(e){const t=e+"CollectionProvider",[r,n]=RB(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,A=te.useRef(null),P=te.useRef(new Map).current;return _.jsx(i,{scope:b,itemMap:P,collectionRef:A,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=te.forwardRef((y,b)=>{const{scope:w,children:A}=y,P=s(a,w),R=Qt(b,P.collectionRef);return _.jsx(Ri,{ref:R,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=te.forwardRef((y,b)=>{const{scope:w,children:A,...P}=y,R=te.useRef(null),N=Qt(b,R),F=s(u,w);return te.useEffect(()=>(F.itemMap.set(R,{ref:R,...P}),()=>void F.itemMap.delete(R))),_.jsx(Ri,{[l]:"",ref:N,children:A})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return te.useCallback(()=>{const A=b.collectionRef.current;if(!A)return[];const P=Array.from(A.querySelectorAll(`[${l}]`));return Array.from(b.itemMap.values()).sort((F,L)=>P.indexOf(F.ref.current)-P.indexOf(L.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,n]}function DB(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,$B(i,...t)]}function $B(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Wp="rovingFocusGroup.onEntryFocus",BB={bubbles:!1,cancelable:!0},Cl="RovingFocusGroup",[Gp,U4,LB]=F4(Cl),[FB,z4]=DB(Cl,[LB]),[UB,zB]=FB(Cl),V4=I.forwardRef((e,t)=>_.jsx(Gp.Provider,{scope:e.__scopeRovingFocusGroup,children:_.jsx(Gp.Slot,{scope:e.__scopeRovingFocusGroup,children:_.jsx(VB,{...e,ref:t})})}));V4.displayName=Cl;var VB=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:l=!1,...f}=e,h=I.useRef(null),y=Qt(t,h),b=Up(s),[w=null,A]=lc({prop:o,defaultProp:a,onChange:c}),[P,R]=I.useState(!1),N=gr(u),F=U4(r),L=I.useRef(!1),[G,q]=I.useState(0);return I.useEffect(()=>{const X=h.current;if(X)return X.addEventListener(Wp,N),()=>X.removeEventListener(Wp,N)},[N]),_.jsx(UB,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:w,onItemFocus:I.useCallback(X=>A(X),[A]),onItemShiftTab:I.useCallback(()=>R(!0),[]),onFocusableItemAdd:I.useCallback(()=>q(X=>X+1),[]),onFocusableItemRemove:I.useCallback(()=>q(X=>X-1),[]),children:_.jsx(Gt.div,{tabIndex:P||G===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:tt(e.onMouseDown,()=>{L.current=!0}),onFocus:tt(e.onFocus,X=>{const ie=!L.current;if(X.target===X.currentTarget&&ie&&!P){const ae=new CustomEvent(Wp,BB);if(X.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const ce=F().filter(m=>m.focusable),V=ce.find(m=>m.active),D=ce.find(m=>m.id===w),d=[V,D,...ce].filter(Boolean).map(m=>m.ref.current);G4(d,l)}}L.current=!1}),onBlur:tt(e.onBlur,()=>R(!1))})})}),q4="RovingFocusGroupItem",W4=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=oc(),c=s||a,u=zB(q4,r),l=u.currentTabStopId===c,f=U4(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return I.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),_.jsx(Gp.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:_.jsx(Gt.span,{tabIndex:l?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:tt(e.onMouseDown,b=>{n?u.onItemFocus(c):b.preventDefault()}),onFocus:tt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:tt(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=GB(b,u.orientation,u.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let P=f().filter(R=>R.focusable).map(R=>R.ref.current);if(w==="last")P.reverse();else if(w==="prev"||w==="next"){w==="prev"&&P.reverse();const R=P.indexOf(b.currentTarget);P=u.loop?HB(P,R+1):P.slice(R+1)}setTimeout(()=>G4(P))}})})})});W4.displayName=q4;var qB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function GB(e,t,r){const n=WB(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return qB[n]}function G4(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function HB(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var KB=V4,XB=W4;function JB(e,[t,r]){return Math.min(r,Math.max(t,e))}var Hp=0;function YB(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??H4()),document.body.insertAdjacentElement("beforeend",e[1]??H4()),Hp++,()=>{Hp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Hp--}},[])}function H4(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Kp="focusScope.autoFocusOnMount",Xp="focusScope.autoFocusOnUnmount",K4={bubbles:!1,cancelable:!0},ZB="FocusScope",X4=I.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=I.useState(null),u=gr(i),l=gr(s),f=I.useRef(null),h=Qt(t,w=>c(w)),y=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(n){let w=function(N){if(y.paused||!a)return;const F=N.target;a.contains(F)?f.current=F:ms(f.current,{select:!0})},A=function(N){if(y.paused||!a)return;const F=N.relatedTarget;F!==null&&(a.contains(F)||ms(f.current,{select:!0}))},P=function(N){if(document.activeElement===document.body)for(const L of N)L.removedNodes.length>0&&ms(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",A);const R=new MutationObserver(P);return a&&R.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",A),R.disconnect()}}},[n,a,y.paused]),I.useEffect(()=>{if(a){Z4.add(y);const w=document.activeElement;if(!a.contains(w)){const P=new CustomEvent(Kp,K4);a.addEventListener(Kp,u),a.dispatchEvent(P),P.defaultPrevented||(QB(iL(J4(a)),{select:!0}),document.activeElement===w&&ms(a))}return()=>{a.removeEventListener(Kp,u),setTimeout(()=>{const P=new CustomEvent(Xp,K4);a.addEventListener(Xp,l),a.dispatchEvent(P),P.defaultPrevented||ms(w??document.body,{select:!0}),a.removeEventListener(Xp,l),Z4.remove(y)},0)}}},[a,u,l,y]);const b=I.useCallback(w=>{if(!r&&!n||y.paused)return;const A=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,P=document.activeElement;if(A&&P){const R=w.currentTarget,[N,F]=eL(R);N&&F?!w.shiftKey&&P===F?(w.preventDefault(),r&&ms(N,{select:!0})):w.shiftKey&&P===N&&(w.preventDefault(),r&&ms(F,{select:!0})):P===R&&w.preventDefault()}},[r,n,y.paused]);return _.jsx(Gt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});X4.displayName=ZB;function QB(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ms(n,{select:t}),document.activeElement!==r)return}function eL(e){const t=J4(e),r=Y4(t,e),n=Y4(t.reverse(),e);return[r,n]}function J4(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Y4(e,t){for(const r of e)if(!tL(r,{upTo:t}))return r}function tL(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rL(e){return e instanceof HTMLInputElement&&"select"in e}function ms(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&rL(e)&&t&&e.select()}}var Z4=nL();function nL(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Q4(e,t),e.unshift(t)},remove(t){var r;e=Q4(e,t),(r=e[0])==null||r.resume()}}}function Q4(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function iL(e){return e.filter(t=>t.tagName!=="A")}var sL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Qo=new WeakMap,Tl=new WeakMap,Ml={},Jp=0,e6=function(e){return e&&(e.host||e6(e.parentNode))},oL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=e6(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},aL=function(e,t,r,n){var i=oL(t,Array.isArray(e)?e:[e]);Ml[r]||(Ml[r]=new WeakMap);var s=Ml[r],o=[],a=new Set,c=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var l=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))l(h);else try{var y=h.getAttribute(n),b=y!==null&&y!=="false",w=(Qo.get(h)||0)+1,A=(s.get(h)||0)+1;Qo.set(h,w),s.set(h,A),o.push(h),w===1&&b&&Tl.set(h,!0),A===1&&h.setAttribute(r,"true"),b||h.setAttribute(n,"true")}catch(P){console.error("aria-hidden: cannot operate on ",h,P)}})};return l(t),a.clear(),Jp++,function(){o.forEach(function(f){var h=Qo.get(f)-1,y=s.get(f)-1;Qo.set(f,h),s.set(f,y),h||(Tl.has(f)||f.removeAttribute(n),Tl.delete(f)),y||f.removeAttribute(r)}),Jp--,Jp||(Qo=new WeakMap,Qo=new WeakMap,Tl=new WeakMap,Ml={})}},cL=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||sL(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),aL(n,i,r,"aria-hidden")):function(){return null}},oi=function(){return oi=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},oi.apply(this,arguments)};function t6(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function uL(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Al="right-scroll-bar-position",Ol="width-before-scroll-bar",lL="with-scroll-bars-hidden",fL="--removed-body-scroll-bar-size";function Yp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function dL(e,t){var r=te.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var hL=typeof window<"u"?I.useLayoutEffect:I.useEffect,r6=new WeakMap;function pL(e,t){var r=dL(t||null,function(n){return e.forEach(function(i){return Yp(i,n)})});return hL(function(){var n=r6.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||Yp(a,null)}),s.forEach(function(a){i.has(a)||Yp(a,o)})}r6.set(r,e)},[e]),r}function mL(e){return e}function gL(e,t){t===void 0&&(t=mL);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var o=t(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var c=function(){var l=o;o=[],l.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(l){o.push(l),u()},filter:function(l){return o=o.filter(l),r}}}};return i}function vL(e){e===void 0&&(e={});var t=gL(null);return t.options=oi({async:!0,ssr:!1},e),t}var n6=function(e){var t=e.sideCar,r=t6(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return I.createElement(n,oi({},r))};n6.isSideCarExport=!0;function yL(e,t){return e.useMedium(t),n6}var i6=vL(),Zp=function(){},Il=I.forwardRef(function(e,t){var r=I.useRef(null),n=I.useState({onScrollCapture:Zp,onWheelCapture:Zp,onTouchMoveCapture:Zp}),i=n[0],s=n[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,l=e.enabled,f=e.shards,h=e.sideCar,y=e.noIsolation,b=e.inert,w=e.allowPinchZoom,A=e.as,P=A===void 0?"div":A,R=e.gapMode,N=t6(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=h,L=pL([r,t]),G=oi(oi({},N),i);return I.createElement(I.Fragment,null,l&&I.createElement(F,{sideCar:i6,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:R}),o?I.cloneElement(I.Children.only(a),oi(oi({},G),{ref:L})):I.createElement(P,oi({},G,{className:c,ref:L}),a))});Il.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Il.classNames={fullWidth:Ol,zeroRight:Al};var s6,bL=function(){if(s6)return s6;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function wL(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=bL();return t&&e.setAttribute("nonce",t),e}function _L(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xL(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var SL=function(){var e=0,t=null;return{add:function(r){e==0&&(t=wL())&&(_L(t,r),xL(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},EL=function(){var e=SL();return function(t,r){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},o6=function(){var e=EL(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},CL={left:0,top:0,right:0,gap:0},Qp=function(e){return parseInt(e||"",10)||0},TL=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Qp(r),Qp(n),Qp(i)]},ML=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return CL;var t=TL(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},AL=o6(),ea="data-scroll-locked",OL=function(e,t,r,n){var i=e.left,s=e.top,o=e.right,a=e.gap;return r===void 0&&(r="margin"),`
|
|
58
|
-
.`.concat(
|
|
57
|
+
`}}),I.createElement(zp,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:A,radius:N,scaling:U,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:P,onRadiusChange:R,onScalingChange:L}))});P4.displayName="ThemeRoot";const zp=I.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=I.useContext(bl),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:Lr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:Lr.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:Lr.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:Lr.panelBackground.default,radius:A=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:Lr.radius.default,scaling:P=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:Lr.scaling.default,onAppearanceChange:N=Xo,onAccentColorChange:R=Xo,onGrayColorChange:U=Xo,onPanelBackgroundChange:L=Xo,onRadiusChange:G=Xo,onScalingChange:q=Xo,...X}=e,ie=u?Ri:"div",ae=b==="auto"?I4(y):b,ce=e.appearance!==void 0&&e.appearance!=="inherit",V=e.grayColor!==void 0,D=!l&&(f===!0||f!==!1&&(ce||V));return I.createElement(bl.Provider,{value:I.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:ae,panelBackground:w,radius:A,scaling:P,onAppearanceChange:N,onAccentColorChange:R,onGrayColorChange:U,onPanelBackgroundChange:L,onRadiusChange:G,onScalingChange:q}),[h,y,b,ae,w,A,P,N,R,U,L,G,q])},I.createElement(ie,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ae,"data-has-background":D?"true":"false","data-panel-background":w,"data-radius":A,"data-scaling":P,ref:t,...X,className:Kt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},X.className)}))});zp.displayName="ThemeImpl";function vB(e){if(e==="inherit")return;const t=document.documentElement;(t.classList.contains("light-theme")||t.classList.contains("dark-theme"))&&(t.classList.remove("light-theme","dark-theme"),t.style.colorScheme=e,t.classList.add(`${e}-theme`)),(t.classList.contains("light")||t.classList.contains("dark"))&&(t.classList.remove("light","dark"),t.style.colorScheme=e,t.classList.add(e))}const dc={type:"enum",values:Lr.accentColor.values,default:void 0},_l={type:"boolean",default:void 0};function bt(e,t="",r){var n,i,s,o;const a=[];if(typeof e=="object"){for(const c of Object.keys(e))if(c in e){const u=(n=e[c])===null||n===void 0?void 0:n.toString(),l=u==null?void 0:u.startsWith("-"),f=t===""?"":"-",h=l?`-${t}`:t,y=l?u==null?void 0:u.substring(1):u;if(y===void 0)continue;const b=(i=r==null?void 0:r[y])!==null&&i!==void 0?i:y,w=c==="initial"?`${h}${f}${b}`:`${c}:${h}${f}${b}`;a.push(w)}}if(typeof e=="string"){const c=e.startsWith("-"),u=t===""?"":"-",l=c?`-${t}`:t,f=c?e.substring(1):e,h=(s=r==null?void 0:r[f])!==null&&s!==void 0?s:f;a.push(`${l}${u}${h}`)}if(typeof e=="boolean"){const c=t===""?"":"-",u=e.toString(),l=(o=r==null?void 0:r[u])!==null&&o!==void 0?o:u;a.push(`${t}${c}${l}`)}return a.join(" ")}const Ks=["0","1","2","3","4","5","6","7","8","9"],yB={p:{type:"enum",values:Ks,default:void 0,responsive:!0},px:{type:"enum",values:Ks,default:void 0,responsive:!0},py:{type:"enum",values:Ks,default:void 0,responsive:!0},pt:{type:"enum",values:Ks,default:void 0,responsive:!0},pr:{type:"enum",values:Ks,default:void 0,responsive:!0},pb:{type:"enum",values:Ks,default:void 0,responsive:!0},pl:{type:"enum",values:Ks,default:void 0,responsive:!0}};function bB(e){const{p:t=_r.p.default,px:r=_r.px.default,py:n=_r.py.default,pt:i=_r.pt.default,pr:s=_r.pr.default,pb:o=_r.pb.default,pl:a=_r.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function wB(e){return[bt(e.p,"rt-r-p"),bt(e.px,"rt-r-px"),bt(e.py,"rt-r-py"),bt(e.pt,"rt-r-pt"),bt(e.pr,"rt-r-pr"),bt(e.pb,"rt-r-pb"),bt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const _B=["static","relative","absolute","fixed","sticky"],hc=["auto","0","50%","100%"],j4=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],_r={...yB,position:{type:"enum",values:_B,default:void 0,responsive:!0},inset:{type:"enum",values:hc,default:void 0,responsive:!0},top:{type:"enum",values:hc,default:void 0,responsive:!0},right:{type:"enum",values:hc,default:void 0,responsive:!0},bottom:{type:"enum",values:hc,default:void 0,responsive:!0},left:{type:"enum",values:hc,default:void 0,responsive:!0},width:{type:"enum",values:j4,default:void 0,responsive:!0},height:{type:"enum",values:j4,default:void 0,responsive:!0},shrink:{type:"enum",values:["0","1"],default:void 0,responsive:!0},grow:{type:"enum",values:["0","1"],default:void 0,responsive:!0}};function xB(e){const{rest:t,...r}=bB(e),{position:n=_r.position.default,width:i=_r.width.default,height:s=_r.height.default,inset:o=_r.inset.default,top:a=_r.top.default,bottom:c=_r.bottom.default,left:u=_r.left.default,right:l=_r.right.default,shrink:f=_r.shrink.default,grow:h=_r.grow.default,...y}=t;return{...r,position:n,width:i,height:s,inset:o,top:a,bottom:c,left:u,right:l,shrink:f,grow:h,rest:y}}function SB(e){return[wB(e),bt(e.position,"rt-r-position"),bt(e.shrink,"rt-r-fs"),bt(e.grow,"rt-r-fg"),bt(e.width,"rt-r-w"),bt(e.height,"rt-r-h"),bt(e.inset,"rt-r-inset"),bt(e.top,"rt-r-top"),bt(e.bottom,"rt-r-bottom"),bt(e.left,"rt-r-left"),bt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const Xs=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Js={m:{type:"enum",values:Xs,default:void 0,responsive:!0},mx:{type:"enum",values:Xs,default:void 0,responsive:!0},my:{type:"enum",values:Xs,default:void 0,responsive:!0},mt:{type:"enum",values:Xs,default:void 0,responsive:!0},mr:{type:"enum",values:Xs,default:void 0,responsive:!0},mb:{type:"enum",values:Xs,default:void 0,responsive:!0},ml:{type:"enum",values:Xs,default:void 0,responsive:!0}};function Jo(e){const{m:t=Js.m.default,mx:r=Js.mx.default,my:n=Js.my.default,mt:i=Js.mt.default,mr:s=Js.mr.default,mb:o=Js.mb.default,ml:a=Js.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function Yo(e){return[bt(e.m,"rt-r-m"),bt(e.mx,"rt-r-mx"),bt(e.my,"rt-r-my"),bt(e.mt,"rt-r-mt"),bt(e.mr,"rt-r-mr"),bt(e.mb,"rt-r-mb"),bt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const Vp={type:"enum",values:Lr.radius.values,default:void 0},Zo={display:{type:"enum",values:["none","inline-flex","flex"],default:"flex",responsive:!0},direction:{type:"enum",values:["row","column","row-reverse","column-reverse"],default:void 0,responsive:!0},align:{type:"enum",values:["start","center","end","baseline","stretch"],default:void 0,responsive:!0},justify:{type:"enum",values:["start","center","end","between"],default:"start",responsive:!0},wrap:{type:"enum",values:["nowrap","wrap","wrap-reverse"],default:void 0,responsive:!0},gap:{type:"enum",values:["0","1","2","3","4","5","6","7","8","9"],default:void 0,responsive:!0}},k4=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{rest:i,...s}=xB(r),{className:o,asChild:a,display:c=Zo.display.default,direction:u=Zo.direction.default,align:l=Zo.align.default,justify:f=Zo.justify.default,wrap:h=Zo.wrap.default,gap:y=Zo.gap.default,...b}=i,w=a?Ri:"div";return I.createElement(w,{...b,ref:t,className:Kt("rt-Flex",o,bt(c,"rt-r-display"),bt(u,"rt-r-fd"),bt(l,"rt-r-ai"),bt(f,"rt-r-jc",{between:"space-between"}),bt(h,"rt-r-fw"),bt(y,"rt-r-gap"),SB(s),Yo(n))})});k4.displayName="Flex";function N4(e){const t=I.useRef({value:e,previous:e});return I.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var qp="Checkbox",[EB,rJ]=zo(qp),[CB,MB]=EB(qp),R4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,U=>y(U)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,N]=fc({prop:i,defaultProp:s,onChange:u}),R=I.useRef(P);return I.useEffect(()=>{const U=h==null?void 0:h.form;if(U){const L=()=>N(R.current);return U.addEventListener("reset",L),()=>U.removeEventListener("reset",L)}},[h,N]),_.jsxs(CB,{scope:r,state:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":ms(P)?"mixed":P,"aria-required":o,"data-state":B4(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:tt(e.onKeyDown,U=>{U.key==="Enter"&&U.preventDefault()}),onClick:tt(e.onClick,U=>{N(L=>ms(L)?!0:!L),A&&(w.current=U.isPropagationStopped(),w.current||U.stopPropagation())})}),A&&_.jsx(TB,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:ms(s)?!1:s})]})});R4.displayName=qp;var D4="CheckboxIndicator",$4=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=MB(D4,r);return _.jsx(kn,{present:n||ms(s.state)||s.state===!0,children:_.jsx(Gt.span,{"data-state":B4(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});$4.displayName=D4;var TB=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=I.useRef(null),a=N4(r),c=Dp(t);I.useEffect(()=>{const l=o.current,f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==r&&y){const b=new Event("click",{bubbles:n});l.indeterminate=ms(r),y.call(l,ms(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=I.useRef(ms(r)?!1:r);return _.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...s,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ms(e){return e==="indeterminate"}function B4(e){return ms(e)?"indeterminate":e?"checked":"unchecked"}var AB=R4,OB=$4;const xl={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:dc,highContrast:_l},Sl=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));Sl.displayName="ThickCheckIcon";const IB=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));IB.displayName="ChevronDownIcon";const L4=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));L4.displayName="ThickChevronRightIcon";const PB=I.forwardRef(({color:e="currentColor",...t},r)=>I.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,ref:r},I.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:e,fillRule:"evenodd",clipRule:"evenodd"})));PB.displayName="InfoCircledIcon";const El=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,style:s,size:o=xl.size.default,variant:a=xl.variant.default,color:c=xl.color.default,highContrast:u=xl.highContrast.default,...l}=r;return I.createElement("span",{className:Kt("rt-CheckboxRoot",i,bt(o,"rt-r-size"),Yo(n)),style:s},I.createElement(AB,{"data-accent-color":c,...l,ref:t,className:Kt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},I.createElement(OB,{className:"rt-CheckboxIndicator"},I.createElement(Sl,{className:"rt-CheckboxIndicatorIcon"}))))});El.displayName="Checkbox";function jB(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,kB(i,...t)]}function kB(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function U4(e){const t=e+"CollectionProvider",[r,n]=jB(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,A=te.useRef(null),P=te.useRef(new Map).current;return _.jsx(i,{scope:b,itemMap:P,collectionRef:A,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=te.forwardRef((y,b)=>{const{scope:w,children:A}=y,P=s(a,w),N=Qt(b,P.collectionRef);return _.jsx(Ri,{ref:N,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=te.forwardRef((y,b)=>{const{scope:w,children:A,...P}=y,N=te.useRef(null),R=Qt(b,N),U=s(u,w);return te.useEffect(()=>(U.itemMap.set(N,{ref:N,...P}),()=>void U.itemMap.delete(N))),_.jsx(Ri,{[l]:"",ref:R,children:A})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return te.useCallback(()=>{const A=b.collectionRef.current;if(!A)return[];const P=Array.from(A.querySelectorAll(`[${l}]`));return Array.from(b.itemMap.values()).sort((U,L)=>P.indexOf(U.ref.current)-P.indexOf(L.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,n]}function NB(e,t=[]){let r=[];function n(s,o){const a=I.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,...b}=f,w=(h==null?void 0:h[e][c])||a,A=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,b=I.useContext(y);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,l]}const i=()=>{const s=r.map(o=>I.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,RB(i,...t)]}function RB(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var Wp="rovingFocusGroup.onEntryFocus",DB={bubbles:!1,cancelable:!0},Cl="RovingFocusGroup",[Gp,F4,$B]=U4(Cl),[BB,z4]=NB(Cl,[$B]),[LB,UB]=BB(Cl),V4=I.forwardRef((e,t)=>_.jsx(Gp.Provider,{scope:e.__scopeRovingFocusGroup,children:_.jsx(Gp.Slot,{scope:e.__scopeRovingFocusGroup,children:_.jsx(FB,{...e,ref:t})})}));V4.displayName=Cl;var FB=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:l=!1,...f}=e,h=I.useRef(null),y=Qt(t,h),b=Fp(s),[w=null,A]=fc({prop:o,defaultProp:a,onChange:c}),[P,N]=I.useState(!1),R=gr(u),U=F4(r),L=I.useRef(!1),[G,q]=I.useState(0);return I.useEffect(()=>{const X=h.current;if(X)return X.addEventListener(Wp,R),()=>X.removeEventListener(Wp,R)},[R]),_.jsx(LB,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:w,onItemFocus:I.useCallback(X=>A(X),[A]),onItemShiftTab:I.useCallback(()=>N(!0),[]),onFocusableItemAdd:I.useCallback(()=>q(X=>X+1),[]),onFocusableItemRemove:I.useCallback(()=>q(X=>X-1),[]),children:_.jsx(Gt.div,{tabIndex:P||G===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:tt(e.onMouseDown,()=>{L.current=!0}),onFocus:tt(e.onFocus,X=>{const ie=!L.current;if(X.target===X.currentTarget&&ie&&!P){const ae=new CustomEvent(Wp,DB);if(X.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const ce=U().filter(m=>m.focusable),V=ce.find(m=>m.active),D=ce.find(m=>m.id===w),d=[V,D,...ce].filter(Boolean).map(m=>m.ref.current);G4(d,l)}}L.current=!1}),onBlur:tt(e.onBlur,()=>N(!1))})})}),q4="RovingFocusGroupItem",W4=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=ac(),c=s||a,u=UB(q4,r),l=u.currentTabStopId===c,f=F4(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return I.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),_.jsx(Gp.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:_.jsx(Gt.span,{tabIndex:l?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:tt(e.onMouseDown,b=>{n?u.onItemFocus(c):b.preventDefault()}),onFocus:tt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:tt(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=qB(b,u.orientation,u.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let P=f().filter(N=>N.focusable).map(N=>N.ref.current);if(w==="last")P.reverse();else if(w==="prev"||w==="next"){w==="prev"&&P.reverse();const N=P.indexOf(b.currentTarget);P=u.loop?WB(P,N+1):P.slice(N+1)}setTimeout(()=>G4(P))}})})})});W4.displayName=q4;var zB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qB(e,t,r){const n=VB(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return zB[n]}function G4(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function WB(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var GB=V4,HB=W4;function KB(e,[t,r]){return Math.min(r,Math.max(t,e))}var Hp=0;function XB(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??H4()),document.body.insertAdjacentElement("beforeend",e[1]??H4()),Hp++,()=>{Hp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Hp--}},[])}function H4(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Kp="focusScope.autoFocusOnMount",Xp="focusScope.autoFocusOnUnmount",K4={bubbles:!1,cancelable:!0},JB="FocusScope",X4=I.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=I.useState(null),u=gr(i),l=gr(s),f=I.useRef(null),h=Qt(t,w=>c(w)),y=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(n){let w=function(R){if(y.paused||!a)return;const U=R.target;a.contains(U)?f.current=U:gs(f.current,{select:!0})},A=function(R){if(y.paused||!a)return;const U=R.relatedTarget;U!==null&&(a.contains(U)||gs(f.current,{select:!0}))},P=function(R){if(document.activeElement===document.body)for(const L of R)L.removedNodes.length>0&&gs(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",A);const N=new MutationObserver(P);return a&&N.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",A),N.disconnect()}}},[n,a,y.paused]),I.useEffect(()=>{if(a){Z4.add(y);const w=document.activeElement;if(!a.contains(w)){const P=new CustomEvent(Kp,K4);a.addEventListener(Kp,u),a.dispatchEvent(P),P.defaultPrevented||(YB(rL(J4(a)),{select:!0}),document.activeElement===w&&gs(a))}return()=>{a.removeEventListener(Kp,u),setTimeout(()=>{const P=new CustomEvent(Xp,K4);a.addEventListener(Xp,l),a.dispatchEvent(P),P.defaultPrevented||gs(w??document.body,{select:!0}),a.removeEventListener(Xp,l),Z4.remove(y)},0)}}},[a,u,l,y]);const b=I.useCallback(w=>{if(!r&&!n||y.paused)return;const A=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,P=document.activeElement;if(A&&P){const N=w.currentTarget,[R,U]=ZB(N);R&&U?!w.shiftKey&&P===U?(w.preventDefault(),r&&gs(R,{select:!0})):w.shiftKey&&P===R&&(w.preventDefault(),r&&gs(U,{select:!0})):P===N&&w.preventDefault()}},[r,n,y.paused]);return _.jsx(Gt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});X4.displayName=JB;function YB(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(gs(n,{select:t}),document.activeElement!==r)return}function ZB(e){const t=J4(e),r=Y4(t,e),n=Y4(t.reverse(),e);return[r,n]}function J4(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Y4(e,t){for(const r of e)if(!QB(r,{upTo:t}))return r}function QB(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function eL(e){return e instanceof HTMLInputElement&&"select"in e}function gs(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&eL(e)&&t&&e.select()}}var Z4=tL();function tL(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Q4(e,t),e.unshift(t)},remove(t){var r;e=Q4(e,t),(r=e[0])==null||r.resume()}}}function Q4(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function rL(e){return e.filter(t=>t.tagName!=="A")}var nL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Qo=new WeakMap,Ml=new WeakMap,Tl={},Jp=0,e6=function(e){return e&&(e.host||e6(e.parentNode))},iL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=e6(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},sL=function(e,t,r,n){var i=iL(t,Array.isArray(e)?e:[e]);Tl[r]||(Tl[r]=new WeakMap);var s=Tl[r],o=[],a=new Set,c=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var l=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))l(h);else try{var y=h.getAttribute(n),b=y!==null&&y!=="false",w=(Qo.get(h)||0)+1,A=(s.get(h)||0)+1;Qo.set(h,w),s.set(h,A),o.push(h),w===1&&b&&Ml.set(h,!0),A===1&&h.setAttribute(r,"true"),b||h.setAttribute(n,"true")}catch(P){console.error("aria-hidden: cannot operate on ",h,P)}})};return l(t),a.clear(),Jp++,function(){o.forEach(function(f){var h=Qo.get(f)-1,y=s.get(f)-1;Qo.set(f,h),s.set(f,y),h||(Ml.has(f)||f.removeAttribute(n),Ml.delete(f)),y||f.removeAttribute(r)}),Jp--,Jp||(Qo=new WeakMap,Qo=new WeakMap,Ml=new WeakMap,Tl={})}},oL=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||nL(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),sL(n,i,r,"aria-hidden")):function(){return null}},oi=function(){return oi=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},oi.apply(this,arguments)};function t6(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function aL(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Al="right-scroll-bar-position",Ol="width-before-scroll-bar",cL="with-scroll-bars-hidden",uL="--removed-body-scroll-bar-size";function Yp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function lL(e,t){var r=te.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=t,r.facade}var fL=typeof window<"u"?I.useLayoutEffect:I.useEffect,r6=new WeakMap;function dL(e,t){var r=lL(t||null,function(n){return e.forEach(function(i){return Yp(i,n)})});return fL(function(){var n=r6.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||Yp(a,null)}),s.forEach(function(a){i.has(a)||Yp(a,o)})}r6.set(r,e)},[e]),r}function hL(e){return e}function pL(e,t){t===void 0&&(t=hL);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var o=t(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var c=function(){var l=o;o=[],l.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(l){o.push(l),u()},filter:function(l){return o=o.filter(l),r}}}};return i}function mL(e){e===void 0&&(e={});var t=pL(null);return t.options=oi({async:!0,ssr:!1},e),t}var n6=function(e){var t=e.sideCar,r=t6(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return I.createElement(n,oi({},r))};n6.isSideCarExport=!0;function gL(e,t){return e.useMedium(t),n6}var i6=mL(),Zp=function(){},Il=I.forwardRef(function(e,t){var r=I.useRef(null),n=I.useState({onScrollCapture:Zp,onWheelCapture:Zp,onTouchMoveCapture:Zp}),i=n[0],s=n[1],o=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,l=e.enabled,f=e.shards,h=e.sideCar,y=e.noIsolation,b=e.inert,w=e.allowPinchZoom,A=e.as,P=A===void 0?"div":A,N=e.gapMode,R=t6(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),U=h,L=dL([r,t]),G=oi(oi({},R),i);return I.createElement(I.Fragment,null,l&&I.createElement(U,{sideCar:i6,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:N}),o?I.cloneElement(I.Children.only(a),oi(oi({},G),{ref:L})):I.createElement(P,oi({},G,{className:c,ref:L}),a))});Il.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Il.classNames={fullWidth:Ol,zeroRight:Al};var s6,vL=function(){if(s6)return s6;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function yL(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=vL();return t&&e.setAttribute("nonce",t),e}function bL(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function wL(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var _L=function(){var e=0,t=null;return{add:function(r){e==0&&(t=yL())&&(bL(t,r),wL(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},xL=function(){var e=_L();return function(t,r){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},o6=function(){var e=xL(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},SL={left:0,top:0,right:0,gap:0},Qp=function(e){return parseInt(e||"",10)||0},EL=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Qp(r),Qp(n),Qp(i)]},CL=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return SL;var t=EL(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},ML=o6(),ea="data-scroll-locked",TL=function(e,t,r,n){var i=e.left,s=e.top,o=e.right,a=e.gap;return r===void 0&&(r="margin"),`
|
|
58
|
+
.`.concat(cL,` {
|
|
59
59
|
overflow: hidden `).concat(n,`;
|
|
60
60
|
padding-right: `).concat(a,"px ").concat(n,`;
|
|
61
61
|
}
|
|
@@ -89,12 +89,12 @@ body { background-color: var(--color-page-background); }
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
body[`).concat(ea,`] {
|
|
92
|
-
`).concat(
|
|
92
|
+
`).concat(uL,": ").concat(a,`px;
|
|
93
93
|
}
|
|
94
|
-
`)},a6=function(){var e=parseInt(document.body.getAttribute(ea)||"0",10);return isFinite(e)?e:0},
|
|
94
|
+
`)},a6=function(){var e=parseInt(document.body.getAttribute(ea)||"0",10);return isFinite(e)?e:0},AL=function(){I.useEffect(function(){return document.body.setAttribute(ea,(a6()+1).toString()),function(){var e=a6()-1;e<=0?document.body.removeAttribute(ea):document.body.setAttribute(ea,e.toString())}},[])},OL=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;AL();var s=I.useMemo(function(){return CL(i)},[i]);return I.createElement(ML,{styles:TL(s,!t,i,r?"":"!important")})},e0=!1;if(typeof window<"u")try{var Pl=Object.defineProperty({},"passive",{get:function(){return e0=!0,!0}});window.addEventListener("test",Pl,Pl),window.removeEventListener("test",Pl,Pl)}catch{e0=!1}var ta=e0?{passive:!1}:!1,IL=function(e){return e.tagName==="TEXTAREA"},c6=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!IL(e)&&r[t]==="visible")},PL=function(e){return c6(e,"overflowY")},jL=function(e){return c6(e,"overflowX")},u6=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=l6(e,n);if(i){var s=f6(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},kL=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},NL=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},l6=function(e,t){return e==="v"?PL(t):jL(t)},f6=function(e,t){return e==="v"?kL(t):NL(t)},RL=function(e,t){return e==="h"&&t==="rtl"?-1:1},DL=function(e,t,r,n,i){var s=RL(e,window.getComputedStyle(t).direction),o=s*n,a=r.target,c=t.contains(a),u=!1,l=o>0,f=0,h=0;do{var y=f6(e,a),b=y[0],w=y[1],A=y[2],P=w-A-s*b;(b||P)&&l6(e,a)&&(f+=P,h+=b),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(l&&(i&&Math.abs(f)<1||!i&&o>f)||!l&&(i&&Math.abs(h)<1||!i&&-o>h))&&(u=!0),u},jl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},d6=function(e){return[e.deltaX,e.deltaY]},h6=function(e){return e&&"current"in e?e.current:e},$L=function(e,t){return e[0]===t[0]&&e[1]===t[1]},BL=function(e){return`
|
|
95
95
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
96
96
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
97
|
-
`)},UL=0,ra=[];function zL(e){var t=I.useRef([]),r=I.useRef([0,0]),n=I.useRef(),i=I.useState(UL++)[0],s=I.useState(o6)[0],o=I.useRef(e);I.useEffect(function(){o.current=e},[e]),I.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=uL([e.lockRef.current],(e.shards||[]).map(h6),!0).filter(Boolean);return w.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(w,A){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var P=kl(w),R=r.current,N="deltaX"in w?w.deltaX:R[0]-P[0],F="deltaY"in w?w.deltaY:R[1]-P[1],L,G=w.target,q=Math.abs(N)>Math.abs(F)?"h":"v";if("touches"in w&&q==="h"&&G.type==="range")return!1;var X=u6(q,G);if(!X)return!0;if(X?L=q:(L=q==="v"?"h":"v",X=u6(q,G)),!X)return!1;if(!n.current&&"changedTouches"in w&&(N||F)&&(n.current=L),!L)return!0;var ie=n.current||L;return BL(ie,A,w,ie==="h"?N:F,!0)},[]),c=I.useCallback(function(w){var A=w;if(!(!ra.length||ra[ra.length-1]!==s)){var P="deltaY"in A?d6(A):kl(A),R=t.current.filter(function(L){return L.name===A.type&&(L.target===A.target||A.target===L.shadowParent)&&LL(L.delta,P)})[0];if(R&&R.should){A.cancelable&&A.preventDefault();return}if(!R){var N=(o.current.shards||[]).map(h6).filter(Boolean).filter(function(L){return L.contains(A.target)}),F=N.length>0?a(A,N[0]):!o.current.noIsolation;F&&A.cancelable&&A.preventDefault()}}},[]),u=I.useCallback(function(w,A,P,R){var N={name:w,delta:A,target:P,should:R,shadowParent:VL(P)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(F){return F!==N})},1)},[]),l=I.useCallback(function(w){r.current=kl(w),n.current=void 0},[]),f=I.useCallback(function(w){u(w.type,d6(w),w.target,a(w,e.lockRef.current))},[]),h=I.useCallback(function(w){u(w.type,kl(w),w.target,a(w,e.lockRef.current))},[]);I.useEffect(function(){return ra.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,ta),document.addEventListener("touchmove",c,ta),document.addEventListener("touchstart",l,ta),function(){ra=ra.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,ta),document.removeEventListener("touchmove",c,ta),document.removeEventListener("touchstart",l,ta)}},[]);var y=e.removeScrollBar,b=e.inert;return I.createElement(I.Fragment,null,b?I.createElement(s,{styles:FL(i)}):null,y?I.createElement(PL,{gapMode:e.gapMode}):null)}function VL(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const qL=yL(i6,zL);var p6=I.forwardRef(function(e,t){return I.createElement(Il,oi({},e,{ref:t,sideCar:qL}))});p6.classNames=Il.classNames;const WL=p6;function GL(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var t0="ScrollArea",[m6,aJ]=zo(t0),[HL,ln]=m6(t0),g6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=I.useState(null),[u,l]=I.useState(null),[f,h]=I.useState(null),[y,b]=I.useState(null),[w,A]=I.useState(null),[P,R]=I.useState(0),[N,F]=I.useState(0),[L,G]=I.useState(!1),[q,X]=I.useState(!1),ie=Qt(t,ce=>c(ce)),ae=Up(i);return _.jsx(HL,{scope:r,type:n,dir:ae,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:h,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:L,onScrollbarXEnabledChange:G,scrollbarY:w,onScrollbarYChange:A,scrollbarYEnabled:q,onScrollbarYEnabledChange:X,onCornerWidthChange:R,onCornerHeightChange:F,children:_.jsx(Gt.div,{dir:ae,...o,ref:ie,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});g6.displayName=t0;var v6="ScrollAreaViewport",y6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=ln(v6,r),a=I.useRef(null),c=Qt(t,a,o.onViewportChange);return _.jsxs(_.Fragment,{children:[_.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),_.jsx(Gt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:_.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});y6.displayName=v6;var ai="ScrollAreaScrollbar",b6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=ln(ai,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return I.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(KL,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(XL,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(w6,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(r0,{...n,ref:t}):null});b6.displayName=ai;var KL=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=ln(ai,e.__scopeScrollArea),[s,o]=I.useState(!1);return I.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},l=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",l),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",l)}}},[i.scrollArea,i.scrollHideDelay]),_.jsx(jn,{present:r||s,children:_.jsx(w6,{"data-state":s?"visible":"hidden",...n,ref:t})})}),XL=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=ln(ai,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Dl(()=>c("SCROLL_END"),100),[a,c]=GL("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return I.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),I.useEffect(()=>{const u=i.viewport,l=s?"scrollLeft":"scrollTop";if(u){let f=u[l];const h=()=>{const y=u[l];f!==y&&(c("SCROLL"),o()),f=y};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,s,c,o]),_.jsx(jn,{present:r||a!=="hidden",children:_.jsx(r0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),w6=I.forwardRef((e,t)=>{const r=ln(ai,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=I.useState(!1),a=e.orientation==="horizontal",c=Dl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return na(r.viewport,c),na(r.content,c),_.jsx(jn,{present:n||s,children:_.jsx(r0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),r0=I.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=ln(ai,e.__scopeScrollArea),s=I.useRef(null),o=I.useRef(0),[a,c]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=C6(a.viewport,a.content),l={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,y){return tF(h,o.current,a,y)}return r==="horizontal"?_.jsx(JL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=T6(h,a,i.dir);s.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):r==="vertical"?_.jsx(YL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=T6(h,a);s.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),JL=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=ln(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarXChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x6,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Nl(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.x),onDragScroll:l=>e.onDragScroll(l.x),onWheelScroll:(l,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+l.deltaX;e.onWheelScroll(h),A6(h,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Rl(o.paddingLeft),paddingEnd:Rl(o.paddingRight)}})}})}),YL=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=ln(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarYChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x6,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Nl(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.y),onDragScroll:l=>e.onDragScroll(l.y),onWheelScroll:(l,f)=>{if(s.viewport){const h=s.viewport.scrollTop+l.deltaY;e.onWheelScroll(h),A6(h,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Rl(o.paddingTop),paddingEnd:Rl(o.paddingBottom)}})}})}),[ZL,_6]=m6(ai),x6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:l,onResize:f,...h}=e,y=ln(ai,r),[b,w]=I.useState(null),A=Qt(t,ie=>w(ie)),P=I.useRef(null),R=I.useRef(""),N=y.viewport,F=n.content-n.viewport,L=gr(l),G=gr(c),q=Dl(f,10);function X(ie){if(P.current){const ae=ie.clientX-P.current.left,ce=ie.clientY-P.current.top;u({x:ae,y:ce})}}return I.useEffect(()=>{const ie=ae=>{const ce=ae.target;(b==null?void 0:b.contains(ce))&&L(ae,F)};return document.addEventListener("wheel",ie,{passive:!1}),()=>document.removeEventListener("wheel",ie,{passive:!1})},[N,b,F,L]),I.useEffect(G,[n,G]),na(b,q),na(y.content,q),_.jsx(ZL,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:gr(s),onThumbPointerUp:gr(o),onThumbPositionChange:G,onThumbPointerDown:gr(a),children:_.jsx(Gt.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:tt(e.onPointerDown,ie=>{ie.button===0&&(ie.target.setPointerCapture(ie.pointerId),P.current=b.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),X(ie))}),onPointerMove:tt(e.onPointerMove,X),onPointerUp:tt(e.onPointerUp,ie=>{const ae=ie.target;ae.hasPointerCapture(ie.pointerId)&&ae.releasePointerCapture(ie.pointerId),document.body.style.webkitUserSelect=R.current,y.viewport&&(y.viewport.style.scrollBehavior=""),P.current=null})})})}),jl="ScrollAreaThumb",S6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=_6(jl,e.__scopeScrollArea);return _.jsx(jn,{present:r||i.hasThumb,children:_.jsx(QL,{ref:t,...n})})}),QL=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=ln(jl,r),o=_6(jl,r),{onThumbPositionChange:a}=o,c=Qt(t,f=>o.onThumbChange(f)),u=I.useRef(),l=Dl(()=>{u.current&&(u.current(),u.current=void 0)},100);return I.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(l(),!u.current){const y=rF(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,l,a]),_.jsx(Gt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:tt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),b=f.clientX-y.left,w=f.clientY-y.top;o.onThumbPointerDown({x:b,y:w})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});S6.displayName=jl;var n0="ScrollAreaCorner",E6=I.forwardRef((e,t)=>{const r=ln(n0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(eF,{...e,ref:t}):null});E6.displayName=n0;var eF=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=ln(n0,r),[s,o]=I.useState(0),[a,c]=I.useState(0),u=!!(s&&a);return na(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),na(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?_.jsx(Gt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Rl(e){return e?parseInt(e,10):0}function C6(e,t){const r=e/t;return isNaN(r)?0:r}function Nl(e){const t=C6(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function tF(e,t,r,n="ltr"){const i=Nl(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,f=n==="ltr"?[0,l]:[l*-1,0];return M6([c,u],f)(e)}function T6(e,t,r="ltr"){const n=Nl(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],u=JB(e,c);return M6([0,o],[0,a])(u)}function M6(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function A6(e,t){return e>0&&e<t}var rF=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function Dl(e,t){const r=gr(e),n=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(n.current),[]),I.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function na(e,t){const r=gr(t);ls(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var nF=g6,iF=y6,O6=b6,I6=S6,sF=E6,i0="Switch",[oF,cJ]=zo(i0),[aF,cF]=oF(i0),P6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,N=>y(N)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,R]=lc({prop:i,defaultProp:s,onChange:u});return _.jsxs(aF,{scope:r,checked:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"switch","aria-checked":P,"aria-required":o,"data-state":R6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:tt(e.onClick,N=>{R(F=>!F),A&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),A&&_.jsx(uF,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});P6.displayName=i0;var k6="SwitchThumb",j6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=cF(k6,r);return _.jsx(Gt.span,{"data-state":R6(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});j6.displayName=k6;var uF=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=I.useRef(null),o=R4(r),a=Dp(t);return I.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==r&&f){const h=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(h)}},[o,r,n]),_.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function R6(e){return e?"checked":"unchecked"}var lF=P6,fF=j6;const hc={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:fc,highContrast:_l,radius:Vp},N6=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,style:s,size:o=hc.size.default,variant:a=hc.variant.default,color:c=hc.color.default,highContrast:u=hc.highContrast.default,radius:l=hc.radius.default,...f}=r;return I.createElement("span",{"data-radius":l,className:Kt("rt-SwitchRoot",i,bt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Yo(n)),style:s},I.createElement(lF,{"data-accent-color":c,...f,ref:t,className:Kt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},I.createElement(fF,{className:Kt("rt-SwitchThumb",{"rt-high-contrast":u})})))});N6.displayName="Switch";var s0=["Enter"," "],dF=["ArrowDown","PageUp","Home"],D6=["ArrowUp","PageDown","End"],hF=[...dF,...D6],pF={ltr:[...s0,"ArrowRight"],rtl:[...s0,"ArrowLeft"]},mF={ltr:["ArrowLeft"],rtl:["ArrowRight"]},pc="Menu",[mc,gF,vF]=F4(pc),[Ys,$6]=zo(pc,[vF,ml,z4]),gc=ml(),B6=z4(),[L6,gs]=Ys(pc),[yF,vc]=Ys(pc),F6=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=gc(t),[c,u]=I.useState(null),l=I.useRef(!1),f=gr(s),h=Up(i);return I.useEffect(()=>{const y=()=>{l.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>l.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),_.jsx(g4,{...a,children:_.jsx(L6,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(yF,{scope:t,onClose:I.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};F6.displayName=pc;var bF="MenuAnchor",o0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=gc(r);return _.jsx(v4,{...i,...n,ref:t})});o0.displayName=bF;var a0="MenuPortal",[wF,U6]=Ys(a0,{forceMount:void 0}),z6=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=gs(a0,t);return _.jsx(wF,{scope:t,forceMount:r,children:_.jsx(jn,{present:r||s.open,children:_.jsx(w4,{asChild:!0,container:i,children:n})})})};z6.displayName=a0;var fn="MenuContent",[_F,c0]=Ys(fn),V6=I.forwardRef((e,t)=>{const r=U6(fn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=gs(fn,e.__scopeMenu),o=vc(fn,e.__scopeMenu);return _.jsx(mc.Provider,{scope:e.__scopeMenu,children:_.jsx(jn,{present:n||s.open,children:_.jsx(mc.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(xF,{...i,ref:t}):_.jsx(SF,{...i,ref:t})})})})}),xF=I.forwardRef((e,t)=>{const r=gs(fn,e.__scopeMenu),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return cL(s)},[]),_.jsx(u0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),SF=I.forwardRef((e,t)=>{const r=gs(fn,e.__scopeMenu);return _.jsx(u0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),u0=I.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,disableOutsideScroll:b,...w}=e,A=gs(fn,r),P=vc(fn,r),R=gc(r),N=B6(r),F=gF(r),[L,G]=I.useState(null),q=I.useRef(null),X=Qt(t,q,A.onContentChange),ie=I.useRef(0),ae=I.useRef(""),ce=I.useRef(0),V=I.useRef(null),D=I.useRef("right"),p=I.useRef(0),d=b?WL:I.Fragment,m=b?{as:Ri,allowPinchZoom:!0}:void 0,x=E=>{var he,ye;const O=ae.current+E,C=F().filter(Ee=>!Ee.disabled),g=document.activeElement,v=(he=C.find(Ee=>Ee.ref.current===g))==null?void 0:he.textValue,k=C.map(Ee=>Ee.textValue),ee=NF(k,O,v),se=(ye=C.find(Ee=>Ee.textValue===ee))==null?void 0:ye.ref.current;(function Ee(Se){ae.current=Se,window.clearTimeout(ie.current),Se!==""&&(ie.current=window.setTimeout(()=>Ee(""),1e3))})(O),se&&setTimeout(()=>se.focus())};I.useEffect(()=>()=>window.clearTimeout(ie.current),[]),YB();const T=I.useCallback(E=>{var C,g;return D.current===((C=V.current)==null?void 0:C.side)&&$F(E,(g=V.current)==null?void 0:g.area)},[]);return _.jsx(_F,{scope:r,searchRef:ae,onItemEnter:I.useCallback(E=>{T(E)&&E.preventDefault()},[T]),onItemLeave:I.useCallback(E=>{var O;T(E)||((O=q.current)==null||O.focus(),G(null))},[T]),onTriggerLeave:I.useCallback(E=>{T(E)&&E.preventDefault()},[T]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:I.useCallback(E=>{V.current=E},[]),children:_.jsx(d,{...m,children:_.jsx(X4,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(Sp,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:_.jsx(KB,{asChild:!0,...N,dir:P.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:G,onEntryFocus:tt(c,E=>{P.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(y4,{role:"menu","aria-orientation":"vertical","data-state":aS(A.open),"data-radix-menu-content":"",dir:P.dir,...R,...w,ref:X,style:{outline:"none",...w.style},onKeyDown:tt(w.onKeyDown,E=>{const C=E.target.closest("[data-radix-menu-content]")===E.currentTarget,g=E.ctrlKey||E.altKey||E.metaKey,v=E.key.length===1;C&&(E.key==="Tab"&&E.preventDefault(),!g&&v&&x(E.key));const k=q.current;if(E.target!==k||!hF.includes(E.key))return;E.preventDefault();const se=F().filter(he=>!he.disabled).map(he=>he.ref.current);D6.includes(E.key)&&se.reverse(),jF(se)}),onBlur:tt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(ie.current),ae.current="")}),onPointerMove:tt(e.onPointerMove,bc(E=>{const O=E.target,C=p.current!==E.clientX;if(E.currentTarget.contains(O)&&C){const g=E.clientX>p.current?"right":"left";D.current=g,p.current=E.clientX}}))})})})})})})});V6.displayName=fn;var EF="MenuGroup",l0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"group",...n,ref:t})});l0.displayName=EF;var CF="MenuLabel",q6=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{...n,ref:t})});q6.displayName=CF;var $l="MenuItem",W6="menu.itemSelect",Bl=I.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=I.useRef(null),o=vc($l,e.__scopeMenu),a=c0($l,e.__scopeMenu),c=Qt(t,s),u=I.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(W6,{bubbles:!0,cancelable:!0});f.addEventListener(W6,y=>n==null?void 0:n(y),{once:!0}),Bx(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(G6,{...i,ref:c,disabled:r,onClick:tt(e.onClick,l),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:tt(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:tt(e.onKeyDown,f=>{const h=a.searchRef.current!=="";r||h&&f.key===" "||s0.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Bl.displayName=$l;var G6=I.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=c0($l,r),a=B6(r),c=I.useRef(null),u=Qt(t,c),[l,f]=I.useState(!1),[h,y]=I.useState("");return I.useEffect(()=>{const b=c.current;b&&y((b.textContent??"").trim())},[s.children]),_.jsx(mc.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:_.jsx(XB,{asChild:!0,...a,focusable:!n,children:_.jsx(Gt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:tt(e.onPointerMove,bc(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,bc(b=>o.onItemLeave(b))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),TF="MenuCheckboxItem",H6=I.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(Z6,{scope:e.__scopeMenu,checked:r,children:_.jsx(Bl,{role:"menuitemcheckbox","aria-checked":Ll(r)?"mixed":r,...i,ref:t,"data-state":h0(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(Ll(r)?!0:!r),{checkForDefaultPrevented:!1})})})});H6.displayName=TF;var K6="MenuRadioGroup",[MF,AF]=Ys(K6,{value:void 0,onValueChange:()=>{}}),X6=I.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=gr(n);return _.jsx(MF,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(l0,{...i,ref:t})})});X6.displayName=K6;var J6="MenuRadioItem",Y6=I.forwardRef((e,t)=>{const{value:r,...n}=e,i=AF(J6,e.__scopeMenu),s=r===i.value;return _.jsx(Z6,{scope:e.__scopeMenu,checked:s,children:_.jsx(Bl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":h0(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});Y6.displayName=J6;var f0="MenuItemIndicator",[Z6,OF]=Ys(f0,{checked:!1}),Q6=I.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=OF(f0,r);return _.jsx(jn,{present:n||Ll(s.checked)||s.checked===!0,children:_.jsx(Gt.span,{...i,ref:t,"data-state":h0(s.checked)})})});Q6.displayName=f0;var IF="MenuSeparator",eS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});eS.displayName=IF;var PF="MenuArrow",tS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=gc(r);return _.jsx(b4,{...i,...n,ref:t})});tS.displayName=PF;var d0="MenuSub",[kF,rS]=Ys(d0),nS=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=gs(d0,t),o=gc(t),[a,c]=I.useState(null),[u,l]=I.useState(null),f=gr(i);return I.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(g4,{...o,children:_.jsx(L6,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(kF,{scope:t,contentId:oc(),triggerId:oc(),trigger:a,onTriggerChange:c,children:r})})})};nS.displayName=d0;var yc="MenuSubTrigger",iS=I.forwardRef((e,t)=>{const r=gs(yc,e.__scopeMenu),n=vc(yc,e.__scopeMenu),i=rS(yc,e.__scopeMenu),s=c0(yc,e.__scopeMenu),o=I.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=I.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return I.useEffect(()=>l,[l]),I.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(o0,{asChild:!0,...u,children:_.jsx(G6,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":aS(r.open),...e,ref:sl(t,i.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:tt(e.onPointerMove,bc(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),l()},100))})),onPointerLeave:tt(e.onPointerLeave,bc(f=>{var y,b;l();const h=(y=r.content)==null?void 0:y.getBoundingClientRect();if(h){const w=(b=r.content)==null?void 0:b.dataset.side,A=w==="right",P=A?-5:5,R=h[A?"left":"right"],N=h[A?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+P,y:f.clientY},{x:R,y:h.top},{x:N,y:h.top},{x:N,y:h.bottom},{x:R,y:h.bottom}],side:w}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:tt(e.onKeyDown,f=>{var y;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||pF[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});iS.displayName=yc;var sS="MenuSubContent",oS=I.forwardRef((e,t)=>{const r=U6(fn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=gs(fn,e.__scopeMenu),o=vc(fn,e.__scopeMenu),a=rS(sS,e.__scopeMenu),c=I.useRef(null),u=Qt(t,c);return _.jsx(mc.Provider,{scope:e.__scopeMenu,children:_.jsx(jn,{present:n||s.open,children:_.jsx(mc.Slot,{scope:e.__scopeMenu,children:_.jsx(u0,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:tt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:tt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:tt(e.onKeyDown,l=>{var y;const f=l.currentTarget.contains(l.target),h=mF[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});oS.displayName=sS;function aS(e){return e?"open":"closed"}function Ll(e){return e==="indeterminate"}function h0(e){return Ll(e)?"indeterminate":e?"checked":"unchecked"}function jF(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function RF(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function NF(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=r?e.indexOf(r):-1;let o=RF(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function DF(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,c=t[s].y,u=t[o].x,l=t[o].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function $F(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return DF(r,t)}function bc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var BF=F6,LF=o0,FF=z6,UF=V6,zF=l0,VF=q6,qF=Bl,WF=H6,GF=X6,HF=Y6,KF=Q6,XF=eS,JF=tS,YF=nS,ZF=iS,QF=oS,p0="DropdownMenu",[eU,fJ]=zo(p0,[$6]),Pr=$6(),[tU,cS]=eU(p0),uS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Pr(t),u=I.useRef(null),[l=!1,f]=lc({prop:i,defaultProp:s,onChange:o});return _.jsx(tU,{scope:t,triggerId:oc(),triggerRef:u,contentId:oc(),open:l,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(h=>!h),[f]),modal:a,children:_.jsx(BF,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};uS.displayName=p0;var lS="DropdownMenuTrigger",fS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=cS(lS,r),o=Pr(r);return _.jsx(LF,{asChild:!0,...o,children:_.jsx(Gt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:sl(t,s.triggerRef),onPointerDown:tt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:tt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});fS.displayName=lS;var rU="DropdownMenuPortal",dS=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Pr(t);return _.jsx(FF,{...n,...r})};dS.displayName=rU;var hS="DropdownMenuContent",pS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=cS(hS,r),s=Pr(r),o=I.useRef(!1);return _.jsx(UF,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:tt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:tt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,l=c.button===2||u;(!i.modal||l)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pS.displayName=hS;var nU="DropdownMenuGroup",mS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(zF,{...i,...n,ref:t})});mS.displayName=nU;var iU="DropdownMenuLabel",gS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(VF,{...i,...n,ref:t})});gS.displayName=iU;var sU="DropdownMenuItem",vS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(qF,{...i,...n,ref:t})});vS.displayName=sU;var oU="DropdownMenuCheckboxItem",yS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(WF,{...i,...n,ref:t})});yS.displayName=oU;var aU="DropdownMenuRadioGroup",bS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(GF,{...i,...n,ref:t})});bS.displayName=aU;var cU="DropdownMenuRadioItem",wS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(HF,{...i,...n,ref:t})});wS.displayName=cU;var uU="DropdownMenuItemIndicator",_S=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(KF,{...i,...n,ref:t})});_S.displayName=uU;var lU="DropdownMenuSeparator",xS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(XF,{...i,...n,ref:t})});xS.displayName=lU;var fU="DropdownMenuArrow",dU=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(JF,{...i,...n,ref:t})});dU.displayName=fU;var hU=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Pr(t),[a=!1,c]=lc({prop:n,defaultProp:s,onChange:i});return _.jsx(YF,{...o,open:a,onOpenChange:c,children:r})},pU="DropdownMenuSubTrigger",SS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(ZF,{...i,...n,ref:t})});SS.displayName=pU;var mU="DropdownMenuSubContent",ES=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Pr(r);return _.jsx(QF,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ES.displayName=mU;var gU=uS,vU=fS,CS=dS,yU=pS,bU=mS,wU=gS,_U=vS,xU=yS,SU=bS,EU=wS,TS=_S,CU=xS,TU=hU,MU=SS,AU=ES;const m0={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Vp,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},g0=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=m0.size.default,radius:l=m0.radius.default,scrollbars:f=m0.scrollbars.default,...h}=r;return I.createElement(nF,{type:o,scrollHideDelay:a,className:Kt("rt-ScrollAreaRoot",i,Yo(n)),style:s},I.createElement(iF,{...h,ref:t,className:"rt-ScrollAreaViewport"}),I.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?I.createElement(O6,{"data-radius":l,orientation:"horizontal",className:Kt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},I.createElement(I6,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?I.createElement(O6,{"data-radius":l,orientation:"vertical",className:Kt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},I.createElement(I6,{className:"rt-ScrollAreaThumb"})):null,f==="both"?I.createElement(sF,{className:"rt-ScrollAreaCorner"}):null)});g0.displayName="ScrollArea";const v0={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:fc,highContrast:_l},MS={color:fc,shortcut:{type:"string",default:void 0}},AS=e=>I.createElement(gU,{...e});AS.displayName="DropdownMenuRoot";const OS=I.forwardRef((e,t)=>I.createElement(vU,{...e,ref:t,asChild:!0}));OS.displayName="DropdownMenuTrigger";const IS=I.createContext({}),PS=I.forwardRef((e,t)=>{const r=yB(),{className:n,children:i,size:s=v0.size.default,variant:o=v0.variant.default,highContrast:a=v0.highContrast.default,color:c=MS.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return I.createElement(CS,{container:u,forceMount:l},I.createElement(wl,{asChild:!0},I.createElement(yU,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,bt(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},I.createElement(g0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},I.createElement(IS.Provider,{value:I.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});PS.displayName="DropdownMenuContent";const kS=I.forwardRef((e,t)=>I.createElement(wU,{...e,ref:t,className:Kt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));kS.displayName="DropdownMenuLabel";const jS=I.forwardRef((e,t)=>{const{className:r,children:n,color:i=MS.color.default,shortcut:s,...o}=e;return I.createElement(_U,{"data-accent-color":i,...o,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},I.createElement(Vo,null,n),s&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});jS.displayName="DropdownMenuItem";const RS=I.forwardRef((e,t)=>I.createElement(bU,{...e,ref:t,className:Kt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));RS.displayName="DropdownMenuGroup";const NS=I.forwardRef((e,t)=>I.createElement(SU,{...e,ref:t,className:Kt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));NS.displayName="DropdownMenuRadioGroup";const DS=I.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return I.createElement(EU,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},I.createElement(Vo,null,r),I.createElement(TS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Sl,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});DS.displayName="DropdownMenuRadioItem";const $S=I.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return I.createElement(xU,{...s,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},I.createElement(Vo,null,r),I.createElement(TS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Sl,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});$S.displayName="DropdownMenuCheckboxItem";const BS=e=>I.createElement(TU,{...e});BS.displayName="DropdownMenuSub";const LS=I.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return I.createElement(MU,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},I.createElement(Vo,null,n),I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},I.createElement(L4,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});LS.displayName="DropdownMenuSubTrigger";const FS=I.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=I.useContext(IS);return I.createElement(CS,{container:i,forceMount:s},I.createElement(wl,{asChild:!0},I.createElement(AU,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,bt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},I.createElement(g0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});FS.displayName="DropdownMenuSubContent";const US=I.forwardRef((e,t)=>I.createElement(CU,{...e,ref:t,className:Kt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));US.displayName="DropdownMenuSeparator";const dn=Object.assign({},{Root:AS,Trigger:OS,Content:PS,Label:kS,Item:jS,Group:RS,RadioGroup:NS,RadioItem:DS,CheckboxItem:$S,Sub:BS,SubTrigger:LS,SubContent:FS,Separator:US}),wc={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:fc,highContrast:_l,radius:Vp},zS=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,asChild:s=!1,size:o=wc.size.default,variant:a=wc.variant.default,color:c=wc.color.default,highContrast:u=wc.highContrast.default,radius:l=wc.radius.default,...f}=r,h=s?Ri:"button";return I.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Kt("rt-reset","rt-BaseButton",i,bt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Yo(n))})});zS.displayName="BaseButton";const VS=I.forwardRef((e,t)=>I.createElement(zS,{...e,ref:t,className:Kt("rt-Button",e.className)}));VS.displayName="Button";const OU={loading:{type:"boolean",default:!0}},ia=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,children:s,loading:o=OU.loading.default,...a}=r;if(!o)return I.createElement(I.Fragment,null,s);const c=I.isValidElement(s)?Ri:"span";return I.createElement(c,{ref:t,"aria-hidden":!0,className:Kt("rt-Skeleton",i,Yo(n)),"data-inline-skeleton":I.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});ia.displayName="Skeleton";const IU=Ft("/images/ghost_loading.png"),PU={primary:Ft("/images/primary_loading.png"),ghost:IU};function kU({size:e="24px",variant:t="primary",wrapStyle:r={}}){return _.jsx(j4,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:_.jsx("img",{src:PU[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const jU="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAPKADAAQAAAABAAAAPAAAAACL3+lcAAAJW0lEQVRoBd1be1BU1xk/LstLdtlVUYKoKKA8fJBKJDVxovYxTadC0zY1/2jaKWM0GRsnTTOpEQNGqc34mGicNpqxGkirMYk4QFONqTG01WioFXzwFhRfUJTl/dple37XnmUf93Hu3Uuknpmdc/ec7/vO97vn9Z3vfHcUGaa0a+2PxlnN9hVWU+Aia5gxLsIaHGk1GUNCAgMCRocaRqHZ7p5BZ++Aw2HrtPe22PqabF32Olun46Stw/Du6s0Fd4ZDNaFhvQS/k/P95ChryKb4iaO/NX1yWHhgwD1gauUPOAadNY1d7bU3u0/csvVmrcr562W1MqTodQGcvzlj9cwppqw5ceYJFKMuMpnCFLuzvK6j+dK1zk3L1xbuYuVac7+Uy8tNf2legiU7cYrJolUBNXyV1zrbSqvas5evK9yhhs+dVhPgd9YvSUmJCzvyzeQxU92FfV3PX15ubSir63pq1cbiMrVtBqhlyM/9wfqli6MOxkaFjVHLqxf9pPGh1sSY0SuT46MGC07UlKiRq6qHC3c8Vbhk/kNLKJMqPjUKqaF1EuIsPn27OGPNkQxePi7F976ZYU6ICDn3+Oyx8byCv066f164W1vV0js389XCDqV2FYf07pz0xAWJlsq5MyxRSsLuV/2UyNCxoQGjVs9JjikoPlndIqeHbA+jZx+LC79BV2GznBDeuu4+B9l+qI4Un2oSWNIfe4j86plYEhqk+N65mqCreMepuvZouZ42yknCMNYLbL/dSX7xu/Pk3zVtribzjjWSC1faSd66b5Ago8FVrvUBut5p6z9H+adLyZB8tVigvpM6fr4Uo9ry7YeukE++vNez7ry37/aRvv5BsmD2WPdizc8Y3qmzJqUeOFp5QEyIKGBsPU8vjF6p12pMhxpZu6eCOOmyKpbKaS9/O3U8ibAEiVWrLpsx2TQjfmqk6JblAxhGBfbZYKM2O9hbO2D85VsXyM2WXu8q13+8iCr6Un6yaKIu+x06KjY6bFHMpIlHikuqPYaVz8SBBWUKMcouZi5NOR4+/Pymx7yVYsHc/ujkTalq1eXAACzejB6A83Mz1uhpLrZ2DJBtdFXmTVs/qCPg0SsBCzC5y/MA/EhC+Ab3Sn+ftxysJTYVAEAL0Homb0wuwHmb0l/U89Rzjg7Rj7+4pVp3DGvw6pWACdiYPBfgWdPMr7FCf3O7w0ly9lVxizGFGsn8WUPbEnjpOZibX4nQHZsAGJ4KHN6VGHnrYVBg1eVJgXR9/MPLc0hb59DcBe97Rxt52LlogA0YQSwAhltGL09FU2sfeftwPZci8I1sfWEmocOOVFz1tPt3FTQQyNIjARswQpYAGD4oPQRDRm5+DenudXCJy3p2BnkybQIprbL5GCVdPXZBFpcgDiKG0QDvIhxuHDyKJH8vv0uOnW1WpAPBqh9OJcu+O0mgPVthE+WBLMjUIwEjsBrgStXqXXRXpG9gkGzYz7dQ/fiJKPLST2Nd7GcrWl3P3g9vvFdFcPDwNwEjsBrgN/ZXGPh3F14ljc09iqIWPjyObMxMdNF10KF7ucFz/roq6cO1ph4qu8G9SPMzsBrgJNcs4X+MDbe7yZ6iBkUxKfHhZMeLs4gxYMhyLa1s85m/3oIA+CoF7m8CVgNuBPwVtGF/NRlQGHbTokaT3S+n+Bz2z1Qoz1HI5p0ucliAlQ5pY4gckVIdzrinLsorPWFMMNn76sNkjDnQR9xXtId5EvVbiZ6neXgZDbAacdfDCtTmnXT+bf5TrSwbrKh3X0kh0RG+7xXG1NzpFpISFy7IYOflkvI75LrIeoC2nkgZRyBTSwJWI7vY0iJg58f1pFnGOGBWFAwLsYQT97rlnt6Yo3QrOvC362LkQlto87VlnjyixCKFwCoYHiJ1ikXwYuR/Kq4YmJkVlZZoVZTFCM7Q7enXv78ku4ihTbStNRlxZWkxqfNuYFd8/Y+VZFDGwI8eH0rOXLYJP3a9RrdCspb2jlhrAPHC9guKix/azKaHi4PZqaq9I8BqxP2shahzGcKLUVbbLvuSMQf//JnnCJg5zSwK9gZ1/6zYUkawJvCk8/T4CB2WLp7IQ+6iAVYDLqNdJRwPdzv6NR/S05J8hzc8HJlvnpddC8TUgicFuqhJwGrAzbsapi0H6jyOcmp405I87996+h1k5bYyUn+rW40YgVbwjhxU5x0BVgPCDHhb+1e1jRwuUe/FgHzM43luCxicBGt2XlScGnK6waMCnXgTsNIh7TjJw3DPi1HNQypKkxRjJma3/XP93kryxXn/wzhy9lUT6MaTgNWAABLEVCgx5B27TqobtW8HjyYPDWfcL2kdKd56QifoppSAEVgNiJZBAIkcwz0vxhU5EsU6tmC9f/y6cLJSZFBB8PbhK6TZJu8dAUZgFQwPRMvIyccb5PViiMnB/H0kwUpgRW3K0z4txGSjDLrt+0TeB8YwCoCb2u3rES0jJfDTr/i8GFL8MC1hWChZUVL8POXHS/8jSQZsCH8CgQD4udeLLiE0SIrDX2ea1RxEnt9WrmhFSbXPUy43pIGNxXq5bGnqdciVEhxLz7L+pNP0+MhrRWltJz46TJIVMV6scsj1QEsqPlpmg6eeVbIcjrTntpbJ2s6M9n7kAdSDgiPo427OfKYHnUptSU+/7zLxPM7Cj6bE9NGz6fcYMctjIkPJQnoObe+2E1vXAOmlF9jSM55xDX8eYQ0SQG5emUTm0UVRLB092/KbghNVZ1idRw+j8PT+Z+r1vEFkDd2PHAFs83/+wTT3tl1zmBUiwq2zV8FBxYhHcA4MwOKtoseQRiVuzBHhNjvOsoh2v88I8BYwEv/T/dX54ec3sjOz/3LIWz8fwCBAOB8CQxImmxK8Gf4f/iM6b+krRc+L6Srbg//Yu7RmpEbfiYFBGaLyFmQeknR6+cxhd0EI56PLuvS1gDvxCHiGrtBZThXRIc0YCj+r6kc4X1iw4Wc0pCiYlY/EHGBLLralrcgqko2MkR3SDNiDFFzKBZgBfxDCh2WHNAPKcoTzIcINQV80NlLVy2Iy9Mqxz2LrkVqNpdpRBRhCsGUhws3ucDyJyHQpwcNZDgvqeGnrYrF9Vqldv3oJQV+IgxI7cCg1rKUeB4H78pGHt7KIg0Jo0HB+xnOxvuO3z2YV7fRuW+1/v3rYu7E9b6TPjAw3bnzgP9TyBo7/2j/FG6Cf4hmH7VO8/wJSjxTWAm8L8gAAAABJRU5ErkJggg==",y0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABGUUKwAAAQcklEQVR4Ac07C3BUVZb33vfp7nQSgiEhYYYgESEj40oZjERH/MxAnFEGQQYUZILRGix1y3V3q3bZqd2trZpZqram1rJ2tMZZiUGFAURQ4romiALjmlkFB2eGEVyMEAQSEiSQ9O+9fvfuOfe923Q66aQ7dDS3q/vcd9+553fPOffzXlMyxqX4hc1Vls9p4Iao5nm8Mp5HSoSfmsIUGjcJRfbMIoJa1CFRbhlh2k3CrJ3F6EG/rTWee3DlkbEUUQqQawYTX3ppVTxInoxN4rPjVxAfAf0kDwG/WEM4RKGUEiEEQYgF0ITxJY2ZPfSwHiJPnV+9etMQ3S6rKWcGmPTcq+XWxOhzVhlfGJ8oQGkoSlnFJcUAAlSk8EHoort1bPMaXGN5lzoao5O1muf9a3vW3nvGRbq8XyXaqKlMebG5IpTXtzF6JZ/PfYINSyjFADDUoCA0eiN+SVvXINIuKKF3qQzKLMr9x9n+YLig/vSPF3UMy3OEm6M2ALgqLd6y5fnwVXyNCJChFZcKU2GcoyGtlx6FuD7MYuQDjemHhNC7mLggR5HTCeWUxic7JD6HG6QGDDmbTxSzrCtEELRPKyOLEB74jDWdu+++hyFslJlGUHng7bTEB6INvPrGC6/O65tmt1iTeKGKWxfDGy7OhL+Tduq9ZLMZ9j19uuGekwMpZHY1pfG1qVZe7Il4EV8ZLSNlYGZgIK3qEXDrZje5GOgw67oevPd3mVG+hJW1AUpf3vpI+GrxjAOj7qmrIpZQhwr/CdbG+sz67tWLj11ic/m1kpden8ELrI2RabyWaIO9QkNv+D/9sbMPLPtVNtyyMsDkra809s8iawjjXj9lAhjxk+TTYLdY1bFm+cFsBMgWt6JpW3WomG6KVpCZhCg5XCqUMBE8Qpq6VvyoIVO6GRmg+oAwvji9sy00zalWKrsMBPF1sW69kzzU9eNlzZkyzQXelM2vLbImORtik3mJoqeCw39CO1gxZUntwbnUVvfSwRENgMp39OzoiJWJsgFZG5JO8BjdfWbpkrp0xL+K9sk7drZEruILYDZxZ0/PCj7IQRXFSytGMsLQ2TtJ8tOnX2+zy2kZo5CBgAdCZjNR8Alb/3Urj2J2wQAUHNHWs7gGczBmSfxlxC6jZadA9iRVhqwOa4CpW3c1RqeRalRcKg+E9X5m5x81lp1acc9Ph6T4NTSiLPlH2TI9BEMDJlDyxipI9dStzY3DiZQ2BK78TfMjfVXiWYHUvKKHme1v1+Z0PPCDP6u28QQrXn7zmmilcyieB6sJKFJwUAA85NHj99815OwwpAfM2PLmvHCleAbmeHR86VK6o4n8z/X7xqvyqDDKhjKirDIc0HOhhKc7z6BOiJNaBhkAV3jhUtEiTMZcV5ImEAXt+vr2Vd/fkUpgvF2jjCgrGEAagaED+xiTOmGiTCmDGiq3v7khdBVpkHjeOj3vBG39/J7v5yTbz9y2pyZO4/cIH68RGisV1PEJjerUZr3MEqepTd+JGUUvnlp647kUWbO6nL7rv1vC3+QLZRzgzAAl2E4b25f94CH3yv0dYICq37Rd2VfZ+5ljgNdjQeP10O4TC+4sddFH94tTae/J1v+0J4il9kRRgHbFkroXSuyLOBG+bnbcd8H4+6Mr7tjmYmf/O233W2djk0SJUpLGCJ/YUTD98PLvdChqA0IgHux/QRiUuRMJ/moi0E0HWEx1zBRevW33yp7w7guRaaTeLiIFFBwTJ2z5wRjFD0L4qqkWJKDWZDK972p7y1Vv7P4thmWm/JLxUHYIBJnHZS6HsI75IxuTcRKEv/Xq/vL+qdEvhA7B42H4z7Kjn935varkDtnUZ2/f+9cXKuxfEH1oBbw1S2K3m0obhUOcwBn6x2N3LfiL1PuZXF/91ttHwiV8lsJlccLzv/B/85N755/BtoQHCM1+juhgepnzYfS5JvIuslWqY7Zw1ta9t/dNc35BNfR0dy7BnS3W5Q4XR9yrJzzOa8PEJZOXB2EneO23tu/5WbYyIL4fdGACZgVcwCE/g8El6OqVhAGsK8hC5YoI8zq1tj8uv2NUGxt0WV4qXgd+lKEFgB5+UQAFk+uJ+x4u9pFf7IF1+MRK2d8oobOBqAPqInl44WaDroqGNMC1r7y3igeZLyEc7OeDjlmvkLKF1726/x/sQoz3S/GtaCPUYESCZ/S2CZ/7/nLSZ+bcwuPaT/292peEo0uC4wNMrmMbDwr/ddvfW56tLIjvt7QHkSfSQWM6Qeq79pV90rt1RIDT2ielc4KzYsz5e1nnR4tvGvV+PjaBPCGVl2kes72XaoA4A+MWHGf1Hy+/5SXk7RX0tH+dtWffWasIsrbKTIAv6ygUFJg6lwDIelb4eOktn1a17uu0ilm5O9OAQfPok0Brk/SAeFDMxpjDDI3QF9ZfRoajKTVv/2+xU0QnSWvLpQjGM9JF21OS36ntTFE+wSZw3vgXxFOeI3uAPAjx42gkkcwSnTKs+EJsM+YepIPQBp2xK6vefqDKKdB8ig06qBHW/yNDuoPQ7Ivxh3HIL9FT4sOkaml81qKb07qxYeu70BM176PqCGVd6P2DGGbYYEZ9T+O0rsKAg86oOxOG1QCjLnMk+r+vn4U+vL/mZIZ0B6E5wfxfFp7QH8w/pW0PnGPHjQizlQK+C/TYKxQegKQpIo/f7I4QIKD7w0gpKHMHZ6fSdB2xGXUy+2kIB0Z6GAdgOA260Fk1k5GPvAQxI9rREakNg/CHuutCcLvJ+0rM2uYDVZbD7xe287FsSPNj+cXPpHAw3ljQj2BGkRCMKLSY9m9pumbUjLo5QQ6nWi59WPNU67DyqyTczTJyrozTP2VELQuktkVz8fHWPw/XZe6uD/89VMwrKYehUVkQvQCFBeg/T08eWHbD74ejMdI9nWuHIQNUKzyui0omfLRERSlaH7aSHyqErwreuPPAP0ZK+V8BfxmK0k1lunIj1rA1J9hv/PBy5dFs9gHqqkKSmFqJDkskHzapAiIcUvWvAtb810cbw6V8NSjtPtrA0XcdUoYkCCzyusnj7y29ftjwyURWqZsAD1PIBjV1ouHy1ysQb36f2aUuxxLiarHmrY/ejxTzeaiwikulPPLW4owHv6SPv7/4+iFPc7KVD3ULEczBrsaCMU2nGuiPqwNsBuubNC43CbJhDH/mtfz+gFVMr8cHWirmVcJDqEdppKBPq9t393W/zZUYqFtykoVzCKpj4kOGsiiYK45p6Nz8xh/+KTTRcZXH0fDYq4QX6NU+KY36bty1uKovDYlRN8NaAAzudsddtq7B4yzHSwIogBXVy+H2qJfBmUhm5Yu/w5GQkqDRPYnAE/D8YdP/3HXt6kzoZIuDulEShwnV7QkPuCAK4hT0dz/SPQxtcraEs8G/tfmTRTzA8uQuD4yQgFDP+5K1jJXyKCMF3dwlPww18NMc5jDmUAsb5VeGA5+TjUJZ4zJxp4x7GAU5JXnQtDWrvG723VnTy6KDcPgceeokp0IIhjixdCPOuh2Bz+HBQvDljN6QBc2sUSHpTlErT+yssr8ZoYeGWyZnzWiIDtSgNW4SdG/qFu1msPBp12Dk8St3gxr99hB9c9hE8y+FnAo95K3hEnpMC+yEZrte5+qqC61d17h2kApxB3LG0eAmHfWWMxPpNc4+CPSTShcXfQ4zEmRjTrN+uSETfsk43NRmUbkQcqcBqfvC5s+r+kvif5ZPVyU2FfkX6bTWuhmj3hEmMx0v9YUtx6b2F/ATcpTdmUfk9xjXsNZF04+YMRZTbgnOAZMRe2K8CJ4rOVAn1E3paVoshrrLIzHDZocdgyd2SY5JVgLjv80Vc0Xn7uaeb0Ty+xJr+ksB4GIELO3h5rqK1xR+LiHqJDdZEHH4cp5hk8NIH3aHcAji6E956UhOTXaAlv3w3ZMz8F4uC2fRYNwniuM+Ir+2V0eIXzgLxUVYzgvqYvnhHQdQ3D0Wg2M/x3wKGUkDvFE3dZNhURkGOE3gCVGc8425lqQACMqZBgRBYSQvD8qFiStOrtkSC3RJuD8EAaw5YqgzMpIGwIrfYq3JAsX8tPaultOJsECcyy4+d/GT7sEIYdpls0glgDrYAVarpj+EvhhtVXgJA5j+wFo4O4fXrnBssBmSoc6llRRyLiCuAlUiSoW5oJ9KQ+qAp2rg2cgbpmFu8sBahZcwwI75JWf8UbbftZTrnpaPzry35dQihXz50Jd40qP4KIgCqofSl8/HpYCyW342UxkaBxZ13HFnSWLLnzAAdvH7J9aDD3DVAb0garINuRII0q2Me3c0UBzwNsw53ifXISBlT4w+GJhrHHVM1sddEiW1LNl9dkPY7zRgEwSBPCvIg/yw87uT65LQRl39kRBpAz2Xe4Ele7paIj6ReAaIAgcirHHngtKHkoUfZAA8qlq8r7vX1gS8BwyzBsQNPOEUeRG2fvv3Jo2bN8OSlUitL3u75+chP193aXULD4UdevH1W0uKcJmXjD8gBPAGIgRsrQ4e6cN7GuieYAU4R4yYfN2Kd3qWJncej3WUMWqKdTiVQyaTwQWvFnPUKVV5lH+QAbBx64Li3wUd/TGNum9byVgFN4jpbMuqt/uuQZzxWFA2lBFHEZWXD9YpE/mO+RjqNJTMQxoAEbfcfsWvIPabXC9w05QD/2CJmM6h8egJK945vzRsxA/BatJQSRZlRx223F6U9lR5UA5ItdLydy8ciGnePgGxMSdAbsxztPWbbyscFzlh5d6LPw8zZx2Kliw//IHl4LZbJ8xNbkutp/UAhVh0W2Gtj7NOdClpWeQB8RXWxLqVe/taFN7XBVEGlAWHRYYqyIfQz7XOovmFtSPJNcBi6ZB/IoTRv7+/LUrEwKUxuILBRXfAMR9q+q6/OV3/sWhfs+fioohGNsCj5xJFHyMfj/gDVDsYvCWv9tc0B6/LK+IIH9jb3xhjdA3HA3VZcEYBzwC+JiefGpyu2nhHcFTvFbn0Rv6tfydU7TC6KcbETJyyB/TA0OS06cXbgg0D2oe5GEhgGER1a827oUcijDwjX+fBcPCOtLz7wk9oW4Hhr3/2JprTZwuPvi9m9NmRjVFCwK09xV37SxEglnlAkMeabg+mTXhKh2SYtQGw88PvWfMijtNiC1KYbADwBLlwwreMDSE6dUI3BwK+p5+toaM6Xnv0AzE1EoE/TRGyEly9LHXE0d3R7eFU52JA0+qe/4455FSXrHBqfVQGQCIoTMN+6/kYERASQ68nJDNYWIEhQhoRR+H57580h3zo9xuHoE9XXpDITUk4RMpjlEymUXsOvAd0A4TYtx1CZ8UJHNenunmSBvBUk8PuoqlxvvnV/m0uSQbyxGFR0X8uvjFGyHzO4eB5mKJGDKEsKRGEM436N+lQZJTHg4fhHwL2Fxbr9U/Pph1D4WbaNmoPSGXwk/2inAvnOYuLhfAA2of3lcCeuoMzhooZhLIDYKo2t2XArw7vSxqEtsLjtLW/nk+l9wxAGMVFzgyQzPvRNrHKtvmTNiezwZV96dx4JAPBcgPCR8R0Sg6bJnvq2Vqa+wOaZMHHov74+6LKiZMGSGTVEPeV4P0lkMNNgBrMJHIAIG7gRRV4c0EQS6OkG1rbIbEd1HTS+Mub6JGxkEvR/H/1GixGG+ou8QAAAABJRU5ErkJggg==";function Vr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=te.useState(y0),c=u=>{a(y0)};return te.useEffect(()=>{a(e||y0)},[e]),_.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[_.jsx("img",{src:o,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...s}),i&&_.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:jU})]})}function RU({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=Uo(),a=te.useMemo(()=>{if(n&&r)return n(r)},[r]),c=te.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return _.jsxs("div",{className:"cs-toast",children:[_.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[_.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&_.jsx("div",{children:_.jsx(kU,{})}),_.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&_.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&_.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&_.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&_.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&_.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&_.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&_.jsx(Dx,{text:"Confirmation is in progress. Check your transaction on here",keywords:["here"],text_highlight_color:"#72c1f7",onKeywordClick:()=>{window.open(o(i,"tx"),"_blank")}})]}),r==="rejected"&&_.jsxs(_.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&_.jsx("span",{children:"Something went wrong"})]}),r==="success"&&_.jsx(_.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),rl.map(u=>_.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:_.jsx(Vr,{src:u.img})},u.link))]})]}),_.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:_.jsx("use",{xlinkHref:"#icon-close"})})]})}const NU=ji((e,t)=>({toasts:[],setToasts:r=>{e(n=>({toasts:[...n.toasts,r]})),setTimeout(()=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r.id)}))},3e3)},removeToast:r=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r)}))}})),sa=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=NU(),i=(a,c="success")=>{const l={id:Date.now(),status:c,buildShowInfo:()=>({toastTitleText:a})};r(l)},s=a=>{const c=Date.now();return a.id=c,r(a),c},o=te.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),Bn.createPortal(_.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>_.jsx(RU,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}},bJ="";function DU(){const{mevProtect:e,setMevProtect:t}=Dr();return _.jsxs(dn.Root,{children:[_.jsx(dn.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:_.jsx("use",{xlinkHref:"#icon-mev"})})})}),_.jsx(dn.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:_.jsxs("div",{className:"mev-settings-box",children:[_.jsxs("div",{className:"mev-setting-title",children:[_.jsxs("div",{className:"name",children:[_.jsx("img",{src:Ft("/images/icon_mev@2x.png")}),_.jsx("span",{children:"MEV Protect"})]}),_.jsx(N6,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),_.jsx("p",{className:"mev-tips",children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."})]})})]})}function $U({onClick:e}){const[t,r]=te.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return _.jsx("div",{className:"refresh-button",children:_.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:_.jsx("use",{xlinkHref:"#icon-refresh"})})})}const wJ="",_J="";function b0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(VS,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function BU(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Dr();return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsxs("span",{children:[r,"%"]})]}),t&&_.jsx(LU,{onClose:()=>e(!1)})]})}function LU({onClose:e}){const{slippage:t,setSlippage:r}=Dr(),[n,i]=te.useState(t),s=u=>{i(u.display)},o=u=>{const l=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");u.target.value=u.target.value.replace(l,"$1"),i(u.target.value)},a=()=>{n&&r(n),e()},c=te.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),_.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:_.jsxs("div",{className:"slippage-settings",children:[_.jsxs("div",{className:"slippage-settings-header",children:[_.jsx("div",{className:"title",children:"Settings"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsx("span",{children:"Slippage Tolerance"})]}),_.jsxs("div",{className:"form-box",children:[_.jsx("div",{className:"slippage-tab-list",children:rD.map(u=>_.jsxs("span",{className:u.display===n?"active":"",onClick:()=>s(u),children:[u.display," %"]}))}),_.jsxs("div",{className:"input-box",children:[_.jsx("span",{children:"Custom"}),_.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:o}),_.jsx("div",{style:{fontSize:"14px",color:"#fff"},children:"%"})]})]}),Number(n)<=.05&&_.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&_.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&_.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),_.jsx(b0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function FU({handleRefresh:e}){return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-header",children:[_.jsx("h3",{className:"swap-title",children:"Swap"}),_.jsxs("div",{className:"right",children:[_.jsx(BU,{}),_.jsx(DU,{}),_.jsx($U,{onClick:e})]})]})})}const xJ="",SJ="";function UU(){const[e,t]=te.useState(!1);return _.jsxs(dn.Root,{open:e,onOpenChange:t,children:[_.jsx(dn.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(dn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"cs-settings-box",children:[_.jsx("h3",{children:"Settings"}),_.jsx(zU,{}),_.jsx(qU,{onClose:()=>{t(!1)}})]})})]})}function zU(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Dr(),i=s=>{console.log("🚀 ~ file: SettingsButton.tsx:32 ~ handleSelectExplorer ~ value:",s),t(s)};return _.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-plorer"})}),_.jsx("span",{children:"Preferred Explorer"})]}),_.jsx("div",{className:"explorer-checkbox-group",children:rl.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(El,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]}))})]})}const VU=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function qU({onClose:e}){const{addTxToast:t}=sa(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Dr(),[a,c]=te.useState(i),[u,l]=te.useState(r),f=w=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${w}`})})},h=w=>{l(w),w.isCustom||(n(w),f(w.link),e())},y=w=>{c(w.target.value)},b=()=>{if(a){const w={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(w),f(a),e()}};return _.jsxs("div",{className:"settings-card rpc-settings-card",children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})}),_.jsx("span",{children:"RPC Node"})]}),_.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(w=>_.jsxs("div",{className:"rpc-item",onClick:()=>h(w),children:[_.jsx(El,{color:"indigo",checked:u.name===w.name,variant:"soft",className:"cs-checkbox"}),_.jsx("span",{children:w.name})]})),u.isCustom&&_.jsxs("div",{className:"custom-rpc-input-box",children:[_.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),_.jsx(b0,{btnIsDisabled:VU(a),text:"Save",onClick:b})]})]})]})}const EJ="",Rn=ji((e,t)=>({accounts:[],currentAccount:void 0,isOpenWalletModal:!1,saveCurrentAccount:r=>{e({currentAccount:r})},saveAccounts:r=>{e({accounts:r})},onWalletModal:r=>{e({isOpenWalletModal:r})},isOpenAccountList:!1,setIsOpenAccountList:r=>{e(()=>({isOpenAccountList:r}))},tokenBalanceObj:{},setTokenBalanceObj:r=>{e(()=>({tokenBalanceObj:r}))}}));var WU=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));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||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},GU=WU,qS={"text/plain":"Text","text/html":"Url",default:"Text"},HU="Copy to clipboard: #{key}, Enter";function KU(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function XU(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=GU(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=qS[t.format]||qS.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(l){r&&console.error("unable to copy using execCommand: ",l),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=KU("message"in t?t.message:HU),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var JU=XU;const WS=ha(JU);function YU({currentAccount:e}){const{mutate:t}=Br.useSwitchAccount(),r=Br.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Rn(),s=()=>{i(!n)};te.useEffect(()=>()=>{i(!1)},[]);const o=te.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);te.useEffect(()=>{console.log("🚀 ~ file: AccountSwitch.tsx:26 ~ accountList:",o)},[o]);const a=c=>{t({account:c},{onSuccess:()=>console.log(`switched to ${c.address}`)})};return _.jsxs("div",{className:"cs-account-switch",children:[_.jsxs("div",{className:"account",onClick:s,children:[_.jsx("span",{children:Gs(e)}),(o==null?void 0:o.length)>0&&_.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})})]}),_.jsx("div",{className:`account-list ${n?"open":"close"}`,children:o.map(c=>_.jsxs("div",{className:"account-item",children:[_.jsxs("div",{className:"left",children:[_.jsx("div",{className:"label",children:c==null?void 0:c.label}),_.jsx("div",{className:"address",children:Gs(c==null?void 0:c.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}function ZU({connect:e}){const t=Br.useCurrentAccount();return te.useEffect(()=>{console.log("TriggerButton currentAccount: ",t)},[t]),_.jsx("div",{children:t?_.jsx(QU,{}):_.jsx(b0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})}function QU(){const{mutate:e}=Br.useDisconnectWallet(),t=Br.useCurrentAccount(),{currentWallet:r}=Br.useCurrentWallet(),{addCommonToast:n}=sa(),{getExplorerUrl:i}=Uo(),s=()=>{t&&(WS(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return te.useEffect(()=>{console.log("TriggerButton currentWallet: ",r)},[r]),_.jsxs(dn.Root,{children:[_.jsx(dn.Trigger,{children:_.jsxs("div",{className:"cs-connected-button",children:[_.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),_.jsx("span",{children:Gs(t==null?void 0:t.address)})]})}),_.jsx(dn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"account-op-box",children:[_.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),_.jsx(YU,{currentAccount:t==null?void 0:t.address}),_.jsxs("div",{className:"account-op-item",onClick:s,style:{marginTop:"12px"},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-copy"})}),_.jsx("span",{children:"Copy address"})]}),_.jsxs("div",{className:"account-op-item",onClick:o,children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-link"})}),_.jsx("span",{children:"Open explorer"})]}),_.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-disconnect"})}),_.jsx("span",{children:"Disconnect"})]})]})})]})}function ez(){Br.useCurrentAccount(),Br.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Rn();return Br.useWallets(),_.jsx(_.Fragment,{children:_.jsx(Br.ConnectModal,{trigger:_.jsx(ZU,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function tz({independentWallet:e,customWallet:t}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:Ft("/images/logo@2x.png"),className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(ez,{}),_.jsx(UU,{})]})]}),_.jsx("div",{style:{marginTop:"20px"}})]})}const CJ="",GS=()=>{const e=te.useRef(null);te.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"#75C8FF",boxShadow:"0px 0px 20px 2px #75C8FF",borderRadius:"50%"};return _.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:_.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>_.jsx("div",{style:t(i),children:_.jsx("div",{style:r})},i))})})};function rz({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=te.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(nz,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(iz,{info:s,status:r,tx:i,onClose:e})]})}function nz({info:e,status:t}){return _.jsxs("div",{className:"progress-dialog",children:[_.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),_.jsx("div",{className:"loading-box",children:_.jsx(GS,{})}),_.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),_.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function iz({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Uo();return _.jsxs("div",{className:"finally-status-dialog",children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[_.jsx("div",{className:"status-icon-box",children:_.jsx("div",{className:"status-icon",children:_.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?_.jsx("use",{xlinkHref:"#icon-sel"}):_.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?_.jsx("span",{children:"Swap Success"}):_.jsx("span",{children:"Swap failed"})]}),_.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),rl.map(s=>_.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:_.jsx("img",{src:s.img})},s.link))]})]}),_.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function Fl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await QN(`${i||il.api}${t}`,n):await eD(`${i||il.api}${t}`,n)}catch(s){throw console.log("🚀 ~ file: useFetch.tsx:6 ~ fetchByApi ~ error:",s),s}}}}function sz(){const{fetchByApi:e}=Fl(),{setProviders:t}=Dr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i),console.log("🚀 ~ file: useGetRouterConfig.ts:13 ~ fetchRouterConfig ~ res:",n)}catch(n){console.log("🚀 ~ file: useGetRouterConfig.ts:18 ~ fetchRouterConfig ~ error:",n)}}}}function oz({interval:e,callback:t}){const r=te.useRef(),n=te.useRef(null);te.useEffect(()=>{r.current=t},[t]);const i=te.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=te.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return te.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Zs=ji((e,t)=>({suiClient:new Ca({url:il.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new nx,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),_c=ji((e,t)=>({requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=new Map(n);s.set(Or(r.coin_type).full_address,r);const o=i.filter(a=>a!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...o]})),ki.setItem(bp,s)},tokenMap:new Map,setTokenMap:(r,n=!1)=>{e(()=>({tokenMap:r})),n||ki.setItem(bp,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||ki.setItem(Ax,r)}}));ki.getItem(bp).then(e=>{e!==null&&_c.getState().setTokenMap(e,!0)}),ki.getItem(Ax).then(e=>{e!==null&&_c.getState().setTrustedTokenList(e,!0)});function az(e,t){return{id:e.id||void 0,logo_url:e.iconUrl||void 0,coin_type:t,decimals:e.decimals,description:e.description,name:e.name,symbol:e.symbol}}function vs(){const{suiClient:e}=Zs(),{fetchByApi:t}=Fl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=_c(),c=async()=>{var b;const f=await t("/v2/sui/coins_info","GET");console.log("🚀 ~ file: useGetTokens.ts:8 ~ getTokens ~ res:",f);const h=[],y=(b=f==null?void 0:f.list)==null?void 0:b.reduce((w,A)=>(w.set(A.coin_type,A),A.is_trusted&&h.push({...A,coin_type:Or(A.coin_type).full_address}),w),new Map);console.log("🚀 ~ file: useTokens.ts:42 ~ getTokens ~ trustedTokenList:",h),y&&(y.set("0x2::sui::SUI",{...y.get("0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"),coin_type:"0x2::sui::SUI"}),r(y),a(h))},u=async f=>{try{const h=l(f);if(h)return h;if(s.includes(f))return;o(f);const y=await e.getCoinMetadata({coinType:f});if(y){ox(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=az(y,f);return i(b),console.log("🚀 ~ file: useToken.ts:38 ~ fetchTokenInfo ~ token:",b,s),b}}catch(h){console.log("🚀 ~ file: useToken.ts:44 ~ fetchTokenInfo ~ error:",h)}},l=te.useCallback(f=>{if(f)return n.get(Or(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Ul(e){const{suiClient:t}=Zs(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Rn(),{fetchTokenInfo:s}=vs(),[o,a]=te.useState([]),{tokenMap:c}=_c(),u=async(y=(r==null?void 0:r.address)||"",b)=>{try{if(!y){l();return}let w=[];b?w=[await t.getBalance({owner:y,coinType:b})]:w=[...await t.getAllBalances({owner:y})],a(w)}catch(w){console.log("getOwnerCoinBalances ~ error:",w),a([])}},l=()=>{n({})};te.useEffect(()=>{(o==null?void 0:o.length)>0&&(c!=null&&c.size)&&f(o)},[o,c]);const f=async y=>{const b={};for(let w=0;w<(y==null?void 0:y.length);w++)try{const A=y[w],P=await s(A.coinType),R=GN(A.totalBalance,P==null?void 0:P.decimals),N=cn(R,4);b[Or(A.coinType).full_address]={...A,displayBalance:N,totalBalanceFormat:R}}catch{continue}n(b)},h=te.useMemo(()=>{if(e&&r)return i[e]||i[Or(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const hn=ji((e,t)=>({isOpenTokensDialog:!1,defaultFromCoinType:void 0,defaultToCoinCoinType:void 0,isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,setDefaultCoin:(r,n)=>{e(()=>({defaultFromCoinType:r,defaultToCoinCoinType:n}))},setFromCoin:r=>{e(()=>({fromCoin:r}))},setToCoin:r=>{e(()=>({toCoin:r}))},setFromAmount:r=>{e(()=>({fromAmount:r}))},setToAmount:r=>{e(()=>({toAmount:r}))},setRouterData:r=>{e(()=>({routerData:r}))},setFindRouterLoading:r=>{e(()=>({findRouterLoading:r}))},setByAmountIn:r=>{e(()=>({byAmountIn:r}))},setIsOpenSecondary:r=>{e(()=>({isOpenSecondary:r}))},setIsOpenTokensDialog:r=>{e(()=>({isOpenTokensDialog:r}))}})),cz={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},HS={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},KS=cz;function uz(e,t){const{fetchTokenInfo:r}=vs(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=hn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Dr(),u=te.useRef({}),l=async(h,y)=>{const b=h?await r(h):HS,w=y?await r(y):KS;n(b),i(w),s(b==null?void 0:b.coin_type,w==null?void 0:w.coin_type)},f=(h,y)=>{const b=[nl[0]];let w=nl[0];h.forEach(A=>{const P={name:A,link:A,isCustom:!1};b.push(P),A===y&&(w=P)}),a([...b,{name:"Custom RPC URL",link:"",isCustom:!0}]),console.log("🚀 ~ file: useInitWidget.ts:51 ~ handleInitRpcList ~ defaultRpcInfo:",w),c(w)};return te.useEffect(()=>{if(!yp(e,u.current)){const{defaultFromToken:h,defaultToToken:y,defaultSlippage:b,customRpcList:w,defaultRpc:A}=e;l(h,y),b&&o(b),(w==null?void 0:w.length)>0&&f(w,A),u.current=e}},[e]),{handleSetDefaultPair:l}}function lz(){const{currentRpc:e}=Dr(),{setSuiClient:t,setAggregatorSDK:r}=Zs(),{currentAccount:n}=Rn();te.useEffect(()=>{if(e){const i=new Ca({url:e.link});t(i)}},[e]),te.useEffect(()=>{if(e){const i=new nx(il.aggregatorUrl,(n==null?void 0:n.address)||void 0,new Ca({url:e.link}),KR.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const XS=ji((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Or(i).full_address]}),e({coinPriceObj:{...n}})}}));function zl(){const{fetchByApi:e}=Fl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=XS(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>qs(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Or(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=te.useCallback(a=>{if(!a)return;const c=t[Or(a).full_address];if(c)return c},[t]),o=te.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Le(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const w0=ji((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),xr=[];for(let e=0;e<256;++e)xr.push((e+256).toString(16).slice(1));function fz(e,t=0){return(xr[e[t+0]]+xr[e[t+1]]+xr[e[t+2]]+xr[e[t+3]]+"-"+xr[e[t+4]]+xr[e[t+5]]+"-"+xr[e[t+6]]+xr[e[t+7]]+"-"+xr[e[t+8]]+xr[e[t+9]]+"-"+xr[e[t+10]]+xr[e[t+11]]+xr[e[t+12]]+xr[e[t+13]]+xr[e[t+14]]+xr[e[t+15]]).toLowerCase()}let _0;const dz=new Uint8Array(16);function hz(){if(!_0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");_0=crypto.getRandomValues.bind(crypto)}return _0(dz)}const JS={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function YS(e,t,r){if(JS.randomUUID&&!t&&!e)return JS.randomUUID();e=e||{};const n=e.random||(e.rng||hz)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return fz(n)}var Qs=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Qs||{});const pz=new Ca({url:mm("mainnet")}),mz=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],gz=["deny_list","DenyList","DenyCap","create_regulated_currency"],vz={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},yz=async e=>{let t=!1;if(mz.includes(e))return t;const r=e.split("::"),n=r[0]&&Lr(r[0]),i=r[1],s=await pz.getObject({id:n,options:vz}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(gz.join("|"),"i").test(o)&&(t=!0),t},bz=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>qs(i,!1)))==null?void 0:n.join(",")};function wz(){const{fetchByApi:e}=Fl(),t=async n=>{try{const i={...n},s=bz(n==null?void 0:n.coin_type);s&&(i.coin_type=s);const o=await e("/v2/sui/stats_pools","GET",i);if(o!=null&&o.lp_list)return{list:(o==null?void 0:o.lp_list)||[],total:o==null?void 0:o.total}}catch(i){return console.error("getPoolList ~ Error:",i),await r(n)}return{list:[],total:0}},r=async n=>{var i,s,o,a;try{const c=Ft("/data/pools.json"),u=await fetch(c).then(l=>l.json());if((i=u==null?void 0:u.data)!=null&&i.lp_list){const l=(s=u==null?void 0:u.data)==null?void 0:s.lp_list;let f=l;if(n!=null&&n.coin_type){const y=(a=(o=n==null?void 0:n.coin_type)==null?void 0:o.split(","))==null?void 0:a.map(b=>rc(b).source_address);f=l==null?void 0:l.filter(b=>{var P,R;const w=rc((P=b==null?void 0:b.coin_a)==null?void 0:P.address).source_address,A=rc((R=b==null?void 0:b.coin_b)==null?void 0:R.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(w)&&y.includes(A)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(w)||y.includes(A)))})}n!=null&&n.is_vaults&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.is_vaults)),n!=null&&n.has_farming&&!(n!=null&&n.is_vaults)&&!(n!=null&&n.has_mining)&&!(n!=null&&n.no_incentives)&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.has_farming));const h=f;return{list:h,total:(h==null?void 0:h.length)||0}}}catch(c){console.error("getLocalJsonPoolList Error:",c)}return{list:[],total:0}};return{getPoolList:t,getLocalJsonPoolList:r}}function _z(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Dr(),{getPoolList:n,getLocalJsonPoolList:i}=wz();return{getPoolListByCoinType:async(o,a)=>{if(o&&a){const c=[o,a].sort(),u=`${c[0]}_${c[1]}`,l=t[u];if(l)return l;const f={coin_type:`${o},${a}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let h=e?await i(f):void 0;(h===void 0||h.list.length===0)&&(h=await n(f));const y=h.list;if(y.length>0)return t[u]=y,r(u,y),y}return[]}}}function xz(e){const{routerData:t}=hn();return{priceAcceptRouterData:te.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Le(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Le(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function ZS(e,t){return{amountLimit:te.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Le(s).mul(Le(1).sub(Le(e).div(100))).toString():Le(i).mul(Le(1).add(Le(e).div(100))).toString()}},[e,t])}}function Sz(e){const{getTokenInfo:t,fetchTokenInfo:r}=vs();return{formatSwapRouter:te.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Le(0);if(e.routerData.routes.forEach((l,f)=>{const h={},y=e.byAmountIn?l.amountIn.toString():l.amountOut.toString();f===e.routerData.routes.length-1?h.percentage=Le(1).sub(c).toFixed(2):h.percentage=Le(y).div(s).toFixed(2),c=Le(c).add(h.percentage);const b=[];l.path.forEach(w=>{i.includes(w.provider)||i.push(w.provider);const A=Or(w.from).full_address,P=Or(w.target).full_address,R=t(A),N=t(P);R||a.includes(A)&&a.push(A),N||a.includes(P)&&a.push(P);const F=w.provider===sc.SCALLOP||w.provider===sc.FLOWX||w.provider===sc.FLOWXV3;b.push({from_type:A,to_type:P,pool_address:F?"":w.id,fee_rate:w.feeRate,provider:w.provider})}),h.paths=b,o.push(h)}),a.length>0)for(const l in a)r(l);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:o}}},[e])}}function Ez(){const{fromCoin:e,toCoin:t}=hn(),{getPoolListByCoinType:r}=_z();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function QS(e,t,r){return te.useMemo(()=>t&&r&&+t&&+r?e?Le(r).div(t).toString():Le(t).div(r).toString():"0",[t,r,e])}function e8(e){const[t,r]=te.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await yz(i.coin_type)}catch(s){console.log("🚀 ~ file: useCheckTokenScamsAlert.ts:19 ~ checkTokenScams ~ error:",s)}return!1};return te.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function Cz(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=hn(),{getTokenInfo:i}=vs(),{ignoreWarnTokenMap:s}=Dr(),o=i(e),a=i(t),c=te.useMemo(()=>!tl(r,HS.coin_type)||!tl(n,KS.coin_type),[r,n]),u=te.useCallback(f=>(console.log("🚀 ~ file: useSwapHelper.ts:287 ~ ignoreWarnTokenMap:",s),console.log("🚀 ~ file: useSwapHelper.ts:287 ~ coin:",f),f&&!s[qs(f.coin_type)]&&(tl(r,f.coin_type)||tl(n,f.coin_type))?!f.is_trusted:!1),[r,n,s]),l=te.useMemo(()=>{const f=[];return c&&(o&&u(o)&&f.push({...o}),a&&u(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:l}}function Tz(){const{aggregatorSDK:e}=Zs(),{getSwapPoolAddress:t}=Ez(),r=s=>s&&s.error?s.error.code===Qs.InsufficientLiquidity||Qs.HoneyPot||Qs.NumberTooLarge:!1,n=async s=>{const{fromToken:o,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:f}=s;try{const h={from:o.coin_type,target:a.coin_type,amount:new w2(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u};console.log("🚀 ~ file: useFindBestRouting.ts:26 ~ findBestRouters ~ routerParams:",h);const y=await e.findRouters(h);if(console.log("🚀 ~ file: useFindBestRouting.ts:145 ~ findBestRouters ~ res:",y),y&&r(y))return i(!1,l,f,o,a,y);if(!y||y.routes.length===0)throw Error("not find router");return i(!1,l,f,o,a,y)}catch(h){console.log("🚀 ~ file: useFindBestRouting.ts:105 ~ findRouters ~ error:",h);const y=await t(),b={from:o.coin_type,target:a.coin_type,amount:new w2(c),byAmountIn:l,pools:y};console.log("🚀 ~ file: useFindBestRouting.ts:115 ~ findRouters ~ routerParams:",b);try{const w=await e.swapInPools(b);return console.log("🚀 ~ file: useFindBestRouting.ts:170 ~ swapInPools ~ res:",w),!w||!w.routeData?i(!0,l,f,o,a):i(!0,l,f,o,a,w.routeData)}catch(w){return console.log("🚀 ~ file: useFindBestRouting.ts:120 ~ swapInPools ~ error:",w),{uuid:f,byAmountIn:l,isDegrade:!0}}}},i=(s,o,a,c,u,l)=>{var f;if(console.log("🚀 ~ file: useSwap.ts:166 ~ handleRouterData ~ res:",{isDegrade:s,routerData:l}),l){const h=l.error!==void 0,y=vp(l.amountIn.toString(),c.decimals).toString(),b=vp(l.amountOut.toString(),u.decimals).toString();return{routerData:h?void 0:l,fromAmountUi:h?o?y:"":y,toAmountUi:h&&o?"":b,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=l.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function oa(e){const t=te.useRef(e);return te.useEffect(()=>{t.current=e},[e]),t}function Mz(e){try{return e&&e.toString().includes("Rejected from user")}catch(t){return console.log("🚀 ~ file: common.ts:214 ~ isUserRejectedError ~ error:",{error:e,error1:t}),!1}}function Az(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function Oz(e){return!!String(e).includes("Could not find the referenced transaction")}function Iz(e){return Mz(e)?"User rejected the request":Az(e)?"Exceeded price slippage":Oz(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var x0={};Object.defineProperty(x0,"__esModule",{value:!0});var Pz=x0.executeAuction=t8,kz=s_,jz="https://rpc.getshio.com",Rz=500,Nz=300;function t8(e,t,r){r===void 0&&(r=Rz);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),kz.default.post(jz,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,Nz)}).catch(s)})}x0.default={executeAuction:t8};function Dz(){const{suiClient:e}=Zs(),{currentAccount:t}=Rn(),{mutateAsync:r}=Br.useSignTransaction(),{mutate:n}=Br.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=te.useMemo(()=>t==null?void 0:t.chains[0],[t]),s=async(c,u,l=!1)=>{var h,y;if(l){const b=await e.devInspectTransactionBlock({transactionBlock:To.Transaction.from(vn(c)),sender:t.address});if(console.log("devInspectTransactionBlock:",b),!b||((h=b.effects)==null?void 0:h.status.status)==="failure")throw Error((y=b.effects)==null?void 0:y.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:u,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,u=!1)=>{var f,h;let l;if(typeof c=="string"?l=To.Transaction.from(c):l=c,console.log("chain: ",{chain:i,transactionBlock:c}),u){const y=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(console.log("devInspectTransactionBlock:",y),!y||((f=y.effects)==null?void 0:f.status.status)==="failure")throw Error((h=y.effects)==null?void 0:h.status.error)}return l.setGasBudget(1e8),console.log("🚀 ~ file: useSigner.ts:71 ~ signTransactionBlock ~ transactionBlock:",c),new Promise((y,b)=>{n({transaction:l,chain:i},{onSuccess:w=>{console.log(" signAndExecuteTransactionBlock executed transaction",w),y(w)},onError:w=>{console.error("signAndExecuteTransactionBlock transaction failed",w),b(w)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=To.Transaction.from(c)),typeof c=="string"&&(c=To.Transaction.from(vn(c))),console.log("🚀 ~ file: useSigner.ts:105 ~ signTransactionBlock ~ transactionBlock:",{transactionBlock:c,chain:i}),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:f=>{console.log("signTransactionBlock result",f),u(f)},onError:f=>{console.error("signTransactionBlock failed",f),l(f)},onSettled:(f,h,y,b)=>{console.error("signTransactionBlock onSettled",{data:f,error:h,variables:y})}})})),executeTransactionBlock:s}}function $z(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=Dz(),{currentAccount:n}=Rn(),{suiClient:i}=Zs(),{setTransactionData:s}=w0(),{addTxToast:o,removeToast:a}=sa(),c=5,u=2e3;async function l(y,b=1){console.log("🚀 ~ file: useTransaction.tsx:24 ~ getTransactionStatus ~ Checking transaction status, attempt:",b);try{let w;try{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0}})}if(console.log("🚀 ~ file: useTransaction.tsx:28 ~ getTransactionStatus ~ response:",w),w)return w;throw new Error("Empty response")}catch(w){if(console.error(`Attempt ${b} failed:`,w),b>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await Tx(u),l(y,b+1)}}const f=async(y,b,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:A=!1,useMev:P,txAction:R="signTransactionBlock"}=w;console.log("🚀 ~ file: useTransaction.tsx:76 ~ useTransaction ~ option:",{useDevInspect:A,useMev:P,txAction:R,tx:y,toastType:b});let N;b.status="confirmation",s(b);try{let G;if(R==="signTransactionBlock"){const X=await e(y);console.log("🚀 ~ file: useTransaction.tsx:94 ~ useTransaction ~ signTx:",X);const{bytes:ie,signature:ae}=X;if(P)try{const ce=await Pz(ie,ae,500);console.log("🚀 ~ file: useTransaction.tsx:92 ~ useTransaction ~ shioRes: success",ce)}catch(ce){console.log("🚀 ~ file: useTransaction.tsx:95 ~ useTransaction ~ shioRes : error:",ce)}console.log("🚀 ~ useTransaction ~ useMev:",P),G=await t(ie,ae,A),console.log("🚀 ~ useTransaction ~ response:",G)}else G=await r(y,A);console.log("🚀 ~ file: useTransaction.tsx:24 ~ signAndExecuteTransaction ~ response:",G),b.status="submitted",s({...b}),b.tx=G.digest,N=o(b),await Tx(u);const q=await l(G.digest,0);if(!q||((F=q.effects)==null?void 0:F.status.status)==="failure")h(b,(L=q.effects)==null?void 0:L.status.error);else{const X=ZN(q,n==null?void 0:n.address,!1);if(console.log("🚀 ~ file: useTransaction.tsx:48 ~ signAndExecuteTransaction ~ balanceChanges:",X),b.buildShowInfo){const ie=b.buildShowInfo("success",X);b.buildShowInfo=ae=>ie}a(N),b.status="success",s({...b})}return q}catch(G){console.log("🚀 ~ file: useTransaction.tsx:144 ~ useTransaction ~ error:",G),h(b,G)}},h=(y,b)=>{console.log("🚀 ~ file: useTransaction.tsx:114 ~ handleError ~ error:",b);const w=Iz(b);if(y.buildShowInfo){const A=y.buildShowInfo("confirmation");y.buildShowInfo=P=>(A.toastDescriptionContent=w,A.modalDescriptionText=w,A),y.status="rejected",s({...y})}else y.buildShowInfo=A=>{const P={};return P.toastDescriptionContent=w,P.modalDescriptionText=w,P},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function S0(e,t=1e3){const r=te.useRef(),n=te.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return te.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function Bz(){const{aggregatorSDK:e}=Zs(),{findBestRouters:t}=Tz(),{getTokenAmountValue:r,fetchTokenPrices:n}=zl(),{providers:i,slippage:s,mevProtect:o}=Dr(),{signAndExecuteTransaction:a}=$z(),{setTransactionData:c}=w0(),{addTxToast:u}=sa(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:w,toAmount:A,setFromAmount:P,setFindRouterLoading:R,setRouterData:N,setByAmountIn:F,byAmountIn:L}=hn(),[G,q]=te.useState(""),X=oa(G),ie=oa(L),ae=oa(w),ce=oa(A),V=oa(l),D=oa(f),{balanceInfo:p,getOwnerCoinBalances:d}=Ul(l==null?void 0:l.coin_type),{balanceInfo:m}=Ul(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),T=r(f==null?void 0:f.coin_type,A),O=S0(async(Se,Ge,Ue)=>{if(V.current&&D.current&&+Se){(+ae.current||+ce.current)&&R(!0);const lt=XN(Se,Ge?V.current.decimals:D.current.decimals),ht=await t({fromToken:V.current,toToken:D.current,amount:lt.toString(),providersKeys:i,by_amount_in:Ge,uuid:Ue});R(!1),X.current===Ue&&(Ge?+ae.current?(b(ht.toAmountUi||""),N(ht)):b(""):+ce.current?(P(ht.fromAmountUi||"ß"),N(ht)):P(""))}else v(!Ge)},500),C=(Se,Ge,Ue=!1)=>{if(F(Ge),Ge?(P(Se),Ue&&b("")):(b(Se),Ue&&P("")),+Se){const lt=YS();q(lt),O(Se,Ge,lt)}else R(!1),N(void 0),v(!Ge)},g=(Se,Ge=!0)=>{v(),Ge?((Se==null?void 0:Se.coin_type)===(f==null?void 0:f.coin_type)&&y(l),h(Se)):((Se==null?void 0:Se.coin_type)===(l==null?void 0:l.coin_type)&&h(f),y(Se))},v=Se=>{Se===void 0?(P(""),b("")):Se?P(""):b(""),R(!1),N(void 0)},k=()=>{const Se=ie.current?ae.current:ce.current;if(console.log("🚀 ~ file: useSwap.ts:273 ~ reCalculateRouteData ~ amount:",Se,ie.current,ae.current,ce.current),+Se){const Ge=YS();q(Ge),O(Se,ie.current,Ge)}},ee=async(Se,Ge)=>{console.log("🚀 ~ file: useSwap.ts:224 ~ doSwapAction ~ partner:",Ge);const{routerData:Ue,byAmountIn:lt,fromAmountUi:ht,toAmountUi:$e}=Se,mt=new To.Transaction,_e={routers:Ue.routes,byAmountIn:lt,slippage:Number(s)/100,txb:mt};Ge&&(_e.partner=Ge);try{console.log("🚀 ~ file: useSwap.ts:304 ~ doSwapAction ~ params:",_e),await e.fastRouterSwap(_e);const ge={status:"confirmation",buildShowInfo:(We,De)=>{const Oe=`Swap ${cn(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${cn($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(We==="success"){let Fe=ht,ft=$e;De&&(Fe=Mx(De,l)||ht,ft=Mx(De,f)||$e);const dt=`Swapped ${cn(Fe,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${cn(ft,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Ie.toastTitleText=dt,Ie.modalDescriptionText=dt}return Ie},id:0};c(ge),await a(mt,ge,{useMev:o})?(v(),d()):k()}catch(ge){String(ge).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Ae,We){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};te.useEffect(()=>{se(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const se=()=>{const Se=[];l&&Se.push(l.coin_type),f&&Se.push(f.coin_type),Se.length>0&&n(Se)},{isScamsCoin:he}=e8(l),{isScamsCoin:ye}=e8(f),Ee=te.useMemo(()=>{if(!(!he&&!ye)){if(he&&ye)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(he)return`${l==null?void 0:l.symbol} token is `;if(ye)return`${f==null?void 0:f.symbol} token is `}},[he,ye]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:T,doSwapAction:ee,reCalculateRouteData:k,refreshMarketPrice:se,scamsText:Ee}}function Lz(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=hn(),{currentAccount:o}=Rn(),a=te.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(s&&s.errorCode){if(s.errorCode===Qs.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Qs.NoRouter||s.errorCode===Qs.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Le(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${un(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function r8({size:e="24px",strokeWidth:t="10",color:r="#909ca4",emptyColor:n="transparent",gapPercentage:i=.5}){const s=50-parseFloat(t),o=2*Math.PI*s,a=o*i,c=o-a;return _.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:n,strokeWidth:t}),_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:r,strokeWidth:t,strokeDasharray:`${c} ${a}`,strokeDashoffset:"0",strokeLinecap:"round",style:{animation:"dash 0.5s linear infinite"}}),_.jsx("style",{children:`
|
|
97
|
+
`)},LL=0,ra=[];function UL(e){var t=I.useRef([]),r=I.useRef([0,0]),n=I.useRef(),i=I.useState(LL++)[0],s=I.useState(o6)[0],o=I.useRef(e);I.useEffect(function(){o.current=e},[e]),I.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=aL([e.lockRef.current],(e.shards||[]).map(h6),!0).filter(Boolean);return w.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(w,A){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var P=jl(w),N=r.current,R="deltaX"in w?w.deltaX:N[0]-P[0],U="deltaY"in w?w.deltaY:N[1]-P[1],L,G=w.target,q=Math.abs(R)>Math.abs(U)?"h":"v";if("touches"in w&&q==="h"&&G.type==="range")return!1;var X=u6(q,G);if(!X)return!0;if(X?L=q:(L=q==="v"?"h":"v",X=u6(q,G)),!X)return!1;if(!n.current&&"changedTouches"in w&&(R||U)&&(n.current=L),!L)return!0;var ie=n.current||L;return DL(ie,A,w,ie==="h"?R:U,!0)},[]),c=I.useCallback(function(w){var A=w;if(!(!ra.length||ra[ra.length-1]!==s)){var P="deltaY"in A?d6(A):jl(A),N=t.current.filter(function(L){return L.name===A.type&&(L.target===A.target||A.target===L.shadowParent)&&$L(L.delta,P)})[0];if(N&&N.should){A.cancelable&&A.preventDefault();return}if(!N){var R=(o.current.shards||[]).map(h6).filter(Boolean).filter(function(L){return L.contains(A.target)}),U=R.length>0?a(A,R[0]):!o.current.noIsolation;U&&A.cancelable&&A.preventDefault()}}},[]),u=I.useCallback(function(w,A,P,N){var R={name:w,delta:A,target:P,should:N,shadowParent:FL(P)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(U){return U!==R})},1)},[]),l=I.useCallback(function(w){r.current=jl(w),n.current=void 0},[]),f=I.useCallback(function(w){u(w.type,d6(w),w.target,a(w,e.lockRef.current))},[]),h=I.useCallback(function(w){u(w.type,jl(w),w.target,a(w,e.lockRef.current))},[]);I.useEffect(function(){return ra.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,ta),document.addEventListener("touchmove",c,ta),document.addEventListener("touchstart",l,ta),function(){ra=ra.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,ta),document.removeEventListener("touchmove",c,ta),document.removeEventListener("touchstart",l,ta)}},[]);var y=e.removeScrollBar,b=e.inert;return I.createElement(I.Fragment,null,b?I.createElement(s,{styles:BL(i)}):null,y?I.createElement(OL,{gapMode:e.gapMode}):null)}function FL(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const zL=gL(i6,UL);var p6=I.forwardRef(function(e,t){return I.createElement(Il,oi({},e,{ref:t,sideCar:zL}))});p6.classNames=Il.classNames;const VL=p6;function qL(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var t0="ScrollArea",[m6,sJ]=zo(t0),[WL,ln]=m6(t0),g6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=I.useState(null),[u,l]=I.useState(null),[f,h]=I.useState(null),[y,b]=I.useState(null),[w,A]=I.useState(null),[P,N]=I.useState(0),[R,U]=I.useState(0),[L,G]=I.useState(!1),[q,X]=I.useState(!1),ie=Qt(t,ce=>c(ce)),ae=Fp(i);return _.jsx(WL,{scope:r,type:n,dir:ae,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:h,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:L,onScrollbarXEnabledChange:G,scrollbarY:w,onScrollbarYChange:A,scrollbarYEnabled:q,onScrollbarYEnabledChange:X,onCornerWidthChange:N,onCornerHeightChange:U,children:_.jsx(Gt.div,{dir:ae,...o,ref:ie,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":R+"px",...e.style}})})});g6.displayName=t0;var v6="ScrollAreaViewport",y6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=ln(v6,r),a=I.useRef(null),c=Qt(t,a,o.onViewportChange);return _.jsxs(_.Fragment,{children:[_.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),_.jsx(Gt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:_.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});y6.displayName=v6;var ai="ScrollAreaScrollbar",b6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=ln(ai,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return I.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(GL,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(HL,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(w6,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(r0,{...n,ref:t}):null});b6.displayName=ai;var GL=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=ln(ai,e.__scopeScrollArea),[s,o]=I.useState(!1);return I.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},l=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",l),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",l)}}},[i.scrollArea,i.scrollHideDelay]),_.jsx(kn,{present:r||s,children:_.jsx(w6,{"data-state":s?"visible":"hidden",...n,ref:t})})}),HL=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=ln(ai,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Dl(()=>c("SCROLL_END"),100),[a,c]=qL("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return I.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),I.useEffect(()=>{const u=i.viewport,l=s?"scrollLeft":"scrollTop";if(u){let f=u[l];const h=()=>{const y=u[l];f!==y&&(c("SCROLL"),o()),f=y};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,s,c,o]),_.jsx(kn,{present:r||a!=="hidden",children:_.jsx(r0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),w6=I.forwardRef((e,t)=>{const r=ln(ai,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=I.useState(!1),a=e.orientation==="horizontal",c=Dl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return na(r.viewport,c),na(r.content,c),_.jsx(kn,{present:n||s,children:_.jsx(r0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),r0=I.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=ln(ai,e.__scopeScrollArea),s=I.useRef(null),o=I.useRef(0),[a,c]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=C6(a.viewport,a.content),l={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,y){return QL(h,o.current,a,y)}return r==="horizontal"?_.jsx(KL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=M6(h,a,i.dir);s.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):r==="vertical"?_.jsx(XL,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=M6(h,a);s.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),KL=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=ln(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarXChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x6,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Rl(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.x),onDragScroll:l=>e.onDragScroll(l.x),onWheelScroll:(l,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+l.deltaX;e.onWheelScroll(h),A6(h,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Nl(o.paddingLeft),paddingEnd:Nl(o.paddingRight)}})}})}),XL=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=ln(ai,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Qt(t,c,s.onScrollbarYChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x6,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Rl(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.y),onDragScroll:l=>e.onDragScroll(l.y),onWheelScroll:(l,f)=>{if(s.viewport){const h=s.viewport.scrollTop+l.deltaY;e.onWheelScroll(h),A6(h,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Nl(o.paddingTop),paddingEnd:Nl(o.paddingBottom)}})}})}),[JL,_6]=m6(ai),x6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:l,onResize:f,...h}=e,y=ln(ai,r),[b,w]=I.useState(null),A=Qt(t,ie=>w(ie)),P=I.useRef(null),N=I.useRef(""),R=y.viewport,U=n.content-n.viewport,L=gr(l),G=gr(c),q=Dl(f,10);function X(ie){if(P.current){const ae=ie.clientX-P.current.left,ce=ie.clientY-P.current.top;u({x:ae,y:ce})}}return I.useEffect(()=>{const ie=ae=>{const ce=ae.target;(b==null?void 0:b.contains(ce))&&L(ae,U)};return document.addEventListener("wheel",ie,{passive:!1}),()=>document.removeEventListener("wheel",ie,{passive:!1})},[R,b,U,L]),I.useEffect(G,[n,G]),na(b,q),na(y.content,q),_.jsx(JL,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:gr(s),onThumbPointerUp:gr(o),onThumbPositionChange:G,onThumbPointerDown:gr(a),children:_.jsx(Gt.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:tt(e.onPointerDown,ie=>{ie.button===0&&(ie.target.setPointerCapture(ie.pointerId),P.current=b.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),X(ie))}),onPointerMove:tt(e.onPointerMove,X),onPointerUp:tt(e.onPointerUp,ie=>{const ae=ie.target;ae.hasPointerCapture(ie.pointerId)&&ae.releasePointerCapture(ie.pointerId),document.body.style.webkitUserSelect=N.current,y.viewport&&(y.viewport.style.scrollBehavior=""),P.current=null})})})}),kl="ScrollAreaThumb",S6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=_6(kl,e.__scopeScrollArea);return _.jsx(kn,{present:r||i.hasThumb,children:_.jsx(YL,{ref:t,...n})})}),YL=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=ln(kl,r),o=_6(kl,r),{onThumbPositionChange:a}=o,c=Qt(t,f=>o.onThumbChange(f)),u=I.useRef(),l=Dl(()=>{u.current&&(u.current(),u.current=void 0)},100);return I.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(l(),!u.current){const y=eU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,l,a]),_.jsx(Gt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:tt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),b=f.clientX-y.left,w=f.clientY-y.top;o.onThumbPointerDown({x:b,y:w})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});S6.displayName=kl;var n0="ScrollAreaCorner",E6=I.forwardRef((e,t)=>{const r=ln(n0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(ZL,{...e,ref:t}):null});E6.displayName=n0;var ZL=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=ln(n0,r),[s,o]=I.useState(0),[a,c]=I.useState(0),u=!!(s&&a);return na(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),na(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?_.jsx(Gt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Nl(e){return e?parseInt(e,10):0}function C6(e,t){const r=e/t;return isNaN(r)?0:r}function Rl(e){const t=C6(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function QL(e,t,r,n="ltr"){const i=Rl(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,f=n==="ltr"?[0,l]:[l*-1,0];return T6([c,u],f)(e)}function M6(e,t,r="ltr"){const n=Rl(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],u=KB(e,c);return T6([0,o],[0,a])(u)}function T6(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function A6(e,t){return e>0&&e<t}var eU=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function Dl(e,t){const r=gr(e),n=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(n.current),[]),I.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function na(e,t){const r=gr(t);fs(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var tU=g6,rU=y6,O6=b6,I6=S6,nU=E6,i0="Switch",[iU,oJ]=zo(i0),[sU,oU]=iU(i0),P6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[h,y]=I.useState(null),b=Qt(t,R=>y(R)),w=I.useRef(!1),A=h?l||!!h.closest("form"):!0,[P=!1,N]=fc({prop:i,defaultProp:s,onChange:u});return _.jsxs(sU,{scope:r,checked:P,disabled:a,children:[_.jsx(Gt.button,{type:"button",role:"switch","aria-checked":P,"aria-required":o,"data-state":N6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:tt(e.onClick,R=>{N(U=>!U),A&&(w.current=R.isPropagationStopped(),w.current||R.stopPropagation())})}),A&&_.jsx(aU,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});P6.displayName=i0;var j6="SwitchThumb",k6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=oU(j6,r);return _.jsx(Gt.span,{"data-state":N6(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});k6.displayName=j6;var aU=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=I.useRef(null),o=N4(r),a=Dp(t);return I.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==r&&f){const h=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(h)}},[o,r,n]),_.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function N6(e){return e?"checked":"unchecked"}var cU=P6,uU=k6;const pc={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:dc,highContrast:_l,radius:Vp},R6=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,style:s,size:o=pc.size.default,variant:a=pc.variant.default,color:c=pc.color.default,highContrast:u=pc.highContrast.default,radius:l=pc.radius.default,...f}=r;return I.createElement("span",{"data-radius":l,className:Kt("rt-SwitchRoot",i,bt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Yo(n)),style:s},I.createElement(cU,{"data-accent-color":c,...f,ref:t,className:Kt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},I.createElement(uU,{className:Kt("rt-SwitchThumb",{"rt-high-contrast":u})})))});R6.displayName="Switch";var s0=["Enter"," "],lU=["ArrowDown","PageUp","Home"],D6=["ArrowUp","PageDown","End"],fU=[...lU,...D6],dU={ltr:[...s0,"ArrowRight"],rtl:[...s0,"ArrowLeft"]},hU={ltr:["ArrowLeft"],rtl:["ArrowRight"]},mc="Menu",[gc,pU,mU]=U4(mc),[Ys,$6]=zo(mc,[mU,ml,z4]),vc=ml(),B6=z4(),[L6,vs]=Ys(mc),[gU,yc]=Ys(mc),U6=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=vc(t),[c,u]=I.useState(null),l=I.useRef(!1),f=gr(s),h=Fp(i);return I.useEffect(()=>{const y=()=>{l.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>l.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),_.jsx(g4,{...a,children:_.jsx(L6,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(gU,{scope:t,onClose:I.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};U6.displayName=mc;var vU="MenuAnchor",o0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=vc(r);return _.jsx(v4,{...i,...n,ref:t})});o0.displayName=vU;var a0="MenuPortal",[yU,F6]=Ys(a0,{forceMount:void 0}),z6=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=vs(a0,t);return _.jsx(yU,{scope:t,forceMount:r,children:_.jsx(kn,{present:r||s.open,children:_.jsx(w4,{asChild:!0,container:i,children:n})})})};z6.displayName=a0;var fn="MenuContent",[bU,c0]=Ys(fn),V6=I.forwardRef((e,t)=>{const r=F6(fn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(fn,e.__scopeMenu),o=yc(fn,e.__scopeMenu);return _.jsx(gc.Provider,{scope:e.__scopeMenu,children:_.jsx(kn,{present:n||s.open,children:_.jsx(gc.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(wU,{...i,ref:t}):_.jsx(_U,{...i,ref:t})})})})}),wU=I.forwardRef((e,t)=>{const r=vs(fn,e.__scopeMenu),n=I.useRef(null),i=Qt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return oL(s)},[]),_.jsx(u0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),_U=I.forwardRef((e,t)=>{const r=vs(fn,e.__scopeMenu);return _.jsx(u0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),u0=I.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,disableOutsideScroll:b,...w}=e,A=vs(fn,r),P=yc(fn,r),N=vc(r),R=B6(r),U=pU(r),[L,G]=I.useState(null),q=I.useRef(null),X=Qt(t,q,A.onContentChange),ie=I.useRef(0),ae=I.useRef(""),ce=I.useRef(0),V=I.useRef(null),D=I.useRef("right"),p=I.useRef(0),d=b?VL:I.Fragment,m=b?{as:Ri,allowPinchZoom:!0}:void 0,x=E=>{var he,ye;const O=ae.current+E,C=U().filter(Ee=>!Ee.disabled),g=document.activeElement,v=(he=C.find(Ee=>Ee.ref.current===g))==null?void 0:he.textValue,j=C.map(Ee=>Ee.textValue),ee=kU(j,O,v),se=(ye=C.find(Ee=>Ee.textValue===ee))==null?void 0:ye.ref.current;(function Ee(Se){ae.current=Se,window.clearTimeout(ie.current),Se!==""&&(ie.current=window.setTimeout(()=>Ee(""),1e3))})(O),se&&setTimeout(()=>se.focus())};I.useEffect(()=>()=>window.clearTimeout(ie.current),[]),XB();const M=I.useCallback(E=>{var C,g;return D.current===((C=V.current)==null?void 0:C.side)&&RU(E,(g=V.current)==null?void 0:g.area)},[]);return _.jsx(bU,{scope:r,searchRef:ae,onItemEnter:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),onItemLeave:I.useCallback(E=>{var O;M(E)||((O=q.current)==null||O.focus(),G(null))},[M]),onTriggerLeave:I.useCallback(E=>{M(E)&&E.preventDefault()},[M]),pointerGraceTimerRef:ce,onPointerGraceIntentChange:I.useCallback(E=>{V.current=E},[]),children:_.jsx(d,{...m,children:_.jsx(X4,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(Sp,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:_.jsx(GB,{asChild:!0,...R,dir:P.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:G,onEntryFocus:tt(c,E=>{P.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(y4,{role:"menu","aria-orientation":"vertical","data-state":aS(A.open),"data-radix-menu-content":"",dir:P.dir,...N,...w,ref:X,style:{outline:"none",...w.style},onKeyDown:tt(w.onKeyDown,E=>{const C=E.target.closest("[data-radix-menu-content]")===E.currentTarget,g=E.ctrlKey||E.altKey||E.metaKey,v=E.key.length===1;C&&(E.key==="Tab"&&E.preventDefault(),!g&&v&&x(E.key));const j=q.current;if(E.target!==j||!fU.includes(E.key))return;E.preventDefault();const se=U().filter(he=>!he.disabled).map(he=>he.ref.current);D6.includes(E.key)&&se.reverse(),PU(se)}),onBlur:tt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(ie.current),ae.current="")}),onPointerMove:tt(e.onPointerMove,wc(E=>{const O=E.target,C=p.current!==E.clientX;if(E.currentTarget.contains(O)&&C){const g=E.clientX>p.current?"right":"left";D.current=g,p.current=E.clientX}}))})})})})})})});V6.displayName=fn;var xU="MenuGroup",l0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"group",...n,ref:t})});l0.displayName=xU;var SU="MenuLabel",q6=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{...n,ref:t})});q6.displayName=SU;var $l="MenuItem",W6="menu.itemSelect",Bl=I.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=I.useRef(null),o=yc($l,e.__scopeMenu),a=c0($l,e.__scopeMenu),c=Qt(t,s),u=I.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(W6,{bubbles:!0,cancelable:!0});f.addEventListener(W6,y=>n==null?void 0:n(y),{once:!0}),Bx(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(G6,{...i,ref:c,disabled:r,onClick:tt(e.onClick,l),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:tt(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:tt(e.onKeyDown,f=>{const h=a.searchRef.current!=="";r||h&&f.key===" "||s0.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Bl.displayName=$l;var G6=I.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=c0($l,r),a=B6(r),c=I.useRef(null),u=Qt(t,c),[l,f]=I.useState(!1),[h,y]=I.useState("");return I.useEffect(()=>{const b=c.current;b&&y((b.textContent??"").trim())},[s.children]),_.jsx(gc.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:_.jsx(HB,{asChild:!0,...a,focusable:!n,children:_.jsx(Gt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:tt(e.onPointerMove,wc(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,wc(b=>o.onItemLeave(b))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),EU="MenuCheckboxItem",H6=I.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(Z6,{scope:e.__scopeMenu,checked:r,children:_.jsx(Bl,{role:"menuitemcheckbox","aria-checked":Ll(r)?"mixed":r,...i,ref:t,"data-state":h0(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(Ll(r)?!0:!r),{checkForDefaultPrevented:!1})})})});H6.displayName=EU;var K6="MenuRadioGroup",[CU,MU]=Ys(K6,{value:void 0,onValueChange:()=>{}}),X6=I.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=gr(n);return _.jsx(CU,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(l0,{...i,ref:t})})});X6.displayName=K6;var J6="MenuRadioItem",Y6=I.forwardRef((e,t)=>{const{value:r,...n}=e,i=MU(J6,e.__scopeMenu),s=r===i.value;return _.jsx(Z6,{scope:e.__scopeMenu,checked:s,children:_.jsx(Bl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":h0(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});Y6.displayName=J6;var f0="MenuItemIndicator",[Z6,TU]=Ys(f0,{checked:!1}),Q6=I.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=TU(f0,r);return _.jsx(kn,{present:n||Ll(s.checked)||s.checked===!0,children:_.jsx(Gt.span,{...i,ref:t,"data-state":h0(s.checked)})})});Q6.displayName=f0;var AU="MenuSeparator",eS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Gt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});eS.displayName=AU;var OU="MenuArrow",tS=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=vc(r);return _.jsx(b4,{...i,...n,ref:t})});tS.displayName=OU;var d0="MenuSub",[IU,rS]=Ys(d0),nS=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=vs(d0,t),o=vc(t),[a,c]=I.useState(null),[u,l]=I.useState(null),f=gr(i);return I.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(g4,{...o,children:_.jsx(L6,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(IU,{scope:t,contentId:ac(),triggerId:ac(),trigger:a,onTriggerChange:c,children:r})})})};nS.displayName=d0;var bc="MenuSubTrigger",iS=I.forwardRef((e,t)=>{const r=vs(bc,e.__scopeMenu),n=yc(bc,e.__scopeMenu),i=rS(bc,e.__scopeMenu),s=c0(bc,e.__scopeMenu),o=I.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=I.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return I.useEffect(()=>l,[l]),I.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(o0,{asChild:!0,...u,children:_.jsx(G6,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":aS(r.open),...e,ref:sl(t,i.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:tt(e.onPointerMove,wc(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),l()},100))})),onPointerLeave:tt(e.onPointerLeave,wc(f=>{var y,b;l();const h=(y=r.content)==null?void 0:y.getBoundingClientRect();if(h){const w=(b=r.content)==null?void 0:b.dataset.side,A=w==="right",P=A?-5:5,N=h[A?"left":"right"],R=h[A?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+P,y:f.clientY},{x:N,y:h.top},{x:R,y:h.top},{x:R,y:h.bottom},{x:N,y:h.bottom}],side:w}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:tt(e.onKeyDown,f=>{var y;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||dU[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});iS.displayName=bc;var sS="MenuSubContent",oS=I.forwardRef((e,t)=>{const r=F6(fn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(fn,e.__scopeMenu),o=yc(fn,e.__scopeMenu),a=rS(sS,e.__scopeMenu),c=I.useRef(null),u=Qt(t,c);return _.jsx(gc.Provider,{scope:e.__scopeMenu,children:_.jsx(kn,{present:n||s.open,children:_.jsx(gc.Slot,{scope:e.__scopeMenu,children:_.jsx(u0,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:tt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:tt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:tt(e.onKeyDown,l=>{var y;const f=l.currentTarget.contains(l.target),h=hU[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});oS.displayName=sS;function aS(e){return e?"open":"closed"}function Ll(e){return e==="indeterminate"}function h0(e){return Ll(e)?"indeterminate":e?"checked":"unchecked"}function PU(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function jU(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function kU(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=r?e.indexOf(r):-1;let o=jU(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function NU(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,c=t[s].y,u=t[o].x,l=t[o].y;c>n!=l>n&&r<(u-a)*(n-c)/(l-c)+a&&(i=!i)}return i}function RU(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return NU(r,t)}function wc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var DU=U6,$U=o0,BU=z6,LU=V6,UU=l0,FU=q6,zU=Bl,VU=H6,qU=X6,WU=Y6,GU=Q6,HU=eS,KU=tS,XU=nS,JU=iS,YU=oS,p0="DropdownMenu",[ZU,uJ]=zo(p0,[$6]),jr=$6(),[QU,cS]=ZU(p0),uS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=jr(t),u=I.useRef(null),[l=!1,f]=fc({prop:i,defaultProp:s,onChange:o});return _.jsx(QU,{scope:t,triggerId:ac(),triggerRef:u,contentId:ac(),open:l,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(h=>!h),[f]),modal:a,children:_.jsx(DU,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};uS.displayName=p0;var lS="DropdownMenuTrigger",fS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=cS(lS,r),o=jr(r);return _.jsx($U,{asChild:!0,...o,children:_.jsx(Gt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:sl(t,s.triggerRef),onPointerDown:tt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:tt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});fS.displayName=lS;var eF="DropdownMenuPortal",dS=e=>{const{__scopeDropdownMenu:t,...r}=e,n=jr(t);return _.jsx(BU,{...n,...r})};dS.displayName=eF;var hS="DropdownMenuContent",pS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=cS(hS,r),s=jr(r),o=I.useRef(!1);return _.jsx(LU,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:tt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:tt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,l=c.button===2||u;(!i.modal||l)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pS.displayName=hS;var tF="DropdownMenuGroup",mS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(UU,{...i,...n,ref:t})});mS.displayName=tF;var rF="DropdownMenuLabel",gS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(FU,{...i,...n,ref:t})});gS.displayName=rF;var nF="DropdownMenuItem",vS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(zU,{...i,...n,ref:t})});vS.displayName=nF;var iF="DropdownMenuCheckboxItem",yS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(VU,{...i,...n,ref:t})});yS.displayName=iF;var sF="DropdownMenuRadioGroup",bS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(qU,{...i,...n,ref:t})});bS.displayName=sF;var oF="DropdownMenuRadioItem",wS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(WU,{...i,...n,ref:t})});wS.displayName=oF;var aF="DropdownMenuItemIndicator",_S=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(GU,{...i,...n,ref:t})});_S.displayName=aF;var cF="DropdownMenuSeparator",xS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(HU,{...i,...n,ref:t})});xS.displayName=cF;var uF="DropdownMenuArrow",lF=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(KU,{...i,...n,ref:t})});lF.displayName=uF;var fF=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=jr(t),[a=!1,c]=fc({prop:n,defaultProp:s,onChange:i});return _.jsx(XU,{...o,open:a,onOpenChange:c,children:r})},dF="DropdownMenuSubTrigger",SS=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(JU,{...i,...n,ref:t})});SS.displayName=dF;var hF="DropdownMenuSubContent",ES=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=jr(r);return _.jsx(YU,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ES.displayName=hF;var pF=uS,mF=fS,CS=dS,gF=pS,vF=mS,yF=gS,bF=vS,wF=yS,_F=bS,xF=wS,MS=_S,SF=xS,EF=fF,CF=SS,MF=ES;const m0={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Vp,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},g0=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=m0.size.default,radius:l=m0.radius.default,scrollbars:f=m0.scrollbars.default,...h}=r;return I.createElement(tU,{type:o,scrollHideDelay:a,className:Kt("rt-ScrollAreaRoot",i,Yo(n)),style:s},I.createElement(rU,{...h,ref:t,className:"rt-ScrollAreaViewport"}),I.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?I.createElement(O6,{"data-radius":l,orientation:"horizontal",className:Kt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},I.createElement(I6,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?I.createElement(O6,{"data-radius":l,orientation:"vertical",className:Kt("rt-ScrollAreaScrollbar",bt(u,"rt-r-size"))},I.createElement(I6,{className:"rt-ScrollAreaThumb"})):null,f==="both"?I.createElement(nU,{className:"rt-ScrollAreaCorner"}):null)});g0.displayName="ScrollArea";const v0={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:dc,highContrast:_l},TS={color:dc,shortcut:{type:"string",default:void 0}},AS=e=>I.createElement(pF,{...e});AS.displayName="DropdownMenuRoot";const OS=I.forwardRef((e,t)=>I.createElement(mF,{...e,ref:t,asChild:!0}));OS.displayName="DropdownMenuTrigger";const IS=I.createContext({}),PS=I.forwardRef((e,t)=>{const r=gB(),{className:n,children:i,size:s=v0.size.default,variant:o=v0.variant.default,highContrast:a=v0.highContrast.default,color:c=TS.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return I.createElement(CS,{container:u,forceMount:l},I.createElement(wl,{asChild:!0},I.createElement(gF,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,bt(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},I.createElement(g0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},I.createElement(IS.Provider,{value:I.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});PS.displayName="DropdownMenuContent";const jS=I.forwardRef((e,t)=>I.createElement(yF,{...e,ref:t,className:Kt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));jS.displayName="DropdownMenuLabel";const kS=I.forwardRef((e,t)=>{const{className:r,children:n,color:i=TS.color.default,shortcut:s,...o}=e;return I.createElement(bF,{"data-accent-color":i,...o,ref:t,className:Kt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},I.createElement(Vo,null,n),s&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});kS.displayName="DropdownMenuItem";const NS=I.forwardRef((e,t)=>I.createElement(vF,{...e,ref:t,className:Kt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));NS.displayName="DropdownMenuGroup";const RS=I.forwardRef((e,t)=>I.createElement(_F,{...e,ref:t,className:Kt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));RS.displayName="DropdownMenuRadioGroup";const DS=I.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return I.createElement(xF,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},I.createElement(Vo,null,r),I.createElement(MS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Sl,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});DS.displayName="DropdownMenuRadioItem";const $S=I.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return I.createElement(wF,{...s,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},I.createElement(Vo,null,r),I.createElement(MS,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement(Sl,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});$S.displayName="DropdownMenuCheckboxItem";const BS=e=>I.createElement(EF,{...e});BS.displayName="DropdownMenuSub";const LS=I.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return I.createElement(CF,{...i,ref:t,className:Kt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},I.createElement(Vo,null,n),I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},I.createElement(L4,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});LS.displayName="DropdownMenuSubTrigger";const US=I.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=I.useContext(IS);return I.createElement(CS,{container:i,forceMount:s},I.createElement(wl,{asChild:!0},I.createElement(MF,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Kt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,bt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},I.createElement(g0,{type:"auto"},I.createElement("div",{className:Kt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});US.displayName="DropdownMenuSubContent";const FS=I.forwardRef((e,t)=>I.createElement(SF,{...e,ref:t,className:Kt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));FS.displayName="DropdownMenuSeparator";const dn=Object.assign({},{Root:AS,Trigger:OS,Content:PS,Label:jS,Item:kS,Group:NS,RadioGroup:RS,RadioItem:DS,CheckboxItem:$S,Sub:BS,SubTrigger:LS,SubContent:US,Separator:FS}),_c={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:dc,highContrast:_l,radius:Vp},zS=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,asChild:s=!1,size:o=_c.size.default,variant:a=_c.variant.default,color:c=_c.color.default,highContrast:u=_c.highContrast.default,radius:l=_c.radius.default,...f}=r,h=s?Ri:"button";return I.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Kt("rt-reset","rt-BaseButton",i,bt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Yo(n))})});zS.displayName="BaseButton";const VS=I.forwardRef((e,t)=>I.createElement(zS,{...e,ref:t,className:Kt("rt-Button",e.className)}));VS.displayName="Button";const TF={loading:{type:"boolean",default:!0}},ia=I.forwardRef((e,t)=>{const{rest:r,...n}=Jo(e),{className:i,children:s,loading:o=TF.loading.default,...a}=r;if(!o)return I.createElement(I.Fragment,null,s);const c=I.isValidElement(s)?Ri:"span";return I.createElement(c,{ref:t,"aria-hidden":!0,className:Kt("rt-Skeleton",i,Yo(n)),"data-inline-skeleton":I.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});ia.displayName="Skeleton";const AF=Ut("/images/ghost_loading.png"),OF={primary:Ut("/images/primary_loading.png"),ghost:AF};function IF({size:e="24px",variant:t="primary",wrapStyle:r={}}){return _.jsx(k4,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:_.jsx("img",{src:OF[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const PF="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAPKADAAQAAAABAAAAPAAAAACL3+lcAAAJW0lEQVRoBd1be1BU1xk/LstLdtlVUYKoKKA8fJBKJDVxovYxTadC0zY1/2jaKWM0GRsnTTOpEQNGqc34mGicNpqxGkirMYk4QFONqTG01WioFXzwFhRfUJTl/dple37XnmUf93Hu3Uuknpmdc/ec7/vO97vn9Z3vfHcUGaa0a+2PxlnN9hVWU+Aia5gxLsIaHGk1GUNCAgMCRocaRqHZ7p5BZ++Aw2HrtPe22PqabF32Olun46Stw/Du6s0Fd4ZDNaFhvQS/k/P95ChryKb4iaO/NX1yWHhgwD1gauUPOAadNY1d7bU3u0/csvVmrcr562W1MqTodQGcvzlj9cwppqw5ceYJFKMuMpnCFLuzvK6j+dK1zk3L1xbuYuVac7+Uy8tNf2legiU7cYrJolUBNXyV1zrbSqvas5evK9yhhs+dVhPgd9YvSUmJCzvyzeQxU92FfV3PX15ubSir63pq1cbiMrVtBqhlyM/9wfqli6MOxkaFjVHLqxf9pPGh1sSY0SuT46MGC07UlKiRq6qHC3c8Vbhk/kNLKJMqPjUKqaF1EuIsPn27OGPNkQxePi7F976ZYU6ICDn3+Oyx8byCv066f164W1vV0js389XCDqV2FYf07pz0xAWJlsq5MyxRSsLuV/2UyNCxoQGjVs9JjikoPlndIqeHbA+jZx+LC79BV2GznBDeuu4+B9l+qI4Un2oSWNIfe4j86plYEhqk+N65mqCreMepuvZouZ42yknCMNYLbL/dSX7xu/Pk3zVtribzjjWSC1faSd66b5Ago8FVrvUBut5p6z9H+adLyZB8tVigvpM6fr4Uo9ry7YeukE++vNez7ry37/aRvv5BsmD2WPdizc8Y3qmzJqUeOFp5QEyIKGBsPU8vjF6p12pMhxpZu6eCOOmyKpbKaS9/O3U8ibAEiVWrLpsx2TQjfmqk6JblAxhGBfbZYKM2O9hbO2D85VsXyM2WXu8q13+8iCr6Un6yaKIu+x06KjY6bFHMpIlHikuqPYaVz8SBBWUKMcouZi5NOR4+/Pymx7yVYsHc/ujkTalq1eXAACzejB6A83Mz1uhpLrZ2DJBtdFXmTVs/qCPg0SsBCzC5y/MA/EhC+Ab3Sn+ftxysJTYVAEAL0Homb0wuwHmb0l/U89Rzjg7Rj7+4pVp3DGvw6pWACdiYPBfgWdPMr7FCf3O7w0ly9lVxizGFGsn8WUPbEnjpOZibX4nQHZsAGJ4KHN6VGHnrYVBg1eVJgXR9/MPLc0hb59DcBe97Rxt52LlogA0YQSwAhltGL09FU2sfeftwPZci8I1sfWEmocOOVFz1tPt3FTQQyNIjARswQpYAGD4oPQRDRm5+DenudXCJy3p2BnkybQIprbL5GCVdPXZBFpcgDiKG0QDvIhxuHDyKJH8vv0uOnW1WpAPBqh9OJcu+O0mgPVthE+WBLMjUIwEjsBrgStXqXXRXpG9gkGzYz7dQ/fiJKPLST2Nd7GcrWl3P3g9vvFdFcPDwNwEjsBrgN/ZXGPh3F14ljc09iqIWPjyObMxMdNF10KF7ucFz/roq6cO1ph4qu8G9SPMzsBrgJNcs4X+MDbe7yZ6iBkUxKfHhZMeLs4gxYMhyLa1s85m/3oIA+CoF7m8CVgNuBPwVtGF/NRlQGHbTokaT3S+n+Bz2z1Qoz1HI5p0ucliAlQ5pY4gckVIdzrinLsorPWFMMNn76sNkjDnQR9xXtId5EvVbiZ6neXgZDbAacdfDCtTmnXT+bf5TrSwbrKh3X0kh0RG+7xXG1NzpFpISFy7IYOflkvI75LrIeoC2nkgZRyBTSwJWI7vY0iJg58f1pFnGOGBWFAwLsYQT97rlnt6Yo3QrOvC362LkQlto87VlnjyixCKFwCoYHiJ1ikXwYuR/Kq4YmJkVlZZoVZTFCM7Q7enXv78ku4ihTbStNRlxZWkxqfNuYFd8/Y+VZFDGwI8eH0rOXLYJP3a9RrdCspb2jlhrAPHC9guKix/azKaHi4PZqaq9I8BqxP2shahzGcKLUVbbLvuSMQf//JnnCJg5zSwK9gZ1/6zYUkawJvCk8/T4CB2WLp7IQ+6iAVYDLqNdJRwPdzv6NR/S05J8hzc8HJlvnpddC8TUgicFuqhJwGrAzbsapi0H6jyOcmp405I87996+h1k5bYyUn+rW40YgVbwjhxU5x0BVgPCDHhb+1e1jRwuUe/FgHzM43luCxicBGt2XlScGnK6waMCnXgTsNIh7TjJw3DPi1HNQypKkxRjJma3/XP93kryxXn/wzhy9lUT6MaTgNWAABLEVCgx5B27TqobtW8HjyYPDWfcL2kdKd56QifoppSAEVgNiJZBAIkcwz0vxhU5EsU6tmC9f/y6cLJSZFBB8PbhK6TZJu8dAUZgFQwPRMvIyccb5PViiMnB/H0kwUpgRW3K0z4txGSjDLrt+0TeB8YwCoCb2u3rES0jJfDTr/i8GFL8MC1hWChZUVL8POXHS/8jSQZsCH8CgQD4udeLLiE0SIrDX2ea1RxEnt9WrmhFSbXPUy43pIGNxXq5bGnqdciVEhxLz7L+pNP0+MhrRWltJz46TJIVMV6scsj1QEsqPlpmg6eeVbIcjrTntpbJ2s6M9n7kAdSDgiPo427OfKYHnUptSU+/7zLxPM7Cj6bE9NGz6fcYMctjIkPJQnoObe+2E1vXAOmlF9jSM55xDX8eYQ0SQG5emUTm0UVRLB092/KbghNVZ1idRw+j8PT+Z+r1vEFkDd2PHAFs83/+wTT3tl1zmBUiwq2zV8FBxYhHcA4MwOKtoseQRiVuzBHhNjvOsoh2v88I8BYwEv/T/dX54ec3sjOz/3LIWz8fwCBAOB8CQxImmxK8Gf4f/iM6b+krRc+L6Srbg//Yu7RmpEbfiYFBGaLyFmQeknR6+cxhd0EI56PLuvS1gDvxCHiGrtBZThXRIc0YCj+r6kc4X1iw4Wc0pCiYlY/EHGBLLralrcgqko2MkR3SDNiDFFzKBZgBfxDCh2WHNAPKcoTzIcINQV80NlLVy2Iy9Mqxz2LrkVqNpdpRBRhCsGUhws3ucDyJyHQpwcNZDgvqeGnrYrF9Vqldv3oJQV+IgxI7cCg1rKUeB4H78pGHt7KIg0Jo0HB+xnOxvuO3z2YV7fRuW+1/v3rYu7E9b6TPjAw3bnzgP9TyBo7/2j/FG6Cf4hmH7VO8/wJSjxTWAm8L8gAAAABJRU5ErkJggg==",y0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABGUUKwAAAQcklEQVR4Ac07C3BUVZb33vfp7nQSgiEhYYYgESEj40oZjERH/MxAnFEGQQYUZILRGix1y3V3q3bZqd2trZpZqram1rJ2tMZZiUGFAURQ4romiALjmlkFB2eGEVyMEAQSEiSQ9O+9fvfuOfe923Q66aQ7dDS3q/vcd9+553fPOffzXlMyxqX4hc1Vls9p4Iao5nm8Mp5HSoSfmsIUGjcJRfbMIoJa1CFRbhlh2k3CrJ3F6EG/rTWee3DlkbEUUQqQawYTX3ppVTxInoxN4rPjVxAfAf0kDwG/WEM4RKGUEiEEQYgF0ITxJY2ZPfSwHiJPnV+9etMQ3S6rKWcGmPTcq+XWxOhzVhlfGJ8oQGkoSlnFJcUAAlSk8EHoort1bPMaXGN5lzoao5O1muf9a3vW3nvGRbq8XyXaqKlMebG5IpTXtzF6JZ/PfYINSyjFADDUoCA0eiN+SVvXINIuKKF3qQzKLMr9x9n+YLig/vSPF3UMy3OEm6M2ALgqLd6y5fnwVXyNCJChFZcKU2GcoyGtlx6FuD7MYuQDjemHhNC7mLggR5HTCeWUxic7JD6HG6QGDDmbTxSzrCtEELRPKyOLEB74jDWdu+++hyFslJlGUHng7bTEB6INvPrGC6/O65tmt1iTeKGKWxfDGy7OhL+Tduq9ZLMZ9j19uuGekwMpZHY1pfG1qVZe7Il4EV8ZLSNlYGZgIK3qEXDrZje5GOgw67oevPd3mVG+hJW1AUpf3vpI+GrxjAOj7qmrIpZQhwr/CdbG+sz67tWLj11ic/m1kpden8ELrI2RabyWaIO9QkNv+D/9sbMPLPtVNtyyMsDkra809s8iawjjXj9lAhjxk+TTYLdY1bFm+cFsBMgWt6JpW3WomG6KVpCZhCg5XCqUMBE8Qpq6VvyoIVO6GRmg+oAwvji9sy00zalWKrsMBPF1sW69kzzU9eNlzZkyzQXelM2vLbImORtik3mJoqeCw39CO1gxZUntwbnUVvfSwRENgMp39OzoiJWJsgFZG5JO8BjdfWbpkrp0xL+K9sk7drZEruILYDZxZ0/PCj7IQRXFSytGMsLQ2TtJ8tOnX2+zy2kZo5CBgAdCZjNR8Alb/3Urj2J2wQAUHNHWs7gGczBmSfxlxC6jZadA9iRVhqwOa4CpW3c1RqeRalRcKg+E9X5m5x81lp1acc9Ph6T4NTSiLPlH2TI9BEMDJlDyxipI9dStzY3DiZQ2BK78TfMjfVXiWYHUvKKHme1v1+Z0PPCDP6u28QQrXn7zmmilcyieB6sJKFJwUAA85NHj99815OwwpAfM2PLmvHCleAbmeHR86VK6o4n8z/X7xqvyqDDKhjKirDIc0HOhhKc7z6BOiJNaBhkAV3jhUtEiTMZcV5ImEAXt+vr2Vd/fkUpgvF2jjCgrGEAagaED+xiTOmGiTCmDGiq3v7khdBVpkHjeOj3vBG39/J7v5yTbz9y2pyZO4/cIH68RGisV1PEJjerUZr3MEqepTd+JGUUvnlp647kUWbO6nL7rv1vC3+QLZRzgzAAl2E4b25f94CH3yv0dYICq37Rd2VfZ+5ljgNdjQeP10O4TC+4sddFH94tTae/J1v+0J4il9kRRgHbFkroXSuyLOBG+bnbcd8H4+6Mr7tjmYmf/O233W2djk0SJUpLGCJ/YUTD98PLvdChqA0IgHux/QRiUuRMJ/moi0E0HWEx1zBRevW33yp7w7guRaaTeLiIFFBwTJ2z5wRjFD0L4qqkWJKDWZDK972p7y1Vv7P4thmWm/JLxUHYIBJnHZS6HsI75IxuTcRKEv/Xq/vL+qdEvhA7B42H4z7Kjn935varkDtnUZ2/f+9cXKuxfEH1oBbw1S2K3m0obhUOcwBn6x2N3LfiL1PuZXF/91ttHwiV8lsJlccLzv/B/85N755/BtoQHCM1+juhgepnzYfS5JvIuslWqY7Zw1ta9t/dNc35BNfR0dy7BnS3W5Q4XR9yrJzzOa8PEJZOXB2EneO23tu/5WbYyIL4fdGACZgVcwCE/g8El6OqVhAGsK8hC5YoI8zq1tj8uv2NUGxt0WV4qXgd+lKEFgB5+UQAFk+uJ+x4u9pFf7IF1+MRK2d8oobOBqAPqInl44WaDroqGNMC1r7y3igeZLyEc7OeDjlmvkLKF1726/x/sQoz3S/GtaCPUYESCZ/S2CZ/7/nLSZ+bcwuPaT/292peEo0uC4wNMrmMbDwr/ddvfW56tLIjvt7QHkSfSQWM6Qeq79pV90rt1RIDT2ielc4KzYsz5e1nnR4tvGvV+PjaBPCGVl2kes72XaoA4A+MWHGf1Hy+/5SXk7RX0tH+dtWffWasIsrbKTIAv6ygUFJg6lwDIelb4eOktn1a17uu0ilm5O9OAQfPok0Brk/SAeFDMxpjDDI3QF9ZfRoajKTVv/2+xU0QnSWvLpQjGM9JF21OS36ntTFE+wSZw3vgXxFOeI3uAPAjx42gkkcwSnTKs+EJsM+YepIPQBp2xK6vefqDKKdB8ig06qBHW/yNDuoPQ7Ivxh3HIL9FT4sOkaml81qKb07qxYeu70BM176PqCGVd6P2DGGbYYEZ9T+O0rsKAg86oOxOG1QCjLnMk+r+vn4U+vL/mZIZ0B6E5wfxfFp7QH8w/pW0PnGPHjQizlQK+C/TYKxQegKQpIo/f7I4QIKD7w0gpKHMHZ6fSdB2xGXUy+2kIB0Z6GAdgOA260Fk1k5GPvAQxI9rREakNg/CHuutCcLvJ+0rM2uYDVZbD7xe287FsSPNj+cXPpHAw3ljQj2BGkRCMKLSY9m9pumbUjLo5QQ6nWi59WPNU67DyqyTczTJyrozTP2VELQuktkVz8fHWPw/XZe6uD/89VMwrKYehUVkQvQCFBeg/T08eWHbD74ejMdI9nWuHIQNUKzyui0omfLRERSlaH7aSHyqErwreuPPAP0ZK+V8BfxmK0k1lunIj1rA1J9hv/PBy5dFs9gHqqkKSmFqJDkskHzapAiIcUvWvAtb810cbw6V8NSjtPtrA0XcdUoYkCCzyusnj7y29ftjwyURWqZsAD1PIBjV1ouHy1ysQb36f2aUuxxLiarHmrY/ejxTzeaiwikulPPLW4owHv6SPv7/4+iFPc7KVD3ULEczBrsaCMU2nGuiPqwNsBuubNC43CbJhDH/mtfz+gFVMr8cHWirmVcJDqEdppKBPq9t393W/zZUYqFtykoVzCKpj4kOGsiiYK45p6Nz8xh/+KTTRcZXH0fDYq4QX6NU+KY36bty1uKovDYlRN8NaAAzudsddtq7B4yzHSwIogBXVy+H2qJfBmUhm5Yu/w5GQkqDRPYnAE/D8YdP/3HXt6kzoZIuDulEShwnV7QkPuCAK4hT0dz/SPQxtcraEs8G/tfmTRTzA8uQuD4yQgFDP+5K1jJXyKCMF3dwlPww18NMc5jDmUAsb5VeGA5+TjUJZ4zJxp4x7GAU5JXnQtDWrvG723VnTy6KDcPgceeokp0IIhjixdCPOuh2Bz+HBQvDljN6QBc2sUSHpTlErT+yssr8ZoYeGWyZnzWiIDtSgNW4SdG/qFu1msPBp12Dk8St3gxr99hB9c9hE8y+FnAo95K3hEnpMC+yEZrte5+qqC61d17h2kApxB3LG0eAmHfWWMxPpNc4+CPSTShcXfQ4zEmRjTrN+uSETfsk43NRmUbkQcqcBqfvC5s+r+kvif5ZPVyU2FfkX6bTWuhmj3hEmMx0v9YUtx6b2F/ATcpTdmUfk9xjXsNZF04+YMRZTbgnOAZMRe2K8CJ4rOVAn1E3paVoshrrLIzHDZocdgyd2SY5JVgLjv80Vc0Xn7uaeb0Ty+xJr+ksB4GIELO3h5rqK1xR+LiHqJDdZEHH4cp5hk8NIH3aHcAji6E956UhOTXaAlv3w3ZMz8F4uC2fRYNwniuM+Ir+2V0eIXzgLxUVYzgvqYvnhHQdQ3D0Wg2M/x3wKGUkDvFE3dZNhURkGOE3gCVGc8425lqQACMqZBgRBYSQvD8qFiStOrtkSC3RJuD8EAaw5YqgzMpIGwIrfYq3JAsX8tPaultOJsECcyy4+d/GT7sEIYdpls0glgDrYAVarpj+EvhhtVXgJA5j+wFo4O4fXrnBssBmSoc6llRRyLiCuAlUiSoW5oJ9KQ+qAp2rg2cgbpmFu8sBahZcwwI75JWf8UbbftZTrnpaPzry35dQihXz50Jd40qP4KIgCqofSl8/HpYCyW342UxkaBxZ13HFnSWLLnzAAdvH7J9aDD3DVAb0garINuRII0q2Me3c0UBzwNsw53ifXISBlT4w+GJhrHHVM1sddEiW1LNl9dkPY7zRgEwSBPCvIg/yw87uT65LQRl39kRBpAz2Xe4Ele7paIj6ReAaIAgcirHHngtKHkoUfZAA8qlq8r7vX1gS8BwyzBsQNPOEUeRG2fvv3Jo2bN8OSlUitL3u75+chP193aXULD4UdevH1W0uKcJmXjD8gBPAGIgRsrQ4e6cN7GuieYAU4R4yYfN2Kd3qWJncej3WUMWqKdTiVQyaTwQWvFnPUKVV5lH+QAbBx64Li3wUd/TGNum9byVgFN4jpbMuqt/uuQZzxWFA2lBFHEZWXD9YpE/mO+RjqNJTMQxoAEbfcfsWvIPabXC9w05QD/2CJmM6h8egJK945vzRsxA/BatJQSRZlRx223F6U9lR5UA5ItdLydy8ciGnePgGxMSdAbsxztPWbbyscFzlh5d6LPw8zZx2Kliw//IHl4LZbJ8xNbkutp/UAhVh0W2Gtj7NOdClpWeQB8RXWxLqVe/taFN7XBVEGlAWHRYYqyIfQz7XOovmFtSPJNcBi6ZB/IoTRv7+/LUrEwKUxuILBRXfAMR9q+q6/OV3/sWhfs+fioohGNsCj5xJFHyMfj/gDVDsYvCWv9tc0B6/LK+IIH9jb3xhjdA3HA3VZcEYBzwC+JiefGpyu2nhHcFTvFbn0Rv6tfydU7TC6KcbETJyyB/TA0OS06cXbgg0D2oe5GEhgGER1a827oUcijDwjX+fBcPCOtLz7wk9oW4Hhr3/2JprTZwuPvi9m9NmRjVFCwK09xV37SxEglnlAkMeabg+mTXhKh2SYtQGw88PvWfMijtNiC1KYbADwBLlwwreMDSE6dUI3BwK+p5+toaM6Xnv0AzE1EoE/TRGyEly9LHXE0d3R7eFU52JA0+qe/4455FSXrHBqfVQGQCIoTMN+6/kYERASQ68nJDNYWIEhQhoRR+H57580h3zo9xuHoE9XXpDITUk4RMpjlEymUXsOvAd0A4TYtx1CZ8UJHNenunmSBvBUk8PuoqlxvvnV/m0uSQbyxGFR0X8uvjFGyHzO4eB5mKJGDKEsKRGEM436N+lQZJTHg4fhHwL2Fxbr9U/Pph1D4WbaNmoPSGXwk/2inAvnOYuLhfAA2of3lcCeuoMzhooZhLIDYKo2t2XArw7vSxqEtsLjtLW/nk+l9wxAGMVFzgyQzPvRNrHKtvmTNiezwZV96dx4JAPBcgPCR8R0Sg6bJnvq2Vqa+wOaZMHHov74+6LKiZMGSGTVEPeV4P0lkMNNgBrMJHIAIG7gRRV4c0EQS6OkG1rbIbEd1HTS+Mub6JGxkEvR/H/1GixGG+ou8QAAAABJRU5ErkJggg==";function Wr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=te.useState(y0),c=u=>{a(y0)};return te.useEffect(()=>{a(e||y0)},[e]),_.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[_.jsx("img",{src:o,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...s}),i&&_.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:PF})]})}function jF({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=Fo(),a=te.useMemo(()=>{if(n&&r)return n(r)},[r]),c=te.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return _.jsxs("div",{className:"cs-toast",children:[_.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[_.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&_.jsx("div",{children:_.jsx(IF,{})}),_.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&_.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&_.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&_.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&_.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&_.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&_.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&_.jsx(Dx,{text:"Confirmation is in progress. Check your transaction on here",keywords:["here"],text_highlight_color:"#72c1f7",onKeywordClick:()=>{window.open(o(i,"tx"),"_blank")}})]}),r==="rejected"&&_.jsxs(_.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&_.jsx("span",{children:"Something went wrong"})]}),r==="success"&&_.jsx(_.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():_.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),rl.map(u=>_.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:_.jsx(Wr,{src:u.img})},u.link))]})]}),_.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:_.jsx("use",{xlinkHref:"#icon-close"})})]})}const kF=Ni((e,t)=>({toasts:[],setToasts:r=>{e(n=>({toasts:[...n.toasts,r]})),setTimeout(()=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r.id)}))},3e3)},removeToast:r=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r)}))}})),sa=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=kF(),i=(a,c="success")=>{const l={id:Date.now(),status:c,buildShowInfo:()=>({toastTitleText:a})};r(l)},s=a=>{const c=Date.now();return a.id=c,r(a),c},o=te.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),Bn.createPortal(_.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>_.jsx(jF,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}},vJ="";function NF(){const{mevProtect:e,setMevProtect:t}=Br();return _.jsxs(dn.Root,{children:[_.jsx(dn.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:_.jsx("use",{xlinkHref:"#icon-mev"})})})}),_.jsx(dn.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:_.jsxs("div",{className:"mev-settings-box",children:[_.jsxs("div",{className:"mev-setting-title",children:[_.jsxs("div",{className:"name",children:[_.jsx("img",{src:Ut("/images/icon_mev@2x.png")}),_.jsx("span",{children:"MEV Protect"})]}),_.jsx(R6,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),_.jsx("p",{className:"mev-tips",children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."})]})})]})}function RF({onClick:e}){const[t,r]=te.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return _.jsx("div",{className:"refresh-button",children:_.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:_.jsx("use",{xlinkHref:"#icon-refresh"})})})}const yJ="",bJ="";function b0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(VS,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function DF(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Br();return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsxs("span",{children:[r,"%"]})]}),t&&_.jsx($F,{onClose:()=>e(!1)})]})}function $F({onClose:e}){const{slippage:t,setSlippage:r}=Br(),[n,i]=te.useState(t),s=u=>{i(u.display)},o=u=>{const l=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");u.target.value=u.target.value.replace(l,"$1"),i(u.target.value)},a=()=>{n&&r(n),e()},c=te.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),_.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:_.jsxs("div",{className:"slippage-settings",children:[_.jsxs("div",{className:"slippage-settings-header",children:[_.jsx("div",{className:"title",children:"Slippage Settings"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsx("span",{children:"Slippage Tolerance"})]}),_.jsxs("div",{className:"form-box",children:[_.jsx("div",{className:"slippage-tab-list",children:eD.map(u=>_.jsxs("span",{className:u.display===n?"active":"",onClick:()=>s(u),children:[u.display," %"]}))}),_.jsxs("div",{className:"input-box",children:[_.jsx("span",{children:"Custom"}),_.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:o}),_.jsx("div",{style:{fontSize:"14px",color:"#fff"},children:"%"})]})]}),Number(n)<=.05&&_.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&_.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&_.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),_.jsx(b0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function BF({handleRefresh:e}){return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-header",children:[_.jsx("h3",{className:"swap-title",children:"Swap"}),_.jsxs("div",{className:"right",children:[_.jsx(DF,{}),_.jsx(NF,{}),_.jsx(RF,{onClick:e})]})]})})}const wJ="",_J="";function LF(){const[e,t]=te.useState(!1);return _.jsxs(dn.Root,{open:e,onOpenChange:t,children:[_.jsx(dn.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(dn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"cs-settings-box",children:[_.jsx("h3",{children:"Settings"}),_.jsx(UF,{}),_.jsx(zF,{onClose:()=>{t(!1)}})]})})]})}function UF(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Br(),i=s=>{t(s)};return _.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-plorer"})}),_.jsx("span",{children:"Preferred Explorer"})]}),_.jsx("div",{className:"explorer-checkbox-group",children:rl.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(El,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]}))})]})}const FF=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function zF({onClose:e}){const{addTxToast:t}=sa(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Br(),[a,c]=te.useState(i),[u,l]=te.useState(r),f=w=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${w}`})})},h=w=>{l(w),w.isCustom||(n(w),f(w.link),e())},y=w=>{c(w.target.value)},b=()=>{if(a){const w={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(w),f(a),e()}};return _.jsxs("div",{className:"settings-card rpc-settings-card",children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})}),_.jsx("span",{children:"RPC Node"})]}),_.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(w=>_.jsxs("div",{className:"rpc-item",onClick:()=>h(w),children:[_.jsx(El,{color:"indigo",checked:u.name===w.name,variant:"soft",className:"cs-checkbox"}),_.jsx("span",{children:w.name})]})),u.isCustom&&_.jsxs("div",{className:"custom-rpc-input-box",children:[_.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),_.jsx(b0,{btnIsDisabled:FF(a),text:"Save",onClick:b})]})]})]})}const xJ="",Nn=Ni((e,t)=>({accounts:[],currentAccount:void 0,isOpenWalletModal:!1,saveCurrentAccount:r=>{e({currentAccount:r})},saveAccounts:r=>{e({accounts:r})},onWalletModal:r=>{e({isOpenWalletModal:r})},isOpenAccountList:!1,setIsOpenAccountList:r=>{e(()=>({isOpenAccountList:r}))},tokenBalanceObj:{},setTokenBalanceObj:r=>{e(()=>({tokenBalanceObj:r}))}}));var VF=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));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||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},qF=VF,qS={"text/plain":"Text","text/html":"Url",default:"Text"},WF="Copy to clipboard: #{key}, Enter";function GF(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function HF(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=qF(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=qS[t.format]||qS.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(l){r&&console.error("unable to copy using execCommand: ",l),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=GF("message"in t?t.message:WF),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var KF=HF;const WS=pa(KF);function XF({currentAccount:e}){const{mutate:t}=Ur.useSwitchAccount(),r=Ur.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Nn(),s=()=>{i(!n)};te.useEffect(()=>()=>{i(!1)},[]);const o=te.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);te.useEffect(()=>{},[o]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return _.jsxs("div",{className:"cs-account-switch",children:[_.jsxs("div",{className:"account",onClick:s,children:[_.jsx("span",{children:Gs(e)}),(o==null?void 0:o.length)>0&&_.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})})]}),_.jsx("div",{className:`account-list ${n?"open":"close"}`,children:o.map(c=>_.jsxs("div",{className:"account-item",children:[_.jsxs("div",{className:"left",children:[_.jsx("div",{className:"label",children:c==null?void 0:c.label}),_.jsx("div",{className:"address",children:Gs(c==null?void 0:c.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}const JF=te.forwardRef(({connect:e})=>{const t=Ur.useCurrentAccount();return _.jsx("div",{children:t?_.jsx(YF,{}):_.jsx(b0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function YF(){const{mutate:e}=Ur.useDisconnectWallet(),t=Ur.useCurrentAccount(),{currentWallet:r}=Ur.useCurrentWallet(),{addCommonToast:n}=sa(),{getExplorerUrl:i}=Fo(),s=()=>{t&&(WS(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return te.useEffect(()=>{},[r]),_.jsxs(dn.Root,{children:[_.jsx(dn.Trigger,{children:_.jsxs("div",{className:"cs-connected-button",children:[_.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),_.jsx("span",{children:Gs(t==null?void 0:t.address)})]})}),_.jsx(dn.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:_.jsxs("div",{className:"account-op-box",children:[_.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),_.jsx(XF,{currentAccount:t==null?void 0:t.address}),_.jsxs("div",{className:"account-op-item",onClick:s,style:{marginTop:"12px"},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-copy"})}),_.jsx("span",{children:"Copy address"})]}),_.jsxs("div",{className:"account-op-item",onClick:o,children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-link"})}),_.jsx("span",{children:"Open explorer"})]}),_.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-disconnect"})}),_.jsx("span",{children:"Disconnect"})]})]})})]})}function ZF(){Ur.useCurrentAccount(),Ur.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Nn();return Ur.useWallets(),_.jsx(_.Fragment,{children:_.jsx(Ur.ConnectModal,{trigger:_.jsx(JF,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function QF({independentWallet:e,customWallet:t}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:Ut("/images/logo@2x.png"),className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(ZF,{}),_.jsx(LF,{})]})]}),_.jsx("div",{style:{marginTop:"20px"}})]})}const SJ="",GS=()=>{const e=te.useRef(null);te.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"#75C8FF",boxShadow:"0px 0px 20px 2px #75C8FF",borderRadius:"50%"};return _.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:_.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>_.jsx("div",{style:t(i),children:_.jsx("div",{style:r})},i))})})};function ez({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=te.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(tz,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(rz,{info:s,status:r,tx:i,onClose:e})]})}function tz({info:e,status:t}){return _.jsxs("div",{className:"progress-dialog",children:[_.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),_.jsx("div",{className:"loading-box",children:_.jsx(GS,{})}),_.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),_.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function rz({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Fo();return _.jsxs("div",{className:"finally-status-dialog",children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[_.jsx("div",{className:"status-icon-box",children:_.jsx("div",{className:"status-icon",children:_.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?_.jsx("use",{xlinkHref:"#icon-sel"}):_.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?_.jsx("span",{children:"Swap Success"}):_.jsx("span",{children:"Swap failed"})]}),_.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),rl.map(s=>_.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:_.jsx("img",{src:s.img})},s.link))]})]}),_.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function Ul(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await YR(`${i||il.api}${t}`,n):await ZR(`${i||il.api}${t}`,n)}catch(s){throw s}}}}function nz(){const{fetchByApi:e}=Ul(),{setProviders:t}=Br();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function iz({interval:e,callback:t}){const r=te.useRef(),n=te.useRef(null);te.useEffect(()=>{r.current=t},[t]);const i=te.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=te.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return te.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Zs=Ni((e,t)=>({suiClient:new Ma({url:il.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new nx,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),oa=Ni((e,t)=>({tokenMapIsInit:!1,requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=Or(r.coin_type).full_address;if(!n.has(s)){const o=new Map(n);o.set(s,r);const a=i.filter(c=>c!==r.coin_type);e(()=>({tokenMap:o,requestTokenList:[...a]})),ki.setItem(bp,o)}},tokenMap:new Map,setTokenMap:(r,n=!1)=>{r.size>0?e(()=>({tokenMap:r,tokenMapIsInit:!0})):e(()=>({tokenMap:r})),n||ki.setItem(bp,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||ki.setItem(Ax,r)}}));ki.getItem(bp).then(e=>{e!==null&&oa.getState().setTokenMap(e,!0)}),ki.getItem(Ax).then(e=>{e!==null&&oa.getState().setTrustedTokenList(e,!0)});function sz(e,t){return{id:e.id||void 0,logo_url:e.iconUrl||void 0,coin_type:t,decimals:e.decimals,description:e.description,name:e.name,symbol:e.symbol}}function ys(){const{suiClient:e}=Zs(),{fetchByApi:t}=Ul(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=oa(),c=async()=>{var b;const f=await t("/v2/sui/coins_info","GET"),h=[],y=(b=f==null?void 0:f.list)==null?void 0:b.reduce((w,A)=>(w.set(A.coin_type,A),A.is_trusted&&h.push({...A,coin_type:Or(A.coin_type).full_address}),w),new Map);y&&(y.set("0x2::sui::SUI",{...y.get("0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"),coin_type:"0x2::sui::SUI"}),r(y),a(h))},u=async f=>{try{const h=l(f);if(h)return h;if(s.includes(f))return;o(f);const y=await e.getCoinMetadata({coinType:f});if(y){ox(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=sz(y,f);return i(b),b}}catch{}},l=te.useCallback(f=>{if(f)return n.get(Or(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Fl(e){const{suiClient:t}=Zs(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Nn(),{fetchTokenInfo:s}=ys(),[o,a]=te.useState([]),{tokenMap:c}=oa(),u=async(y=(r==null?void 0:r.address)||"",b)=>{try{if(!y){l();return}let w=[];b?w=[await t.getBalance({owner:y,coinType:b})]:w=[...await t.getAllBalances({owner:y})],a(w)}catch{a([])}},l=()=>{n({})};te.useEffect(()=>{(o==null?void 0:o.length)>0&&(c!=null&&c.size)&&f(o)},[o,c]);const f=async y=>{const b={};for(let w=0;w<(y==null?void 0:y.length);w++)try{const A=y[w],P=await s(A.coinType),N=WR(A.totalBalance,P==null?void 0:P.decimals),R=Pr(N,4);b[Or(A.coinType).full_address]={...A,displayBalance:R,totalBalanceFormat:N}}catch{continue}n(b)},h=te.useMemo(()=>{if(e&&r)return i[e]||i[Or(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const hn=Ni((e,t)=>({isOpenTokensDialog:!1,defaultFromCoinType:void 0,defaultToCoinCoinType:void 0,isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,setDefaultCoin:(r,n)=>{e(()=>({defaultFromCoinType:r,defaultToCoinCoinType:n}))},setFromCoin:r=>{e(()=>({fromCoin:r}))},setToCoin:r=>{e(()=>({toCoin:r}))},setFromAmount:r=>{e(()=>({fromAmount:r}))},setToAmount:r=>{e(()=>({toAmount:r}))},setRouterData:r=>{e(()=>({routerData:r}))},setFindRouterLoading:r=>{e(()=>({findRouterLoading:r}))},setByAmountIn:r=>{e(()=>({byAmountIn:r}))},setIsOpenSecondary:r=>{e(()=>({isOpenSecondary:r}))},setIsOpenTokensDialog:r=>{e(()=>({isOpenTokensDialog:r}))}})),oz={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},HS={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},KS=oz;function az(e,t){const{fetchTokenInfo:r}=ys(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=hn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Br(),{tokenMapIsInit:u}=oa(),l=te.useRef({}),f=async(y,b)=>{const w=y?await r(y):HS,A=b?await r(b):KS;n(w),i(A),s(w==null?void 0:w.coin_type,A==null?void 0:A.coin_type)},h=(y,b)=>{const w=[nl[0]];let A=nl[0];y.forEach(P=>{const N={name:P,link:P,isCustom:!1};w.push(N),P===b&&(A=N)}),a([...w,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(A)};return te.useEffect(()=>{if(u&&!yp(e,l.current)){const{defaultFromToken:y,defaultToToken:b,defaultSlippage:w,customRpcList:A,defaultRpc:P}=e;f(y,b),w&&o(w),(A==null?void 0:A.length)>0&&h(A,P),l.current=e}},[e,u]),{handleSetDefaultPair:f}}function cz(){const{currentRpc:e}=Br(),{setSuiClient:t,setAggregatorSDK:r}=Zs(),{currentAccount:n}=Nn();te.useEffect(()=>{if(e){const i=new Ma({url:e.link});t(i)}},[e]),te.useEffect(()=>{if(e){const i=new nx(il.aggregatorUrl,(n==null?void 0:n.address)||void 0,new Ma({url:e.link}),KN.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const XS=Ni((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Or(i).full_address]}),e({coinPriceObj:{...n}})}}));function zl(){const{fetchByApi:e}=Ul(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=XS(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>Pi(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Or(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=te.useCallback(a=>{if(!a)return;const c=t[Or(a).full_address];if(c)return c},[t]),o=te.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Le(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const w0=Ni((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),xr=[];for(let e=0;e<256;++e)xr.push((e+256).toString(16).slice(1));function uz(e,t=0){return(xr[e[t+0]]+xr[e[t+1]]+xr[e[t+2]]+xr[e[t+3]]+"-"+xr[e[t+4]]+xr[e[t+5]]+"-"+xr[e[t+6]]+xr[e[t+7]]+"-"+xr[e[t+8]]+xr[e[t+9]]+"-"+xr[e[t+10]]+xr[e[t+11]]+xr[e[t+12]]+xr[e[t+13]]+xr[e[t+14]]+xr[e[t+15]]).toLowerCase()}let _0;const lz=new Uint8Array(16);function fz(){if(!_0){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");_0=crypto.getRandomValues.bind(crypto)}return _0(lz)}const JS={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function YS(e,t,r){if(JS.randomUUID&&!t&&!e)return JS.randomUUID();e=e||{};const n=e.random||(e.rng||fz)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return uz(n)}var Qs=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Qs||{});const dz=new Ma({url:mm("mainnet")}),hz=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],pz=["deny_list","DenyList","DenyCap","create_regulated_currency"],mz={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},gz=async e=>{let t=!1;if(hz.includes(e))return t;const r=e.split("::"),n=r[0]&&Fr(r[0]),i=r[1],s=await dz.getObject({id:n,options:mz}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(pz.join("|"),"i").test(o)&&(t=!0),t},vz=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>Pi(i,!1)))==null?void 0:n.join(",")};function yz(){const{fetchByApi:e}=Ul(),t=async n=>{try{const i={...n},s=vz(n==null?void 0:n.coin_type);s&&(i.coin_type=s);const o=await e("/v2/sui/stats_pools","GET",i);if(o!=null&&o.lp_list)return{list:(o==null?void 0:o.lp_list)||[],total:o==null?void 0:o.total}}catch(i){return console.error("getPoolList ~ Error:",i),await r(n)}return{list:[],total:0}},r=async n=>{var i,s,o,a;try{const c=Ut("/data/pools.json"),u=await fetch(c).then(l=>l.json());if((i=u==null?void 0:u.data)!=null&&i.lp_list){const l=(s=u==null?void 0:u.data)==null?void 0:s.lp_list;let f=l;if(n!=null&&n.coin_type){const y=(a=(o=n==null?void 0:n.coin_type)==null?void 0:o.split(","))==null?void 0:a.map(b=>nc(b).source_address);f=l==null?void 0:l.filter(b=>{var P,N;const w=nc((P=b==null?void 0:b.coin_a)==null?void 0:P.address).source_address,A=nc((N=b==null?void 0:b.coin_b)==null?void 0:N.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(w)&&y.includes(A)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(w)||y.includes(A)))})}n!=null&&n.is_vaults&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.is_vaults)),n!=null&&n.has_farming&&!(n!=null&&n.is_vaults)&&!(n!=null&&n.has_mining)&&!(n!=null&&n.no_incentives)&&(f=l==null?void 0:l.filter(y=>y==null?void 0:y.has_farming));const h=f;return{list:h,total:(h==null?void 0:h.length)||0}}}catch(c){console.error("getLocalJsonPoolList Error:",c)}return{list:[],total:0}};return{getPoolList:t,getLocalJsonPoolList:r}}function bz(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Br(),{getPoolList:n,getLocalJsonPoolList:i}=yz();return{getPoolListByCoinType:async(o,a)=>{if(o&&a){const c=[o,a].sort(),u=`${c[0]}_${c[1]}`,l=t[u];if(l)return l;const f={coin_type:`${o},${a}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let h=e?await i(f):void 0;(h===void 0||h.list.length===0)&&(h=await n(f));const y=h.list;if(y.length>0)return t[u]=y,r(u,y),y}return[]}}}function wz(e){const{routerData:t}=hn();return{priceAcceptRouterData:te.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Le(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Le(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function ZS(e,t){return{amountLimit:te.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Le(s).mul(Le(1).sub(Le(e).div(100))).toString():Le(i).mul(Le(1).add(Le(e).div(100))).toString()}},[e,t])}}function _z(e){const{getTokenInfo:t,fetchTokenInfo:r}=ys();return{formatSwapRouter:te.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Le(0);if(e.routerData.routes.forEach((l,f)=>{const h={},y=e.byAmountIn?l.amountIn.toString():l.amountOut.toString();f===e.routerData.routes.length-1?h.percentage=Le(1).sub(c).toFixed(2):h.percentage=Le(y).div(s).toFixed(2),c=Le(c).add(h.percentage);const b=[];l.path.forEach(w=>{i.includes(w.provider)||i.push(w.provider);const A=Or(w.from).full_address,P=Or(w.target).full_address,N=t(A),R=t(P);N||a.includes(A)&&a.push(A),R||a.includes(P)&&a.push(P);const U=w.provider===oc.SCALLOP||w.provider===oc.FLOWX||w.provider===oc.FLOWXV3;b.push({from_type:A,to_type:P,pool_address:U?"":w.id,fee_rate:w.feeRate,provider:w.provider})}),h.paths=b,o.push(h)}),a.length>0)for(const l in a)r(l);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:o}}},[e])}}function xz(){const{fromCoin:e,toCoin:t}=hn(),{getPoolListByCoinType:r}=bz();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function QS(e,t,r){return te.useMemo(()=>t&&r&&+t&&+r?e?Le(r).div(t).toString():Le(t).div(r).toString():"0",[t,r,e])}function e8(e){const[t,r]=te.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await gz(i.coin_type)}catch{}return!1};return te.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function Sz(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=hn(),{getTokenInfo:i}=ys(),{ignoreWarnTokenMap:s}=Br(),o=i(e),a=i(t),c=te.useMemo(()=>!tl(r,HS.coin_type)||!tl(n,KS.coin_type),[r,n]),u=te.useCallback(f=>f&&!s[Pi(f.coin_type)]&&(tl(r,f.coin_type)||tl(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),l=te.useMemo(()=>{const f=[];return c&&(o&&u(o)&&f.push({...o}),a&&u(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:l}}function Ez(){const{aggregatorSDK:e}=Zs(),{getSwapPoolAddress:t}=xz(),r=s=>s&&s.error?s.error.code===Qs.InsufficientLiquidity||Qs.HoneyPot||Qs.NumberTooLarge:!1,n=async s=>{const{fromToken:o,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:f}=s;try{const h={from:o.coin_type,target:a.coin_type,amount:new w2(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u},y=await e.findRouters(h);if(y&&r(y))return i(!1,l,f,o,a,y);if(!y||y.routes.length===0)throw Error("not find router");return i(!1,l,f,o,a,y)}catch{const y=await t(),b={from:o.coin_type,target:a.coin_type,amount:new w2(c),byAmountIn:l,pools:y};try{const w=await e.swapInPools(b);return!w||!w.routeData?i(!0,l,f,o,a):i(!0,l,f,o,a,w.routeData)}catch{return{uuid:f,byAmountIn:l,isDegrade:!0}}}},i=(s,o,a,c,u,l)=>{var f;if(l){const h=l.error!==void 0,y=vp(l.amountIn.toString(),c.decimals).toString(),b=vp(l.amountOut.toString(),u.decimals).toString();return{routerData:h?void 0:l,fromAmountUi:h?o?y:"":y,toAmountUi:h&&o?"":b,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=l.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function aa(e){const t=te.useRef(e);return te.useEffect(()=>{t.current=e},[e]),t}function Cz(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function Mz(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function Tz(e){return!!String(e).includes("Could not find the referenced transaction")}function Az(e){return Cz(e)?"User rejected the request":Mz(e)?"Exceeded price slippage":Tz(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var x0={};Object.defineProperty(x0,"__esModule",{value:!0});var Oz=x0.executeAuction=t8,Iz=s_,Pz="https://rpc.getshio.com",jz=500,kz=300;function t8(e,t,r){r===void 0&&(r=jz);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),Iz.default.post(Pz,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,kz)}).catch(s)})}x0.default={executeAuction:t8};function Nz(){const{suiClient:e}=Zs(),{currentAccount:t}=Nn(),{mutateAsync:r}=Ur.useSignTransaction(),{mutate:n}=Ur.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=te.useMemo(()=>t==null?void 0:t.chains[0],[t]),s=async(c,u,l=!1)=>{var h,y;if(l){const b=await e.devInspectTransactionBlock({transactionBlock:Mo.Transaction.from(vn(c)),sender:t.address});if(!b||((h=b.effects)==null?void 0:h.status.status)==="failure")throw Error((y=b.effects)==null?void 0:y.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:u,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,u=!1)=>{var f,h;let l;if(typeof c=="string"?l=Mo.Transaction.from(c):l=c,u){const y=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!y||((f=y.effects)==null?void 0:f.status.status)==="failure")throw Error((h=y.effects)==null?void 0:h.status.error)}return l.setGasBudget(1e8),new Promise((y,b)=>{n({transaction:l,chain:i},{onSuccess:w=>{y(w)},onError:w=>{console.error("signAndExecuteTransactionBlock transaction failed",w),b(w)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=Mo.Transaction.from(c)),typeof c=="string"&&(c=Mo.Transaction.from(vn(c))),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:f=>{u(f)},onError:f=>{console.error("signTransactionBlock failed",f),l(f)},onSettled:(f,h,y,b)=>{console.error("signTransactionBlock onSettled",{data:f,error:h,variables:y})}})})),executeTransactionBlock:s}}function Rz(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=Nz(),{currentAccount:n}=Nn(),{suiClient:i}=Zs(),{setTransactionData:s}=w0(),{addTxToast:o,removeToast:a}=sa(),c=5,u=2e3;async function l(y,b=1){try{let w;try{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{w=await i.getTransactionBlock({digest:y,options:{showEvents:!0,showEffects:!0}})}if(w)return w;throw new Error("Empty response")}catch(w){if(console.error(`Attempt ${b} failed:`,w),b>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await Mx(u),l(y,b+1)}}const f=async(y,b,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var U,L;const{useDevInspect:A=!1,useMev:P,txAction:N="signTransactionBlock"}=w;let R;b.status="confirmation",s(b);try{let G;if(N==="signTransactionBlock"){const X=await e(y),{bytes:ie,signature:ae}=X;if(P)try{const ce=await Oz(ie,ae,500)}catch{}G=await t(ie,ae,A)}else G=await r(y,A);b.status="submitted",s({...b}),b.tx=G.digest,R=o(b),await Mx(u);const q=await l(G.digest,0);if(!q||((U=q.effects)==null?void 0:U.status.status)==="failure")h(b,(L=q.effects)==null?void 0:L.status.error);else{const X=JR(q,n==null?void 0:n.address,!1);if(b.buildShowInfo){const ie=b.buildShowInfo("success",X);b.buildShowInfo=ae=>ie}a(R),b.status="success",s({...b})}return q}catch(G){h(b,G)}},h=(y,b)=>{const w=Az(b);if(y.buildShowInfo){const A=y.buildShowInfo("confirmation");y.buildShowInfo=P=>(A.toastDescriptionContent=w,A.modalDescriptionText=w,A),y.status="rejected",s({...y})}else y.buildShowInfo=A=>{const P={};return P.toastDescriptionContent=w,P.modalDescriptionText=w,P},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function S0(e,t=1e3){const r=te.useRef(),n=te.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return te.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function Dz(){const{aggregatorSDK:e}=Zs(),{findBestRouters:t}=Ez(),{getTokenAmountValue:r,fetchTokenPrices:n}=zl(),{providers:i,slippage:s,mevProtect:o}=Br(),{signAndExecuteTransaction:a}=Rz(),{setTransactionData:c}=w0(),{addTxToast:u}=sa(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:w,toAmount:A,setFromAmount:P,setFindRouterLoading:N,setRouterData:R,setByAmountIn:U,byAmountIn:L}=hn(),[G,q]=te.useState(""),X=aa(G),ie=aa(L),ae=aa(w),ce=aa(A),V=aa(l),D=aa(f),{balanceInfo:p,getOwnerCoinBalances:d}=Fl(l==null?void 0:l.coin_type),{balanceInfo:m}=Fl(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),M=r(f==null?void 0:f.coin_type,A),O=S0(async(Se,We,Fe)=>{if(V.current&&D.current&&+Se){(+ae.current||+ce.current)&&N(!0);const lt=HR(Se,We?V.current.decimals:D.current.decimals),ht=await t({fromToken:V.current,toToken:D.current,amount:lt.toString(),providersKeys:i,by_amount_in:We,uuid:Fe});N(!1),X.current===Fe&&(We?+ae.current?(b(ht.toAmountUi||""),R(ht)):b(""):+ce.current?(P(ht.fromAmountUi||"ß"),R(ht)):P(""))}else v(!We)},500),C=(Se,We,Fe=!1)=>{if(U(We),We?(P(Se),Fe&&b("")):(b(Se),Fe&&P("")),+Se){const lt=YS();q(lt),O(Se,We,lt)}else N(!1),R(void 0),v(!We)},g=(Se,We=!0)=>{v(),We?((Se==null?void 0:Se.coin_type)===(f==null?void 0:f.coin_type)&&y(l),h(Se)):((Se==null?void 0:Se.coin_type)===(l==null?void 0:l.coin_type)&&h(f),y(Se))},v=Se=>{Se===void 0?(P(""),b("")):Se?P(""):b(""),N(!1),R(void 0)},j=()=>{const Se=ie.current?ae.current:ce.current;if(+Se){const We=YS();q(We),O(Se,ie.current,We)}},ee=async(Se,We)=>{const{routerData:Fe,byAmountIn:lt,fromAmountUi:ht,toAmountUi:$e}=Se,mt=new Mo.Transaction,_e={routers:Fe.routes,byAmountIn:lt,slippage:Number(s)/100,txb:mt};We&&(_e.partner=We);try{await e.fastRouterSwap(_e);const ge={status:"confirmation",buildShowInfo:(Ge,De)=>{const Oe=`Swap ${Pr(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${Pr($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(Ge==="success"){let Ue=ht,ft=$e;De&&(Ue=Tx(De,l)||ht,ft=Tx(De,f)||$e);const dt=`Swapped ${Pr(Ue,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${Pr(ft,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Ie.toastTitleText=dt,Ie.modalDescriptionText=dt}return Ie},id:0};c(ge),await a(mt,ge,{useMev:o})?(v(),d()):j()}catch(ge){String(ge).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Ae,Ge){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};te.useEffect(()=>{se(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const se=()=>{const Se=[];l&&Se.push(l.coin_type),f&&Se.push(f.coin_type),Se.length>0&&n(Se)},{isScamsCoin:he}=e8(l),{isScamsCoin:ye}=e8(f),Ee=te.useMemo(()=>{if(!(!he&&!ye)){if(he&&ye)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(he)return`${l==null?void 0:l.symbol} token is `;if(ye)return`${f==null?void 0:f.symbol} token is `}},[he,ye]);return{handleAmountChange:C,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:M,doSwapAction:ee,reCalculateRouteData:j,refreshMarketPrice:se,scamsText:Ee}}function $z(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=hn(),{currentAccount:o}=Nn(),a=te.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(s&&s.errorCode){if(s.errorCode===Qs.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Qs.NoRouter||s.errorCode===Qs.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Le(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${un(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function r8({size:e="24px",strokeWidth:t="10",color:r="#909ca4",emptyColor:n="transparent",gapPercentage:i=.5}){const s=50-parseFloat(t),o=2*Math.PI*s,a=o*i,c=o-a;return _.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:n,strokeWidth:t}),_.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:r,strokeWidth:t,strokeDasharray:`${c} ${a}`,strokeDashoffset:"0",strokeLinecap:"round",style:{animation:"dash 0.5s linear infinite"}}),_.jsx("style",{children:`
|
|
98
98
|
@keyframes dash {
|
|
99
99
|
0% {
|
|
100
100
|
stroke-dashoffset: 0; /* 从起点开始 */
|
|
@@ -103,7 +103,7 @@ body { background-color: var(--color-page-background); }
|
|
|
103
103
|
stroke-dashoffset: -${o}; /* 一圈 */
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
`})]})}function E0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=te.useState(!0),a=QS(s,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[_.jsx(Vr,{src:s?e.logo_url:t.logo_url}),_.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",un(s?e.symbol:t.symbol)," ","="," ",i?_.jsx(ia,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):cn(a,t.decimals)," ",un(s?t.symbol:e.symbol)]}),_.jsx(Vr,{src:s?t.logo_url:e.logo_url}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function Vl(){const[e,t]=te.useState(window.innerWidth),r=S0(()=>{t(window.innerWidth)},300);te.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=te.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function n8(e,t,r,n){const{getTokenPrice:i}=zl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=QS(!0,r,n),c=te.useMemo(()=>{if(o&&s)return Le(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=te.useMemo(()=>{if(c&&+a)return Le(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=te.useMemo(()=>{const y=[];return s&&y.push(s.market),o&&!y.includes(o.market)&&y.push(o.market),y},[s==null?void 0:s.market,o==null?void 0:o.market]),f=te.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(5):!1,[u]),h=te.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(10):!1,[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h}}function ql({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=te.useState(!1),[o,a]=te.useState(!1),c=te.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};te.useEffect(()=>()=>{i||c.current&&(clearTimeout(c.current),c.current=null)},[i]);const l=()=>{c.current=setTimeout(()=>{o||(s(!1),c.current&&(clearTimeout(c.current),c.current=null))},0)},f=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},h=te.useRef(null),[y,b]=te.useState({left:void 0,top:void 0});return te.useEffect(()=>{var w;if(i&&h.current){const A=(w=h.current)==null?void 0:w.getBoundingClientRect();let P,R;r==="top"?(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top-2*A.height-8}px`):r==="bottom"?(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.bottom}px`):r==="left"?(P=`${window.scrollX+A.left-8}px`,R=`${window.scrollY+A.top+A.height/2}px`):r==="right"?(P=`${window.scrollX+A.right+8}px`,R=`${window.scrollY+A.top+A.height/2}px`):(P=`${window.scrollX+A.left+A.width/2}px`,R=`${window.scrollY+A.top+A.height/2}px`),b({left:P,top:R})}},[i]),_.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&Bn.createPortal(_.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:i?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...f(),...y},onMouseEnter:()=>a(!0),onMouseLeave:()=>{c.current&&(clearTimeout(c.current),c.current=null),a(!1),s(!1)},children:e}),document.body)]})}function i8({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=Vl();return i&&n?_.jsxs(dn.Root,{children:[_.jsx(dn.Trigger,{children:_.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),_.jsx(dn.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):_.jsx(ql,{content:e,position:r,children:t})}function s8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=hn();Vl();const{priceImpact:a,sources:c,marketPrice:u}=n8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi),l=te.useMemo(()=>{if(a){if(Le(a).gt(0))return"green";const f=Le(a).abs();return f.gt(1)&&f.lt(10)?"yellow":f.gte(10)?"red":"green"}return"yellow"},[a]);return _.jsxs(_.Fragment,{children:[!r&&Le(a).lte(-30)&&_.jsx("div",{className:"price-impact-tips red",children:"Price Impact Alert. Be cautious before submitting your order."}),_.jsxs("div",{className:"price-impact-block",children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{style:{color:"var(--cs-text-con)"},children:"Price Impact"}),_.jsx(i8,{autoSwitchTooltip:!0,position:"top",content:_.jsx(Fz,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{children:[e&&_.jsx(ia,{style:{width:"80px",height:"20px"}}),!e&&_.jsxs("div",{className:"right",children:[_.jsx("span",{className:l,children:a?qN(a,2):"Incalculable"}),_.jsx("div",{className:"platforms",children:c.map(f=>_.jsx(ql,{content:_.jsx("span",{style:{fontSize:"12px"},children:kx[f]}),position:"top",delay:300,children:_.jsx(Vr,{src:aD[f]})},f))})]})]})]})]})}function Fz({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:s}=Vl();return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:s?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),_.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[_.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?_.jsx(E0,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):_.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(o=>kx[o]+" ").join("")})]})]})}function o8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=hn();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?_.jsx(ia,{style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[cn(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,an.ROUND_DOWN)," ",un(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function Uz({scamsText:e}){return _.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[_.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),_.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:_.jsx(Dx,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function zz({onClick:e}){return _.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-back"})}),_.jsx("span",{children:"Back"})]})}function C0({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(zz,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Wl=globalThis||void 0||self;var Vz=typeof Wl=="object"&&Wl&&Wl.Object===Object&&Wl;const a8=Vz;var qz=typeof self=="object"&&self&&self.Object===Object&&self,Wz=a8||qz||Function("return this")();const ci=Wz;var Gz=ci.Symbol;const ui=Gz;var c8=Object.prototype,Hz=c8.hasOwnProperty,Kz=c8.toString,xc=ui?ui.toStringTag:void 0;function Xz(e){var t=Hz.call(e,xc),r=e[xc];try{e[xc]=void 0;var n=!0}catch{}var i=Kz.call(e);return n&&(t?e[xc]=r:delete e[xc]),i}var Jz=Object.prototype,Yz=Jz.toString;function Zz(e){return Yz.call(e)}var Qz="[object Null]",eV="[object Undefined]",u8=ui?ui.toStringTag:void 0;function aa(e){return e==null?e===void 0?eV:Qz:u8&&u8 in Object(e)?Xz(e):Zz(e)}function ys(e){return e!=null&&typeof e=="object"}var tV="[object Symbol]";function Sc(e){return typeof e=="symbol"||ys(e)&&aa(e)==tV}function Gl(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var rV=Array.isArray;const qr=rV;var nV=1/0,l8=ui?ui.prototype:void 0,f8=l8?l8.toString:void 0;function d8(e){if(typeof e=="string")return e;if(qr(e))return Gl(e,d8)+"";if(Sc(e))return f8?f8.call(e):"";var t=e+"";return t=="0"&&1/e==-nV?"-0":t}function ca(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function h8(e){return e}var iV="[object AsyncFunction]",sV="[object Function]",oV="[object GeneratorFunction]",aV="[object Proxy]";function p8(e){if(!ca(e))return!1;var t=aa(e);return t==sV||t==oV||t==iV||t==aV}var cV=ci["__core-js_shared__"];const T0=cV;var m8=function(){var e=/[^.]+$/.exec(T0&&T0.keys&&T0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function uV(e){return!!m8&&m8 in e}var lV=Function.prototype,fV=lV.toString;function eo(e){if(e!=null){try{return fV.call(e)}catch{}try{return e+""}catch{}}return""}var dV=/[\\^$.*+?()[\]{}|]/g,hV=/^\[object .+?Constructor\]$/,pV=Function.prototype,mV=Object.prototype,gV=pV.toString,vV=mV.hasOwnProperty,yV=RegExp("^"+gV.call(vV).replace(dV,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function bV(e){if(!ca(e)||uV(e))return!1;var t=p8(e)?yV:hV;return t.test(eo(e))}function wV(e,t){return e==null?void 0:e[t]}function to(e,t){var r=wV(e,t);return bV(r)?r:void 0}var _V=to(ci,"WeakMap");const M0=_V;var g8=Object.create,xV=function(){function e(){}return function(t){if(!ca(t))return{};if(g8)return g8(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const SV=xV;function EV(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var CV=function(){try{var e=to(Object,"defineProperty");return e({},"",{}),e}catch{}}();const v8=CV;function TV(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var MV=9007199254740991,AV=/^(?:0|[1-9]\d*)$/;function y8(e,t){var r=typeof e;return t=t??MV,!!t&&(r=="number"||r!="symbol"&&AV.test(e))&&e>-1&&e%1==0&&e<t}function b8(e,t,r){t=="__proto__"&&v8?v8(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function A0(e,t){return e===t||e!==e&&t!==t}var OV=Object.prototype,IV=OV.hasOwnProperty;function w8(e,t,r){var n=e[t];(!(IV.call(e,t)&&A0(n,r))||r===void 0&&!(t in e))&&b8(e,t,r)}function Hl(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?b8(r,a,c):w8(r,a,c)}return r}var PV=9007199254740991;function O0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=PV}function Kl(e){return e!=null&&O0(e.length)&&!p8(e)}var kV=Object.prototype;function I0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||kV;return e===r}function jV(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var RV="[object Arguments]";function _8(e){return ys(e)&&aa(e)==RV}var x8=Object.prototype,NV=x8.hasOwnProperty,DV=x8.propertyIsEnumerable,$V=_8(function(){return arguments}())?_8:function(e){return ys(e)&&NV.call(e,"callee")&&!DV.call(e,"callee")};const S8=$V;function BV(){return!1}var E8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,C8=E8&&typeof module=="object"&&module&&!module.nodeType&&module,LV=C8&&C8.exports===E8,T8=LV?ci.Buffer:void 0,FV=T8?T8.isBuffer:void 0,UV=FV||BV;const Xl=UV;var zV="[object Arguments]",VV="[object Array]",qV="[object Boolean]",WV="[object Date]",GV="[object Error]",HV="[object Function]",KV="[object Map]",XV="[object Number]",JV="[object Object]",YV="[object RegExp]",ZV="[object Set]",QV="[object String]",eq="[object WeakMap]",tq="[object ArrayBuffer]",rq="[object DataView]",nq="[object Float32Array]",iq="[object Float64Array]",sq="[object Int8Array]",oq="[object Int16Array]",aq="[object Int32Array]",cq="[object Uint8Array]",uq="[object Uint8ClampedArray]",lq="[object Uint16Array]",fq="[object Uint32Array]",Xt={};Xt[nq]=Xt[iq]=Xt[sq]=Xt[oq]=Xt[aq]=Xt[cq]=Xt[uq]=Xt[lq]=Xt[fq]=!0,Xt[zV]=Xt[VV]=Xt[tq]=Xt[qV]=Xt[rq]=Xt[WV]=Xt[GV]=Xt[HV]=Xt[KV]=Xt[XV]=Xt[JV]=Xt[YV]=Xt[ZV]=Xt[QV]=Xt[eq]=!1;function dq(e){return ys(e)&&O0(e.length)&&!!Xt[aa(e)]}function Jl(e){return function(t){return e(t)}}var M8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,Ec=M8&&typeof module=="object"&&module&&!module.nodeType&&module,hq=Ec&&Ec.exports===M8,P0=hq&&a8.process,pq=function(){try{var e=Ec&&Ec.require&&Ec.require("util").types;return e||P0&&P0.binding&&P0.binding("util")}catch{}}();const ua=pq;var A8=ua&&ua.isTypedArray,mq=A8?Jl(A8):dq;const O8=mq;var gq=Object.prototype,vq=gq.hasOwnProperty;function I8(e,t){var r=qr(e),n=!r&&S8(e),i=!r&&!n&&Xl(e),s=!r&&!n&&!i&&O8(e),o=r||n||i||s,a=o?jV(e.length,String):[],c=a.length;for(var u in e)(t||vq.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||y8(u,c)))&&a.push(u);return a}function P8(e,t){return function(r){return e(t(r))}}var yq=P8(Object.keys,Object);const bq=yq;var wq=Object.prototype,_q=wq.hasOwnProperty;function xq(e){if(!I0(e))return bq(e);var t=[];for(var r in Object(e))_q.call(e,r)&&r!="constructor"&&t.push(r);return t}function Cc(e){return Kl(e)?I8(e):xq(e)}function Sq(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var Eq=Object.prototype,Cq=Eq.hasOwnProperty;function Tq(e){if(!ca(e))return Sq(e);var t=I0(e),r=[];for(var n in e)n=="constructor"&&(t||!Cq.call(e,n))||r.push(n);return r}function k0(e){return Kl(e)?I8(e,!0):Tq(e)}var Mq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Aq=/^\w*$/;function j0(e,t){if(qr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Sc(e)?!0:Aq.test(e)||!Mq.test(e)||t!=null&&e in Object(t)}var Oq=to(Object,"create");const Tc=Oq;function Iq(){this.__data__=Tc?Tc(null):{},this.size=0}function Pq(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var kq="__lodash_hash_undefined__",jq=Object.prototype,Rq=jq.hasOwnProperty;function Nq(e){var t=this.__data__;if(Tc){var r=t[e];return r===kq?void 0:r}return Rq.call(t,e)?t[e]:void 0}var Dq=Object.prototype,$q=Dq.hasOwnProperty;function Bq(e){var t=this.__data__;return Tc?t[e]!==void 0:$q.call(t,e)}var Lq="__lodash_hash_undefined__";function Fq(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Tc&&t===void 0?Lq:t,this}function ro(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ro.prototype.clear=Iq,ro.prototype.delete=Pq,ro.prototype.get=Nq,ro.prototype.has=Bq,ro.prototype.set=Fq;function Uq(){this.__data__=[],this.size=0}function Yl(e,t){for(var r=e.length;r--;)if(A0(e[r][0],t))return r;return-1}var zq=Array.prototype,Vq=zq.splice;function qq(e){var t=this.__data__,r=Yl(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Vq.call(t,r,1),--this.size,!0}function Wq(e){var t=this.__data__,r=Yl(t,e);return r<0?void 0:t[r][1]}function Gq(e){return Yl(this.__data__,e)>-1}function Hq(e,t){var r=this.__data__,n=Yl(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function $i(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$i.prototype.clear=Uq,$i.prototype.delete=qq,$i.prototype.get=Wq,$i.prototype.has=Gq,$i.prototype.set=Hq;var Kq=to(ci,"Map");const Mc=Kq;function Xq(){this.size=0,this.__data__={hash:new ro,map:new(Mc||$i),string:new ro}}function Jq(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Zl(e,t){var r=e.__data__;return Jq(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Yq(e){var t=Zl(this,e).delete(e);return this.size-=t?1:0,t}function Zq(e){return Zl(this,e).get(e)}function Qq(e){return Zl(this,e).has(e)}function eW(e,t){var r=Zl(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Bi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Bi.prototype.clear=Xq,Bi.prototype.delete=Yq,Bi.prototype.get=Zq,Bi.prototype.has=Qq,Bi.prototype.set=eW;var tW="Expected a function";function R0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(tW);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(R0.Cache||Bi),r}R0.Cache=Bi;var rW=500;function nW(e){var t=R0(e,function(n){return r.size===rW&&r.clear(),n}),r=t.cache;return t}var iW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,sW=/\\(\\)?/g,oW=nW(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(iW,function(r,n,i,s){t.push(i?s.replace(sW,"$1"):n||r)}),t});const aW=oW;function cW(e){return e==null?"":d8(e)}function k8(e,t){return qr(e)?e:j0(e,t)?[e]:aW(cW(e))}var uW=1/0;function Ql(e){if(typeof e=="string"||Sc(e))return e;var t=e+"";return t=="0"&&1/e==-uW?"-0":t}function N0(e,t){t=k8(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Ql(t[r++])];return r&&r==n?e:void 0}function lW(e,t,r){var n=e==null?void 0:N0(e,t);return n===void 0?r:n}function j8(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var fW=P8(Object.getPrototypeOf,Object);const R8=fW;function dW(){this.__data__=new $i,this.size=0}function hW(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function pW(e){return this.__data__.get(e)}function mW(e){return this.__data__.has(e)}var gW=200;function vW(e,t){var r=this.__data__;if(r instanceof $i){var n=r.__data__;if(!Mc||n.length<gW-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Bi(n)}return r.set(e,t),this.size=r.size,this}function li(e){var t=this.__data__=new $i(e);this.size=t.size}li.prototype.clear=dW,li.prototype.delete=hW,li.prototype.get=pW,li.prototype.has=mW,li.prototype.set=vW;function yW(e,t){return e&&Hl(t,Cc(t),e)}function bW(e,t){return e&&Hl(t,k0(t),e)}var N8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,D8=N8&&typeof module=="object"&&module&&!module.nodeType&&module,wW=D8&&D8.exports===N8,$8=wW?ci.Buffer:void 0,B8=$8?$8.allocUnsafe:void 0;function _W(e,t){if(t)return e.slice();var r=e.length,n=B8?B8(r):new e.constructor(r);return e.copy(n),n}function L8(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function F8(){return[]}var xW=Object.prototype,SW=xW.propertyIsEnumerable,U8=Object.getOwnPropertySymbols,EW=U8?function(e){return e==null?[]:(e=Object(e),L8(U8(e),function(t){return SW.call(e,t)}))}:F8;const D0=EW;function CW(e,t){return Hl(e,D0(e),t)}var TW=Object.getOwnPropertySymbols,MW=TW?function(e){for(var t=[];e;)j8(t,D0(e)),e=R8(e);return t}:F8;const z8=MW;function AW(e,t){return Hl(e,z8(e),t)}function V8(e,t,r){var n=t(e);return qr(e)?n:j8(n,r(e))}function $0(e){return V8(e,Cc,D0)}function OW(e){return V8(e,k0,z8)}var IW=to(ci,"DataView");const B0=IW;var PW=to(ci,"Promise");const L0=PW;var kW=to(ci,"Set");const F0=kW;var q8="[object Map]",jW="[object Object]",W8="[object Promise]",G8="[object Set]",H8="[object WeakMap]",K8="[object DataView]",RW=eo(B0),NW=eo(Mc),DW=eo(L0),$W=eo(F0),BW=eo(M0),no=aa;(B0&&no(new B0(new ArrayBuffer(1)))!=K8||Mc&&no(new Mc)!=q8||L0&&no(L0.resolve())!=W8||F0&&no(new F0)!=G8||M0&&no(new M0)!=H8)&&(no=function(e){var t=aa(e),r=t==jW?e.constructor:void 0,n=r?eo(r):"";if(n)switch(n){case RW:return K8;case NW:return q8;case DW:return W8;case $W:return G8;case BW:return H8}return t});const Ac=no;var LW=Object.prototype,FW=LW.hasOwnProperty;function UW(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&FW.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var zW=ci.Uint8Array;const ef=zW;function U0(e){var t=new e.constructor(e.byteLength);return new ef(t).set(new ef(e)),t}function VW(e,t){var r=t?U0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var qW=/\w*$/;function WW(e){var t=new e.constructor(e.source,qW.exec(e));return t.lastIndex=e.lastIndex,t}var X8=ui?ui.prototype:void 0,J8=X8?X8.valueOf:void 0;function GW(e){return J8?Object(J8.call(e)):{}}function HW(e,t){var r=t?U0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var KW="[object Boolean]",XW="[object Date]",JW="[object Map]",YW="[object Number]",ZW="[object RegExp]",QW="[object Set]",eG="[object String]",tG="[object Symbol]",rG="[object ArrayBuffer]",nG="[object DataView]",iG="[object Float32Array]",sG="[object Float64Array]",oG="[object Int8Array]",aG="[object Int16Array]",cG="[object Int32Array]",uG="[object Uint8Array]",lG="[object Uint8ClampedArray]",fG="[object Uint16Array]",dG="[object Uint32Array]";function hG(e,t,r){var n=e.constructor;switch(t){case rG:return U0(e);case KW:case XW:return new n(+e);case nG:return VW(e,r);case iG:case sG:case oG:case aG:case cG:case uG:case lG:case fG:case dG:return HW(e,r);case JW:return new n;case YW:case eG:return new n(e);case ZW:return WW(e);case QW:return new n;case tG:return GW(e)}}function pG(e){return typeof e.constructor=="function"&&!I0(e)?SV(R8(e)):{}}var mG="[object Map]";function gG(e){return ys(e)&&Ac(e)==mG}var Y8=ua&&ua.isMap,vG=Y8?Jl(Y8):gG;const yG=vG;var bG="[object Set]";function wG(e){return ys(e)&&Ac(e)==bG}var Z8=ua&&ua.isSet,_G=Z8?Jl(Z8):wG;const xG=_G;var SG=1,EG=2,CG=4,Q8="[object Arguments]",TG="[object Array]",MG="[object Boolean]",AG="[object Date]",OG="[object Error]",e3="[object Function]",IG="[object GeneratorFunction]",PG="[object Map]",kG="[object Number]",t3="[object Object]",jG="[object RegExp]",RG="[object Set]",NG="[object String]",DG="[object Symbol]",$G="[object WeakMap]",BG="[object ArrayBuffer]",LG="[object DataView]",FG="[object Float32Array]",UG="[object Float64Array]",zG="[object Int8Array]",VG="[object Int16Array]",qG="[object Int32Array]",WG="[object Uint8Array]",GG="[object Uint8ClampedArray]",HG="[object Uint16Array]",KG="[object Uint32Array]",Ht={};Ht[Q8]=Ht[TG]=Ht[BG]=Ht[LG]=Ht[MG]=Ht[AG]=Ht[FG]=Ht[UG]=Ht[zG]=Ht[VG]=Ht[qG]=Ht[PG]=Ht[kG]=Ht[t3]=Ht[jG]=Ht[RG]=Ht[NG]=Ht[DG]=Ht[WG]=Ht[GG]=Ht[HG]=Ht[KG]=!0,Ht[OG]=Ht[e3]=Ht[$G]=!1;function tf(e,t,r,n,i,s){var o,a=t&SG,c=t&EG,u=t&CG;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ca(e))return e;var l=qr(e);if(l){if(o=UW(e),!a)return EV(e,o)}else{var f=Ac(e),h=f==e3||f==IG;if(Xl(e))return _W(e,a);if(f==t3||f==Q8||h&&!i){if(o=c||h?{}:pG(e),!a)return c?AW(e,bW(o,e)):CW(e,yW(o,e))}else{if(!Ht[f])return i?e:{};o=hG(e,f,a)}}s||(s=new li);var y=s.get(e);if(y)return y;s.set(e,o),xG(e)?e.forEach(function(A){o.add(tf(A,t,r,A,e,s))}):yG(e)&&e.forEach(function(A,P){o.set(P,tf(A,t,r,P,e,s))});var b=u?c?OW:$0:c?k0:Cc,w=l?void 0:b(e);return TV(w||e,function(A,P){w&&(P=A,A=e[P]),w8(o,P,tf(A,t,r,P,e,s))}),o}var XG=1,JG=4;function YG(e){return tf(e,XG|JG)}var ZG="__lodash_hash_undefined__";function QG(e){return this.__data__.set(e,ZG),this}function eH(e){return this.__data__.has(e)}function rf(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Bi;++t<r;)this.add(e[t])}rf.prototype.add=rf.prototype.push=QG,rf.prototype.has=eH;function tH(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function rH(e,t){return e.has(t)}var nH=1,iH=2;function r3(e,t,r,n,i,s){var o=r&nH,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(e),l=s.get(t);if(u&&l)return u==t&&l==e;var f=-1,h=!0,y=r&iH?new rf:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],w=t[f];if(n)var A=o?n(w,b,f,t,e,s):n(b,w,f,e,t,s);if(A!==void 0){if(A)continue;h=!1;break}if(y){if(!tH(t,function(P,R){if(!rH(y,R)&&(b===P||i(b,P,r,n,s)))return y.push(R)})){h=!1;break}}else if(!(b===w||i(b,w,r,n,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function sH(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function oH(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var aH=1,cH=2,uH="[object Boolean]",lH="[object Date]",fH="[object Error]",dH="[object Map]",hH="[object Number]",pH="[object RegExp]",mH="[object Set]",gH="[object String]",vH="[object Symbol]",yH="[object ArrayBuffer]",bH="[object DataView]",n3=ui?ui.prototype:void 0,z0=n3?n3.valueOf:void 0;function wH(e,t,r,n,i,s,o){switch(r){case bH:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case yH:return!(e.byteLength!=t.byteLength||!s(new ef(e),new ef(t)));case uH:case lH:case hH:return A0(+e,+t);case fH:return e.name==t.name&&e.message==t.message;case pH:case gH:return e==t+"";case dH:var a=sH;case mH:var c=n&aH;if(a||(a=oH),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=cH,o.set(e,t);var l=r3(a(e),a(t),n,i,s,o);return o.delete(e),l;case vH:if(z0)return z0.call(e)==z0.call(t)}return!1}var _H=1,xH=Object.prototype,SH=xH.hasOwnProperty;function EH(e,t,r,n,i,s){var o=r&_H,a=$0(e),c=a.length,u=$0(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:SH.call(t,h)))return!1}var y=s.get(e),b=s.get(t);if(y&&b)return y==t&&b==e;var w=!0;s.set(e,t),s.set(t,e);for(var A=o;++f<c;){h=a[f];var P=e[h],R=t[h];if(n)var N=o?n(R,P,h,t,e,s):n(P,R,h,e,t,s);if(!(N===void 0?P===R||i(P,R,r,n,s):N)){w=!1;break}A||(A=h=="constructor")}if(w&&!A){var F=e.constructor,L=t.constructor;F!=L&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof L=="function"&&L instanceof L)&&(w=!1)}return s.delete(e),s.delete(t),w}var CH=1,i3="[object Arguments]",s3="[object Array]",nf="[object Object]",TH=Object.prototype,o3=TH.hasOwnProperty;function MH(e,t,r,n,i,s){var o=qr(e),a=qr(t),c=o?s3:Ac(e),u=a?s3:Ac(t);c=c==i3?nf:c,u=u==i3?nf:u;var l=c==nf,f=u==nf,h=c==u;if(h&&Xl(e)){if(!Xl(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new li),o||O8(e)?r3(e,t,r,n,i,s):wH(e,t,c,r,n,i,s);if(!(r&CH)){var y=l&&o3.call(e,"__wrapped__"),b=f&&o3.call(t,"__wrapped__");if(y||b){var w=y?e.value():e,A=b?t.value():t;return s||(s=new li),i(w,A,r,n,s)}}return h?(s||(s=new li),EH(e,t,r,n,i,s)):!1}function sf(e,t,r,n,i){return e===t?!0:e==null||t==null||!ys(e)&&!ys(t)?e!==e&&t!==t:MH(e,t,r,n,sf,i)}var AH=1,OH=2;function IH(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],u=e[c],l=a[1];if(o&&a[2]){if(u===void 0&&!(c in e))return!1}else{var f=new li;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?sf(l,u,AH|OH,n,f):h))return!1}}return!0}function a3(e){return e===e&&!ca(e)}function PH(e){for(var t=Cc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,a3(i)]}return t}function c3(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function kH(e){var t=PH(e);return t.length==1&&t[0][2]?c3(t[0][0],t[0][1]):function(r){return r===e||IH(r,e,t)}}function jH(e,t){return e!=null&&t in Object(e)}function RH(e,t,r){t=k8(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Ql(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&O0(i)&&y8(o,i)&&(qr(e)||S8(e)))}function NH(e,t){return e!=null&&RH(e,t,jH)}var DH=1,$H=2;function BH(e,t){return j0(e)&&a3(t)?c3(Ql(e),t):function(r){var n=lW(r,e);return n===void 0&&n===t?NH(r,e):sf(t,n,DH|$H)}}function LH(e){return function(t){return t==null?void 0:t[e]}}function FH(e){return function(t){return N0(t,e)}}function UH(e){return j0(e)?LH(Ql(e)):FH(e)}function u3(e){return typeof e=="function"?e:e==null?h8:typeof e=="object"?qr(e)?BH(e[0],e[1]):kH(e):UH(e)}function zH(e){return function(t,r,n){for(var i=-1,s=Object(t),o=n(t),a=o.length;a--;){var c=o[e?a:++i];if(r(s[c],c,s)===!1)break}return t}}var VH=zH();const qH=VH;function WH(e,t){return e&&qH(e,t,Cc)}function GH(e,t){return function(r,n){if(r==null)return r;if(!Kl(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Object(r);(t?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var HH=GH(WH);const l3=HH;function KH(e,t){var r=[];return l3(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function XH(e,t){var r=qr(e)?L8:KH;return r(e,u3(t))}function JH(e,t){var r=-1,n=Kl(e)?Array(e.length):[];return l3(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function YH(e,t){return sf(e,t)}function ZH(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function QH(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Sc(e),o=t!==void 0,a=t===null,c=t===t,u=Sc(t);if(!a&&!u&&!s&&e>t||s&&o&&c&&!a&&!u||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!u&&e<t||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function eK(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=QH(i[n],s[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function tK(e,t,r){t.length?t=Gl(t,function(s){return qr(s)?function(o){return N0(o,s.length===1?s[0]:s)}:s}):t=[h8];var n=-1;t=Gl(t,Jl(u3));var i=JH(e,function(s,o,a){var c=Gl(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return ZH(i,function(s,o){return eK(s,o,r)})}function rK(e,t,r,n){return e==null?[]:(qr(t)||(t=t==null?[]:[t]),r=n?void 0:r,qr(r)||(r=r==null?[]:[r]),tK(e,t,r))}function nK({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=hn(),s=te.useRef(!1),{slippage:o}=Dr(),[a,c]=te.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=ZS(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=n8(n,i,u,l),{priceAcceptRouterData:w}=xz(a),[A,P]=te.useState(!1),[R,N]=te.useState(!1);te.useMemo(()=>f?i:n,[f]);const F=te.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=YG(w);c(q),setTimeout(()=>{s.current=!1},300)}},G=te.useMemo(()=>A?!1:!!b,[A,b]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(C0,{title:"Review your order",backClick:e}),_.jsxs("div",{className:"secondary-content",children:[_.jsxs("div",{className:"trade-info",children:[_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:Fo(u||"")}),_.jsx("img",{src:n==null?void 0:n.logo_url}),_.jsx("span",{className:"symbol",children:un((n==null?void 0:n.symbol)||"")})]}),_.jsx("div",{className:"dividing-line",children:_.jsx("div",{className:"swap-icon",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-trade"})})})}),_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:Fo(l||"")}),_.jsx("img",{src:i==null?void 0:i.logo_url}),_.jsx("span",{className:"symbol",children:un((i==null?void 0:i.symbol)||"")})]})]}),_.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[_.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:_.jsx(E0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&_.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"Price Impact Alert. Be cautious before submitting your order."})]}),_.jsxs("div",{className:"swap-info-between",children:[_.jsx("div",{className:"left",children:"Slippage Tolerance"}),_.jsxs("div",{className:"right",children:[o,"%"]})]}),_.jsx(o8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),_.jsx(s8,{isLoading:!1,routerData:a,noTips:!0}),b&&_.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[_.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"#ff5073"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),_.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:A?"#72c1f7":"#7F98A7"},onClick:()=>{P(!0)},children:"Yes, please continue."}),_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"#7F98A7",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!F&&_.jsx("button",{disabled:G||R,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{R||(N(!0),t(a))},children:R?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(r8,{})}):"Confirm Swap"}),F&&_.jsxs("div",{className:"price-update",children:[_.jsxs("div",{className:"left",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{children:"Price update"})]}),_.jsx("div",{className:"right",children:_.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function of(e){const{text:t,type:r}=e,[n,i]=te.useState(!1),{addCommonToast:s}=sa(),o=a=>{n||(el(a),WS(t,{debug:!1,message:"message"}),s("Copied"),i(!n))};return te.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),_.jsx(_.Fragment,{children:r==="btn"?_.jsxs("div",{className:"copy-btn",onClick:o,children:[_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),_.jsx("span",{children:"Copy"})]}):_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:o,children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function iK({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=hn(),{getTokenInfo:a}=vs(),c=te.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(f=>({...f,fromToken:a(f.from_type),toToken:a(f.to_type)}))}))},[t]);return _.jsxs("div",{className:"route-dialog",children:[_.jsx(C0,{title:"Route",backClick:e}),_.jsxs("div",{className:"route-dialog-content",children:[_.jsx("div",{className:"simple-router-box",children:_.jsx(d3,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),_.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[_.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[_.jsx(Vr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:cn(s,n==null?void 0:n.decimals)}),_.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),_.jsx("div",{className:"route-box-h5 center",children:_.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((u,l)=>_.jsxs("div",{className:"route-item-box-h5",children:[_.jsxs("div",{className:"percent",children:[Le(u.percentage).mul(100).toString(),"%"]}),_.jsx("div",{className:u.paths.length>1?"route-two-h5":"",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:u.paths.map(f=>_.jsx("div",{className:"route-path-item",children:_.jsx(i8,{autoSwitchTooltip:!0,position:"bottom",content:_.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[_.jsx(oK,{poolAddress:f.pool_address}),_.jsx(f3,{token:f.fromToken}),_.jsx(f3,{token:f.toToken})]}),children:_.jsx(sK,{path:f})})},f.to_type))})]},l))})}),_.jsxs("div",{className:"center",style:{gap:"4px"},children:[_.jsx(Vr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:cn(o,i==null?void 0:i.decimals)}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function sK({path:e}){var t,r,n;return _.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[_.jsx(Vr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx(Vr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),_.jsxs("span",{className:"provider",children:[(n=jx[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&_.jsxs("div",{className:"fee-tier",children:[" ",Le(e.fee_rate).mul(100).toString(),"%"]})]})}function f3({token:e}){const{getExplorerUrl:t}=Uo();return _.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[_.jsx(Vr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:un((e==null?void 0:e.symbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:el,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:Gs(e==null?void 0:e.coin_type)}),_.jsx(of,{text:(e==null?void 0:e.coin_type)||""})]})]})}function oK({poolAddress:e}){const{getExplorerUrl:t}=Uo();return _.jsxs(_.Fragment,{children:[e&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[_.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:el,href:t(e,"poolAddress"),target:"_blank",children:Gs(e)}),_.jsx(of,{text:e})]})]}),e&&_.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function d3({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var c,u,l;const[n,i]=te.useState(!1),{isApp:s}=Vl(),{getTokenInfo:o}=vs(),a=te.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]);return _.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[_.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?_.jsx(ia,{style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[_.jsx("span",{style:{textAlign:"right",color:"#fff"},children:a?(u=(c=r==null?void 0:r.routers[0])==null?void 0:c.paths)==null?void 0:u.map((f,h)=>{var y,b,w;return h===0?`${(y=o(f==null?void 0:f.from_type))==null?void 0:y.symbol} > ${(b=o(f==null?void 0:f.to_type))==null?void 0:b.symbol}`:(w=o(f==null?void 0:f.to_type))==null?void 0:w.symbol}).join(" > "):r==null?void 0:r.router_summery}),_.jsxs("div",{className:"providers",children:[(l=r==null?void 0:r.providers)==null?void 0:l.map((f,h)=>s?_.jsx(Vr,{src:vr[f],style:{width:"16px",height:"16px"}}):_.jsx(ql,{content:_.jsx("div",{children:jx[f].name}),position:"top",delay:300,children:_.jsx(Vr,{src:vr[f],style:{width:"16px",height:"16px"}})},f)),e&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:_.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&_.jsx(iK,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const PJ="",Oc=ji((e,t)=>({currentTypeTab:"Default",setCurrentTypeTab:r=>{e(()=>({currentTypeTab:r}))},currentPlatformTab:"All",setCurrentPlatformTab:r=>{e(()=>({currentPlatformTab:r}))},platformList:["All","Wormhole"],setPlatformList:r=>{e(()=>({platformList:r}))},isOpenImportDialog:!1,setIsOpenImportDialog:r=>{e(()=>({isOpenImportDialog:r}))},collectTokenMap:new Map,setCollectTokenMap:(r,n=!1)=>{e(()=>({collectTokenMap:r})),n||ki.setItem(Ox,r)},showTokenList:[],setShowTokenList:r=>{e(()=>({showTokenList:[...r]}))},combineTokenList:[],setComBineTokenList:r=>{e(()=>({combineTokenList:r}))},currentImportTokenData:void 0,setCurrentImportTokenData:r=>{e(()=>({currentImportTokenData:r}))},importTokenList:[],importTokenIsLoading:!1,setImportToken:(r,n)=>{const{importTokenList:i,setImportTokenList:s}=t();let o=i;if(n)o=[r,...o];else{const a=ix(r.coin_type);o=i.filter(c=>ix(c.coin_type)!==a)}return s(o),ki.setItem(Ix,o),o},setImportTokenList:r=>{e(()=>({importTokenList:r}))},setImportTokenIsLoading:r=>{e(()=>({importTokenIsLoading:r}))},searchInput:"",setSearchInput:r=>{e(()=>({searchInput:r}))},showTokenListIsLoading:!1,setShowTokenListIsLoading:r=>{e(()=>({showTokenListIsLoading:r}))}}));ki.getItem(Ox).then(e=>{e!==null&&Oc.getState().setCollectTokenMap(e,!0)}),ki.getItem(Ix).then(e=>{e&&Oc.getState().setImportTokenList(e)});function h3(){const{setCollectTokenMap:e,collectTokenMap:t}=Oc(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=te.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function aK(e){const{trustedTokenList:t}=_c(),{tokenBalanceObj:r,currentAccount:n}=Rn(),{coinPriceObj:i}=XS(),{getTokenAmountValue:s}=zl(),{fetchTokenInfo:o}=vs(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:w,currentImportTokenData:A,searchInput:P,setSearchInput:R,importTokenIsLoading:N,showTokenListIsLoading:F,setCurrentTypeTab:L}=Oc(),[G,q]=te.useState(!1);te.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[X,ie]=te.useState(!1);te.useEffect(()=>{Ex(i)||ie(!0)},[i]);const ae=te.useRef({}),[ce,V]=te.useState(!1);te.useEffect(()=>{(!Ex(r)||!yp(ae.current,r))&&(ae.current=r,V(!0))},[r]);const D=(v,k)=>{const ee=k&&k.toLocaleLowerCase().trim(),se=v.map(ye=>{let Ee=0,Se=0;ye.symbol.toLowerCase()===ee||ye.name.toLowerCase()===ee||ye.coin_type.toLowerCase()===ee?(Ee=1e3,Se=2):ye.symbol.toLowerCase().indexOf(ee)>-1?(Ee=100,Se=0):ye.name.toLowerCase().indexOf(ee)>-1?(Ee=10,Se=0):ye.coin_type.toLowerCase().indexOf(ee)>-1?(Ee=1,Se=0):ye.coin_type.toLowerCase()=="0x2::sui::sui"&&(Se=1);let Ge=Array.isArray(ye==null?void 0:ye.coin_priority)?Number(ye.coin_priority[0])||0:Number(ye==null?void 0:ye.coin_priority)||0;return e===ye.coin_type&&!k&&(Se=12,Ee=1e3,Ge=1e4),{...ye,mark:Ee,sort:Se,coin_priority_sort:Ge,rateNumber:Number((ye==null?void 0:ye.rate)||"0"),balanceNumber:Number((ye==null?void 0:ye.balance)||"0")}});return rK(se,[ye=>!k&&e===ye.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},p=(v,k=!1)=>{const ee=k?v.trim():v.toLowerCase().trim(),se=["symbol","name","coin_type"];return XH(ee.length===0?l:[...l,...f],ye=>se.some(Ee=>{const Se=ye[Ee];return typeof Se=="string"?(k?Se:Se.toLowerCase()).includes(ee):!1}))},d=v=>{v||b(void 0);const k=p(v);if(console.log("🚀 ~ file: useTokenSelect.ts:182 ~ handleSearch ~ filterList:",{filterList:k,keyword:v,searchInput:P}),(k==null?void 0:k.length)===0){m(v);return}else{const ee=D(k,v);u(ee)}},m=async v=>{var k;console.log("🚀 ~ file: useTokenSelect.ts:182 ~ assemblyImportTokenInfo ~ coinType:",v),w(!0);try{if(Cx(v)){const ee=v.trim(),se=Or(ee).full_address,he=await o(se);if(!he){u([]);return}const ye=((k=r==null?void 0:r[ee])==null?void 0:k.totalBalanceFormat)||"0",Ee=Le(ye).gt("0")?s(ee,ye):"0",Se={...he,balance:ye,rate:Ee};u([Se]),b(Se)}else{u([]);return}}catch(ee){console.log("🚀 ~ file: useTokenSelect.ts:182 ~ assemblyImportTokenInfo ~ error:",ee),b(void 0),u([]);return}finally{w(!1)}},x=v=>{if(v==="Default")O("All");else{const k=D(f,P);u(k)}},T=()=>{if(A){const v=y(A,!0),k=D(v,P);u(k),b(void 0),R("")}},E=v=>{const k=y(v,!1),ee=D(k,P);u(ee)},O=v=>{const k=v==="All"?[...l]:l.filter(se=>v=="Native"?!se.labels||se.labels.length==0||se.labels=="Native":se.labels&&se.labels.length>0&&se.labels[0].toLowerCase()==v.toLowerCase()),ee=D(k,P);u(ee)};te.useEffect(()=>{if(!G||!(t!=null&&t.length)){h([]);return}if(!(n!=null&&n.address))h(t);else if(n!=null&&n.address){const v=[];for(const k of t){const ee=r==null?void 0:r[k==null?void 0:k.coin_type],se=(ee==null?void 0:ee.totalBalanceFormat)||"0",he=(ee==null?void 0:ee.displayBalance)||"0",ye=Le(se).gt("0")?s(k==null?void 0:k.coin_type,se):"0";v.push({...k,balance:he,rate:cn(ye,4,!0)})}h(v)}},[G,X,ce,n==null?void 0:n.address]);const C=te.useRef([]);te.useEffect(()=>{if((l==null?void 0:l.length)>0&&!YH(C.current,l)){C.current=l;const v=D(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),x("Imported")):u(v)}},[l,e]);const g=te.useMemo(()=>{if(a==="Default"){if(!F&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!N)return!0;return!1},[P,c,A,N,F]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:A,handleChangeType:x,handleImportClick:T,handleDeleteImportClick:E,isNoData:g}}function cK({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(uK,{token:r,onHandleTokenAction:t},r.coin_type))})}function uK({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),_.jsx("span",{children:e.symbol}),_.jsx("i",{children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:_.jsx("use",{xlinkHref:"#icon-close"})})})]})}const lK=Ft("/images/img_no_data@2x.png");function fK(e){const{img:t=lK,text:r,width:n="100%",height:i="auto",padding:s="20px",subItem:o}=e;return _.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&_.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&_.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),o&&o]})}function dK({tabList:e,currentTab:t,changeTab:r}){return _.jsx("div",{className:"platform-tabs",children:e.map(n=>_.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var p3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function hK(e,t){return!!(e===t||p3(e)&&p3(t))}function pK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!hK(e[r],t[r]))return!1;return!0}function mK(e,t){t===void 0&&(t=pK);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function V0(){return V0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},V0.apply(null,arguments)}function m3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q0(e,t){return q0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},q0(e,t)}function gK(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,q0(e,t)}var g3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function vK(e,t){return!!(e===t||g3(e)&&g3(t))}function yK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!vK(e[r],t[r]))return!1;return!0}function W0(e,t){t===void 0&&(t=yK);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function v3(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}var bK=typeof performance=="object"&&typeof performance.now=="function",y3=bK?function(){return performance.now()}:function(){return Date.now()};function b3(e){cancelAnimationFrame(e.id)}function wK(e,t){var r=y3();function n(){y3()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var G0=-1;function w3(e){if(e===void 0&&(e=!1),G0===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),G0=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return G0}var la=null;function _3(e){if(e===void 0&&(e=!1),la===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?la="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?la="negative":la="positive-ascending"),document.body.removeChild(t),la}return la}mn.env.NODE_ENV;var _K=150,xK=function(t,r){return t},af=null,cf=null;mn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(af=new WeakSet,cf=new WeakSet);function SK(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(f){gK(h,f);function h(b){var w;return w=f.call(this,b)||this,w._instanceProps=c(w.props,m3(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:m3(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=W0(function(A,P,R,N){return w.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:P,visibleStartIndex:R,visibleStopIndex:N})}),w._callOnScroll=void 0,w._callOnScroll=W0(function(A,P,R){return w.props.onScroll({scrollDirection:A,scrollOffset:P,scrollUpdateWasRequested:R})}),w._getItemStyle=void 0,w._getItemStyle=function(A){var P=w.props,R=P.direction,N=P.itemSize,F=P.layout,L=w._getItemStyleCache(u&&N,u&&F,u&&R),G;if(L.hasOwnProperty(A))G=L[A];else{var q=r(w.props,A,w._instanceProps),X=i(w.props,A,w._instanceProps),ie=R==="horizontal"||F==="horizontal",ae=R==="rtl",ce=ie?q:0;L[A]=G={position:"absolute",left:ae?void 0:ce,right:ae?ce:void 0,top:ie?0:q,height:ie?"100%":X,width:ie?X:"100%"}}return G},w._getItemStyleCache=void 0,w._getItemStyleCache=W0(function(A,P,R){return{}}),w._onScrollHorizontal=function(A){var P=A.currentTarget,R=P.clientWidth,N=P.scrollLeft,F=P.scrollWidth;w.setState(function(L){if(L.scrollOffset===N)return null;var G=w.props.direction,q=N;if(G==="rtl")switch(_3()){case"negative":q=-N;break;case"positive-descending":q=F-R-N;break}return q=Math.max(0,Math.min(q,F-R)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(A){var P=A.currentTarget,R=P.clientHeight,N=P.scrollHeight,F=P.scrollTop;w.setState(function(L){if(L.scrollOffset===F)return null;var G=Math.max(0,Math.min(F,N-R));return{isScrolling:!0,scrollDirection:L.scrollOffset<G?"forward":"backward",scrollOffset:G,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(A){var P=w.props.outerRef;w._outerRef=A,typeof P=="function"?P(A):P!=null&&typeof P=="object"&&P.hasOwnProperty("current")&&(P.current=A)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&b3(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=wK(w._resetIsScrolling,_K)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,A){return EK(w,A),l(w),null};var y=h.prototype;return y.scrollTo=function(w){w=Math.max(0,w),this.setState(function(A){return A.scrollOffset===w?null:{scrollDirection:A.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(w,A){A===void 0&&(A="auto");var P=this.props,R=P.itemCount,N=P.layout,F=this.state.scrollOffset;w=Math.max(0,Math.min(w,R-1));var L=0;if(this._outerRef){var G=this._outerRef;N==="vertical"?L=G.scrollWidth>G.clientWidth?w3():0:L=G.scrollHeight>G.clientHeight?w3():0}this.scrollTo(s(this.props,w,A,F,this._instanceProps,L))},y.componentDidMount=function(){var w=this.props,A=w.direction,P=w.initialScrollOffset,R=w.layout;if(typeof P=="number"&&this._outerRef!=null){var N=this._outerRef;A==="horizontal"||R==="horizontal"?N.scrollLeft=P:N.scrollTop=P}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,A=w.direction,P=w.layout,R=this.state,N=R.scrollOffset,F=R.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(A==="horizontal"||P==="horizontal")if(A==="rtl")switch(_3()){case"negative":L.scrollLeft=-N;break;case"positive-ascending":L.scrollLeft=N;break;default:var G=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-G-N;break}else L.scrollLeft=N;else L.scrollTop=N}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&b3(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,A=w.children,P=w.className,R=w.direction,N=w.height,F=w.innerRef,L=w.innerElementType,G=w.innerTagName,q=w.itemCount,X=w.itemData,ie=w.itemKey,ae=ie===void 0?xK:ie,ce=w.layout,V=w.outerElementType,D=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,T=R==="horizontal"||ce==="horizontal",E=T?this._onScrollHorizontal:this._onScrollVertical,O=this._getRangeToRender(),C=O[0],g=O[1],v=[];if(q>0)for(var k=C;k<=g;k++)v.push(te.createElement(A,{data:X,key:ae(k,X),index:k,isScrolling:d?x:void 0,style:this._getItemStyle(k)}));var ee=n(this.props,this._instanceProps);return te.createElement(V||D||"div",{className:P,onScroll:E,ref:this._outerRefSetter,style:V0({position:"relative",height:N,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},p)},te.createElement(L||G||"div",{children:v,ref:F,style:{height:T?"100%":ee,pointerEvents:x?"none":void 0,width:T?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var A=this._getRangeToRender(),P=A[0],R=A[1],N=A[2],F=A[3];this._callOnItemsRendered(P,R,N,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,G=L.scrollDirection,q=L.scrollOffset,X=L.scrollUpdateWasRequested;this._callOnScroll(G,q,X)}},y._getRangeToRender=function(){var w=this.props,A=w.itemCount,P=w.overscanCount,R=this.state,N=R.isScrolling,F=R.scrollDirection,L=R.scrollOffset;if(A===0)return[0,0,0,0];var G=o(this.props,L,this._instanceProps),q=a(this.props,G,L,this._instanceProps),X=!N||F==="backward"?Math.max(1,P):1,ie=!N||F==="forward"?Math.max(1,P):1;return[Math.max(0,G-X),Math.max(0,Math.min(A-1,q+ie)),G,q]},h}(te.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var EK=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(mn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&cf&&!cf.has(l)&&(cf.add(l),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=i==="horizontal"||o==="horizontal";switch(i){case"horizontal":case"vertical":af&&!af.has(l)&&(af.add(l),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},CK=SK({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,f=t.layout,h=t.width,y=a==="horizontal"||f==="horizontal",b=y?h:c,w=Math.max(0,u*l-b),A=Math.min(w,r*l),P=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=P-b&&i<=A+b?n="auto":n="center"),n){case"start":return A;case"end":return P;case"center":{var R=Math.round(P+(A-P)/2);return R<Math.ceil(b/2)?0:R>w+Math.floor(b/2)?w:R}case"auto":default:return i>=P&&i<=A?i:i<P?P:A}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",f=r*a,h=l?u:s,y=Math.ceil((h+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(mn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function x3(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var TK=["style"],MK=["style"];function AK(e,t){var r=e.style,n=v3(e,TK),i=t.style,s=v3(t,MK);return!x3(r,i)&&!x3(n,s)}const OK=te.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return _.jsx("div",{style:r,children:_.jsx(kK,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},AK),IK=mK((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function PK({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=te.useRef(null);te.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=IK(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(CK,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:OK})})}function kK({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=h3(),{getExplorerUrl:s}=Uo();return _.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Vr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),_.jsxs("div",{className:"token-info",children:[_.jsx("h4",{className:"token-symbol",children:_.jsx("span",{children:un(e.symbol)})}),_.jsx("p",{className:"token-name",children:un(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:el,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Gs(e==null?void 0:e.coin_type)}),_.jsx(of,{text:e==null?void 0:e.coin_type})]})]}),_.jsxs("div",{className:"token-balance",children:[_.jsxs("div",{className:"balance",children:[_.jsx("h4",{children:e==null?void 0:e.balance}),_.jsx("p",{children:e!=null&&e.rate?xx(e==null?void 0:e.rate,2):""})]}),r&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function jK({currentType:e,changeTab:t}){const r=["Default","Imported"];return _.jsx("div",{className:"type-tabs",children:r.map(n=>_.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function RK({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=aK(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:w,isOpenImportDialog:A,setIsOpenImportDialog:P,setSearchInput:R,searchInput:N,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:G}=Oc();te.useEffect(()=>()=>{R(""),b("All"),h("Default"),G(void 0)},[]);const{handleCollectToken:q,collectTokenMap:X}=h3(),ie=m=>{h(m),a(m)},ae=m=>{b(m),o(m)},ce=()=>{c(),P(!1)},V=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();R(x),x?(D(x),console.log("🚀🚀🚀 ~ file: index.tsx:36 ~ changeInputValue1 ~ regValue:",x)):(console.log("🚀🚀🚀 ~ file: index.tsx:36 ~ changeInputValue2 ~ regValue:",x),D(""),ie("Default"))},D=S0(m=>{Cx(m)?s(qs(m,!1)):s(m)},300),p=(m,x)=>{if(x==="delete_import"){u(m);return}if(x==="collect_token"||x==="un_collect"){q(m);return}x==="select_token"&&(t(m),e())},d=te.useMemo(()=>Array.from(X.values()),[X]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(C0,{backClick:e,title:"Select Token"}),_.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:"search-input",style:{position:"relative"},children:[_.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:N,onChange:m=>V(m.target.value),style:{paddingRight:"40px"}}),N.length>0&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{V("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(cK,{tokenList:d,onHandleTokenAction:p}),N.length===0&&_.jsx(jK,{currentType:f,changeTab:ie}),N.length===0&&f==="Default"&&_.jsx(dK,{tabList:w,currentTab:y,changeTab:ae})]}),i&&_.jsx(NK,{showTooltip:N.length>0,text:N.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),F&&_.jsx(GS,{}),L&&_.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&_.jsxs("div",{style:{position:"relative"},children:[_.jsx(PK,{showTokenList:n,showCollect:!L,showDelete:!L&&f==="Imported",onHandleTokenAction:p}),L&&_.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:_.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ce(),p(L,"select_token")},children:"Import"})})]})]})]})}function NK({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(fK,{text:t,subItem:e?_.jsx("div",{children:_.jsx(ql,{position:"bottom",content:_.jsx("div",{children:"The unique id of coin"}),children:_.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function DK({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=te.useState(!1),{setIgnoreWarnToken:s}=Dr();return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",onClick:e}),_.jsxs("div",{className:"import-dialog",children:[_.jsxs("div",{className:"cs-dialog-header",children:[_.jsx("div",{className:"title",children:"Tips"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"import-content",children:[_.jsx("div",{className:"tip-text-box",children:_.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(o=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(Vr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:o.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",o.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:Gs(o.coin_type)}),_.jsx(of,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox",children:[_.jsx(El,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),_.jsx("span",{children:"I acknowledge the risk"})]}),_.jsxs("div",{className:"button-block",children:[_.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),_.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}const kJ="";function S3(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var Ic;(function(e){e.event="event",e.props="prop"})(Ic||(Ic={}));function bs(){}function $K(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function Pc(e){return!!(e||"").match(/\d/)}function fa(e){return e==null}function BK(e){return typeof e=="number"&&isNaN(e)}function E3(e){return fa(e)||BK(e)||typeof e=="number"&&!isFinite(e)}function C3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function LK(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function FK(e,t,r){var n=LK(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function UK(e){var t=te.useRef(e);t.current=e;var r=te.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function H0(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),s=i[0],o=i[1]||"";return{beforeDecimal:s,afterDecimal:o,hasNegation:r,addNegation:n}}function zK(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function T3(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function M3(e,t){return Array(t+1).join(e)}function A3(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],s=n[1];if(s=Number(s),!s)return r+i;i=i.replace(".","");var o=1+s,a=i.length;return o<0?i="0."+M3("0",Math.abs(o))+i:o>=a?i=i+M3("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function O3(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=H0(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),u=o.length<=t?"0."+o:c.toFixed(t),l=u.split("."),f=s;s&&Number(l[0])&&(f=s.split("").reverse().reduce(function(w,A,P){return w.length>P?(Number(w[0])+Number(A)).toString()+w.substring(1,w.length):A+w},l[0]));var h=T3(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function io(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var I3=$K(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),VK=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function qK(e,t,r){return Math.min(Math.max(e,t),r)}function K0(e){return Math.max(e.selectionStart,e.selectionEnd)}function WK(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function GK(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function HK(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function KK(e,t,r,n,i,s,o){o===void 0&&(o=HK);var a=i.findIndex(function(F){return F}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,f={},h=new Array(u),y=0;y<u;y++){h[y]=-1;for(var b=0,w=l;b<w;b++){var A=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(A&&f[b]!==!0){h[y]=b,f[b]=!0;break}}}for(var P=n;P<u&&(h[P]===-1||!s(r[P]));)P++;var R=P===u||h[P]===-1?l:h[P];for(P=n-1;P>0&&h[P]===-1;)P--;var N=P===-1||h[P]===-1?0:h[P]+1;return N>R?R:n-N<R-n?N:R}function P3(e,t,r,n){var i=e.length;if(t=qK(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function XK(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Pc(e[r])||Pc(e[r-1]));return t}function k3(e,t,r,n,i,s){s===void 0&&(s=bs);var o=UK(function(b,w){var A,P;return E3(b)?(P="",A=""):typeof b=="number"||w?(P=typeof b=="number"?A3(b):b,A=n(P)):(P=i(b,void 0),A=n(P)),{formattedValue:A,numAsString:P}}),a=te.useState(function(){return o(fa(e)?t:e,r)}),c=a[0],u=a[1],l=function(b,w){b.formattedValue!==c.formattedValue&&u({formattedValue:b.formattedValue,numAsString:b.value}),s(b,w)},f=e,h=r;fa(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return te.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function JK(e){return e.replace(/[^0-9]/g,"")}function YK(e){return e}function ZK(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,s=e.getInputRef,o=e.format;o===void 0&&(o=YK);var a=e.removeFormatting;a===void 0&&(a=JK);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=bs);var y=e.onKeyDown;y===void 0&&(y=bs);var b=e.onMouseUp;b===void 0&&(b=bs);var w=e.onFocus;w===void 0&&(w=bs);var A=e.onBlur;A===void 0&&(A=bs);var P=e.value,R=e.getCaretBoundary;R===void 0&&(R=XK);var N=e.isValidInputCharacter;N===void 0&&(N=Pc);var F=e.isCharacterSame,L=S3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),G=k3(P,c,!!u,o,a,l),q=G[0],X=q.formattedValue,ie=q.numAsString,ae=G[1],ce=te.useRef(),V=te.useRef({formattedValue:X,numAsString:ie}),D=function(_e,ge){V.current={formattedValue:_e.formattedValue,numAsString:_e.value},ae(_e,ge)},p=te.useState(!1),d=p[0],m=p[1],x=te.useRef(null),T=te.useRef({setCaretTimeout:null,focusTimeout:null});te.useEffect(function(){return m(!0),function(){clearTimeout(T.current.setCaretTimeout),clearTimeout(T.current.focusTimeout)}},[]);var E=o,O=function(_e,ge){var Ae=parseFloat(ge);return{formattedValue:_e,value:ge,floatValue:isNaN(Ae)?void 0:Ae}},C=function(_e,ge,Ae){_e.selectionStart===0&&_e.selectionEnd===_e.value.length||(io(_e,ge),T.current.setCaretTimeout=setTimeout(function(){_e.value===Ae&&_e.selectionStart!==ge&&io(_e,ge)},0))},g=function(_e,ge,Ae){return P3(_e,ge,R(_e),Ae)},v=function(_e,ge,Ae){var We=R(ge),De=KK(ge,X,_e,Ae,We,N,F);return De=P3(ge,De,We),De},k=function(_e){var ge=_e.formattedValue;ge===void 0&&(ge="");var Ae=_e.input,We=_e.source,De=_e.event,Oe=_e.numAsString,Ie;if(Ae){var Fe=_e.inputValue||Ae.value,ft=K0(Ae);Ae.value=ge,Ie=v(Fe,ge,ft),Ie!==void 0&&C(Ae,Ie,ge)}ge!==X&&D(O(ge,Oe),{event:De,source:We})};te.useEffect(function(){var _e=V.current,ge=_e.formattedValue,Ae=_e.numAsString;(X!==ge||ie!==Ae)&&D(O(X,ie),{event:void 0,source:Ic.props})},[X,ie]);var ee=x.current?K0(x.current):void 0,se=typeof window<"u"?te.useLayoutEffect:te.useEffect;se(function(){var _e=x.current;if(X!==V.current.formattedValue&&_e){var ge=v(V.current.formattedValue,X,ee);_e.value=X,C(_e,ge,X)}},[X]);var he=function(_e,ge,Ae){var We=ge.target,De=ce.current?VK(ce.current,We.selectionEnd):I3(X,_e),Oe=Object.assign(Object.assign({},De),{lastValue:X}),Ie=a(_e,Oe),Fe=E(Ie);if(Ie=a(Fe,void 0),f&&!f(O(Fe,Ie))){var ft=ge.target,dt=K0(ft),He=v(_e,X,dt);return ft.value=X,C(ft,He,X),!1}return k({formattedValue:Fe,numAsString:Ie,inputValue:_e,event:ge,source:Ae,input:ge.target}),!0},ye=function(_e,ge){ge===void 0&&(ge=0);var Ae=_e.selectionStart,We=_e.selectionEnd;ce.current={selectionStart:Ae,selectionEnd:We+ge}},Ee=function(_e){var ge=_e.target,Ae=ge.value,We=he(Ae,_e,Ic.event);We&&h(_e),ce.current=void 0},Se=function(_e){var ge=_e.target,Ae=_e.key,We=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie;Ae==="ArrowLeft"||Ae==="Backspace"?Ie=Math.max(We-1,0):Ae==="ArrowRight"?Ie=Math.min(We+1,Oe.length):Ae==="Delete"&&(Ie=We);var Fe=0;Ae==="Delete"&&We===De&&(Fe=1);var ft=Ae==="ArrowLeft"||Ae==="ArrowRight";if(Ie===void 0||We!==De&&!ft){y(_e),ye(ge,Fe);return}var dt=Ie;if(ft){var He=Ae==="ArrowLeft"?"left":"right";dt=g(Oe,Ie,He),dt!==Ie&&_e.preventDefault()}else Ae==="Delete"&&!N(Oe[Ie])?dt=g(Oe,Ie,"right"):Ae==="Backspace"&&!N(Oe[Ie])&&(dt=g(Oe,Ie,"left"));dt!==Ie&&C(ge,dt,Oe),y(_e),ye(ge,Fe)},Ge=function(_e){var ge=_e.target,Ae=function(){var We=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;if(Oe===void 0&&(Oe=""),We===De){var Ie=g(Oe,We);Ie!==We&&C(ge,Ie,Oe)}};Ae(),requestAnimationFrame(function(){Ae()}),b(_e),ye(ge)},Ue=function(_e){_e.persist&&_e.persist();var ge=_e.target,Ae=_e.currentTarget;x.current=ge,T.current.focusTimeout=setTimeout(function(){var We=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie=g(Oe,We);Ie!==We&&!(We===0&&De===Oe.length)&&C(ge,Ie,Oe),w(Object.assign(Object.assign({},_e),{currentTarget:Ae}))},0)},lt=function(_e){x.current=null,clearTimeout(T.current.focusTimeout),clearTimeout(T.current.setCaretTimeout),A(_e)},ht=d&&WK()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:X,onChange:Ee,onKeyDown:Se,onMouseUp:Ge,onFocus:Ue,onBlur:lt});if(r==="text")return i?te.createElement(te.Fragment,null,i(X,L)||null):te.createElement("span",Object.assign({},L,{ref:s}),X);if(n){var mt=n;return te.createElement(mt,Object.assign({},$e,{ref:s}))}return te.createElement("input",Object.assign({},$e,{ref:s}))}function j3(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=uf(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=H0(e,o),y=h.beforeDecimal,b=h.afterDecimal,w=h.addNegation;return r!==void 0&&(b=T3(b,r,!!n)),u&&(y=FK(y,u,a)),i&&(y=i+y),s&&(b=b+s),w&&(y="-"+y),e=y+(f&&l||"")+b,e}function uf(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function QK(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function eX(e,t){return new RegExp("(^-)|[0-9]|"+C3(e),t?"g":void 0)}function tX(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function rX(e,t,r){var n;t===void 0&&(t=GK(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,f=u.end,h=uf(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,w=e[f]===b;if(Pc(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var A=a===0?"":b;e=e.substring(0,l)+A+e.substring(l+1,e.length)}var P=function(x,T,E){var O=!1,C=!1;s.startsWith("-")?O=!1:x.startsWith("--")?(O=!1,C=!0):o.startsWith("-")&&x.length===o.length?O=!1:x[0]==="-"&&(O=!0);var g=O?1:0;return C&&(g=2),g&&(x=x.substring(g),T-=g,E-=g),{value:x,start:T,end:E,hasNegation:O}},R=P(e,l,f),N=R.hasNegation;n=R,e=n.value,l=n.start,f=n.end;var F=P(t.lastValue,c.start,c.end),L=F.start,G=F.end,q=F.value,X=e.substring(l,f);e.length&&q.length&&(L>q.length-o.length||G<s.length)&&!(X&&o.startsWith(X))&&(e=q);var ie=0;e.startsWith(s)?ie+=s.length:l<s.length&&(ie=l),e=e.substring(ie),f-=ie;var ae=e.length,ce=e.length-o.length;e.endsWith(o)?ae=ce:(f>ce||f>e.length-o.length)&&(ae=f),e=e.substring(0,ae),e=QK(N?"-"+e:e,i),e=(e.match(eX(b,!0))||[]).join("");var V=e.indexOf(b);e=e.replace(new RegExp(C3(b),"g"),function(x,T){return T===V?".":""});var D=H0(e,i),p=D.beforeDecimal,d=D.afterDecimal,m=D.addNegation;return u.end-u.start<c.end-c.start&&p===""&&w&&!parseFloat(d)&&(e=m?"-":""),e}function nX(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function iX(e){var t=uf(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),r===n)throw new Error(`
|
|
106
|
+
`})]})}function E0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=te.useState(!0),a=QS(s,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[_.jsx(Wr,{src:s?e.logo_url:t.logo_url}),_.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-title)",fontSize:"12px",maxWidth:"80%"},children:["1"," ",un(s?e.symbol:t.symbol)," ","="," ",i?_.jsx(ia,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):Pr(a,t.decimals)," ",un(s?t.symbol:e.symbol)]}),_.jsx(Wr,{src:s?t.logo_url:e.logo_url}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function Vl(){const[e,t]=te.useState(window.innerWidth),r=S0(()=>{t(window.innerWidth)},300);te.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=te.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function n8(e,t,r,n){const{getTokenPrice:i}=zl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=QS(!0,r,n),c=te.useMemo(()=>{if(o&&s)return Le(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=te.useMemo(()=>{if(c&&+a)return Le(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=te.useMemo(()=>{const b=[];return s&&b.push(s.market),o&&!b.includes(o.market)&&b.push(o.market),b},[s==null?void 0:s.market,o==null?void 0:o.market]),f=te.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(5):!1,[u]),h=te.useMemo(()=>u&&Le(u).lt(0)?Le(u).abs().gt(10):!1,[u]),y=te.useMemo(()=>{let b,w="yellow";if(u)if(Le(u).gt(0))w="green",Le(u).lt(.1)?b="< 0.1% cheaper than":b=`${Pr(u,2,!0,$r.ROUND_UP)}% cheaper than`;else if(Le(u).eq(0))b="0%",w="green";else{const A=Le(u).abs();A.lte(5)?(w="green",b=`Within ${Pr(A.toString(),2,!0,$r.ROUND_UP)}%`):A.lte(10)?(w="yellow",b=`${Pr(A.toString(),2,!0,$r.ROUND_UP)}% more than`):A.lte(100)?(w="red",b=`${Pr(A.toString(),2,!0,$r.ROUND_UP)}% more than`):(w="red",b="> 100% more than")}return{priceImpactText:b,textColor:w}},[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h,priceImpactTextInfo:y}}function ql({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=te.useState(!1),[o,a]=te.useState(!1),c=te.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};te.useEffect(()=>()=>{i||c.current&&(clearTimeout(c.current),c.current=null)},[i]);const l=()=>{c.current=setTimeout(()=>{o||(s(!1),c.current&&(clearTimeout(c.current),c.current=null))},0)},f=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},h=te.useRef(null),[y,b]=te.useState({left:void 0,top:void 0});return te.useEffect(()=>{var w;if(i&&h.current){const A=(w=h.current)==null?void 0:w.getBoundingClientRect();let P,N;r==="top"?(P=`${window.scrollX+A.left+A.width/2}px`,N=`${window.scrollY+A.top-2*A.height-8}px`):r==="bottom"?(P=`${window.scrollX+A.left+A.width/2}px`,N=`${window.scrollY+A.bottom}px`):r==="left"?(P=`${window.scrollX+A.left-8}px`,N=`${window.scrollY+A.top+A.height/2}px`):r==="right"?(P=`${window.scrollX+A.right+8}px`,N=`${window.scrollY+A.top+A.height/2}px`):(P=`${window.scrollX+A.left+A.width/2}px`,N=`${window.scrollY+A.top+A.height/2}px`),b({left:P,top:N})}},[i]),_.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&Bn.createPortal(_.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:i?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...f(),...y},onMouseEnter:()=>a(!0),onMouseLeave:()=>{c.current&&(clearTimeout(c.current),c.current=null),a(!1),s(!1)},children:e}),document.body)]})}function i8({content:e,children:t,position:r,autoSwitchTooltip:n=!1}){const{isApp:i}=Vl();return i&&n?_.jsxs(dn.Root,{children:[_.jsx(dn.Trigger,{children:_.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),_.jsx(dn.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-dialog-bg)",color:"var(--cs-text-con)",borderRadius:"8px",fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):_.jsx(ql,{content:e,position:r,children:t})}function s8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=hn();Vl();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l}=n8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return _.jsxs(_.Fragment,{children:[!r&&Le(a).lte(-30)&&_.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),_.jsxs("div",{className:"price-impact-block",children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{style:{color:"var(--cs-text-con)"},children:"Price Difference"}),_.jsx(i8,{autoSwitchTooltip:!0,position:"top",content:_.jsx(Bz,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{children:[e&&_.jsx(ia,{style:{width:"80px",height:"20px"}}),!e&&_.jsxs("div",{className:"right",children:[_.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText?l==null?void 0:l.priceImpactText:"Incalculable"}),_.jsx("div",{className:"platforms",children:c.map(f=>_.jsx(ql,{content:_.jsx("span",{style:{fontSize:"12px"},children:jx[f]}),position:"top",delay:300,children:_.jsx(Wr,{src:sD[f]})},f))})]})]})]})]})}function Bz({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){const{isApp:s}=Vl();return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:s?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),_.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[_.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?_.jsx(E0,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):_.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(o=>jx[o]+" ").join("")})]})]})}function o8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=hn();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?_.jsx(ia,{style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[Pr(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,$r.ROUND_DOWN)," ",un(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function Lz({scamsText:e}){return _.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[_.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),_.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:_.jsx(Dx,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function Uz({onClick:e}){return _.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-back"})}),_.jsx("span",{children:"Back"})]})}function C0({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(Uz,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Wl=globalThis||void 0||self;var Fz=typeof Wl=="object"&&Wl&&Wl.Object===Object&&Wl;const a8=Fz;var zz=typeof self=="object"&&self&&self.Object===Object&&self,Vz=a8||zz||Function("return this")();const ci=Vz;var qz=ci.Symbol;const ui=qz;var c8=Object.prototype,Wz=c8.hasOwnProperty,Gz=c8.toString,xc=ui?ui.toStringTag:void 0;function Hz(e){var t=Wz.call(e,xc),r=e[xc];try{e[xc]=void 0;var n=!0}catch{}var i=Gz.call(e);return n&&(t?e[xc]=r:delete e[xc]),i}var Kz=Object.prototype,Xz=Kz.toString;function Jz(e){return Xz.call(e)}var Yz="[object Null]",Zz="[object Undefined]",u8=ui?ui.toStringTag:void 0;function ca(e){return e==null?e===void 0?Zz:Yz:u8&&u8 in Object(e)?Hz(e):Jz(e)}function bs(e){return e!=null&&typeof e=="object"}var Qz="[object Symbol]";function Sc(e){return typeof e=="symbol"||bs(e)&&ca(e)==Qz}function Gl(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var eV=Array.isArray;const Gr=eV;var tV=1/0,l8=ui?ui.prototype:void 0,f8=l8?l8.toString:void 0;function d8(e){if(typeof e=="string")return e;if(Gr(e))return Gl(e,d8)+"";if(Sc(e))return f8?f8.call(e):"";var t=e+"";return t=="0"&&1/e==-tV?"-0":t}function ua(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function h8(e){return e}var rV="[object AsyncFunction]",nV="[object Function]",iV="[object GeneratorFunction]",sV="[object Proxy]";function p8(e){if(!ua(e))return!1;var t=ca(e);return t==nV||t==iV||t==rV||t==sV}var oV=ci["__core-js_shared__"];const M0=oV;var m8=function(){var e=/[^.]+$/.exec(M0&&M0.keys&&M0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function aV(e){return!!m8&&m8 in e}var cV=Function.prototype,uV=cV.toString;function eo(e){if(e!=null){try{return uV.call(e)}catch{}try{return e+""}catch{}}return""}var lV=/[\\^$.*+?()[\]{}|]/g,fV=/^\[object .+?Constructor\]$/,dV=Function.prototype,hV=Object.prototype,pV=dV.toString,mV=hV.hasOwnProperty,gV=RegExp("^"+pV.call(mV).replace(lV,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vV(e){if(!ua(e)||aV(e))return!1;var t=p8(e)?gV:fV;return t.test(eo(e))}function yV(e,t){return e==null?void 0:e[t]}function to(e,t){var r=yV(e,t);return vV(r)?r:void 0}var bV=to(ci,"WeakMap");const T0=bV;var g8=Object.create,wV=function(){function e(){}return function(t){if(!ua(t))return{};if(g8)return g8(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const _V=wV;function xV(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var SV=function(){try{var e=to(Object,"defineProperty");return e({},"",{}),e}catch{}}();const v8=SV;function EV(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var CV=9007199254740991,MV=/^(?:0|[1-9]\d*)$/;function y8(e,t){var r=typeof e;return t=t??CV,!!t&&(r=="number"||r!="symbol"&&MV.test(e))&&e>-1&&e%1==0&&e<t}function b8(e,t,r){t=="__proto__"&&v8?v8(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function A0(e,t){return e===t||e!==e&&t!==t}var TV=Object.prototype,AV=TV.hasOwnProperty;function w8(e,t,r){var n=e[t];(!(AV.call(e,t)&&A0(n,r))||r===void 0&&!(t in e))&&b8(e,t,r)}function Hl(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?b8(r,a,c):w8(r,a,c)}return r}var OV=9007199254740991;function O0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=OV}function Kl(e){return e!=null&&O0(e.length)&&!p8(e)}var IV=Object.prototype;function I0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||IV;return e===r}function PV(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var jV="[object Arguments]";function _8(e){return bs(e)&&ca(e)==jV}var x8=Object.prototype,kV=x8.hasOwnProperty,NV=x8.propertyIsEnumerable,RV=_8(function(){return arguments}())?_8:function(e){return bs(e)&&kV.call(e,"callee")&&!NV.call(e,"callee")};const S8=RV;function DV(){return!1}var E8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,C8=E8&&typeof module=="object"&&module&&!module.nodeType&&module,$V=C8&&C8.exports===E8,M8=$V?ci.Buffer:void 0,BV=M8?M8.isBuffer:void 0,LV=BV||DV;const Xl=LV;var UV="[object Arguments]",FV="[object Array]",zV="[object Boolean]",VV="[object Date]",qV="[object Error]",WV="[object Function]",GV="[object Map]",HV="[object Number]",KV="[object Object]",XV="[object RegExp]",JV="[object Set]",YV="[object String]",ZV="[object WeakMap]",QV="[object ArrayBuffer]",eq="[object DataView]",tq="[object Float32Array]",rq="[object Float64Array]",nq="[object Int8Array]",iq="[object Int16Array]",sq="[object Int32Array]",oq="[object Uint8Array]",aq="[object Uint8ClampedArray]",cq="[object Uint16Array]",uq="[object Uint32Array]",Xt={};Xt[tq]=Xt[rq]=Xt[nq]=Xt[iq]=Xt[sq]=Xt[oq]=Xt[aq]=Xt[cq]=Xt[uq]=!0,Xt[UV]=Xt[FV]=Xt[QV]=Xt[zV]=Xt[eq]=Xt[VV]=Xt[qV]=Xt[WV]=Xt[GV]=Xt[HV]=Xt[KV]=Xt[XV]=Xt[JV]=Xt[YV]=Xt[ZV]=!1;function lq(e){return bs(e)&&O0(e.length)&&!!Xt[ca(e)]}function Jl(e){return function(t){return e(t)}}var T8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,Ec=T8&&typeof module=="object"&&module&&!module.nodeType&&module,fq=Ec&&Ec.exports===T8,P0=fq&&a8.process,dq=function(){try{var e=Ec&&Ec.require&&Ec.require("util").types;return e||P0&&P0.binding&&P0.binding("util")}catch{}}();const la=dq;var A8=la&&la.isTypedArray,hq=A8?Jl(A8):lq;const O8=hq;var pq=Object.prototype,mq=pq.hasOwnProperty;function I8(e,t){var r=Gr(e),n=!r&&S8(e),i=!r&&!n&&Xl(e),s=!r&&!n&&!i&&O8(e),o=r||n||i||s,a=o?PV(e.length,String):[],c=a.length;for(var u in e)(t||mq.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||y8(u,c)))&&a.push(u);return a}function P8(e,t){return function(r){return e(t(r))}}var gq=P8(Object.keys,Object);const vq=gq;var yq=Object.prototype,bq=yq.hasOwnProperty;function wq(e){if(!I0(e))return vq(e);var t=[];for(var r in Object(e))bq.call(e,r)&&r!="constructor"&&t.push(r);return t}function Cc(e){return Kl(e)?I8(e):wq(e)}function _q(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var xq=Object.prototype,Sq=xq.hasOwnProperty;function Eq(e){if(!ua(e))return _q(e);var t=I0(e),r=[];for(var n in e)n=="constructor"&&(t||!Sq.call(e,n))||r.push(n);return r}function j0(e){return Kl(e)?I8(e,!0):Eq(e)}var Cq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mq=/^\w*$/;function k0(e,t){if(Gr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Sc(e)?!0:Mq.test(e)||!Cq.test(e)||t!=null&&e in Object(t)}var Tq=to(Object,"create");const Mc=Tq;function Aq(){this.__data__=Mc?Mc(null):{},this.size=0}function Oq(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Iq="__lodash_hash_undefined__",Pq=Object.prototype,jq=Pq.hasOwnProperty;function kq(e){var t=this.__data__;if(Mc){var r=t[e];return r===Iq?void 0:r}return jq.call(t,e)?t[e]:void 0}var Nq=Object.prototype,Rq=Nq.hasOwnProperty;function Dq(e){var t=this.__data__;return Mc?t[e]!==void 0:Rq.call(t,e)}var $q="__lodash_hash_undefined__";function Bq(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Mc&&t===void 0?$q:t,this}function ro(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ro.prototype.clear=Aq,ro.prototype.delete=Oq,ro.prototype.get=kq,ro.prototype.has=Dq,ro.prototype.set=Bq;function Lq(){this.__data__=[],this.size=0}function Yl(e,t){for(var r=e.length;r--;)if(A0(e[r][0],t))return r;return-1}var Uq=Array.prototype,Fq=Uq.splice;function zq(e){var t=this.__data__,r=Yl(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Fq.call(t,r,1),--this.size,!0}function Vq(e){var t=this.__data__,r=Yl(t,e);return r<0?void 0:t[r][1]}function qq(e){return Yl(this.__data__,e)>-1}function Wq(e,t){var r=this.__data__,n=Yl(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Bi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Bi.prototype.clear=Lq,Bi.prototype.delete=zq,Bi.prototype.get=Vq,Bi.prototype.has=qq,Bi.prototype.set=Wq;var Gq=to(ci,"Map");const Tc=Gq;function Hq(){this.size=0,this.__data__={hash:new ro,map:new(Tc||Bi),string:new ro}}function Kq(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Zl(e,t){var r=e.__data__;return Kq(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Xq(e){var t=Zl(this,e).delete(e);return this.size-=t?1:0,t}function Jq(e){return Zl(this,e).get(e)}function Yq(e){return Zl(this,e).has(e)}function Zq(e,t){var r=Zl(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Li(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Li.prototype.clear=Hq,Li.prototype.delete=Xq,Li.prototype.get=Jq,Li.prototype.has=Yq,Li.prototype.set=Zq;var Qq="Expected a function";function N0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Qq);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(N0.Cache||Li),r}N0.Cache=Li;var eW=500;function tW(e){var t=N0(e,function(n){return r.size===eW&&r.clear(),n}),r=t.cache;return t}var rW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nW=/\\(\\)?/g,iW=tW(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(rW,function(r,n,i,s){t.push(i?s.replace(nW,"$1"):n||r)}),t});const sW=iW;function oW(e){return e==null?"":d8(e)}function j8(e,t){return Gr(e)?e:k0(e,t)?[e]:sW(oW(e))}var aW=1/0;function Ql(e){if(typeof e=="string"||Sc(e))return e;var t=e+"";return t=="0"&&1/e==-aW?"-0":t}function R0(e,t){t=j8(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Ql(t[r++])];return r&&r==n?e:void 0}function cW(e,t,r){var n=e==null?void 0:R0(e,t);return n===void 0?r:n}function k8(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var uW=P8(Object.getPrototypeOf,Object);const N8=uW;function lW(){this.__data__=new Bi,this.size=0}function fW(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function dW(e){return this.__data__.get(e)}function hW(e){return this.__data__.has(e)}var pW=200;function mW(e,t){var r=this.__data__;if(r instanceof Bi){var n=r.__data__;if(!Tc||n.length<pW-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Li(n)}return r.set(e,t),this.size=r.size,this}function li(e){var t=this.__data__=new Bi(e);this.size=t.size}li.prototype.clear=lW,li.prototype.delete=fW,li.prototype.get=dW,li.prototype.has=hW,li.prototype.set=mW;function gW(e,t){return e&&Hl(t,Cc(t),e)}function vW(e,t){return e&&Hl(t,j0(t),e)}var R8=typeof Vt=="object"&&Vt&&!Vt.nodeType&&Vt,D8=R8&&typeof module=="object"&&module&&!module.nodeType&&module,yW=D8&&D8.exports===R8,$8=yW?ci.Buffer:void 0,B8=$8?$8.allocUnsafe:void 0;function bW(e,t){if(t)return e.slice();var r=e.length,n=B8?B8(r):new e.constructor(r);return e.copy(n),n}function L8(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function U8(){return[]}var wW=Object.prototype,_W=wW.propertyIsEnumerable,F8=Object.getOwnPropertySymbols,xW=F8?function(e){return e==null?[]:(e=Object(e),L8(F8(e),function(t){return _W.call(e,t)}))}:U8;const D0=xW;function SW(e,t){return Hl(e,D0(e),t)}var EW=Object.getOwnPropertySymbols,CW=EW?function(e){for(var t=[];e;)k8(t,D0(e)),e=N8(e);return t}:U8;const z8=CW;function MW(e,t){return Hl(e,z8(e),t)}function V8(e,t,r){var n=t(e);return Gr(e)?n:k8(n,r(e))}function $0(e){return V8(e,Cc,D0)}function TW(e){return V8(e,j0,z8)}var AW=to(ci,"DataView");const B0=AW;var OW=to(ci,"Promise");const L0=OW;var IW=to(ci,"Set");const U0=IW;var q8="[object Map]",PW="[object Object]",W8="[object Promise]",G8="[object Set]",H8="[object WeakMap]",K8="[object DataView]",jW=eo(B0),kW=eo(Tc),NW=eo(L0),RW=eo(U0),DW=eo(T0),no=ca;(B0&&no(new B0(new ArrayBuffer(1)))!=K8||Tc&&no(new Tc)!=q8||L0&&no(L0.resolve())!=W8||U0&&no(new U0)!=G8||T0&&no(new T0)!=H8)&&(no=function(e){var t=ca(e),r=t==PW?e.constructor:void 0,n=r?eo(r):"";if(n)switch(n){case jW:return K8;case kW:return q8;case NW:return W8;case RW:return G8;case DW:return H8}return t});const Ac=no;var $W=Object.prototype,BW=$W.hasOwnProperty;function LW(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&BW.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var UW=ci.Uint8Array;const ef=UW;function F0(e){var t=new e.constructor(e.byteLength);return new ef(t).set(new ef(e)),t}function FW(e,t){var r=t?F0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var zW=/\w*$/;function VW(e){var t=new e.constructor(e.source,zW.exec(e));return t.lastIndex=e.lastIndex,t}var X8=ui?ui.prototype:void 0,J8=X8?X8.valueOf:void 0;function qW(e){return J8?Object(J8.call(e)):{}}function WW(e,t){var r=t?F0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var GW="[object Boolean]",HW="[object Date]",KW="[object Map]",XW="[object Number]",JW="[object RegExp]",YW="[object Set]",ZW="[object String]",QW="[object Symbol]",eG="[object ArrayBuffer]",tG="[object DataView]",rG="[object Float32Array]",nG="[object Float64Array]",iG="[object Int8Array]",sG="[object Int16Array]",oG="[object Int32Array]",aG="[object Uint8Array]",cG="[object Uint8ClampedArray]",uG="[object Uint16Array]",lG="[object Uint32Array]";function fG(e,t,r){var n=e.constructor;switch(t){case eG:return F0(e);case GW:case HW:return new n(+e);case tG:return FW(e,r);case rG:case nG:case iG:case sG:case oG:case aG:case cG:case uG:case lG:return WW(e,r);case KW:return new n;case XW:case ZW:return new n(e);case JW:return VW(e);case YW:return new n;case QW:return qW(e)}}function dG(e){return typeof e.constructor=="function"&&!I0(e)?_V(N8(e)):{}}var hG="[object Map]";function pG(e){return bs(e)&&Ac(e)==hG}var Y8=la&&la.isMap,mG=Y8?Jl(Y8):pG;const gG=mG;var vG="[object Set]";function yG(e){return bs(e)&&Ac(e)==vG}var Z8=la&&la.isSet,bG=Z8?Jl(Z8):yG;const wG=bG;var _G=1,xG=2,SG=4,Q8="[object Arguments]",EG="[object Array]",CG="[object Boolean]",MG="[object Date]",TG="[object Error]",e3="[object Function]",AG="[object GeneratorFunction]",OG="[object Map]",IG="[object Number]",t3="[object Object]",PG="[object RegExp]",jG="[object Set]",kG="[object String]",NG="[object Symbol]",RG="[object WeakMap]",DG="[object ArrayBuffer]",$G="[object DataView]",BG="[object Float32Array]",LG="[object Float64Array]",UG="[object Int8Array]",FG="[object Int16Array]",zG="[object Int32Array]",VG="[object Uint8Array]",qG="[object Uint8ClampedArray]",WG="[object Uint16Array]",GG="[object Uint32Array]",Ht={};Ht[Q8]=Ht[EG]=Ht[DG]=Ht[$G]=Ht[CG]=Ht[MG]=Ht[BG]=Ht[LG]=Ht[UG]=Ht[FG]=Ht[zG]=Ht[OG]=Ht[IG]=Ht[t3]=Ht[PG]=Ht[jG]=Ht[kG]=Ht[NG]=Ht[VG]=Ht[qG]=Ht[WG]=Ht[GG]=!0,Ht[TG]=Ht[e3]=Ht[RG]=!1;function tf(e,t,r,n,i,s){var o,a=t&_G,c=t&xG,u=t&SG;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ua(e))return e;var l=Gr(e);if(l){if(o=LW(e),!a)return xV(e,o)}else{var f=Ac(e),h=f==e3||f==AG;if(Xl(e))return bW(e,a);if(f==t3||f==Q8||h&&!i){if(o=c||h?{}:dG(e),!a)return c?MW(e,vW(o,e)):SW(e,gW(o,e))}else{if(!Ht[f])return i?e:{};o=fG(e,f,a)}}s||(s=new li);var y=s.get(e);if(y)return y;s.set(e,o),wG(e)?e.forEach(function(A){o.add(tf(A,t,r,A,e,s))}):gG(e)&&e.forEach(function(A,P){o.set(P,tf(A,t,r,P,e,s))});var b=u?c?TW:$0:c?j0:Cc,w=l?void 0:b(e);return EV(w||e,function(A,P){w&&(P=A,A=e[P]),w8(o,P,tf(A,t,r,P,e,s))}),o}var HG=1,KG=4;function XG(e){return tf(e,HG|KG)}var JG="__lodash_hash_undefined__";function YG(e){return this.__data__.set(e,JG),this}function ZG(e){return this.__data__.has(e)}function rf(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Li;++t<r;)this.add(e[t])}rf.prototype.add=rf.prototype.push=YG,rf.prototype.has=ZG;function QG(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function eH(e,t){return e.has(t)}var tH=1,rH=2;function r3(e,t,r,n,i,s){var o=r&tH,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(e),l=s.get(t);if(u&&l)return u==t&&l==e;var f=-1,h=!0,y=r&rH?new rf:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],w=t[f];if(n)var A=o?n(w,b,f,t,e,s):n(b,w,f,e,t,s);if(A!==void 0){if(A)continue;h=!1;break}if(y){if(!QG(t,function(P,N){if(!eH(y,N)&&(b===P||i(b,P,r,n,s)))return y.push(N)})){h=!1;break}}else if(!(b===w||i(b,w,r,n,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function nH(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function iH(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var sH=1,oH=2,aH="[object Boolean]",cH="[object Date]",uH="[object Error]",lH="[object Map]",fH="[object Number]",dH="[object RegExp]",hH="[object Set]",pH="[object String]",mH="[object Symbol]",gH="[object ArrayBuffer]",vH="[object DataView]",n3=ui?ui.prototype:void 0,z0=n3?n3.valueOf:void 0;function yH(e,t,r,n,i,s,o){switch(r){case vH:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case gH:return!(e.byteLength!=t.byteLength||!s(new ef(e),new ef(t)));case aH:case cH:case fH:return A0(+e,+t);case uH:return e.name==t.name&&e.message==t.message;case dH:case pH:return e==t+"";case lH:var a=nH;case hH:var c=n&sH;if(a||(a=iH),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=oH,o.set(e,t);var l=r3(a(e),a(t),n,i,s,o);return o.delete(e),l;case mH:if(z0)return z0.call(e)==z0.call(t)}return!1}var bH=1,wH=Object.prototype,_H=wH.hasOwnProperty;function xH(e,t,r,n,i,s){var o=r&bH,a=$0(e),c=a.length,u=$0(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:_H.call(t,h)))return!1}var y=s.get(e),b=s.get(t);if(y&&b)return y==t&&b==e;var w=!0;s.set(e,t),s.set(t,e);for(var A=o;++f<c;){h=a[f];var P=e[h],N=t[h];if(n)var R=o?n(N,P,h,t,e,s):n(P,N,h,e,t,s);if(!(R===void 0?P===N||i(P,N,r,n,s):R)){w=!1;break}A||(A=h=="constructor")}if(w&&!A){var U=e.constructor,L=t.constructor;U!=L&&"constructor"in e&&"constructor"in t&&!(typeof U=="function"&&U instanceof U&&typeof L=="function"&&L instanceof L)&&(w=!1)}return s.delete(e),s.delete(t),w}var SH=1,i3="[object Arguments]",s3="[object Array]",nf="[object Object]",EH=Object.prototype,o3=EH.hasOwnProperty;function CH(e,t,r,n,i,s){var o=Gr(e),a=Gr(t),c=o?s3:Ac(e),u=a?s3:Ac(t);c=c==i3?nf:c,u=u==i3?nf:u;var l=c==nf,f=u==nf,h=c==u;if(h&&Xl(e)){if(!Xl(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new li),o||O8(e)?r3(e,t,r,n,i,s):yH(e,t,c,r,n,i,s);if(!(r&SH)){var y=l&&o3.call(e,"__wrapped__"),b=f&&o3.call(t,"__wrapped__");if(y||b){var w=y?e.value():e,A=b?t.value():t;return s||(s=new li),i(w,A,r,n,s)}}return h?(s||(s=new li),xH(e,t,r,n,i,s)):!1}function sf(e,t,r,n,i){return e===t?!0:e==null||t==null||!bs(e)&&!bs(t)?e!==e&&t!==t:CH(e,t,r,n,sf,i)}var MH=1,TH=2;function AH(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],u=e[c],l=a[1];if(o&&a[2]){if(u===void 0&&!(c in e))return!1}else{var f=new li;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?sf(l,u,MH|TH,n,f):h))return!1}}return!0}function a3(e){return e===e&&!ua(e)}function OH(e){for(var t=Cc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,a3(i)]}return t}function c3(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function IH(e){var t=OH(e);return t.length==1&&t[0][2]?c3(t[0][0],t[0][1]):function(r){return r===e||AH(r,e,t)}}function PH(e,t){return e!=null&&t in Object(e)}function jH(e,t,r){t=j8(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Ql(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&O0(i)&&y8(o,i)&&(Gr(e)||S8(e)))}function kH(e,t){return e!=null&&jH(e,t,PH)}var NH=1,RH=2;function DH(e,t){return k0(e)&&a3(t)?c3(Ql(e),t):function(r){var n=cW(r,e);return n===void 0&&n===t?kH(r,e):sf(t,n,NH|RH)}}function $H(e){return function(t){return t==null?void 0:t[e]}}function BH(e){return function(t){return R0(t,e)}}function LH(e){return k0(e)?$H(Ql(e)):BH(e)}function u3(e){return typeof e=="function"?e:e==null?h8:typeof e=="object"?Gr(e)?DH(e[0],e[1]):IH(e):LH(e)}function UH(e){return function(t,r,n){for(var i=-1,s=Object(t),o=n(t),a=o.length;a--;){var c=o[e?a:++i];if(r(s[c],c,s)===!1)break}return t}}var FH=UH();const zH=FH;function VH(e,t){return e&&zH(e,t,Cc)}function qH(e,t){return function(r,n){if(r==null)return r;if(!Kl(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Object(r);(t?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var WH=qH(VH);const l3=WH;function GH(e,t){var r=[];return l3(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function HH(e,t){var r=Gr(e)?L8:GH;return r(e,u3(t))}function KH(e,t){var r=-1,n=Kl(e)?Array(e.length):[];return l3(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function XH(e,t){return sf(e,t)}function JH(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function YH(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Sc(e),o=t!==void 0,a=t===null,c=t===t,u=Sc(t);if(!a&&!u&&!s&&e>t||s&&o&&c&&!a&&!u||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!u&&e<t||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function ZH(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=YH(i[n],s[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function QH(e,t,r){t.length?t=Gl(t,function(s){return Gr(s)?function(o){return R0(o,s.length===1?s[0]:s)}:s}):t=[h8];var n=-1;t=Gl(t,Jl(u3));var i=KH(e,function(s,o,a){var c=Gl(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return JH(i,function(s,o){return ZH(s,o,r)})}function eK(e,t,r,n){return e==null?[]:(Gr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Gr(r)||(r=r==null?[]:[r]),QH(e,t,r))}function tK({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=hn(),s=te.useRef(!1),{slippage:o}=Br(),[a,c]=te.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=ZS(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=n8(n,i,u,l),{priceAcceptRouterData:w}=wz(a),[A,P]=te.useState(!1),[N,R]=te.useState(!1);te.useMemo(()=>f?i:n,[f]);const U=te.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=XG(w);c(q),setTimeout(()=>{s.current=!1},300)}},G=te.useMemo(()=>A?!1:!!b,[A,b]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(C0,{title:"Review your order",backClick:e}),_.jsxs("div",{className:"secondary-content",children:[_.jsxs("div",{className:"trade-info",children:[_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:Uo(u||"")}),_.jsx("img",{src:n==null?void 0:n.logo_url}),_.jsx("span",{className:"symbol",children:un((n==null?void 0:n.symbol)||"")})]}),_.jsx("div",{className:"dividing-line",children:_.jsx("div",{className:"swap-icon",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-trade"})})})}),_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:Uo(l||"")}),_.jsx("img",{src:i==null?void 0:i.logo_url}),_.jsx("span",{className:"symbol",children:un((i==null?void 0:i.symbol)||"")})]})]}),_.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[_.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",marginTop:"-1px"},children:_.jsx(E0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&_.jsx("div",{style:{paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),_.jsxs("div",{className:"swap-info-between",children:[_.jsx("div",{className:"left",children:"Slippage Tolerance"}),_.jsxs("div",{className:"right",children:[o,"%"]})]}),_.jsx(o8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),_.jsx(s8,{isLoading:!1,routerData:a,noTips:!0}),b&&_.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[_.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"#ff5073"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),_.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:A?"#72c1f7":"#7F98A7"},onClick:()=>{P(!0)},children:"Yes, please continue."}),_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"#7F98A7",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!U&&_.jsx("button",{disabled:G||N,className:"swap-btn cs-solid-btn",style:{marginTop:"8px"},onClick:()=>{N||(R(!0),t(a))},children:N?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(r8,{})}):"Confirm Swap"}),U&&_.jsxs("div",{className:"price-update",children:[_.jsxs("div",{className:"left",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{children:"Price update"})]}),_.jsx("div",{className:"right",children:_.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function of(e){const{text:t,type:r}=e,[n,i]=te.useState(!1),{addCommonToast:s}=sa(),o=a=>{n||(el(a),WS(t,{debug:!1,message:"message"}),s("Copied"),i(!n))};return te.useEffect(()=>{n&&setTimeout(()=>{i(!1)},2e3)},[n]),_.jsx(_.Fragment,{children:r==="btn"?_.jsxs("div",{className:"copy-btn",onClick:o,children:[_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})}),_.jsx("span",{children:"Copy"})]}):_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:o,children:_.jsx("use",{xlinkHref:n?"#icon-sel":"#icon-copy"})})})}function rK({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=hn(),{getTokenInfo:a}=ys(),c=te.useMemo(()=>{var u;return(u=t==null?void 0:t.routers)==null?void 0:u.map(l=>({...l,paths:l.paths.map(f=>({...f,fromToken:a(f.from_type),toToken:a(f.to_type)}))}))},[t]);return _.jsxs("div",{className:"route-dialog",children:[_.jsx(C0,{title:"Route",backClick:e}),_.jsxs("div",{className:"route-dialog-content",children:[_.jsx("div",{className:"simple-router-box",children:_.jsx(d3,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),_.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[_.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[_.jsx(Wr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:Pr(s,n==null?void 0:n.decimals)}),_.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),_.jsx("div",{className:"route-box-h5 center",children:_.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((u,l)=>_.jsxs("div",{className:"route-item-box-h5",children:[_.jsxs("div",{className:"percent",children:[Le(u.percentage).mul(100).toString(),"%"]}),_.jsx("div",{className:u.paths.length>1?"route-two-h5":"",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:u.paths.map(f=>_.jsx("div",{className:"route-path-item",children:_.jsx(i8,{autoSwitchTooltip:!0,position:"bottom",content:_.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[_.jsx(iK,{poolAddress:f.pool_address}),_.jsx(f3,{token:f.fromToken}),_.jsx(f3,{token:f.toToken})]}),children:_.jsx(nK,{path:f})})},f.to_type))})]},l))})}),_.jsxs("div",{className:"center",style:{gap:"4px"},children:[_.jsx(Wr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:Pr(o,i==null?void 0:i.decimals)}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function nK({path:e}){var t,r,n;return _.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[_.jsx(Wr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx(Wr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),_.jsxs("span",{className:"provider",children:[(n=kx[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&_.jsxs("div",{className:"fee-tier",children:[" ",Le(e.fee_rate).mul(100).toString(),"%"]})]})}function f3({token:e}){const{getExplorerUrl:t}=Fo();return _.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[_.jsx(Wr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:un((e==null?void 0:e.symbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:el,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:Gs(e==null?void 0:e.coin_type)}),_.jsx(of,{text:(e==null?void 0:e.coin_type)||""})]})]})}function iK({poolAddress:e}){const{getExplorerUrl:t}=Fo();return _.jsxs(_.Fragment,{children:[e&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[_.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:el,href:t(e,"poolAddress"),target:"_blank",children:Gs(e)}),_.jsx(of,{text:e})]})]}),e&&_.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function d3({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var c,u,l;const[n,i]=te.useState(!1),{isApp:s}=Vl(),{getTokenInfo:o}=ys(),a=te.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]);return _.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[_.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?_.jsx(ia,{style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[_.jsx("span",{style:{textAlign:"right",color:"#fff"},children:a?(u=(c=r==null?void 0:r.routers[0])==null?void 0:c.paths)==null?void 0:u.map((f,h)=>{var y,b,w;return h===0?`${(y=o(f==null?void 0:f.from_type))==null?void 0:y.symbol} > ${(b=o(f==null?void 0:f.to_type))==null?void 0:b.symbol}`:(w=o(f==null?void 0:f.to_type))==null?void 0:w.symbol}).join(" > "):r==null?void 0:r.router_summery}),_.jsxs("div",{className:"providers",children:[(l=r==null?void 0:r.providers)==null?void 0:l.map((f,h)=>s?_.jsx(Wr,{src:vr[f],style:{width:"16px",height:"16px"}}):_.jsx(ql,{content:_.jsx("div",{children:kx[f].name}),position:"top",delay:300,children:_.jsx(Wr,{src:vr[f],style:{width:"16px",height:"16px"}})},f)),e&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:_.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&_.jsx(rK,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const OJ="",Oc=Ni((e,t)=>({currentTypeTab:"Default",setCurrentTypeTab:r=>{e(()=>({currentTypeTab:r}))},currentPlatformTab:"All",setCurrentPlatformTab:r=>{e(()=>({currentPlatformTab:r}))},platformList:["All","Wormhole"],setPlatformList:r=>{e(()=>({platformList:r}))},isOpenImportDialog:!1,setIsOpenImportDialog:r=>{e(()=>({isOpenImportDialog:r}))},collectTokenMap:new Map,setCollectTokenMap:(r,n=!1)=>{e(()=>({collectTokenMap:r})),n||ki.setItem(Ox,r)},showTokenList:[],setShowTokenList:r=>{e(()=>({showTokenList:[...r]}))},combineTokenList:[],setComBineTokenList:r=>{e(()=>({combineTokenList:r}))},currentImportTokenData:void 0,setCurrentImportTokenData:r=>{e(()=>({currentImportTokenData:r}))},importTokenList:[],importTokenIsLoading:!1,setImportToken:(r,n)=>{const{importTokenList:i,setImportTokenList:s}=t();let o=i;if(n)o=[r,...o];else{const a=ix(r.coin_type);o=i.filter(c=>ix(c.coin_type)!==a)}return s(o),ki.setItem(Ix,o),o},setImportTokenList:r=>{e(()=>({importTokenList:r}))},setImportTokenIsLoading:r=>{e(()=>({importTokenIsLoading:r}))},searchInput:"",setSearchInput:r=>{e(()=>({searchInput:r}))},showTokenListIsLoading:!1,setShowTokenListIsLoading:r=>{e(()=>({showTokenListIsLoading:r}))}}));ki.getItem(Ox).then(e=>{e!==null&&Oc.getState().setCollectTokenMap(e,!0)}),ki.getItem(Ix).then(e=>{e&&Oc.getState().setImportTokenList(e)});function h3(){const{setCollectTokenMap:e,collectTokenMap:t}=Oc(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=te.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function sK(e){const{trustedTokenList:t}=oa(),{tokenBalanceObj:r,currentAccount:n}=Nn(),{coinPriceObj:i}=XS(),{getTokenAmountValue:s}=zl(),{fetchTokenInfo:o}=ys(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:w,currentImportTokenData:A,searchInput:P,setSearchInput:N,importTokenIsLoading:R,showTokenListIsLoading:U,setCurrentTypeTab:L}=Oc(),[G,q]=te.useState(!1);te.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[X,ie]=te.useState(!1);te.useEffect(()=>{Ex(i)||ie(!0)},[i]);const ae=te.useRef({}),[ce,V]=te.useState(!1);te.useEffect(()=>{(!Ex(r)||!yp(ae.current,r))&&(ae.current=r,V(!0))},[r]);const D=(v,j)=>{const ee=j&&j.toLocaleLowerCase().trim(),se=v.map(ye=>{let Ee=0,Se=0;ye.symbol.toLowerCase()===ee||ye.name.toLowerCase()===ee||ye.coin_type.toLowerCase()===ee?(Ee=1e3,Se=2):ye.symbol.toLowerCase().indexOf(ee)>-1?(Ee=100,Se=0):ye.name.toLowerCase().indexOf(ee)>-1?(Ee=10,Se=0):ye.coin_type.toLowerCase().indexOf(ee)>-1?(Ee=1,Se=0):ye.coin_type.toLowerCase()=="0x2::sui::sui"&&(Se=1);let We=Array.isArray(ye==null?void 0:ye.coin_priority)?Number(ye.coin_priority[0])||0:Number(ye==null?void 0:ye.coin_priority)||0;return e===ye.coin_type&&!j&&(Se=12,Ee=1e3,We=1e4),{...ye,mark:Ee,sort:Se,coin_priority_sort:We,rateNumber:Number((ye==null?void 0:ye.rate)||"0"),balanceNumber:Number((ye==null?void 0:ye.balance)||"0")}});return eK(se,[ye=>!j&&e===ye.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},p=(v,j=!1)=>{const ee=j?v.trim():v.toLowerCase().trim(),se=["symbol","name","coin_type"];return HH(ee.length===0?l:[...l,...f],ye=>se.some(Ee=>{const Se=ye[Ee];if(typeof Se=="string"){const We=j?Se:Se.toLowerCase();return Ee==="coin_type"?We.includes(ee)||Pi(We,!0).includes(Pi(ee,!0)):We.includes(ee)}return!1}))},d=v=>{v||b(void 0);const j=p(v);if((j==null?void 0:j.length)===0){m(v);return}else{const ee=D(j,v);u(ee)}},m=async v=>{var j;w(!0);try{if(Cx(v)){const ee=v.trim(),se=Or(ee).full_address,he=await o(se);if(!he){u([]);return}const ye=((j=r==null?void 0:r[ee])==null?void 0:j.totalBalanceFormat)||"0",Ee=Le(ye).gt("0")?s(ee,ye):"0",Se={...he,balance:ye,rate:Ee};u([Se]),b(Se)}else{u([]);return}}catch{b(void 0),u([]);return}finally{w(!1)}},x=v=>{if(v==="Default")O("All");else{const j=D(f,P);u(j)}},M=()=>{if(A){const v=y(A,!0),j=D(v,P);u(j),b(void 0),N("")}},E=v=>{const j=y(v,!1),ee=D(j,P);u(ee)},O=v=>{const j=v==="All"?[...l]:l.filter(se=>v=="Native"?!se.labels||se.labels.length==0||se.labels=="Native":se.labels&&se.labels.length>0&&se.labels[0].toLowerCase()==v.toLowerCase()),ee=D(j,P);u(ee)};te.useEffect(()=>{if(!G||!(t!=null&&t.length)){h([]);return}if(!(n!=null&&n.address))h(t);else if(n!=null&&n.address){const v=[];for(const j of t){const ee=r==null?void 0:r[j==null?void 0:j.coin_type],se=(ee==null?void 0:ee.totalBalanceFormat)||"0",he=(ee==null?void 0:ee.displayBalance)||"0",ye=Le(se).gt("0")?s(j==null?void 0:j.coin_type,se):"0";v.push({...j,balance:he,rate:Pr(ye,4,!0)})}h(v)}},[G,X,ce,n==null?void 0:n.address]);const C=te.useRef([]);te.useEffect(()=>{if((l==null?void 0:l.length)>0&&!XH(C.current,l)){C.current=l;const v=D(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(L("Imported"),x("Imported")):u(v)}},[l,e]);const g=te.useMemo(()=>{if(a==="Default"){if(!U&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!R)return!0;return!1},[P,c,A,R,U]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:A,handleChangeType:x,handleImportClick:M,handleDeleteImportClick:E,isNoData:g}}function oK({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(aK,{token:r,onHandleTokenAction:t},r.coin_type))})}function aK({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),_.jsx("span",{children:e.symbol}),_.jsx("i",{children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:_.jsx("use",{xlinkHref:"#icon-close"})})})]})}const cK=Ut("/images/img_no_data@2x.png");function uK(e){const{img:t=cK,text:r,width:n="100%",height:i="auto",padding:s="20px",subItem:o}=e;return _.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&_.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&_.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),o&&o]})}function lK({tabList:e,currentTab:t,changeTab:r}){return _.jsx("div",{className:"platform-tabs",children:e.map(n=>_.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var p3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function fK(e,t){return!!(e===t||p3(e)&&p3(t))}function dK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!fK(e[r],t[r]))return!1;return!0}function hK(e,t){t===void 0&&(t=dK);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function V0(){return V0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},V0.apply(null,arguments)}function m3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q0(e,t){return q0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},q0(e,t)}function pK(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,q0(e,t)}var g3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function mK(e,t){return!!(e===t||g3(e)&&g3(t))}function gK(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!mK(e[r],t[r]))return!1;return!0}function W0(e,t){t===void 0&&(t=gK);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function v3(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}var vK=typeof performance=="object"&&typeof performance.now=="function",y3=vK?function(){return performance.now()}:function(){return Date.now()};function b3(e){cancelAnimationFrame(e.id)}function yK(e,t){var r=y3();function n(){y3()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var G0=-1;function w3(e){if(e===void 0&&(e=!1),G0===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),G0=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return G0}var fa=null;function _3(e){if(e===void 0&&(e=!1),fa===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?fa="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?fa="negative":fa="positive-ascending"),document.body.removeChild(t),fa}return fa}mn.env.NODE_ENV;var bK=150,wK=function(t,r){return t},af=null,cf=null;mn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(af=new WeakSet,cf=new WeakSet);function _K(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(f){pK(h,f);function h(b){var w;return w=f.call(this,b)||this,w._instanceProps=c(w.props,m3(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:m3(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=W0(function(A,P,N,R){return w.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:P,visibleStartIndex:N,visibleStopIndex:R})}),w._callOnScroll=void 0,w._callOnScroll=W0(function(A,P,N){return w.props.onScroll({scrollDirection:A,scrollOffset:P,scrollUpdateWasRequested:N})}),w._getItemStyle=void 0,w._getItemStyle=function(A){var P=w.props,N=P.direction,R=P.itemSize,U=P.layout,L=w._getItemStyleCache(u&&R,u&&U,u&&N),G;if(L.hasOwnProperty(A))G=L[A];else{var q=r(w.props,A,w._instanceProps),X=i(w.props,A,w._instanceProps),ie=N==="horizontal"||U==="horizontal",ae=N==="rtl",ce=ie?q:0;L[A]=G={position:"absolute",left:ae?void 0:ce,right:ae?ce:void 0,top:ie?0:q,height:ie?"100%":X,width:ie?X:"100%"}}return G},w._getItemStyleCache=void 0,w._getItemStyleCache=W0(function(A,P,N){return{}}),w._onScrollHorizontal=function(A){var P=A.currentTarget,N=P.clientWidth,R=P.scrollLeft,U=P.scrollWidth;w.setState(function(L){if(L.scrollOffset===R)return null;var G=w.props.direction,q=R;if(G==="rtl")switch(_3()){case"negative":q=-R;break;case"positive-descending":q=U-N-R;break}return q=Math.max(0,Math.min(q,U-N)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(A){var P=A.currentTarget,N=P.clientHeight,R=P.scrollHeight,U=P.scrollTop;w.setState(function(L){if(L.scrollOffset===U)return null;var G=Math.max(0,Math.min(U,R-N));return{isScrolling:!0,scrollDirection:L.scrollOffset<G?"forward":"backward",scrollOffset:G,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(A){var P=w.props.outerRef;w._outerRef=A,typeof P=="function"?P(A):P!=null&&typeof P=="object"&&P.hasOwnProperty("current")&&(P.current=A)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&b3(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=yK(w._resetIsScrolling,bK)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,A){return xK(w,A),l(w),null};var y=h.prototype;return y.scrollTo=function(w){w=Math.max(0,w),this.setState(function(A){return A.scrollOffset===w?null:{scrollDirection:A.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(w,A){A===void 0&&(A="auto");var P=this.props,N=P.itemCount,R=P.layout,U=this.state.scrollOffset;w=Math.max(0,Math.min(w,N-1));var L=0;if(this._outerRef){var G=this._outerRef;R==="vertical"?L=G.scrollWidth>G.clientWidth?w3():0:L=G.scrollHeight>G.clientHeight?w3():0}this.scrollTo(s(this.props,w,A,U,this._instanceProps,L))},y.componentDidMount=function(){var w=this.props,A=w.direction,P=w.initialScrollOffset,N=w.layout;if(typeof P=="number"&&this._outerRef!=null){var R=this._outerRef;A==="horizontal"||N==="horizontal"?R.scrollLeft=P:R.scrollTop=P}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,A=w.direction,P=w.layout,N=this.state,R=N.scrollOffset,U=N.scrollUpdateWasRequested;if(U&&this._outerRef!=null){var L=this._outerRef;if(A==="horizontal"||P==="horizontal")if(A==="rtl")switch(_3()){case"negative":L.scrollLeft=-R;break;case"positive-ascending":L.scrollLeft=R;break;default:var G=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-G-R;break}else L.scrollLeft=R;else L.scrollTop=R}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&b3(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,A=w.children,P=w.className,N=w.direction,R=w.height,U=w.innerRef,L=w.innerElementType,G=w.innerTagName,q=w.itemCount,X=w.itemData,ie=w.itemKey,ae=ie===void 0?wK:ie,ce=w.layout,V=w.outerElementType,D=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,M=N==="horizontal"||ce==="horizontal",E=M?this._onScrollHorizontal:this._onScrollVertical,O=this._getRangeToRender(),C=O[0],g=O[1],v=[];if(q>0)for(var j=C;j<=g;j++)v.push(te.createElement(A,{data:X,key:ae(j,X),index:j,isScrolling:d?x:void 0,style:this._getItemStyle(j)}));var ee=n(this.props,this._instanceProps);return te.createElement(V||D||"div",{className:P,onScroll:E,ref:this._outerRefSetter,style:V0({position:"relative",height:R,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:N},p)},te.createElement(L||G||"div",{children:v,ref:U,style:{height:M?"100%":ee,pointerEvents:x?"none":void 0,width:M?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var A=this._getRangeToRender(),P=A[0],N=A[1],R=A[2],U=A[3];this._callOnItemsRendered(P,N,R,U)}}if(typeof this.props.onScroll=="function"){var L=this.state,G=L.scrollDirection,q=L.scrollOffset,X=L.scrollUpdateWasRequested;this._callOnScroll(G,q,X)}},y._getRangeToRender=function(){var w=this.props,A=w.itemCount,P=w.overscanCount,N=this.state,R=N.isScrolling,U=N.scrollDirection,L=N.scrollOffset;if(A===0)return[0,0,0,0];var G=o(this.props,L,this._instanceProps),q=a(this.props,G,L,this._instanceProps),X=!R||U==="backward"?Math.max(1,P):1,ie=!R||U==="forward"?Math.max(1,P):1;return[Math.max(0,G-X),Math.max(0,Math.min(A-1,q+ie)),G,q]},h}(te.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var xK=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(mn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&cf&&!cf.has(l)&&(cf.add(l),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=i==="horizontal"||o==="horizontal";switch(i){case"horizontal":case"vertical":af&&!af.has(l)&&(af.add(l),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},SK=_K({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,f=t.layout,h=t.width,y=a==="horizontal"||f==="horizontal",b=y?h:c,w=Math.max(0,u*l-b),A=Math.min(w,r*l),P=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=P-b&&i<=A+b?n="auto":n="center"),n){case"start":return A;case"end":return P;case"center":{var N=Math.round(P+(A-P)/2);return N<Math.ceil(b/2)?0:N>w+Math.floor(b/2)?w:N}case"auto":default:return i>=P&&i<=A?i:i<P?P:A}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",f=r*a,h=l?u:s,y=Math.ceil((h+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(mn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function x3(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var EK=["style"],CK=["style"];function MK(e,t){var r=e.style,n=v3(e,EK),i=t.style,s=v3(t,CK);return!x3(r,i)&&!x3(n,s)}const TK=te.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return _.jsx("div",{style:r,children:_.jsx(IK,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},MK),AK=hK((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function OK({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=te.useRef(null);te.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=AK(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(SK,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:TK})})}function IK({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=h3(),{getExplorerUrl:s}=Fo();return _.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Wr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),_.jsxs("div",{className:"token-info",children:[_.jsx("h4",{className:"token-symbol",children:_.jsx("span",{children:un(e.symbol)})}),_.jsx("p",{className:"token-name",children:un(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:el,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Gs(e==null?void 0:e.coin_type)}),_.jsx(of,{text:e==null?void 0:e.coin_type})]})]}),_.jsxs("div",{className:"token-balance",children:[_.jsxs("div",{className:"balance",children:[_.jsx("h4",{children:e==null?void 0:e.balance}),_.jsx("p",{children:e!=null&&e.rate?xx(e==null?void 0:e.rate,2):""})]}),r&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function PK({currentType:e,changeTab:t}){const r=["Default","Imported"];return _.jsx("div",{className:"type-tabs",children:r.map(n=>_.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function jK({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=sK(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:w,isOpenImportDialog:A,setIsOpenImportDialog:P,setSearchInput:N,searchInput:R,importTokenIsLoading:U,currentImportTokenData:L,setCurrentImportTokenData:G}=Oc();te.useEffect(()=>()=>{N(""),b("All"),h("Default"),G(void 0)},[]);const{handleCollectToken:q,collectTokenMap:X}=h3(),ie=m=>{h(m),a(m)},ae=m=>{b(m),o(m)},ce=()=>{c(),P(!1)},V=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();N(x),x?D(x):(D(""),ie("Default"))},D=S0(m=>{Cx(m)?s(Pi(m,!0)):s(m)},300),p=(m,x)=>{if(x==="delete_import"){u(m);return}if(x==="collect_token"||x==="un_collect"){q(m);return}x==="select_token"&&(t(m),e())},d=te.useMemo(()=>Array.from(X.values()),[X]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(C0,{backClick:e,title:"Select Token"}),_.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:"search-input",style:{position:"relative"},children:[_.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:R,onChange:m=>V(m.target.value),style:{paddingRight:"40px"}}),R.length>0&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{V("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(oK,{tokenList:d,onHandleTokenAction:p}),R.length===0&&_.jsx(PK,{currentType:f,changeTab:ie}),R.length===0&&f==="Default"&&_.jsx(lK,{tabList:w,currentTab:y,changeTab:ae})]}),i&&_.jsx(kK,{showTooltip:R.length>0,text:R.length>0||L===void 0?"No tokens found":"No Imported Tokens"}),U&&_.jsx(GS,{}),L&&_.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&_.jsxs("div",{style:{position:"relative"},children:[_.jsx(OK,{showTokenList:n,showCollect:!L,showDelete:!L&&f==="Imported",onHandleTokenAction:p}),L&&_.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:_.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ce(),p(L,"select_token")},children:"Import"})})]})]})]})}function kK({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(uK,{text:t,subItem:e?_.jsx("div",{children:_.jsx(ql,{position:"bottom",content:_.jsx("div",{children:"The unique id of coin"}),children:_.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function NK({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=te.useState(!1),{setIgnoreWarnToken:s}=Br();return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",onClick:e}),_.jsxs("div",{className:"import-dialog",children:[_.jsxs("div",{className:"cs-dialog-header",children:[_.jsx("div",{className:"title",children:"Tips"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"import-content",children:[_.jsx("div",{className:"tip-text-box",children:_.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(o=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(Wr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:o.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",o.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:Gs(o.coin_type)}),_.jsx(of,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox",children:[_.jsx(El,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),_.jsx("span",{children:"I acknowledge the risk"})]}),_.jsxs("div",{className:"button-block",children:[_.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),_.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}const IJ="";function S3(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var Ic;(function(e){e.event="event",e.props="prop"})(Ic||(Ic={}));function ws(){}function RK(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function Pc(e){return!!(e||"").match(/\d/)}function da(e){return e==null}function DK(e){return typeof e=="number"&&isNaN(e)}function E3(e){return da(e)||DK(e)||typeof e=="number"&&!isFinite(e)}function C3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function $K(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function BK(e,t,r){var n=$K(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function LK(e){var t=te.useRef(e);t.current=e;var r=te.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function H0(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),s=i[0],o=i[1]||"";return{beforeDecimal:s,afterDecimal:o,hasNegation:r,addNegation:n}}function UK(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function M3(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function T3(e,t){return Array(t+1).join(e)}function A3(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],s=n[1];if(s=Number(s),!s)return r+i;i=i.replace(".","");var o=1+s,a=i.length;return o<0?i="0."+T3("0",Math.abs(o))+i:o>=a?i=i+T3("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function O3(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=H0(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),u=o.length<=t?"0."+o:c.toFixed(t),l=u.split("."),f=s;s&&Number(l[0])&&(f=s.split("").reverse().reduce(function(w,A,P){return w.length>P?(Number(w[0])+Number(A)).toString()+w.substring(1,w.length):A+w},l[0]));var h=M3(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function io(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var I3=RK(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),FK=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function zK(e,t,r){return Math.min(Math.max(e,t),r)}function K0(e){return Math.max(e.selectionStart,e.selectionEnd)}function VK(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function qK(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function WK(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function GK(e,t,r,n,i,s,o){o===void 0&&(o=WK);var a=i.findIndex(function(U){return U}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,f={},h=new Array(u),y=0;y<u;y++){h[y]=-1;for(var b=0,w=l;b<w;b++){var A=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(A&&f[b]!==!0){h[y]=b,f[b]=!0;break}}}for(var P=n;P<u&&(h[P]===-1||!s(r[P]));)P++;var N=P===u||h[P]===-1?l:h[P];for(P=n-1;P>0&&h[P]===-1;)P--;var R=P===-1||h[P]===-1?0:h[P]+1;return R>N?N:n-R<N-n?R:N}function P3(e,t,r,n){var i=e.length;if(t=zK(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function HK(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Pc(e[r])||Pc(e[r-1]));return t}function j3(e,t,r,n,i,s){s===void 0&&(s=ws);var o=LK(function(b,w){var A,P;return E3(b)?(P="",A=""):typeof b=="number"||w?(P=typeof b=="number"?A3(b):b,A=n(P)):(P=i(b,void 0),A=n(P)),{formattedValue:A,numAsString:P}}),a=te.useState(function(){return o(da(e)?t:e,r)}),c=a[0],u=a[1],l=function(b,w){b.formattedValue!==c.formattedValue&&u({formattedValue:b.formattedValue,numAsString:b.value}),s(b,w)},f=e,h=r;da(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return te.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function KK(e){return e.replace(/[^0-9]/g,"")}function XK(e){return e}function JK(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,s=e.getInputRef,o=e.format;o===void 0&&(o=XK);var a=e.removeFormatting;a===void 0&&(a=KK);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=ws);var y=e.onKeyDown;y===void 0&&(y=ws);var b=e.onMouseUp;b===void 0&&(b=ws);var w=e.onFocus;w===void 0&&(w=ws);var A=e.onBlur;A===void 0&&(A=ws);var P=e.value,N=e.getCaretBoundary;N===void 0&&(N=HK);var R=e.isValidInputCharacter;R===void 0&&(R=Pc);var U=e.isCharacterSame,L=S3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),G=j3(P,c,!!u,o,a,l),q=G[0],X=q.formattedValue,ie=q.numAsString,ae=G[1],ce=te.useRef(),V=te.useRef({formattedValue:X,numAsString:ie}),D=function(_e,ge){V.current={formattedValue:_e.formattedValue,numAsString:_e.value},ae(_e,ge)},p=te.useState(!1),d=p[0],m=p[1],x=te.useRef(null),M=te.useRef({setCaretTimeout:null,focusTimeout:null});te.useEffect(function(){return m(!0),function(){clearTimeout(M.current.setCaretTimeout),clearTimeout(M.current.focusTimeout)}},[]);var E=o,O=function(_e,ge){var Ae=parseFloat(ge);return{formattedValue:_e,value:ge,floatValue:isNaN(Ae)?void 0:Ae}},C=function(_e,ge,Ae){_e.selectionStart===0&&_e.selectionEnd===_e.value.length||(io(_e,ge),M.current.setCaretTimeout=setTimeout(function(){_e.value===Ae&&_e.selectionStart!==ge&&io(_e,ge)},0))},g=function(_e,ge,Ae){return P3(_e,ge,N(_e),Ae)},v=function(_e,ge,Ae){var Ge=N(ge),De=GK(ge,X,_e,Ae,Ge,R,U);return De=P3(ge,De,Ge),De},j=function(_e){var ge=_e.formattedValue;ge===void 0&&(ge="");var Ae=_e.input,Ge=_e.source,De=_e.event,Oe=_e.numAsString,Ie;if(Ae){var Ue=_e.inputValue||Ae.value,ft=K0(Ae);Ae.value=ge,Ie=v(Ue,ge,ft),Ie!==void 0&&C(Ae,Ie,ge)}ge!==X&&D(O(ge,Oe),{event:De,source:Ge})};te.useEffect(function(){var _e=V.current,ge=_e.formattedValue,Ae=_e.numAsString;(X!==ge||ie!==Ae)&&D(O(X,ie),{event:void 0,source:Ic.props})},[X,ie]);var ee=x.current?K0(x.current):void 0,se=typeof window<"u"?te.useLayoutEffect:te.useEffect;se(function(){var _e=x.current;if(X!==V.current.formattedValue&&_e){var ge=v(V.current.formattedValue,X,ee);_e.value=X,C(_e,ge,X)}},[X]);var he=function(_e,ge,Ae){var Ge=ge.target,De=ce.current?FK(ce.current,Ge.selectionEnd):I3(X,_e),Oe=Object.assign(Object.assign({},De),{lastValue:X}),Ie=a(_e,Oe),Ue=E(Ie);if(Ie=a(Ue,void 0),f&&!f(O(Ue,Ie))){var ft=ge.target,dt=K0(ft),He=v(_e,X,dt);return ft.value=X,C(ft,He,X),!1}return j({formattedValue:Ue,numAsString:Ie,inputValue:_e,event:ge,source:Ae,input:ge.target}),!0},ye=function(_e,ge){ge===void 0&&(ge=0);var Ae=_e.selectionStart,Ge=_e.selectionEnd;ce.current={selectionStart:Ae,selectionEnd:Ge+ge}},Ee=function(_e){var ge=_e.target,Ae=ge.value,Ge=he(Ae,_e,Ic.event);Ge&&h(_e),ce.current=void 0},Se=function(_e){var ge=_e.target,Ae=_e.key,Ge=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie;Ae==="ArrowLeft"||Ae==="Backspace"?Ie=Math.max(Ge-1,0):Ae==="ArrowRight"?Ie=Math.min(Ge+1,Oe.length):Ae==="Delete"&&(Ie=Ge);var Ue=0;Ae==="Delete"&&Ge===De&&(Ue=1);var ft=Ae==="ArrowLeft"||Ae==="ArrowRight";if(Ie===void 0||Ge!==De&&!ft){y(_e),ye(ge,Ue);return}var dt=Ie;if(ft){var He=Ae==="ArrowLeft"?"left":"right";dt=g(Oe,Ie,He),dt!==Ie&&_e.preventDefault()}else Ae==="Delete"&&!R(Oe[Ie])?dt=g(Oe,Ie,"right"):Ae==="Backspace"&&!R(Oe[Ie])&&(dt=g(Oe,Ie,"left"));dt!==Ie&&C(ge,dt,Oe),y(_e),ye(ge,Ue)},We=function(_e){var ge=_e.target,Ae=function(){var Ge=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;if(Oe===void 0&&(Oe=""),Ge===De){var Ie=g(Oe,Ge);Ie!==Ge&&C(ge,Ie,Oe)}};Ae(),requestAnimationFrame(function(){Ae()}),b(_e),ye(ge)},Fe=function(_e){_e.persist&&_e.persist();var ge=_e.target,Ae=_e.currentTarget;x.current=ge,M.current.focusTimeout=setTimeout(function(){var Ge=ge.selectionStart,De=ge.selectionEnd,Oe=ge.value;Oe===void 0&&(Oe="");var Ie=g(Oe,Ge);Ie!==Ge&&!(Ge===0&&De===Oe.length)&&C(ge,Ie,Oe),w(Object.assign(Object.assign({},_e),{currentTarget:Ae}))},0)},lt=function(_e){x.current=null,clearTimeout(M.current.focusTimeout),clearTimeout(M.current.setCaretTimeout),A(_e)},ht=d&&VK()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:X,onChange:Ee,onKeyDown:Se,onMouseUp:We,onFocus:Fe,onBlur:lt});if(r==="text")return i?te.createElement(te.Fragment,null,i(X,L)||null):te.createElement("span",Object.assign({},L,{ref:s}),X);if(n){var mt=n;return te.createElement(mt,Object.assign({},$e,{ref:s}))}return te.createElement("input",Object.assign({},$e,{ref:s}))}function k3(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=uf(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=H0(e,o),y=h.beforeDecimal,b=h.afterDecimal,w=h.addNegation;return r!==void 0&&(b=M3(b,r,!!n)),u&&(y=BK(y,u,a)),i&&(y=i+y),s&&(b=b+s),w&&(y="-"+y),e=y+(f&&l||"")+b,e}function uf(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function YK(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function ZK(e,t){return new RegExp("(^-)|[0-9]|"+C3(e),t?"g":void 0)}function QK(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function eX(e,t,r){var n;t===void 0&&(t=qK(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,f=u.end,h=uf(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,w=e[f]===b;if(Pc(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var A=a===0?"":b;e=e.substring(0,l)+A+e.substring(l+1,e.length)}var P=function(x,M,E){var O=!1,C=!1;s.startsWith("-")?O=!1:x.startsWith("--")?(O=!1,C=!0):o.startsWith("-")&&x.length===o.length?O=!1:x[0]==="-"&&(O=!0);var g=O?1:0;return C&&(g=2),g&&(x=x.substring(g),M-=g,E-=g),{value:x,start:M,end:E,hasNegation:O}},N=P(e,l,f),R=N.hasNegation;n=N,e=n.value,l=n.start,f=n.end;var U=P(t.lastValue,c.start,c.end),L=U.start,G=U.end,q=U.value,X=e.substring(l,f);e.length&&q.length&&(L>q.length-o.length||G<s.length)&&!(X&&o.startsWith(X))&&(e=q);var ie=0;e.startsWith(s)?ie+=s.length:l<s.length&&(ie=l),e=e.substring(ie),f-=ie;var ae=e.length,ce=e.length-o.length;e.endsWith(o)?ae=ce:(f>ce||f>e.length-o.length)&&(ae=f),e=e.substring(0,ae),e=YK(R?"-"+e:e,i),e=(e.match(ZK(b,!0))||[]).join("");var V=e.indexOf(b);e=e.replace(new RegExp(C3(b),"g"),function(x,M){return M===V?".":""});var D=H0(e,i),p=D.beforeDecimal,d=D.afterDecimal,m=D.addNegation;return u.end-u.start<c.end-c.start&&p===""&&w&&!parseFloat(d)&&(e=m?"-":""),e}function tX(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function rX(e){var t=uf(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),r===n)throw new Error(`
|
|
107
107
|
Decimal separator can't be same as thousand separator.
|
|
108
108
|
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
109
109
|
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
|
@@ -111,4 +111,4 @@ body { background-color: var(--color-page-background); }
|
|
|
111
111
|
Prefix can't start with '-' when allowNegative is true.
|
|
112
112
|
prefix: `+i+`
|
|
113
113
|
allowNegative: `+s+`
|
|
114
|
-
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function sX(e){e=iX(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=bs);var s=e.onBlur;s===void 0&&(s=bs);var o=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,u=e.prefix;u===void 0&&(u="");var l=e.defaultValue,f=e.value,h=e.valueIsNumericString,y=e.onValueChange,b=S3(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=uf(e),A=w.decimalSeparator,P=w.allowedDecimalSeparators,R=function(m){return j3(m,e)},N=function(m,x){return rX(m,x,e)},F=fa(f)?l:f,L=h??tX(F,u,t);fa(f)?fa(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var G=function(m){return E3(m)?m:(typeof m=="number"&&(m=A3(m)),L&&typeof a=="number"?O3(m,a,!!c):m)},q=k3(G(f),G(l),!!L,R,N,y),X=q[0],ie=X.numAsString,ae=X.formattedValue,ce=q[1],V=function(m){var x=m.target,T=m.key,E=x.selectionStart,O=x.selectionEnd,C=x.value;if(C===void 0&&(C=""),(T==="Backspace"||T==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}T==="Backspace"&&C[0]==="-"&&E===u.length+1&&r&&io(x,1),a&&c&&(T==="Backspace"&&C[E-1]===A?(io(x,E-1),m.preventDefault()):T==="Delete"&&C[E]===A&&m.preventDefault()),P!=null&&P.includes(T)&&C[E]===A&&io(x,E+1);var g=o===!0?",":o;T==="Backspace"&&C[E-1]===g&&io(x,E-1),T==="Delete"&&C[E]===g&&io(x,E+1),i(m)},D=function(m){var x=ie;if(x.match(/\d/g)||(x=""),n||(x=zK(x)),c&&a&&(x=O3(x,a,c)),x!==ie){var T=j3(x,e);ce({formattedValue:T,value:x,floatValue:parseFloat(x)},{event:m,source:Ic.event})}s(m)},p=function(m){return m===A?!0:Pc(m)},d=function(m){var x=m.currentValue,T=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,C=m.formattedValueIndex,g=x[O],v=E[C],k=I3(T,x),ee=k.to,se=function(he){return N(he).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===A&&se(x)<O&&se(E)>C?!1:O>=ee.start&&O<ee.end&&P&&P.includes(g)&&v===A?!0:g===v};return Object.assign(Object.assign({},b),{value:ae,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:ce,format:R,removeFormatting:N,getCaretBoundary:function(m){return nX(m,e)},onKeyDown:V,onBlur:D})}function oX(e){var t=sX(e);return te.createElement(ZK,Object.assign({},t))}function aX(e){const{className:t,value:r,decimals:n,placeholder:i,style:s,onChange:o,maxValue:a,minValue:c=0,inputAllowed:u=!0,prefix:l,...f}=e,h=y=>{var A;const b=((A=y==null?void 0:y.target)==null?void 0:A.value)||"";let w=b;if(b.startsWith("0")&&b!=="0"&&!b.startsWith("0.")&&(w=b.replace(/^0+/,"")),w){if(w.startsWith(".")){o(w.slice(1,w.length));return}let P=String(w).replace(/,/g,"");if(P.startsWith("-")){o("");return}l&&(P=P.replace(l,"")),a!==void 0&&Le(P).gt(a)?P=a.toString():c!==void 0&&Le(P).lt(c)&&(P=c.toString()),o(String(P))}else o("")};return _.jsx(oX,{className:t,value:r,disabled:!u,placeholder:i,decimalScale:n,prefix:l,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:y=>!y.value.startsWith("-"),onChange:h,...f,style:{...s,cursor:u?"pointer":"not-allowed",fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",fontFeatureSettings:"tnum",fontVariant:"tabular-nums"}})}function cX(e){const{token:t,handleTokenSelectClick:r}=e;return _.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[_.jsx("div",{className:"token-img-box",children:_.jsx(Vr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),_.jsx("div",{className:"name",children:_.jsxs("h4",{className:"truncate-text",children:[" ",t==null?void 0:t.symbol]})}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function R3({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:s,token:o,loading:a=!1,showMax:c=!0,showHalf:u=!0,inputAllowed:l=!0,marginTop:f}){const[h,y]=te.useState(!1),{currentAccount:b}=Rn(),w=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||"0").div(2),R=cn(P.toString(),o==null?void 0:o.decimals,!0).toString();t&&Le(R).eq(t)||i(R)},A=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||0),R=Or((o==null?void 0:o.coin_type)||"").full_address===Pf,N=.05;let F=P;R&&Le(P).gt(N)&&(F=F.sub(N)),!(t&&Le(F).eq(t))&&Le(F).gte(0)&&i(F.toString())};return _.jsxs("div",{className:h?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:f},children:[_.jsxs("div",{className:"title",children:[" ",e," "]}),_.jsxs("div",{className:"token-input",children:[a?_.jsxs("div",{style:{flex:1},children:[" ",_.jsx(ia,{style:{width:"200px",height:"28px",flex:1}})," "]}):_.jsx(aX,{inputAllowed:l,value:t,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),_.jsx(cX,{token:o,handleTokenSelectClick:s})]}),_.jsxs("div",{className:"info-box",children:[!a&&r&&Le(r).gt(0)?_.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:xx(r,2)}):_.jsx("div",{}),b&&_.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[_.jsxs("div",{className:"token-balance",children:[_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-wallet"})}),_.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),_.jsxs("div",{className:"btn-box",children:[u&&_.jsx("button",{className:"cs-outline-btn",onClick:w,children:"HALF"}),c&&_.jsx("button",{className:"cs-outline-btn",onClick:A,children:"MAX"})]})]})]})]})}function uX({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Rn(),{getOwnerCoinBalances:s}=Ul(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:b,isOpenTokensDialog:w,setIsOpenTokensDialog:A}=hn(),{handleAmountChange:P,handleSelectToken:R,fromBalanceInfo:N,toBalanceInfo:F,fromAmountValue:L,toAmountValue:G,doSwapAction:q,reCalculateRouteData:X,refreshMarketPrice:ie,scamsText:ae}=Bz(),{slippage:ce}=Dr(),{isCustomMode:V,customWarnTokenList:D}=Cz(o==null?void 0:o.coin_type,a==null?void 0:a.coin_type),{amountLimit:p}=ZS(ce,h),{formatSwapRouter:d}=Sz(h),[m,x]=te.useState(!1),{btnText:T,btnDisabled:E}=Lz(N==null?void 0:N.totalBalanceFormat),[O,C]=te.useState(!1),[g,v]=te.useState(!1);te.useEffect(()=>{y?e>=5&&k():e>=20&&k()},[e]);const k=()=>{X(),n&&s(),ie()},ee=()=>({...h}),se=async()=>{a&&R(a,!0)};return _.jsxs("div",{className:"swap-trade-box",children:[_.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[_.jsx(R3,{loading:!f&&l,balance:N,amountValue:L,handleTokenSelectClick:()=>{C(!0),A(!0)},onInputChange:he=>{P(he,!0)},amount:c,token:o}),_.jsx("div",{onClick:se,className:"swap-icon",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{cursor:"pointer"},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:_.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),_.jsx(R3,{marginTop:"-20px",loading:f&&l,balance:F,showHalf:!1,showMax:!1,amountValue:G,handleTokenSelectClick:()=>{C(!1),A(!0)},onInputChange:he=>{P(he,!1)},inputAllowed:!1,amount:u,token:a})]}),ae&&_.jsx(Uz,{scamsText:ae}),_.jsxs("div",{className:"swap-bottom-block",style:{border:E?"0px solid #2a3238":"1px solid #2a3238"},children:[_.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:E||l,onClick:()=>{n?V&&D.length>0?v(!0):b(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(r8,{})}):T}),c&&u&&Le(c).gt(0)&&Le(u).gt(0)&&_.jsxs("div",{className:"content",children:[_.jsxs("div",{className:"price-related-info",children:[h&&!(h!=null&&h.errorCode)&&_.jsx(E0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),_.jsx(s8,{isLoading:l,routerData:h})]}),_.jsx(o8,{isLoading:l,amountLimit:p}),_.jsx(d3,{hasSubMenu:!0,formatSwapRouter:d,isLoading:l})]})]}),y&&_.jsx(nK,{data:ee(),toBack:()=>b(!1),onSubmitClick:async he=>{try{await q(he,r==null?void 0:r.partner)}finally{b(!1)}}}),w&&_.jsx(RK,{currToken:O?o:a,backClick:()=>A(!1),onSelectToken:he=>{R(he,O),A(!1)}}),g&&D.length>0&&_.jsx(DK,{onClose:()=>{v(!1)},tokenList:D,onSureClick:()=>{v(!1),b(!0)}})]})}function lX({initProps:e={},customWallet:t}){lz();const{ToastContainer:r}=sa(),{fetchRouterConfig:n}=sz(),{getTokens:i}=vs(),{fetchTokenPrices:s}=zl(),{transactionData:o,setTransactionData:a}=w0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=hn(),[y,b]=te.useState(0),w=te.useRef(y);uz(e),te.useEffect(()=>{i(),s([]),n()},[]),te.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),oz({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&A():w.current>=20&&A()}});const A=()=>{w.current=20,b(20),setTimeout(()=>{w.current=0,b(0)},20)};return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-container",id:"cs-swap-widget",children:[_.jsx(tz,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),_.jsx(FU,{handleRefresh:A}),_.jsx(uX,{refreshCount:y,customWallet:t,initProps:e}),o&&_.jsx(rz,{transactionData:o,onClose:()=>{a(void 0)}}),_.jsx(r,{})]})})}function X0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Ul(),n=Br.useCurrentAccount(),{saveCurrentAccount:i}=Rn(),{mutate:s}=Br.useConnectWallet();return te.useEffect(()=>{console.log("currentAccount: ",n),i(n||void 0),r(n==null?void 0:n.address)},[n]),te.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>console.log("connected with outside")})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),_.jsx(lX,{initProps:e,customWallet:t})}function fX({initProps:e,customWallet:t}){const[r,n]=te.useState(!0);return _.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&_.jsx("div",{className:"swap-modal-box",children:_.jsx(X0,{initProps:e,customWallet:t})}),_.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function dX({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=te.useState(!1),o=()=>{s(!i)};return _.jsxs("div",{className:"widget-btn-box",children:[_.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})}):_.jsx("img",{src:Ft("/images/img-logo@2x.png")})}),i&&_.jsx("div",{className:`widget-modal ${t} ${e}`,children:_.jsx(X0,{initProps:r,customWallet:n})})]})}function hX({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return _.jsxs(wl,{appearance:"dark",children:[r==="Integrated"&&_.jsx(X0,{initProps:e,customWallet:t}),r==="Widget"&&_.jsx(dX,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&_.jsx(fX,{initProps:e,customWallet:t})]})}const pX=hX;Vt.CetusSwap=pX,Object.defineProperty(Vt,Symbol.toStringTag,{value:"Module"})});
|
|
114
|
+
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function nX(e){e=rX(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=ws);var s=e.onBlur;s===void 0&&(s=ws);var o=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,u=e.prefix;u===void 0&&(u="");var l=e.defaultValue,f=e.value,h=e.valueIsNumericString,y=e.onValueChange,b=S3(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=uf(e),A=w.decimalSeparator,P=w.allowedDecimalSeparators,N=function(m){return k3(m,e)},R=function(m,x){return eX(m,x,e)},U=da(f)?l:f,L=h??QK(U,u,t);da(f)?da(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var G=function(m){return E3(m)?m:(typeof m=="number"&&(m=A3(m)),L&&typeof a=="number"?O3(m,a,!!c):m)},q=j3(G(f),G(l),!!L,N,R,y),X=q[0],ie=X.numAsString,ae=X.formattedValue,ce=q[1],V=function(m){var x=m.target,M=m.key,E=x.selectionStart,O=x.selectionEnd,C=x.value;if(C===void 0&&(C=""),(M==="Backspace"||M==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}M==="Backspace"&&C[0]==="-"&&E===u.length+1&&r&&io(x,1),a&&c&&(M==="Backspace"&&C[E-1]===A?(io(x,E-1),m.preventDefault()):M==="Delete"&&C[E]===A&&m.preventDefault()),P!=null&&P.includes(M)&&C[E]===A&&io(x,E+1);var g=o===!0?",":o;M==="Backspace"&&C[E-1]===g&&io(x,E-1),M==="Delete"&&C[E]===g&&io(x,E+1),i(m)},D=function(m){var x=ie;if(x.match(/\d/g)||(x=""),n||(x=UK(x)),c&&a&&(x=O3(x,a,c)),x!==ie){var M=k3(x,e);ce({formattedValue:M,value:x,floatValue:parseFloat(x)},{event:m,source:Ic.event})}s(m)},p=function(m){return m===A?!0:Pc(m)},d=function(m){var x=m.currentValue,M=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,C=m.formattedValueIndex,g=x[O],v=E[C],j=I3(M,x),ee=j.to,se=function(he){return R(he).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===A&&se(x)<O&&se(E)>C?!1:O>=ee.start&&O<ee.end&&P&&P.includes(g)&&v===A?!0:g===v};return Object.assign(Object.assign({},b),{value:ae,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:ce,format:N,removeFormatting:R,getCaretBoundary:function(m){return tX(m,e)},onKeyDown:V,onBlur:D})}function iX(e){var t=nX(e);return te.createElement(JK,Object.assign({},t))}function sX(e){const{className:t,value:r,decimals:n,placeholder:i,style:s,onChange:o,maxValue:a,minValue:c=0,inputAllowed:u=!0,prefix:l,...f}=e,h=y=>{var A;const b=((A=y==null?void 0:y.target)==null?void 0:A.value)||"";let w=b;if(b.startsWith("0")&&b!=="0"&&!b.startsWith("0.")&&(w=b.replace(/^0+/,"")),w){if(w.startsWith(".")){o(w.slice(1,w.length));return}let P=String(w).replace(/,/g,"");if(P.startsWith("-")){o("");return}l&&(P=P.replace(l,"")),a!==void 0&&Le(P).gt(a)?P=a.toString():c!==void 0&&Le(P).lt(c)&&(P=c.toString()),o(String(P))}else o("")};return _.jsx(iX,{className:t,value:r,disabled:!u,placeholder:i,decimalScale:n,prefix:l,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:y=>!y.value.startsWith("-"),onChange:h,...f,style:{...s,cursor:u?"pointer":"not-allowed",fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",fontFeatureSettings:"tnum",fontVariant:"tabular-nums"}})}function oX(e){const{token:t,handleTokenSelectClick:r}=e;return _.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[_.jsx("div",{className:"token-img-box",children:_.jsx(Wr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),_.jsx("div",{className:"name",children:_.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function N3({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:s,token:o,loading:a=!1,showMax:c=!0,showHalf:u=!0,inputAllowed:l=!0,marginTop:f}){const[h,y]=te.useState(!1),{currentAccount:b}=Nn(),w=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||"0").div(2),N=Pr(P.toString(),o==null?void 0:o.decimals,!0).toString();t&&Le(N).eq(t)||i(N)},A=()=>{const P=Le((n==null?void 0:n.totalBalanceFormat)||0),N=Or((o==null?void 0:o.coin_type)||"").full_address===Pf,R=.05;let U=P;N&&Le(P).gt(R)&&(U=U.sub(R)),!(t&&Le(U).eq(t))&&Le(U).gte(0)&&i(U.toString())};return _.jsxs("div",{className:h?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e",marginTop:f},children:[_.jsxs("div",{className:"title",children:[" ",e," "]}),_.jsxs("div",{className:"token-input",children:[a?_.jsxs("div",{style:{flex:1},children:[" ",_.jsx(ia,{style:{width:"200px",height:"28px",flex:1}})," "]}):_.jsx(sX,{inputAllowed:l,value:t,decimals:(o==null?void 0:o.decimals)||9,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),_.jsx(oX,{token:o,handleTokenSelectClick:s})]}),_.jsxs("div",{className:"info-box",children:[!a&&r&&Le(r).gt(0)?_.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:xx(r,2)}):_.jsx("div",{}),b&&o&&_.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[_.jsxs("div",{className:"token-balance",children:[_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-wallet"})}),_.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),_.jsxs("div",{className:"btn-box",children:[u&&_.jsx("button",{className:"cs-outline-btn",onClick:w,children:"HALF"}),c&&_.jsx("button",{className:"cs-outline-btn",onClick:A,children:"MAX"})]})]})]})]})}function aX({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Nn(),{getOwnerCoinBalances:s}=Fl(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:b,isOpenTokensDialog:w,setIsOpenTokensDialog:A}=hn(),{handleAmountChange:P,handleSelectToken:N,fromBalanceInfo:R,toBalanceInfo:U,fromAmountValue:L,toAmountValue:G,doSwapAction:q,reCalculateRouteData:X,refreshMarketPrice:ie,scamsText:ae}=Dz(),{slippage:ce}=Br(),{isCustomMode:V,customWarnTokenList:D}=Sz(o==null?void 0:o.coin_type,a==null?void 0:a.coin_type),{amountLimit:p}=ZS(ce,h),{formatSwapRouter:d}=_z(h),[m,x]=te.useState(!1),{btnText:M,btnDisabled:E}=$z(R==null?void 0:R.totalBalanceFormat),[O,C]=te.useState(!1),[g,v]=te.useState(!1);te.useEffect(()=>{y?e>=5&&j():e>=20&&j()},[e]);const j=()=>{X(),n&&s(),ie()},ee=()=>({...h}),se=async()=>{a&&N(a,!0)};return _.jsxs("div",{className:"swap-trade-box",children:[_.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[_.jsx(N3,{loading:!f&&l,balance:R,amountValue:L,handleTokenSelectClick:()=>{C(!0),A(!0)},onInputChange:he=>{P(he,!0)},amount:c,token:o}),_.jsx("div",{onClick:se,className:"swap-icon",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),style:{cursor:"pointer"},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:_.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),_.jsx(N3,{marginTop:"-20px",loading:f&&l,balance:U,showHalf:!1,showMax:!1,amountValue:G,handleTokenSelectClick:()=>{C(!1),A(!0)},onInputChange:he=>{P(he,!1)},inputAllowed:!1,amount:u,token:a})]}),ae&&_.jsx(Lz,{scamsText:ae}),_.jsxs("div",{className:"swap-bottom-block",style:{border:E?"0px solid #2a3238":"1px solid #2a3238"},children:[_.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:E||l,onClick:()=>{n?V&&D.length>0?v(!0):b(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(r8,{})}):M}),c&&u&&Le(c).gt(0)&&Le(u).gt(0)&&_.jsxs("div",{className:"content",children:[_.jsxs("div",{className:"price-related-info",children:[h&&!(h!=null&&h.errorCode)&&_.jsx(E0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),_.jsx(s8,{isLoading:l,routerData:h})]}),_.jsx(o8,{isLoading:l,amountLimit:p}),_.jsx(d3,{hasSubMenu:!0,formatSwapRouter:d,isLoading:l})]})]}),y&&_.jsx(tK,{data:ee(),toBack:()=>b(!1),onSubmitClick:async he=>{try{await q(he,r==null?void 0:r.partner)}finally{b(!1)}}}),w&&_.jsx(jK,{currToken:O?o:a,backClick:()=>A(!1),onSelectToken:he=>{N(he,O),A(!1)}}),g&&D.length>0&&_.jsx(NK,{onClose:()=>{v(!1)},tokenList:D,onSureClick:()=>{v(!1),b(!0)}})]})}function cX({initProps:e={},customWallet:t}){cz();const{ToastContainer:r}=sa(),{fetchRouterConfig:n}=nz(),{getTokens:i}=ys(),{fetchTokenPrices:s}=zl(),{transactionData:o,setTransactionData:a}=w0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=hn(),[y,b]=te.useState(0),w=te.useRef(y);az(e),te.useEffect(()=>{i(),s([]),n()},[]),te.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),iz({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&A():w.current>=20&&A()}});const A=()=>{w.current=20,b(20),setTimeout(()=>{w.current=0,b(0)},20)};return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-container",id:"cs-swap-widget",children:[_.jsx(QF,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),_.jsx(BF,{handleRefresh:A}),_.jsx(aX,{refreshCount:y,customWallet:t,initProps:e}),o&&_.jsx(ez,{transactionData:o,onClose:()=>{a(void 0)}}),_.jsx(r,{})]})})}function X0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Fl(),n=Ur.useCurrentAccount(),{saveCurrentAccount:i}=Nn(),{mutate:s}=Ur.useConnectWallet();return te.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),te.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),_.jsx(cX,{initProps:e,customWallet:t})}function uX({initProps:e,customWallet:t}){const[r,n]=te.useState(!0);return _.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&_.jsx("div",{className:"swap-modal-box",children:_.jsx(X0,{initProps:e,customWallet:t})}),_.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function lX({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=te.useState(!1),o=()=>{s(!i)};return _.jsxs("div",{className:"widget-btn-box",children:[_.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?_.jsx("svg",{className:"icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})}):_.jsx("img",{src:Ut("/images/img-logo@2x.png")})}),i&&_.jsx("div",{className:`widget-modal ${t} ${e}`,children:_.jsx(X0,{initProps:r,customWallet:n})})]})}function fX({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return _.jsxs(wl,{appearance:"dark",children:[r==="Integrated"&&_.jsx(X0,{initProps:e,customWallet:t}),r==="Widget"&&_.jsx(lX,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&_.jsx(uX,{initProps:e,customWallet:t})]})}const dX=fX;Vt.CetusSwap=dX,Object.defineProperty(Vt,Symbol.toStringTag,{value:"Module"})});
|