@cetusprotocol/terminal 0.0.1 → 0.0.2
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 +34 -34
- package/dist/cetus-swap.cjs.js.gz +0 -0
- package/dist/cetus-swap.es.js +19207 -20672
- package/dist/cetus-swap.es.js.gz +0 -0
- package/dist/cetus-swap.umd.js +34 -34
- package/dist/cetus-swap.umd.js.gz +0 -0
- package/dist/components/swap/SwapTrade.d.ts +2 -1
- package/dist/components/swap/TokenSelectModal/{ImportDialog.d.ts → WarnTokenDialog.d.ts} +2 -2
- package/dist/hooks/swap/useSwap.d.ts +1 -1
- package/dist/hooks/swap/useSwapHelper.d.ts +3 -0
- package/dist/stores/swap.d.ts +3 -0
- package/dist/style.css +1 -1
- package/dist/style.css.gz +0 -0
- package/dist/types/common.d.ts +7 -0
- package/package.json +5 -4
package/dist/cetus-swap.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var y3=Object.defineProperty;var b3=(e,t,r)=>t in e?y3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Q0=(e,t,r)=>(b3(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("react"),Uu=require("react-dom"),$r=require("@mysten/dapp-kit");function Lg(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 O=Lg(ie),Ug=Lg(Uu);function w3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fg={exports:{}},sr=Fg.exports={},Nn,Dn;function Af(){throw new Error("setTimeout has not been defined")}function Tf(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Nn=setTimeout:Nn=Af}catch{Nn=Af}try{typeof clearTimeout=="function"?Dn=clearTimeout:Dn=Tf}catch{Dn=Tf}})();function zg(e){if(Nn===setTimeout)return setTimeout(e,0);if((Nn===Af||!Nn)&&setTimeout)return Nn=setTimeout,setTimeout(e,0);try{return Nn(e,0)}catch{try{return Nn.call(null,e,0)}catch{return Nn.call(this,e,0)}}}function _3(e){if(Dn===clearTimeout)return clearTimeout(e);if((Dn===Tf||!Dn)&&clearTimeout)return Dn=clearTimeout,clearTimeout(e);try{return Dn(e)}catch{try{return Dn.call(null,e)}catch{return Dn.call(this,e)}}}var di=[],po=!1,Cs,Ic=-1;function x3(){!po||!Cs||(po=!1,Cs.length?di=Cs.concat(di):Ic=-1,di.length&&Vg())}function Vg(){if(!po){var e=zg(x3);po=!0;for(var t=di.length;t;){for(Cs=di,di=[];++Ic<t;)Cs&&Cs[Ic].run();Ic=-1,t=di.length}Cs=null,po=!1,_3(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];di.push(new qg(e,t)),di.length===1&&!po&&zg(Vg)};function qg(e,t){this.fun=e,this.array=t}qg.prototype.run=function(){this.fun.apply(null,this.array)};sr.title="browser";sr.browser=!0;sr.env={};sr.argv=[];sr.version="";sr.versions={};function Mi(){}sr.on=Mi;sr.addListener=Mi;sr.once=Mi;sr.off=Mi;sr.removeListener=Mi;sr.removeAllListeners=Mi;sr.emit=Mi;sr.prependListener=Mi;sr.prependOnceListener=Mi;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 S3=Fg.exports;const Wi=w3(S3);var io=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Fu(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 Of={exports:{}},Jo={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,60 +6,55 @@
|
|
|
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
|
|
10
|
-
`+
|
|
11
|
-
`),
|
|
12
|
-
`),
|
|
13
|
-
`+at[
|
|
9
|
+
*/var ep;function E3(){if(ep)return Jo;ep=1;var e=ie,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 Jo.Fragment=r,Jo.jsx=o,Jo.jsxs=o,Jo}var Zo={},tp;function M3(){return tp||(tp=1,Wi.env.NODE_ENV!=="production"&&function(){var e=ie,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"),_=Symbol.iterator,w="@@iterator";function A(z){if(z===null||typeof z!="object")return null;var ne=_&&z[_]||z[w];return typeof ne=="function"?ne:null}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function P(z){{for(var ne=arguments.length,he=new Array(ne>1?ne-1:0),Pe=1;Pe<ne;Pe++)he[Pe-1]=arguments[Pe];N("error",z,he)}}function N(z,ne,he){{var Pe=I.ReactDebugCurrentFrame,We=Pe.getStackAddendum();We!==""&&(ne+="%s",he=he.concat([We]));var Re=he.map(function(Fe){return String(Fe)});Re.unshift("Warning: "+ne),Function.prototype.apply.call(console[z],console,Re)}}var F=!1,L=!1,H=!1,q=!1,X=!1,re;re=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||F||L||H||typeof z=="object"&&z!==null&&(z.$$typeof===h||z.$$typeof===f||z.$$typeof===o||z.$$typeof===a||z.$$typeof===c||z.$$typeof===re||z.getModuleId!==void 0))}function oe(z,ne,he){var Pe=z.displayName;if(Pe)return Pe;var We=ne.displayName||ne.name||"";return We!==""?he+"("+We+")":he}function V(z){return z.displayName||"Context"}function $(z){if(z==null)return null;if(typeof z.tag=="number"&&P("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 ne=z;return V(ne)+".Consumer";case o:var he=z;return V(he._context)+".Provider";case c:return oe(z,z.render,"ForwardRef");case f:var Pe=z.displayName||null;return Pe!==null?Pe:$(z.type)||"Memo";case h:{var We=z,Re=We._payload,Fe=We._init;try{return $(Fe(Re))}catch{return null}}}return null}var p=Object.assign,d=0,m,x,E,C,k,T,g;function v(){}v.__reactDisabledLog=!0;function R(){{if(d===0){m=console.log,x=console.info,E=console.warn,C=console.error,k=console.group,T=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 se(){{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:E}),error:p({},z,{value:C}),group:p({},z,{value:k}),groupCollapsed:p({},z,{value:T}),groupEnd:p({},z,{value:g})})}d<0&&P("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ue=I.ReactCurrentDispatcher,xe;function be(z,ne,he){{if(xe===void 0)try{throw Error()}catch(We){var Pe=We.stack.trim().match(/\n( *(at )?)/);xe=Pe&&Pe[1]||""}return`
|
|
10
|
+
`+xe+z}}var Ce=!1,Me;{var Ke=typeof WeakMap=="function"?WeakMap:Map;Me=new Ke}function Ue(z,ne){if(!z||Ce)return"";{var he=Me.get(z);if(he!==void 0)return he}var Pe;Ce=!0;var We=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Re;Re=ue.current,ue.current=null,R();try{if(ne){var Fe=function(){throw Error()};if(Object.defineProperty(Fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Fe,[])}catch(Wt){Pe=Wt}Reflect.construct(z,[],Fe)}else{try{Fe.call()}catch(Wt){Pe=Wt}z.call(Fe.prototype)}}else{try{throw Error()}catch(Wt){Pe=Wt}z()}}catch(Wt){if(Wt&&Pe&&typeof Wt.stack=="string"){for(var at=Wt.stack.split(`
|
|
11
|
+
`),Ht=Pe.stack.split(`
|
|
12
|
+
`),Pt=at.length-1,Nt=Ht.length-1;Pt>=1&&Nt>=0&&at[Pt]!==Ht[Nt];)Nt--;for(;Pt>=1&&Nt>=0;Pt--,Nt--)if(at[Pt]!==Ht[Nt]){if(Pt!==1||Nt!==1)do if(Pt--,Nt--,Nt<0||at[Pt]!==Ht[Nt]){var Qt=`
|
|
13
|
+
`+at[Pt].replace(" at new "," at ");return z.displayName&&Qt.includes("<anonymous>")&&(Qt=Qt.replace("<anonymous>",z.displayName)),typeof z=="function"&&Me.set(z,Qt),Qt}while(Pt>=1&&Nt>=0);break}}}finally{Ce=!1,ue.current=Re,se(),Error.prepareStackTrace=We}var gr=z?z.displayName||z.name:"",nr=gr?be(gr):"";return typeof z=="function"&&Me.set(z,nr),nr}function lt(z,ne,he){return Ue(z,!1)}function ht(z){var ne=z.prototype;return!!(ne&&ne.isReactComponent)}function $e(z,ne,he){if(z==null)return"";if(typeof z=="function")return Ue(z,ht(z));if(typeof z=="string")return be(z);switch(z){case u:return be("Suspense");case l:return be("SuspenseList")}if(typeof z=="object")switch(z.$$typeof){case c:return lt(z.render);case f:return $e(z.type,ne,he);case h:{var Pe=z,We=Pe._payload,Re=Pe._init;try{return $e(Re(We),ne,he)}catch{}}}return""}var mt=Object.prototype.hasOwnProperty,we={},me=I.ReactDebugCurrentFrame;function Te(z){if(z){var ne=z._owner,he=$e(z.type,z._source,ne?ne.type:null);me.setExtraStackFrame(he)}else me.setExtraStackFrame(null)}function qe(z,ne,he,Pe,We){{var Re=Function.call.bind(mt);for(var Fe in z)if(Re(z,Fe)){var at=void 0;try{if(typeof z[Fe]!="function"){var Ht=Error((Pe||"React class")+": "+he+" type `"+Fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof z[Fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ht.name="Invariant Violation",Ht}at=z[Fe](ne,Fe,Pe,he,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Pt){at=Pt}at&&!(at instanceof Error)&&(Te(We),P("%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).",Pe||"React class",he,Fe,typeof at),Te(null)),at instanceof Error&&!(at.message in we)&&(we[at.message]=!0,Te(We),P("Failed %s type: %s",he,at.message),Te(null))}}}var De=Array.isArray;function Oe(z){return De(z)}function Ie(z){{var ne=typeof Symbol=="function"&&Symbol.toStringTag,he=ne&&z[Symbol.toStringTag]||z.constructor.name||"Object";return he}}function Le(z){try{return ft(z),!1}catch{return!0}}function ft(z){return""+z}function dt(z){if(Le(z))return P("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=I.ReactCurrentOwner,kt={key:!0,ref:!0,__self:!0,__source:!0},_t,Ze,Mt;Mt={};function Rt(z){if(mt.call(z,"ref")){var ne=Object.getOwnPropertyDescriptor(z,"ref").get;if(ne&&ne.isReactWarning)return!1}return z.ref!==void 0}function nt(z){if(mt.call(z,"key")){var ne=Object.getOwnPropertyDescriptor(z,"key").get;if(ne&&ne.isReactWarning)return!1}return z.key!==void 0}function xt(z,ne){if(typeof z.ref=="string"&&He.current&&ne&&He.current.stateNode!==ne){var he=$(He.current.type);Mt[he]||(P('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',$(He.current.type),z.ref),Mt[he]=!0)}}function Ct(z,ne){{var he=function(){_t||(_t=!0,P("%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)",ne))};he.isReactWarning=!0,Object.defineProperty(z,"key",{get:he,configurable:!0})}}function st(z,ne){{var he=function(){Ze||(Ze=!0,P("%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)",ne))};he.isReactWarning=!0,Object.defineProperty(z,"ref",{get:he,configurable:!0})}}var jt=function(z,ne,he,Pe,We,Re,Fe){var at={$$typeof:t,type:z,key:ne,ref:he,props:Fe,_owner:Re};return at._store={},Object.defineProperty(at._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(at,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Pe}),Object.defineProperty(at,"_source",{configurable:!1,enumerable:!1,writable:!1,value:We}),Object.freeze&&(Object.freeze(at.props),Object.freeze(at)),at};function Ot(z,ne,he,Pe,We){{var Re,Fe={},at=null,Ht=null;he!==void 0&&(dt(he),at=""+he),nt(ne)&&(dt(ne.key),at=""+ne.key),Rt(ne)&&(Ht=ne.ref,xt(ne,We));for(Re in ne)mt.call(ne,Re)&&!kt.hasOwnProperty(Re)&&(Fe[Re]=ne[Re]);if(z&&z.defaultProps){var Pt=z.defaultProps;for(Re in Pt)Fe[Re]===void 0&&(Fe[Re]=Pt[Re])}if(at||Ht){var Nt=typeof z=="function"?z.displayName||z.name||"Unknown":z;at&&Ct(Fe,Nt),Ht&&st(Fe,Nt)}return jt(z,at,Ht,We,Pe,He.current,Fe)}}var it=I.ReactCurrentOwner,yt=I.ReactDebugCurrentFrame;function St(z){if(z){var ne=z._owner,he=$e(z.type,z._source,ne?ne.type:null);yt.setExtraStackFrame(he)}else yt.setExtraStackFrame(null)}var Je;Je=!1;function gt(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function It(){{if(it.current){var z=$(it.current.type);if(z)return`
|
|
14
14
|
|
|
15
|
-
Check the render method of \``+
|
|
15
|
+
Check the render method of \``+z+"`."}return""}}function ot(z){{if(z!==void 0){var ne=z.fileName.replace(/^.*[\\\/]/,""),he=z.lineNumber;return`
|
|
16
16
|
|
|
17
|
-
Check your code at `+
|
|
17
|
+
Check your code at `+ne+":"+he+"."}return""}}var bt={};function Lt(z){{var ne=It();if(!ne){var he=typeof z=="string"?z:z.displayName||z.name;he&&(ne=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+
|
|
19
|
+
Check the top-level render call using <`+he+">.")}return ne}}function j(z,ne){{if(!z._store||z._store.validated||z.key!=null)return;z._store.validated=!0;var he=Lt(ne);if(bt[he])return;bt[he]=!0;var Pe="";z&&z._owner&&z._owner!==it.current&&(Pe=" It was passed a child from "+$(z._owner.type)+"."),St(z),P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',he,Pe),St(null)}}function S(z,ne){{if(typeof z!="object")return;if(Oe(z))for(var he=0;he<z.length;he++){var Pe=z[he];gt(Pe)&&j(Pe,ne)}else if(gt(z))z._store&&(z._store.validated=!0);else if(z){var We=A(z);if(typeof We=="function"&&We!==z.entries)for(var Re=We.call(z),Fe;!(Fe=Re.next()).done;)gt(Fe.value)&&j(Fe.value,ne)}}}function M(z){{var ne=z.type;if(ne==null||typeof ne=="string")return;var he;if(typeof ne=="function")he=ne.propTypes;else if(typeof ne=="object"&&(ne.$$typeof===c||ne.$$typeof===f))he=ne.propTypes;else return;if(he){var Pe=$(ne);qe(he,z.props,"prop",Pe,z)}else if(ne.PropTypes!==void 0&&!Je){Je=!0;var We=$(ne);P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",We||"Unknown")}typeof ne.getDefaultProps=="function"&&!ne.getDefaultProps.isReactClassApproved&&P("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function B(z){{for(var ne=Object.keys(z.props),he=0;he<ne.length;he++){var Pe=ne[he];if(Pe!=="children"&&Pe!=="key"){St(z),P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Pe),St(null);break}}z.ref!==null&&(St(z),P("Invalid attribute `ref` supplied to `React.Fragment`."),St(null))}}var K={};function Z(z,ne,he,Pe,We,Re){{var Fe=ae(z);if(!Fe){var at="";(z===void 0||typeof z=="object"&&z!==null&&Object.keys(z).length===0)&&(at+=" 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 Ht=ot(We);Ht?at+=Ht:at+=It();var Pt;z===null?Pt="null":Oe(z)?Pt="array":z!==void 0&&z.$$typeof===t?(Pt="<"+($(z.type)||"Unknown")+" />",at=" Did you accidentally export a JSX literal instead of a component?"):Pt=typeof z,P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Pt,at)}var Nt=Ot(z,ne,he,We,Re);if(Nt==null)return Nt;if(Fe){var Qt=ne.children;if(Qt!==void 0)if(Pe)if(Oe(Qt)){for(var gr=0;gr<Qt.length;gr++)S(Qt[gr],z);Object.freeze&&Object.freeze(Qt)}else P("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(Qt,z)}if(mt.call(ne,"key")){var nr=$(z),Wt=Object.keys(ne).filter(function(Rr){return Rr!=="key"}),mr=Wt.length>0?"{key: someKey, "+Wt.join(": ..., ")+": ...}":"{key: someKey}";if(!K[nr+mr]){var on=Wt.length>0?"{"+Wt.join(": ..., ")+": ...}":"{}";P(`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} />`,mr,nr,an,nr),X[nr+mr]=!0}}return V===n?$(Dt):A(Dt),Dt}}function re(V,oe,de){return Z(V,oe,de,!0)}function Be(V,oe,de){return Z(V,oe,de,!1)}var et=Be,Re=re;na.Fragment=n,na.jsx=et,na.jsxs=Re}()),na}bn.env.NODE_ENV==="production"?cd.exports=lS():cd.exports=fS();var _=cd.exports;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);function Ln(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 dS="1.18.0",hS="1.40.0",pS={"-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 mh extends Error{}class gh extends mh{constructor(t,r){super(t),this.code=r,this.type=pS[r]??"ServerError"}}class Lv extends mh{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var Fv=e=>{throw TypeError(e)},vh=(e,t,r)=>t.has(e)||Fv("Cannot "+r),er=(e,t,r)=>(vh(e,t,"read from private field"),r?r.call(e):t.get(e)),cs=(e,t,r)=>t.has(e)?Fv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),bo=(e,t,r,n)=>(vh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Uv=(e,t,r)=>(vh(e,t,"access private method"),r),mS=(e,t,r,n)=>({set _(i){bo(e,t,i,r)},get _(){return er(e,t,n)}}),gs,xa,di,Os,Ra,wo,hu,zv,Vv;function gS(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const vS={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class yS{constructor(t,r={}){if(cs(this,hu),cs(this,gs,0),cs(this,xa,0),cs(this,di,null),cs(this,Os,null),cs(this,Ra,new Set),cs(this,wo,new Map),this.endpoint=t,this.options={...vS,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=gS(this.endpoint))}async makeRequest(t,r){const n=await Uv(this,hu,zv).call(this);return new Promise((i,s)=>{bo(this,gs,er(this,gs)+1),er(this,wo).set(er(this,gs),{resolve:i,reject:s,timeout:setTimeout(()=>{er(this,wo).delete(er(this,gs)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:er(this,gs),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new gh(i.message,i.code);return s})}async subscribe(t){const r=new bS(t);return er(this,Ra).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}gs=new WeakMap;xa=new WeakMap;di=new WeakMap;Os=new WeakMap;Ra=new WeakMap;wo=new WeakMap;hu=new WeakSet;zv=function(){return er(this,Os)?er(this,Os):(bo(this,Os,new Promise(e=>{var t;(t=er(this,di))==null||t.close(),bo(this,di,new this.options.WebSocketConstructor(this.endpoint)),er(this,di).addEventListener("open",()=>{bo(this,xa,0),e(er(this,di))}),er(this,di).addEventListener("close",()=>{mS(this,xa)._++,er(this,xa)<=this.options.maxReconnects&&setTimeout(()=>{Uv(this,hu,Vv).call(this)},this.options.reconnectTimeout)}),er(this,di).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&&er(this,wo).has(n.id)){const{resolve:i,timeout:s}=er(this,wo).get(n.id);clearTimeout(s),i(n)}else if("params"in n){const{params:i}=n;er(this,Ra).forEach(s=>{s.subscriptionId===i.subscription&&i.subscription===s.subscriptionId&&s.onMessage(i.result)})}})})),er(this,Os))};Vv=async function(){var e;return(e=er(this,di))==null||e.close(),bo(this,Os,null),Promise.allSettled([...er(this,Ra)].map(t=>t.subscribe(this)))};class bS{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 qv=e=>{throw TypeError(e)},yh=(e,t,r)=>t.has(e)||qv("Cannot "+r),Qr=(e,t,r)=>(yh(e,t,"read from private field"),r?r.call(e):t.get(e)),Sc=(e,t,r)=>t.has(e)?qv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ud=(e,t,r,n)=>(yh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),wS=(e,t,r)=>(yh(e,t,"access private method"),r),ga,hn,Sa,ld,Hv;class Wv{constructor(t){Sc(this,ld),Sc(this,ga,0),Sc(this,hn),Sc(this,Sa),ud(this,hn,t)}fetch(t,r){const n=Qr(this,hn).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;ud(this,ga,Qr(this,ga)+1);const r=await this.fetch(((i=Qr(this,hn).rpc)==null?void 0:i.url)??Qr(this,hn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":dS,"Client-Target-Api-Version":hS,"Client-Request-Method":t.method,...(s=Qr(this,hn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:Qr(this,ga),method:t.method,params:t.params})});if(!r.ok)throw new Lv(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new gh(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await wS(this,ld,Hv).call(this).subscribe(t);return async()=>!!await r()}}ga=new WeakMap;hn=new WeakMap;Sa=new WeakMap;ld=new WeakSet;Hv=function(){var e;if(!Qr(this,Sa)){const t=Qr(this,hn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");ud(this,Sa,new yS(((e=Qr(this,hn).websocket)==null?void 0:e.url)??Qr(this,hn).url,{WebSocketConstructor:t,...Qr(this,hn).websocket}))}return Qr(this,Sa)};function Gv(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 _S(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 z=b-1;(R!==0||N<f)&&z!==-1;z--,N++)R+=256*w[z]>>>0,w[z]=R%r>>>0,R=R/r>>>0;if(R!==0)throw new Error("Non-zero carry");f=N,h++}let T=b-f;for(;T!==b&&w[T]===0;)T++;let P=n.repeat(l);for(;T<b;++T)P+=e.charAt(w[T]);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 z=y-1;(R!==0||N<h)&&z!==-1;z--,N++)R+=r*b[z]>>>0,b[z]=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 T=new Uint8Array(f+(y-w));let P=f;for(;w!==y;)T[P++]=b[w++];return T}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 xS="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const Kv=_S(xS),Zu=e=>Kv.encode(e),Do=e=>Kv.decode(e),SS=Zu,ES=Do;function Qu(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const sf=8192;function Ui(e){if(e.length<sf)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=sf){const n=e.slice(r,r+sf);t+=String.fromCharCode(...n)}return btoa(t)}const CS=Ui,MS=Qu;function el(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 ic(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const AS=ic,TS=el;function bh(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 OS(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 Xv{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}=OS(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 Jv(e,t){switch(t){case"base58":return Zu(e);case"base64":return Ui(e);case"hex":return ic(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function IS(e,t){switch(t){case"base58":return Do(e);case"base64":return Qu(e);case"hex":return el(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function PS(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 Yv{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 of(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return of(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return of(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return bh(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 Jv(this.toBytes(),t)}}function of(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 Zv=e=>{throw TypeError(e)},Qv=(e,t,r)=>t.has(e)||Zv("Cannot "+r),pn=(e,t,r)=>(Qv(e,t,"read from private field"),r?r.call(e):t.get(e)),pu=(e,t,r)=>t.has(e)?Zv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),mu=(e,t,r,n)=>(Qv(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),oo,va,zc,ji;const kS=class e1{constructor(t){pu(this,oo),pu(this,va),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),mu(this,oo,t.write),mu(this,va,t.serialize??((r,n)=>{const i=new Yv({initialSize:this.serializedSize(r)??void 0,...n});return pn(this,oo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),pn(this,oo).call(this,t,r)}serialize(t,r){return this.validate(t),new r1(this,pn(this,va).call(this,t,r))}parse(t){const r=new Xv(t);return this.read(r)}fromHex(t){return this.parse(el(t))}fromBase58(t){return this.parse(Do(t))}fromBase64(t){return this.parse(Qu(t))}transform({name:t,input:r,output:n,validate:i}){return new e1({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>pn(this,oo).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>pn(this,va).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};oo=new WeakMap;va=new WeakMap;let Fn=kS;const t1=Symbol.for("@mysten/serialized-bcs");function jS(e){return!!e&&typeof e=="object"&&e[t1]===!0}class r1{constructor(t,r){pu(this,zc),pu(this,ji),mu(this,zc,t),mu(this,ji,r)}get[t1](){return!0}toBytes(){return pn(this,ji)}toHex(){return ic(pn(this,ji))}toBase64(){return Ui(pn(this,ji))}toBase58(){return Zu(pn(this,ji))}parse(){return pn(this,zc).parse(pn(this,ji))}}zc=new WeakMap;ji=new WeakMap;function gu({size:e,...t}){return new Fn({...t,serializedSize:()=>e})}function af({readMethod:e,writeMethod:t,...r}){return gu({...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 cf({readMethod:e,writeMethod:t,...r}){return gu({...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 RS({serialize:e,...t}){const r=new Fn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function NS({toBytes:e,fromBytes:t,...r}){return new Fn({...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=bh(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 DS(e){let t=null;function r(){return t||(t=e()),t}return new Fn({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 Vc={u8(e){return af({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return af({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return af({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return cf({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return cf({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return cf({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return gu({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 RS({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(bh(t)),...e})},bytes(e,t){return gu({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 NS({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Fn({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 Vc.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 Fn({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 Fn({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 Fn({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 Fn({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 Vc.vector(Vc.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 DS(e)}},BS=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:Xv,BcsType:Fn,BcsWriter:Yv,SerializedBcs:r1,bcs:Vc,decodeStr:IS,encodeStr:Jv,fromB58:ES,fromB64:MS,fromBase58:Do,fromBase64:Qu,fromHEX:TS,fromHex:el,isSerializedBcs:jS,splitGenericParameters:PS,toB58:SS,toB64:CS,toBase58:Zu,toBase64:Ui,toHEX:AS,toHex:ic},Symbol.toStringTag,{value:"Module"})),$S=32;function F0(e){try{return Do(e).length===$S}catch{return!1}}const n1=32;function vs(e){return LS(e)&&FS(e)===n1}function Ec(e){return vs(e)}function ys(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(n1*2,"0")}`}function Cc(e,t=!1){return ys(e,t)}function LS(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function FS(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const US=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,zS=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i;function VS(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!US.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!zS.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 Ds={},Mo={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.anumber=Na;Mn.number=Na;Mn.abytes=tl;Mn.bytes=tl;Mn.ahash=i1;Mn.aexists=s1;Mn.aoutput=o1;function Na(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function qS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function tl(e,...t){if(!qS(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 i1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Na(e.outputLen),Na(e.blockLen)}function s1(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 o1(e,t){tl(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const HS={number:Na,bytes:tl,hash:i1,exists:s1,output:o1};Mn.default=HS;var wh={},rl={};Object.defineProperty(rl,"__esModule",{value:!0});rl.crypto=void 0;rl.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=n,e.byteSwap32=l,e.bytesToHex=h,e.hexToBytes=w,e.asyncLoop=P,e.utf8ToBytes=R,e.toBytes=N,e.concatBytes=z,e.checkOpts=W,e.wrapConstructor=q,e.wrapConstructorWithOpts=K,e.wrapXOFConstructorWithOpts=te,e.randomBytes=se;const t=rl,r=Mn;function n(H){return H instanceof Uint8Array||ArrayBuffer.isView(H)&&H.constructor.name==="Uint8Array"}const i=H=>new Uint8Array(H.buffer,H.byteOffset,H.byteLength);e.u8=i;const s=H=>new Uint32Array(H.buffer,H.byteOffset,Math.floor(H.byteLength/4));e.u32=s;const o=H=>new DataView(H.buffer,H.byteOffset,H.byteLength);e.createView=o;const a=(H,L)=>H<<32-L|H>>>L;e.rotr=a;const c=(H,L)=>H<<L|H>>>32-L>>>0;e.rotl=c,e.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();const u=H=>H<<24&4278190080|H<<8&16711680|H>>>8&65280|H>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?H=>H:H=>(0,e.byteSwap)(H);function l(H){for(let L=0;L<H.length;L++)H[L]=(0,e.byteSwap)(H[L])}const f=Array.from({length:256},(H,L)=>L.toString(16).padStart(2,"0"));function h(H){(0,r.abytes)(H);let L="";for(let D=0;D<H.length;D++)L+=f[H[D]];return L}const y={_0:48,_9:57,A:65,F:70,a:97,f:102};function b(H){if(H>=y._0&&H<=y._9)return H-y._0;if(H>=y.A&&H<=y.F)return H-(y.A-10);if(H>=y.a&&H<=y.f)return H-(y.a-10)}function w(H){if(typeof H!="string")throw new Error("hex string expected, got "+typeof H);const L=H.length,D=L/2;if(L%2)throw new Error("hex string expected, got unpadded hex of length "+L);const p=new Uint8Array(D);for(let d=0,m=0;d<D;d++,m+=2){const x=b(H.charCodeAt(m)),C=b(H.charCodeAt(m+1));if(x===void 0||C===void 0){const E=H[m]+H[m+1];throw new Error('hex string expected, got non-hex character "'+E+'" at index '+m)}p[d]=x*16+C}return p}const T=async()=>{};e.nextTick=T;async function P(H,L,D){let p=Date.now();for(let d=0;d<H;d++){D(d);const m=Date.now()-p;m>=0&&m<L||(await(0,e.nextTick)(),p+=m)}}function R(H){if(typeof H!="string")throw new Error("utf8ToBytes expected string, got "+typeof H);return new Uint8Array(new TextEncoder().encode(H))}function N(H){return typeof H=="string"&&(H=R(H)),(0,r.abytes)(H),H}function z(...H){let L=0;for(let p=0;p<H.length;p++){const d=H[p];(0,r.abytes)(d),L+=d.length}const D=new Uint8Array(L);for(let p=0,d=0;p<H.length;p++){const m=H[p];D.set(m,d),d+=m.length}return D}class F{clone(){return this._cloneInto()}}e.Hash=F;function W(H,L){if(L!==void 0&&{}.toString.call(L)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(H,L)}function q(H){const L=p=>H().update(N(p)).digest(),D=H();return L.outputLen=D.outputLen,L.blockLen=D.blockLen,L.create=()=>H(),L}function K(H){const L=(p,d)=>H(d).update(N(p)).digest(),D=H({});return L.outputLen=D.outputLen,L.blockLen=D.blockLen,L.create=p=>H(p),L}function te(H){const L=(p,d)=>H(d).update(N(p)).digest(),D=H({});return L.outputLen=D.outputLen,L.blockLen=D.blockLen,L.create=p=>H(p),L}function se(H=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(H));if(t.crypto&&typeof t.crypto.randomBytes=="function")return t.crypto.randomBytes(H);throw new Error("crypto.getRandomValues must be defined")}})(wh);Object.defineProperty(Mo,"__esModule",{value:!0});Mo.BLAKE=Mo.SIGMA=void 0;const Ks=Mn,vr=wh;Mo.SIGMA=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 WS extends vr.Hash{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,(0,Ks.anumber)(t),(0,Ks.anumber)(r),(0,Ks.anumber)(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=(0,vr.u32)(this.buffer)}update(t){(0,Ks.aexists)(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=(0,vr.toBytes)(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(vr.isLE||(0,vr.byteSwap32)(i),this.compress(i,0,!1),vr.isLE||(0,vr.byteSwap32)(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));vr.isLE||(0,vr.byteSwap32)(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);vr.isLE||(0,vr.byteSwap32)(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){(0,Ks.aexists)(this),(0,Ks.aoutput)(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),vr.isLE||(0,vr.byteSwap32)(n),this.compress(n,0,!0),vr.isLE||(0,vr.byteSwap32)(n);const i=(0,vr.u32)(t);this.get().forEach((s,o)=>i[o]=(0,vr.byteSwapIfBE)(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}}Mo.BLAKE=WS;var ft={};Object.defineProperty(ft,"__esModule",{value:!0});ft.add5L=ft.add5H=ft.add4H=ft.add4L=ft.add3H=ft.add3L=ft.rotlBL=ft.rotlBH=ft.rotlSL=ft.rotlSH=ft.rotr32L=ft.rotr32H=ft.rotrBL=ft.rotrBH=ft.rotrSL=ft.rotrSH=ft.shrSL=ft.shrSH=ft.toBig=void 0;ft.fromBig=_h;ft.split=a1;ft.add=_1;const Mc=BigInt(2**32-1),fd=BigInt(32);function _h(e,t=!1){return t?{h:Number(e&Mc),l:Number(e>>fd&Mc)}:{h:Number(e>>fd&Mc)|0,l:Number(e&Mc)|0}}function a1(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}=_h(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const c1=(e,t)=>BigInt(e>>>0)<<fd|BigInt(t>>>0);ft.toBig=c1;const u1=(e,t,r)=>e>>>r;ft.shrSH=u1;const l1=(e,t,r)=>e<<32-r|t>>>r;ft.shrSL=l1;const f1=(e,t,r)=>e>>>r|t<<32-r;ft.rotrSH=f1;const d1=(e,t,r)=>e<<32-r|t>>>r;ft.rotrSL=d1;const h1=(e,t,r)=>e<<64-r|t>>>r-32;ft.rotrBH=h1;const p1=(e,t,r)=>e>>>r-32|t<<64-r;ft.rotrBL=p1;const m1=(e,t)=>t;ft.rotr32H=m1;const g1=(e,t)=>e;ft.rotr32L=g1;const v1=(e,t,r)=>e<<r|t>>>32-r;ft.rotlSH=v1;const y1=(e,t,r)=>t<<r|e>>>32-r;ft.rotlSL=y1;const b1=(e,t,r)=>t<<r-32|e>>>64-r;ft.rotlBH=b1;const w1=(e,t,r)=>e<<r-32|t>>>64-r;ft.rotlBL=w1;function _1(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const x1=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);ft.add3L=x1;const S1=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;ft.add3H=S1;const E1=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);ft.add4L=E1;const C1=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;ft.add4H=C1;const M1=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ft.add5L=M1;const A1=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;ft.add5H=A1;const GS={fromBig:_h,split:a1,toBig:c1,shrSH:u1,shrSL:l1,rotrSH:f1,rotrSL:d1,rotrBH:h1,rotrBL:p1,rotr32H:m1,rotr32L:g1,rotlSH:v1,rotlSL:y1,rotlBH:b1,rotlBL:w1,add:_1,add3L:x1,add3H:S1,add4L:E1,add4H:C1,add5H:A1,add5L:M1};ft.default=GS;Object.defineProperty(Ds,"__esModule",{value:!0});Ds.blake2b=Ds.BLAKE2b=void 0;const U0=Mo,Pr=ft,Br=wh,ur=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Ie=new Uint32Array(32);function Ii(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],f=Ie[2*t+1],h=Ie[2*r],y=Ie[2*r+1],b=Ie[2*n],w=Ie[2*n+1],T=Pr.default.add3L(c,l,o);u=Pr.default.add3H(T,u,f,a),c=T|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Pr.default.rotr32H(w,b),Dl:Pr.default.rotr32L(w,b)},{h:y,l:h}=Pr.default.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Pr.default.rotrSH(f,l,24),Bl:Pr.default.rotrSL(f,l,24)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=f,Ie[2*r]=h,Ie[2*r+1]=y,Ie[2*n]=b,Ie[2*n+1]=w}function Pi(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=Ie[2*e],u=Ie[2*e+1],l=Ie[2*t],f=Ie[2*t+1],h=Ie[2*r],y=Ie[2*r+1],b=Ie[2*n],w=Ie[2*n+1],T=Pr.default.add3L(c,l,o);u=Pr.default.add3H(T,u,f,a),c=T|0,{Dh:w,Dl:b}={Dh:w^u,Dl:b^c},{Dh:w,Dl:b}={Dh:Pr.default.rotrSH(w,b,16),Dl:Pr.default.rotrSL(w,b,16)},{h:y,l:h}=Pr.default.add(y,h,w,b),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Pr.default.rotrBH(f,l,63),Bl:Pr.default.rotrBL(f,l,63)},Ie[2*e]=c,Ie[2*e+1]=u,Ie[2*t]=l,Ie[2*t+1]=f,Ie[2*r]=h,Ie[2*r+1]=y,Ie[2*n]=b,Ie[2*n+1]=w}class T1 extends U0.BLAKE{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=ur[0]|0,this.v0h=ur[1]|0,this.v1l=ur[2]|0,this.v1h=ur[3]|0,this.v2l=ur[4]|0,this.v2h=ur[5]|0,this.v3l=ur[6]|0,this.v3h=ur[7]|0,this.v4l=ur[8]|0,this.v4h=ur[9]|0,this.v5l=ur[10]|0,this.v5h=ur[11]|0,this.v6l=ur[12]|0,this.v6h=ur[13]|0,this.v7l=ur[14]|0,this.v7h=ur[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=(0,Br.u32)((0,Br.toBytes)(t.salt));this.v4l^=(0,Br.byteSwapIfBE)(n[0]),this.v4h^=(0,Br.byteSwapIfBE)(n[1]),this.v5l^=(0,Br.byteSwapIfBE)(n[2]),this.v5h^=(0,Br.byteSwapIfBE)(n[3])}if(t.personalization){const n=(0,Br.u32)((0,Br.toBytes)(t.personalization));this.v6l^=(0,Br.byteSwapIfBE)(n[0]),this.v6h^=(0,Br.byteSwapIfBE)(n[1]),this.v7l^=(0,Br.byteSwapIfBE)(n[2]),this.v7h^=(0,Br.byteSwapIfBE)(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set((0,Br.toBytes)(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:T}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,T]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,b,w,T){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=T|0}compress(t,r,n){this.get().forEach((c,u)=>Ie[u]=c),Ie.set(ur,16);let{h:i,l:s}=Pr.default.fromBig(BigInt(this.length));Ie[24]=ur[8]^s,Ie[25]=ur[9]^i,n&&(Ie[28]=~Ie[28],Ie[29]=~Ie[29]);let o=0;const a=U0.SIGMA;for(let c=0;c<12;c++)Ii(0,4,8,12,t,r+2*a[o++]),Pi(0,4,8,12,t,r+2*a[o++]),Ii(1,5,9,13,t,r+2*a[o++]),Pi(1,5,9,13,t,r+2*a[o++]),Ii(2,6,10,14,t,r+2*a[o++]),Pi(2,6,10,14,t,r+2*a[o++]),Ii(3,7,11,15,t,r+2*a[o++]),Pi(3,7,11,15,t,r+2*a[o++]),Ii(0,5,10,15,t,r+2*a[o++]),Pi(0,5,10,15,t,r+2*a[o++]),Ii(1,6,11,12,t,r+2*a[o++]),Pi(1,6,11,12,t,r+2*a[o++]),Ii(2,7,8,13,t,r+2*a[o++]),Pi(2,7,8,13,t,r+2*a[o++]),Ii(3,4,9,14,t,r+2*a[o++]),Pi(3,4,9,14,t,r+2*a[o++]);this.v0l^=Ie[0]^Ie[16],this.v0h^=Ie[1]^Ie[17],this.v1l^=Ie[2]^Ie[18],this.v1h^=Ie[3]^Ie[19],this.v2l^=Ie[4]^Ie[20],this.v2h^=Ie[5]^Ie[21],this.v3l^=Ie[6]^Ie[22],this.v3h^=Ie[7]^Ie[23],this.v4l^=Ie[8]^Ie[24],this.v4h^=Ie[9]^Ie[25],this.v5l^=Ie[10]^Ie[26],this.v5h^=Ie[11]^Ie[27],this.v6l^=Ie[12]^Ie[28],this.v6h^=Ie[13]^Ie[29],this.v7l^=Ie[14]^Ie[30],this.v7h^=Ie[15]^Ie[31],Ie.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)}}Ds.BLAKE2b=T1;Ds.blake2b=(0,Br.wrapConstructorWithOpts)(e=>new T1(e));var xh=Object.defineProperty,KS=Object.getOwnPropertyDescriptor,XS=Object.getOwnPropertyNames,JS=Object.prototype.hasOwnProperty,YS=(e,t)=>{for(var r in t)xh(e,r,{get:t[r],enumerable:!0})},ZS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XS(t))!JS.call(e,i)&&i!==r&&xh(e,i,{get:()=>t[i],enumerable:!(n=KS(t,i))||n.enumerable});return e},QS=e=>ZS(xh({},"__esModule",{value:!0}),e),O1={};YS(O1,{BIC_REGEX:()=>P1,CUID2_REGEX:()=>k1,DECIMAL_REGEX:()=>j1,EMAIL_REGEX:()=>R1,EMOJI_REGEX:()=>N1,HEXADECIMAL_REGEX:()=>D1,HEX_COLOR_REGEX:()=>B1,IMEI_REGEX:()=>$1,IPV4_REGEX:()=>L1,IPV6_REGEX:()=>F1,IP_REGEX:()=>U1,ISO_DATE_REGEX:()=>z1,ISO_DATE_TIME_REGEX:()=>V1,ISO_TIMESTAMP_REGEX:()=>W1,ISO_TIME_REGEX:()=>q1,ISO_TIME_SECOND_REGEX:()=>H1,ISO_WEEK_REGEX:()=>G1,MAC48_REGEX:()=>K1,MAC64_REGEX:()=>X1,MAC_REGEX:()=>J1,OCTAL_REGEX:()=>Y1,ULID_REGEX:()=>Z1,UUID_REGEX:()=>Q1,ValiError:()=>nl,_addIssue:()=>ue,_isLuhnAlgo:()=>Sh,_isValidObjectKey:()=>Us,_stringify:()=>Nr,any:()=>jb,array:()=>Rb,arrayAsync:()=>Nb,awaitAsync:()=>I1,bic:()=>iy,bigint:()=>Db,blob:()=>Bb,boolean:()=>$b,brand:()=>sy,bytes:()=>oy,check:()=>ay,checkAsync:()=>cy,checkItems:()=>uy,config:()=>vE,creditCard:()=>ly,cuid2:()=>fy,custom:()=>Lb,customAsync:()=>Fb,date:()=>Ub,decimal:()=>dy,deleteGlobalConfig:()=>tE,deleteGlobalMessage:()=>nE,deleteSchemaMessage:()=>sE,deleteSpecificMessage:()=>aE,email:()=>hy,emoji:()=>py,empty:()=>my,endsWith:()=>gy,entriesFromList:()=>uE,enum:()=>gd,enum_:()=>gd,everyItem:()=>vy,excludes:()=>yy,fallback:()=>yE,fallbackAsync:()=>bE,file:()=>zb,filterItems:()=>by,findItem:()=>wy,finite:()=>_y,flatten:()=>wE,forward:()=>_E,forwardAsync:()=>xE,function:()=>vd,function_:()=>vd,getDefault:()=>Mi,getDefaults:()=>dd,getDefaultsAsync:()=>hd,getDotPath:()=>ny,getFallback:()=>oc,getFallbacks:()=>pd,getFallbacksAsync:()=>md,getGlobalConfig:()=>sc,getGlobalMessage:()=>ey,getSchemaMessage:()=>ty,getSpecificMessage:()=>ry,hash:()=>xy,hexColor:()=>Ey,hexadecimal:()=>Sy,imei:()=>Cy,includes:()=>My,instance:()=>Vb,integer:()=>Ay,intersect:()=>qb,intersectAsync:()=>Hb,ip:()=>Ty,ipv4:()=>Oy,ipv6:()=>Iy,is:()=>SE,isOfKind:()=>lE,isOfType:()=>fE,isValiError:()=>dE,isoDate:()=>Py,isoDateTime:()=>ky,isoTime:()=>jy,isoTimeSecond:()=>Ry,isoTimestamp:()=>Ny,isoWeek:()=>Dy,keyof:()=>EE,lazy:()=>Wb,lazyAsync:()=>Gb,length:()=>By,literal:()=>Kb,looseObject:()=>Xb,looseObjectAsync:()=>Jb,looseTuple:()=>Yb,looseTupleAsync:()=>Zb,mac:()=>$y,mac48:()=>Ly,mac64:()=>Fy,map:()=>Qb,mapAsync:()=>ew,mapItems:()=>Uy,maxBytes:()=>zy,maxLength:()=>Vy,maxSize:()=>qy,maxValue:()=>Hy,mimeType:()=>Wy,minBytes:()=>Gy,minLength:()=>Ky,minSize:()=>Xy,minValue:()=>Jy,multipleOf:()=>Yy,nan:()=>tw,never:()=>rw,nonEmpty:()=>Zy,nonNullable:()=>nw,nonNullableAsync:()=>iw,nonNullish:()=>sw,nonNullishAsync:()=>ow,nonOptional:()=>Eh,nonOptionalAsync:()=>Ch,normalize:()=>Qy,notBytes:()=>eb,notLength:()=>tb,notSize:()=>rb,notValue:()=>nb,null:()=>yd,null_:()=>yd,nullable:()=>aw,nullableAsync:()=>cw,nullish:()=>uw,nullishAsync:()=>lw,number:()=>fw,object:()=>dw,objectAsync:()=>hw,objectWithRest:()=>pw,objectWithRestAsync:()=>mw,octal:()=>ib,omit:()=>CE,optional:()=>Mh,optionalAsync:()=>Ah,parse:()=>Dw,parseAsync:()=>Bw,parser:()=>ME,parserAsync:()=>AE,partial:()=>TE,partialAsync:()=>OE,partialCheck:()=>ob,partialCheckAsync:()=>ab,pick:()=>IE,picklist:()=>Th,pipe:()=>PE,pipeAsync:()=>kE,promise:()=>gw,rawCheck:()=>cb,rawCheckAsync:()=>ub,rawTransform:()=>lb,rawTransformAsync:()=>fb,readonly:()=>db,record:()=>vw,recordAsync:()=>yw,reduceItems:()=>hb,regex:()=>pb,required:()=>jE,requiredAsync:()=>RE,safeInteger:()=>mb,safeParse:()=>$w,safeParseAsync:()=>Lw,safeParser:()=>NE,safeParserAsync:()=>DE,set:()=>bw,setAsync:()=>ww,setGlobalConfig:()=>eE,setGlobalMessage:()=>rE,setSchemaMessage:()=>iE,setSpecificMessage:()=>oE,size:()=>gb,someItem:()=>vb,sortItems:()=>yb,startsWith:()=>bb,strictObject:()=>_w,strictObjectAsync:()=>xw,strictTuple:()=>Sw,strictTupleAsync:()=>Ew,string:()=>Cw,symbol:()=>Mw,toLowerCase:()=>wb,toMaxValue:()=>_b,toMinValue:()=>xb,toUpperCase:()=>Sb,transform:()=>Eb,transformAsync:()=>Cb,trim:()=>Mb,trimEnd:()=>Ab,trimStart:()=>Tb,tuple:()=>Aw,tupleAsync:()=>Tw,tupleWithRest:()=>Ow,tupleWithRestAsync:()=>Iw,ulid:()=>Ob,undefined:()=>bd,undefined_:()=>bd,union:()=>Pw,unionAsync:()=>kw,unknown:()=>jw,unwrap:()=>BE,url:()=>Ib,uuid:()=>Pb,value:()=>kb,variant:()=>Rw,variantAsync:()=>Nw,void:()=>wd,void_:()=>wd});var is=QS(O1);function I1(){return{kind:"transformation",type:"await",reference:I1,async:!0,async _run(e){return e.value=await e.value,e}}}var P1=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,k1=/^[a-z][\da-z]*$/u,j1=/^\d+$/u,R1=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,N1=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,D1=/^(?:0h|0x)?[\da-f]+$/iu,B1=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,$1=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,L1=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,F1=/^(?:(?:[\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,U1=/^(?:(?:[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,z1=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,V1=/^\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,q1=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,H1=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,W1=/^\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,G1=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,K1=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,X1=/^(?:[\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,J1=/^(?:[\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,Y1=/^(?:0o)?[0-7]+$/iu,Z1=/^[\da-hjkmnp-tv-z]{26}$/iu,Q1=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,Yr;function eE(e){Yr={...Yr,...e}}function sc(e){return{lang:(e==null?void 0:e.lang)??(Yr==null?void 0:Yr.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(Yr==null?void 0:Yr.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(Yr==null?void 0:Yr.abortPipeEarly)}}function tE(){Yr=void 0}var yi;function rE(e,t){yi||(yi=new Map),yi.set(t,e)}function ey(e){return yi==null?void 0:yi.get(e)}function nE(e){yi==null||yi.delete(e)}var bi;function iE(e,t){bi||(bi=new Map),bi.set(t,e)}function ty(e){return bi==null?void 0:bi.get(e)}function sE(e){bi==null||bi.delete(e)}var gn;function oE(e,t,r){gn||(gn=new Map),gn.get(e)||gn.set(e,new Map),gn.get(e).set(r,t)}function ry(e,t){var r;return(r=gn==null?void 0:gn.get(e))==null?void 0:r.get(t)}function aE(e,t){var r;(r=gn==null?void 0:gn.get(e))==null||r.delete(t)}function Nr(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 ue(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)??Nr(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??ry(e.reference,c.lang)??(u?ty(c.lang):null)??n.message??ey(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 cE=/\D/gu;function Sh(e){const t=e.replace(cE,"");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 Us(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function uE(e,t){const r={};for(const n of e)r[n]=t;return r}function ny(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 lE(e,t){return t.kind===e}function fE(e,t){return t.type===e}function dE(e){return e instanceof nl}var nl=class extends Error{constructor(t){super(t[0].message);gt(this,"issues");this.name="ValiError",this.issues=t}};function iy(e){return{kind:"validation",type:"bic",reference:iy,async:!1,expects:null,requirement:P1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"BIC",t,r),t}}}function sy(e){return{kind:"transformation",type:"brand",reference:sy,async:!1,name:e,_run(t){return t}}}function oy(e,t){return{kind:"validation",type:"bytes",reference:oy,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&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function ay(e,t){return{kind:"validation",type:"check",reference:ay,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement(r.value)&&ue(this,"input",r,n),r}}}function cy(e,t){return{kind:"validation",type:"check",reference:cy,async:!0,expects:null,requirement:e,message:t,async _run(r,n){return r.typed&&!await this.requirement(r.value)&&ue(this,"input",r,n),r}}}function uy(e,t){return{kind:"validation",type:"check_items",reference:uy,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)||ue(this,"item",r,n,{input:s,path:[{type:"array",origin:"value",input:r.value,key:i,value:s}]})}return r}}}var hE=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,pE=/[- ]/gu,mE=[/^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 ly(e){return{kind:"validation",type:"credit_card",reference:ly,async:!1,expects:null,requirement(t){let r;return hE.test(t)&&(r=t.replace(pE,""))&&mE.some(n=>n.test(r))&&Sh(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"credit card",t,r),t}}}function fy(e){return{kind:"validation",type:"cuid2",reference:fy,async:!1,expects:null,requirement:k1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"Cuid2",t,r),t}}}function dy(e){return{kind:"validation",type:"decimal",reference:dy,async:!1,expects:null,requirement:j1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"decimal",t,r),t}}}function hy(e){return{kind:"validation",type:"email",reference:hy,expects:null,async:!1,requirement:R1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"email",t,r),t}}}function py(e){return{kind:"validation",type:"emoji",reference:py,async:!1,expects:null,requirement:N1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"emoji",t,r),t}}}function my(e){return{kind:"validation",type:"empty",reference:my,async:!1,expects:"0",message:e,_run(t,r){return t.typed&&t.value.length>0&&ue(this,"length",t,r,{received:`${t.value.length}`}),t}}}function gy(e,t){return{kind:"validation",type:"ends_with",reference:gy,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.endsWith(this.requirement)&&ue(this,"end",r,n,{received:`"${r.value.slice(-this.requirement.length)}"`}),r}}}function vy(e,t){return{kind:"validation",type:"every_item",reference:vy,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.every(this.requirement)&&ue(this,"item",r,n),r}}}function yy(e,t){const r=Nr(e);return{kind:"validation",type:"excludes",reference:yy,async:!1,expects:`!${r}`,requirement:e,message:t,_run(n,i){return n.typed&&n.value.includes(this.requirement)&&ue(this,"content",n,i,{received:r}),n}}}function by(e){return{kind:"transformation",type:"filter_items",reference:by,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function wy(e){return{kind:"transformation",type:"find_item",reference:wy,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function _y(e){return{kind:"validation",type:"finite",reference:_y,async:!1,expects:null,requirement:Number.isFinite,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"finite",t,r),t}}}var gE={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 xy(e,t){return{kind:"validation",type:"hash",reference:xy,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${gE[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&ue(this,"hash",r,n),r}}}function Sy(e){return{kind:"validation",type:"hexadecimal",reference:Sy,async:!1,expects:null,requirement:D1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"hexadecimal",t,r),t}}}function Ey(e){return{kind:"validation",type:"hex_color",reference:Ey,async:!1,expects:null,requirement:B1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"hex color",t,r),t}}}function Cy(e){return{kind:"validation",type:"imei",reference:Cy,async:!1,expects:null,requirement(t){return $1.test(t)&&Sh(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"IMEI",t,r),t}}}function My(e,t){const r=Nr(e);return{kind:"validation",type:"includes",reference:My,async:!1,expects:r,requirement:e,message:t,_run(n,i){return n.typed&&!n.value.includes(this.requirement)&&ue(this,"content",n,i,{received:`!${r}`}),n}}}function Ay(e){return{kind:"validation",type:"integer",reference:Ay,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"integer",t,r),t}}}function Ty(e){return{kind:"validation",type:"ip",reference:Ty,async:!1,expects:null,requirement:U1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"IP",t,r),t}}}function Oy(e){return{kind:"validation",type:"ipv4",reference:Oy,async:!1,expects:null,requirement:L1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"IPv4",t,r),t}}}function Iy(e){return{kind:"validation",type:"ipv6",reference:Iy,async:!1,expects:null,requirement:F1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"IPv6",t,r),t}}}function Py(e){return{kind:"validation",type:"iso_date",reference:Py,async:!1,expects:null,requirement:z1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"date",t,r),t}}}function ky(e){return{kind:"validation",type:"iso_date_time",reference:ky,async:!1,expects:null,requirement:V1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"date-time",t,r),t}}}function jy(e){return{kind:"validation",type:"iso_time",reference:jy,async:!1,expects:null,requirement:q1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"time",t,r),t}}}function Ry(e){return{kind:"validation",type:"iso_time_second",reference:Ry,async:!1,expects:null,requirement:H1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"time-second",t,r),t}}}function Ny(e){return{kind:"validation",type:"iso_timestamp",reference:Ny,async:!1,expects:null,requirement:W1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"timestamp",t,r),t}}}function Dy(e){return{kind:"validation",type:"iso_week",reference:Dy,async:!1,expects:null,requirement:G1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"week",t,r),t}}}function By(e,t){return{kind:"validation",type:"length",reference:By,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length!==this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function $y(e){return{kind:"validation",type:"mac",reference:$y,async:!1,expects:null,requirement:J1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"MAC",t,r),t}}}function Ly(e){return{kind:"validation",type:"mac48",reference:Ly,async:!1,expects:null,requirement:K1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"48-bit MAC",t,r),t}}}function Fy(e){return{kind:"validation",type:"mac64",reference:Fy,async:!1,expects:null,requirement:X1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"64-bit MAC",t,r),t}}}function Uy(e){return{kind:"transformation",type:"map_items",reference:Uy,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function zy(e,t){return{kind:"validation",type:"max_bytes",reference:zy,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&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function Vy(e,t){return{kind:"validation",type:"max_length",reference:Vy,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length>this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function qy(e,t){return{kind:"validation",type:"max_size",reference:qy,async:!1,expects:`<=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size>this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Hy(e,t){return{kind:"validation",type:"max_value",reference:Hy,async:!1,expects:`<=${e instanceof Date?e.toJSON():Nr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value>this.requirement&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Nr(r.value)}),r}}}function Wy(e,t){return{kind:"validation",type:"mime_type",reference:Wy,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)&&ue(this,"MIME type",r,n,{received:`"${r.value.type}"`}),r}}}function Gy(e,t){return{kind:"validation",type:"min_bytes",reference:Gy,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&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function Ky(e,t){return{kind:"validation",type:"min_length",reference:Ky,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length<this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function Xy(e,t){return{kind:"validation",type:"min_size",reference:Xy,async:!1,expects:`>=${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size<this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function Jy(e,t){return{kind:"validation",type:"min_value",reference:Jy,async:!1,expects:`>=${e instanceof Date?e.toJSON():Nr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value<this.requirement&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Nr(r.value)}),r}}}function Yy(e,t){return{kind:"validation",type:"multiple_of",reference:Yy,async:!1,expects:`%${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value%this.requirement!==0&&ue(this,"multiple",r,n),r}}}function Zy(e){return{kind:"validation",type:"non_empty",reference:Zy,async:!1,expects:"!0",message:e,_run(t,r){return t.typed&&t.value.length===0&&ue(this,"length",t,r,{received:"0"}),t}}}function Qy(e){return{kind:"transformation",type:"normalize",reference:Qy,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function eb(e,t){return{kind:"validation",type:"not_bytes",reference:eb,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&&ue(this,"bytes",r,n,{received:`${i}`})}return r}}}function tb(e,t){return{kind:"validation",type:"not_length",reference:tb,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.length===this.requirement&&ue(this,"length",r,n,{received:`${r.value.length}`}),r}}}function rb(e,t){return{kind:"validation",type:"not_size",reference:rb,async:!1,expects:`!${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size===this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function nb(e,t){return{kind:"validation",type:"not_value",reference:nb,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Nr(e)}`,requirement:e,message:t,_run(r,n){return r.typed&&this.requirement<=r.value&&this.requirement>=r.value&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Nr(r.value)}),r}}}function ib(e){return{kind:"validation",type:"octal",reference:ib,async:!1,expects:null,requirement:Y1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"octal",t,r),t}}}function sb(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 ob(e,t,r){return{kind:"validation",type:"partial_check",reference:ob,async:!1,expects:null,requirement:t,message:r,_run(n,i){return sb(n,e)&&!this.requirement(n.value)&&ue(this,"input",n,i),n}}}function ab(e,t,r){return{kind:"validation",type:"partial_check",reference:ab,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return sb(n,e)&&!await this.requirement(n.value)&&ue(this,"input",n,i),n}}}function cb(e){return{kind:"validation",type:"raw_check",reference:cb,async:!1,expects:null,_run(t,r){return e({dataset:t,config:r,addIssue:n=>ue(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function ub(e){return{kind:"validation",type:"raw_check",reference:ub,async:!0,expects:null,async _run(t,r){return await e({dataset:t,config:r,addIssue:n=>ue(this,(n==null?void 0:n.label)??"input",t,r,n)}),t}}}function lb(e){return{kind:"transformation",type:"raw_transform",reference:lb,async:!1,_run(t,r){const n=e({dataset:t,config:r,addIssue:i=>ue(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function fb(e){return{kind:"transformation",type:"raw_transform",reference:fb,async:!0,async _run(t,r){const n=await e({dataset:t,config:r,addIssue:i=>ue(this,(i==null?void 0:i.label)??"input",t,r,i),NEVER:null});return t.issues?t.typed=!1:t.value=n,t}}}function db(){return{kind:"transformation",type:"readonly",reference:db,async:!1,_run(e){return e}}}function hb(e,t){return{kind:"transformation",type:"reduce_items",reference:hb,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function pb(e,t){return{kind:"validation",type:"regex",reference:pb,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&ue(this,"format",r,n),r}}}function mb(e){return{kind:"validation",type:"safe_integer",reference:mb,async:!1,expects:null,requirement:Number.isSafeInteger,message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&ue(this,"safe integer",t,r),t}}}function gb(e,t){return{kind:"validation",type:"size",reference:gb,async:!1,expects:`${e}`,requirement:e,message:t,_run(r,n){return r.typed&&r.value.size!==this.requirement&&ue(this,"size",r,n,{received:`${r.value.size}`}),r}}}function vb(e,t){return{kind:"validation",type:"some_item",reference:vb,async:!1,expects:null,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.some(this.requirement)&&ue(this,"item",r,n),r}}}function yb(e){return{kind:"transformation",type:"sort_items",reference:yb,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function bb(e,t){return{kind:"validation",type:"starts_with",reference:bb,async:!1,expects:`"${e}"`,requirement:e,message:t,_run(r,n){return r.typed&&!r.value.startsWith(this.requirement)&&ue(this,"start",r,n,{received:`"${r.value.slice(0,this.requirement.length)}"`}),r}}}function wb(){return{kind:"transformation",type:"to_lower_case",reference:wb,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function _b(e){return{kind:"transformation",type:"to_max_value",reference:_b,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function xb(e){return{kind:"transformation",type:"to_min_value",reference:xb,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function Sb(){return{kind:"transformation",type:"to_upper_case",reference:Sb,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function Eb(e){return{kind:"transformation",type:"transform",reference:Eb,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function Cb(e){return{kind:"transformation",type:"transform",reference:Cb,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function Mb(){return{kind:"transformation",type:"trim",reference:Mb,async:!1,_run(e){return e.value=e.value.trim(),e}}}function Ab(){return{kind:"transformation",type:"trim_end",reference:Ab,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function Tb(){return{kind:"transformation",type:"trim_start",reference:Tb,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function Ob(e){return{kind:"validation",type:"ulid",reference:Ob,async:!1,expects:null,requirement:Z1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"ULID",t,r),t}}}function Ib(e){return{kind:"validation",type:"url",reference:Ib,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)&&ue(this,"URL",t,r),t}}}function Pb(e){return{kind:"validation",type:"uuid",reference:Pb,async:!1,expects:null,requirement:Q1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&ue(this,"UUID",t,r),t}}}function kb(e,t){return{kind:"validation",type:"value",reference:kb,async:!1,expects:e instanceof Date?e.toJSON():Nr(e),requirement:e,message:t,_run(r,n){return r.typed&&!(this.requirement<=r.value&&this.requirement>=r.value)&&ue(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Nr(r.value)}),r}}}function vE(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function oc(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function yE(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:oc(this,r,n)}:r}}}function bE(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await oc(this,r,n)}:r}}}function wE(e){const t={};for(const r of e)if(r.path){const n=ny(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 _E(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 xE(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 Mi(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function dd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=dd(e.entries[r]);return t}return"items"in e?e.items.map(dd):Mi(e)}async function hd(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await hd(r)]))):"items"in e?Promise.all(e.items.map(hd)):Mi(e)}function pd(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=pd(e.entries[r]);return t}return"items"in e?e.items.map(pd):oc(e)}async function md(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await md(r)]))):"items"in e?Promise.all(e.items.map(md)):oc(e)}function SE(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function jb(){return{kind:"schema",type:"any",reference:jb,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function Rb(e,t){return{kind:"schema",type:"array",reference:Rb,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 ue(this,"type",r,n);return r}}}function Nb(e,t){return{kind:"schema",type:"array",reference:Nb,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 ue(this,"type",r,n);return r}}}function Db(e){return{kind:"schema",type:"bigint",reference:Db,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:ue(this,"type",t,r),t}}}function Bb(e){return{kind:"schema",type:"blob",reference:Bb,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:ue(this,"type",t,r),t}}}function $b(e){return{kind:"schema",type:"boolean",reference:$b,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:ue(this,"type",t,r),t}}}function Lb(e,t){return{kind:"schema",type:"custom",reference:Lb,expects:"unknown",async:!1,check:e,message:t,_run(r,n){return this.check(r.value)?r.typed=!0:ue(this,"type",r,n),r}}}function Fb(e,t){return{kind:"schema",type:"custom",reference:Fb,expects:"unknown",async:!0,check:e,message:t,async _run(r,n){return await this.check(r.value)?r.typed=!0:ue(this,"type",r,n),r}}}function Ub(e){return{kind:"schema",type:"date",reference:Ub,expects:"Date",async:!1,message:e,_run(t,r){return t.value instanceof Date?isNaN(t.value)?ue(this,"type",t,r,{received:'"Invalid Date"'}):t.typed=!0:ue(this,"type",t,r),t}}}function gd(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:gd,expects:r.map(Nr).join(" | ")||"never",async:!1,enum:e,options:r,message:t,_run(n,i){return this.options.includes(n.value)?n.typed=!0:ue(this,"type",n,i),n}}}function zb(e){return{kind:"schema",type:"file",reference:zb,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:ue(this,"type",t,r),t}}}function vd(e){return{kind:"schema",type:"function",reference:vd,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:ue(this,"type",t,r),t}}}function Vb(e,t){return{kind:"schema",type:"instance",reference:Vb,expects:e.name,async:!1,class:e,message:t,_run(r,n){return r.value instanceof this.class?r.typed=!0:ue(this,"type",r,n),r}}}function vu(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=vu(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=vu(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function qb(e,t){return{kind:"schema",type:"intersect",reference:qb,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=vu(r.value,s[o]);if(a.issue){ue(this,"type",r,n,{received:"unknown"});break}r.value=a.value}}}else ue(this,"type",r,n);return r}}}function Hb(e,t){return{kind:"schema",type:"intersect",reference:Hb,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=vu(r.value,s[a]);if(c.issue){ue(this,"type",r,n,{received:"unknown"});break}r.value=c.value}}}else ue(this,"type",r,n);return r}}}function Wb(e){return{kind:"schema",type:"lazy",reference:Wb,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function Gb(e){return{kind:"schema",type:"lazy",reference:Gb,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function Kb(e,t){return{kind:"schema",type:"literal",reference:Kb,expects:Nr(e),async:!1,literal:e,message:t,_run(r,n){return r.value===this.literal?r.typed=!0:ue(this,"type",r,n),r}}}function Xb(e,t){return{kind:"schema",type:"loose_object",reference:Xb,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)Us(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else ue(this,"type",r,n);return r}}}function Jb(e,t){return{kind:"schema",type:"loose_object",reference:Jb,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)Us(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else ue(this,"type",r,n);return r}}}function Yb(e,t){return{kind:"schema",type:"loose_tuple",reference:Yb,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 ue(this,"type",r,n);return r}}}function Zb(e,t){return{kind:"schema",type:"loose_tuple",reference:Zb,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 ue(this,"type",r,n);return r}}}function Qb(e,t,r){return{kind:"schema",type:"map",reference:Qb,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 ue(this,"type",n,i);return n}}}function ew(e,t,r){return{kind:"schema",type:"map",reference:ew,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 ue(this,"type",n,i);return n}}}function tw(e){return{kind:"schema",type:"nan",reference:tw,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:ue(this,"type",t,r),t}}}function rw(e){return{kind:"schema",type:"never",reference:rw,expects:"never",async:!1,message:e,_run(t,r){return ue(this,"type",t,r),t}}}function nw(e,t){return{kind:"schema",type:"non_nullable",reference:nw,expects:"!null",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function iw(e,t){return{kind:"schema",type:"non_nullable",reference:iw,expects:"!null",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function sw(e,t){return{kind:"schema",type:"non_nullish",reference:sw,expects:"!null & !undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===null||r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function ow(e,t){return{kind:"schema",type:"non_nullish",reference:ow,expects:"!null & !undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===null||r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function Eh(e,t){return{kind:"schema",type:"non_optional",reference:Eh,expects:"!undefined",async:!1,wrapped:e,message:t,_run(r,n){return r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function Ch(e,t){return{kind:"schema",type:"non_optional",reference:Ch,expects:"!undefined",async:!0,wrapped:e,message:t,async _run(r,n){return r.value===void 0?(ue(this,"type",r,n),r):this.wrapped._run(r,n)}}}function yd(e){return{kind:"schema",type:"null",reference:yd,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:ue(this,"type",t,r),t}}}function aw(e,...t){const r={kind:"schema",type:"nullable",reference:aw,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=Mi(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 cw(e,...t){const r={kind:"schema",type:"nullable",reference:cw,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await Mi(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 uw(e,...t){const r={kind:"schema",type:"nullish",reference:uw,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=Mi(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 lw(e,...t){const r={kind:"schema",type:"nullish",reference:lw,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 Mi(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 fw(e){return{kind:"schema",type:"number",reference:fw,expects:"number",async:!1,message:e,_run(t,r){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:ue(this,"type",t,r),t}}}function dw(e,t){return{kind:"schema",type:"object",reference:dw,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 ue(this,"type",r,n);return r}}}function hw(e,t){return{kind:"schema",type:"object",reference:hw,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 ue(this,"type",r,n);return r}}}function pw(e,t,r){return{kind:"schema",type:"object_with_rest",reference:pw,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(Us(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 ue(this,"type",n,i);return n}}}function mw(e,t,r){return{kind:"schema",type:"object_with_rest",reference:mw,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])=>Us(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 ue(this,"type",n,i);return n}}}function Mh(e,...t){const r={kind:"schema",type:"optional",reference:Mh,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=Mi(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 Ah(e,...t){const r={kind:"schema",type:"optional",reference:Ah,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await Mi(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 Th(e,t){return{kind:"schema",type:"picklist",reference:Th,expects:e.map(Nr).join(" | ")||"never",async:!1,options:e,message:t,_run(r,n){return this.options.includes(r.value)?r.typed=!0:ue(this,"type",r,n),r}}}function gw(e){return{kind:"schema",type:"promise",reference:gw,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:ue(this,"type",t,r),t}}}function vw(e,t,r){return{kind:"schema",type:"record",reference:vw,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(Us(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 ue(this,"type",n,i);return n}}}function yw(e,t,r){return{kind:"schema",type:"record",reference:yw,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])=>Us(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 ue(this,"type",n,i);return n}}}function bw(e,t){return{kind:"schema",type:"set",reference:bw,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 ue(this,"type",r,n);return r}}}function ww(e,t){return{kind:"schema",type:"set",reference:ww,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 ue(this,"type",r,n);return r}}}function _w(e,t){return{kind:"schema",type:"strict_object",reference:_w,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];ue(this,"type",r,n,{input:a,expected:"never",path:[{type:"object",origin:"value",input:i,key:o,value:a}]});break}}}else ue(this,"type",r,n);return r}}}function xw(e,t){return{kind:"schema",type:"strict_object",reference:xw,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];ue(this,"type",r,n,{input:c,expected:"never",path:[{type:"object",origin:"value",input:i,key:a,value:c}]});break}}}else ue(this,"type",r,n);return r}}}function Sw(e,t){return{kind:"schema",type:"strict_tuple",reference:Sw,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];ue(this,"type",r,n,{input:o,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:o}]})}}else ue(this,"type",r,n);return r}}}function Ew(e,t){return{kind:"schema",type:"strict_tuple",reference:Ew,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];ue(this,"type",r,n,{input:a,expected:"never",path:[{type:"array",origin:"value",input:i,key:this.items.length,value:a}]})}}else ue(this,"type",r,n);return r}}}function Cw(e){return{kind:"schema",type:"string",reference:Cw,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:ue(this,"type",t,r),t}}}function Mw(e){return{kind:"schema",type:"symbol",reference:Mw,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:ue(this,"type",t,r),t}}}function Aw(e,t){return{kind:"schema",type:"tuple",reference:Aw,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 ue(this,"type",r,n);return r}}}function Tw(e,t){return{kind:"schema",type:"tuple",reference:Tw,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 ue(this,"type",r,n);return r}}}function Ow(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:Ow,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 ue(this,"type",n,i);return n}}}function Iw(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:Iw,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 ue(this,"type",n,i);return n}}}function bd(e){return{kind:"schema",type:"undefined",reference:bd,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:ue(this,"type",t,r),t}}}function yu(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function Pw(e,t){return{kind:"schema",type:"union",reference:Pw,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];ue(this,"type",r,n,{issues:yu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];ue(this,"type",r,n,{issues:yu(o)})}return r}}}function kw(e,t){return{kind:"schema",type:"union",reference:kw,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];ue(this,"type",r,n,{issues:yu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];ue(this,"type",r,n,{issues:yu(o)})}return r}}}function jw(){return{kind:"schema",type:"unknown",reference:jw,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function Oh(e,t,r=new Set){for(const n of t)n.type==="variant"?Oh(e,n.options,r):r.add(n.entries[e].expects);return r}function Rw(e,t,r){let n;return{kind:"schema",type:"variant",reference:Rw,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=[...Oh(this.key,this.options)].join(" | ")||"never"),ue(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else ue(this,"type",i,s);return i}}}function Nw(e,t,r){let n;return{kind:"schema",type:"variant",reference:Nw,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=[...Oh(this.key,this.options)].join(" | ")||"never"),ue(this,"type",i,s,{input:a,expected:n,path:[{type:"object",origin:"value",input:o,key:this.key,value:a}]})}else ue(this,"type",i,s);return i}}}function wd(e){return{kind:"schema",type:"void",reference:wd,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:ue(this,"type",t,r),t}}}function EE(e,t){return Th(Object.keys(e.entries),t)}function CE(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function Dw(e,t,r){const n=e._run({typed:!1,value:t},sc(r));if(n.issues)throw new nl(n.issues);return n.value}async function Bw(e,t,r){const n=await e._run({typed:!1,value:t},sc(r));if(n.issues)throw new nl(n.issues);return n.value}function ME(e,t){const r=n=>Dw(e,n,t);return r.schema=e,r.config=t,r}function AE(e,t){const r=n=>Bw(e,n,t);return r.schema=e,r.config=t,r}function TE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Mh(e.entries[n]):e.entries[n];return{...e,entries:r}}function OE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Ah(e.entries[n]):e.entries[n];return{...e,entries:r}}function IE(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function PE(...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 kE(...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 jE(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)?Eh(e.entries[o],i):e.entries[o];return{...e,entries:s}}function RE(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)?Ch(e.entries[o],i):e.entries[o];return{...e,entries:s}}function $w(e,t,r){const n=e._run({typed:!1,value:t},sc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function Lw(e,t,r){const n=await e._run({typed:!1,value:t},sc(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function NE(e,t){const r=n=>$w(e,n,t);return r.schema=e,r.config=t,r}function DE(e,t){const r=n=>Lw(e,n,t);return r.schema=e,r.config=t,r}function BE(e){return e.wrapped}const $E=Symbol.for("@mysten/transaction");function LE(e){return!!e&&typeof e=="object"&&e[$E]===!0}const Fw=Symbol.for("@mysten/SuiClient");function FE(e){return typeof e=="object"&&e!==null&&e[Fw]===!0}class Da{get[Fw](){return!0}constructor(t){this.transport=t.transport??new Wv({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!vs(ys(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||!vs(ys(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||!vs(ys(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||!vs(ys(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||!vs(ys(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||!Ec(Cc(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||!Ec(Cc(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(!F0(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(!F0(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:Ui(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||!vs(ys(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||!Ec(Cc(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(LE(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=Ui(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=Ui(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:Ui(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!Ec(Cc(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=Do(t.digest);return ic(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=>VS(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 UE=Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:gh,SuiClient:Da,SuiHTTPStatusError:Lv,SuiHTTPTransport:Wv,SuiHTTPTransportError:mh,getFullnodeUrl:Gv,isSuiClient:FE},Symbol.toStringTag,{value:"Module"})),zE=$v(UE);var Ih=Object.defineProperty,VE=Object.getOwnPropertyDescriptor,qE=Object.getOwnPropertyNames,HE=Object.prototype.hasOwnProperty,WE=(e,t)=>{for(var r in t)Ih(e,r,{get:t[r],enumerable:!0})},GE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qE(t))!HE.call(e,i)&&i!==r&&Ih(e,i,{get:()=>t[i],enumerable:!(n=VE(t,i))||n.enumerable});return e},KE=e=>GE(Ih({},"__esModule",{value:!0}),e),Uw={};WE(Uw,{formatAddress:()=>JE,formatDigest:()=>YE});var XE=KE(Uw);const zw="…";function JE(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${zw}${e.slice(-4)}`}function YE(e){return`${e.slice(0,10)}${zw}`}const Or=$v(BS);var Ph=Object.defineProperty,ZE=Object.getOwnPropertyDescriptor,QE=Object.getOwnPropertyNames,eC=Object.prototype.hasOwnProperty,tC=(e,t)=>{for(var r in t)Ph(e,r,{get:t[r],enumerable:!0})},rC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of QE(t))!eC.call(e,i)&&i!==r&&Ph(e,i,{get:()=>t[i],enumerable:!(n=ZE(t,i))||n.enumerable});return e},nC=e=>rC(Ph({},"__esModule",{value:!0}),e),Vw={};tC(Vw,{SUI_ADDRESS_LENGTH:()=>kh,isValidSuiAddress:()=>Hw,isValidSuiObjectId:()=>oC,isValidTransactionDigest:()=>sC,normalizeStructTag:()=>Ww,normalizeSuiAddress:()=>Rh,normalizeSuiObjectId:()=>cC,parseStructTag:()=>jh});var Kr=nC(Vw),qw=Or;const iC=32;function sC(e){try{return(0,qw.fromBase58)(e).length===iC}catch{return!1}}const kh=32;function Hw(e){return uC(e)&&lC(e)===kh}function oC(e){return Hw(e)}function aC(e){return e.includes("::")?jh(e):e}function jh(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,qw.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>aC(o.trim())):[];return{address:Rh(t),module:r,name:i,typeParams:s}}function Ww(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?jh(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:Ww(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Rh(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(kh*2,"0")}`}function cC(e,t=!1){return Rh(e,t)}function uC(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function lC(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var Nh=Object.defineProperty,fC=Object.getOwnPropertyDescriptor,dC=Object.getOwnPropertyNames,hC=Object.prototype.hasOwnProperty,pC=(e,t)=>{for(var r in t)Nh(e,r,{get:t[r],enumerable:!0})},mC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dC(t))!hC.call(e,i)&&i!==r&&Nh(e,i,{get:()=>t[i],enumerable:!(n=fC(t,i))||n.enumerable});return e},gC=e=>mC(Nh({},"__esModule",{value:!0}),e),Gw={};pC(Gw,{isValidSuiNSName:()=>yC,normalizeSuiNSName:()=>bC});var Kw=gC(Gw);const Xw=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,Jw=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,vC=235;function yC(e){return e.length>vC?!1:e.includes("@")?Xw.test(e):Jw.test(e)}function bC(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!Xw.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!Jw.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 Dh=Object.defineProperty,wC=Object.getOwnPropertyDescriptor,_C=Object.getOwnPropertyNames,xC=Object.prototype.hasOwnProperty,SC=(e,t)=>{for(var r in t)Dh(e,r,{get:t[r],enumerable:!0})},EC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _C(t))!xC.call(e,i)&&i!==r&&Dh(e,i,{get:()=>t[i],enumerable:!(n=wC(t,i))||n.enumerable});return e},CC=e=>EC(Dh({},"__esModule",{value:!0}),e),Yw={};SC(Yw,{MIST_PER_SUI:()=>TC,MOVE_STDLIB_ADDRESS:()=>OC,SUI_CLOCK_OBJECT_ID:()=>PC,SUI_DECIMALS:()=>AC,SUI_FRAMEWORK_ADDRESS:()=>Qw,SUI_SYSTEM_ADDRESS:()=>IC,SUI_SYSTEM_MODULE_NAME:()=>kC,SUI_SYSTEM_STATE_OBJECT_ID:()=>RC,SUI_TYPE_ARG:()=>jC});var MC=CC(Yw),Zw=Kr;const AC=9,TC=BigInt(1e9),OC="0x1",Qw="0x2",IC="0x3",PC=(0,Zw.normalizeSuiObjectId)("0x6"),kC="sui_system",jC=`${Qw}::sui::SUI`,RC=(0,Zw.normalizeSuiObjectId)("0x5");var Bh=Object.defineProperty,NC=Object.getOwnPropertyDescriptor,DC=Object.getOwnPropertyNames,BC=Object.prototype.hasOwnProperty,$C=(e,t)=>{for(var r in t)Bh(e,r,{get:t[r],enumerable:!0})},LC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of DC(t))!BC.call(e,i)&&i!==r&&Bh(e,i,{get:()=>t[i],enumerable:!(n=NC(t,i))||n.enumerable});return e},FC=e=>LC(Bh({},"__esModule",{value:!0}),e),e2={};$C(e2,{isValidNamedPackage:()=>n2,isValidNamedType:()=>HC});var t2=FC(e2),UC=Kw;const zC=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,VC=/^\d+$/,qC=64,r2="/",n2=e=>{const t=e.split(r2);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!VC.test(i)||!(0,UC.isValidSuiNSName)(r)?!1:zC.test(n)&&n.length<qC},HC=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(r2)&&!n2(r))return!1;return!0};var $h=Object.defineProperty,WC=Object.getOwnPropertyDescriptor,GC=Object.getOwnPropertyNames,KC=Object.prototype.hasOwnProperty,XC=(e,t)=>{for(var r in t)$h(e,r,{get:t[r],enumerable:!0})},JC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GC(t))!KC.call(e,i)&&i!==r&&$h(e,i,{get:()=>t[i],enumerable:!(n=WC(t,i))||n.enumerable});return e},YC=e=>JC($h({},"__esModule",{value:!0}),e),i2={};XC(i2,{TypeTagSerializer:()=>Es});var s2=YC(i2),ZC=Or,QC=Kr;const eM=/^vector<(.+)>$/,tM=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Es{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(eM);if(n)return{vector:Es.parseFromStr(n[1],r)};const i=t.match(tM);if(i)return{struct:{address:r?(0,QC.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:Es.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,ZC.splitGenericParameters)(t).map(n=>Es.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<${Es.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(Es.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var Lh=Object.defineProperty,rM=Object.getOwnPropertyDescriptor,nM=Object.getOwnPropertyNames,iM=Object.prototype.hasOwnProperty,sM=(e,t)=>{for(var r in t)Lh(e,r,{get:t[r],enumerable:!0})},oM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nM(t))!iM.call(e,i)&&i!==r&&Lh(e,i,{get:()=>t[i],enumerable:!(n=rM(t,i))||n.enumerable});return e},aM=e=>oM(Lh({},"__esModule",{value:!0}),e),o2={};sM(o2,{Address:()=>Vn,AppId:()=>S2,Argument:()=>Dn,CallArg:()=>f2,Command:()=>h2,CompressedSignature:()=>M2,GasData:()=>y2,Intent:()=>E2,IntentMessage:()=>C2,IntentScope:()=>_2,IntentVersion:()=>x2,MultiSig:()=>lM,MultiSigPkMap:()=>T2,MultiSigPublicKey:()=>O2,ObjectArg:()=>l2,ObjectDigest:()=>c2,PasskeyAuthenticator:()=>dM,ProgrammableMoveCall:()=>d2,ProgrammableTransaction:()=>p2,PublicKey:()=>A2,SenderSignedData:()=>fM,SenderSignedTransaction:()=>P2,SharedObjectRef:()=>u2,StructTag:()=>v2,SuiObjectRef:()=>bu,TransactionData:()=>w2,TransactionDataV1:()=>b2,TransactionExpiration:()=>g2,TransactionKind:()=>m2,TypeTag:()=>Uh,base64String:()=>I2});var a2=aM(o2),fe=Or,ia=Kr,z0=s2;function cM(e){return fe.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function uM(e){return fe.bcs.enum("Option",{None:null,Some:e})}const Vn=fe.bcs.bytes(ia.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,fe.toHex)(e);if(!t||!(0,ia.isValidSuiAddress)((0,ia.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,fe.fromHex)((0,ia.normalizeSuiAddress)(e)):e,output:e=>(0,ia.normalizeSuiAddress)((0,fe.toHex)(e))}),c2=fe.bcs.vector(fe.bcs.u8()).transform({name:"ObjectDigest",input:e=>(0,fe.fromBase58)(e),output:e=>(0,fe.toBase58)(new Uint8Array(e)),validate:e=>{if((0,fe.fromBase58)(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),bu=fe.bcs.struct("SuiObjectRef",{objectId:Vn,version:fe.bcs.u64(),digest:c2}),u2=fe.bcs.struct("SharedObjectRef",{objectId:Vn,initialSharedVersion:fe.bcs.u64(),mutable:fe.bcs.bool()}),l2=fe.bcs.enum("ObjectArg",{ImmOrOwnedObject:bu,SharedObject:u2,Receiving:bu}),f2=fe.bcs.enum("CallArg",{Pure:fe.bcs.struct("Pure",{bytes:fe.bcs.vector(fe.bcs.u8()).transform({input:e=>typeof e=="string"?(0,fe.fromBase64)(e):e,output:e=>(0,fe.toBase64)(new Uint8Array(e))})}),Object:l2}),Fh=fe.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:fe.bcs.lazy(()=>Fh),struct:fe.bcs.lazy(()=>v2),u16:null,u32:null,u256:null}),Uh=Fh.transform({input:e=>typeof e=="string"?z0.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>z0.TypeTagSerializer.tagToString(e)}),Dn=fe.bcs.enum("Argument",{GasCoin:null,Input:fe.bcs.u16(),Result:fe.bcs.u16(),NestedResult:fe.bcs.tuple([fe.bcs.u16(),fe.bcs.u16()])}),d2=fe.bcs.struct("ProgrammableMoveCall",{package:Vn,module:fe.bcs.string(),function:fe.bcs.string(),typeArguments:fe.bcs.vector(Uh),arguments:fe.bcs.vector(Dn)}),h2=fe.bcs.enum("Command",{MoveCall:d2,TransferObjects:fe.bcs.struct("TransferObjects",{objects:fe.bcs.vector(Dn),address:Dn}),SplitCoins:fe.bcs.struct("SplitCoins",{coin:Dn,amounts:fe.bcs.vector(Dn)}),MergeCoins:fe.bcs.struct("MergeCoins",{destination:Dn,sources:fe.bcs.vector(Dn)}),Publish:fe.bcs.struct("Publish",{modules:fe.bcs.vector(fe.bcs.vector(fe.bcs.u8()).transform({input:e=>typeof e=="string"?(0,fe.fromBase64)(e):e,output:e=>(0,fe.toBase64)(new Uint8Array(e))})),dependencies:fe.bcs.vector(Vn)}),MakeMoveVec:fe.bcs.struct("MakeMoveVec",{type:uM(Uh).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:fe.bcs.vector(Dn)}),Upgrade:fe.bcs.struct("Upgrade",{modules:fe.bcs.vector(fe.bcs.vector(fe.bcs.u8()).transform({input:e=>typeof e=="string"?(0,fe.fromBase64)(e):e,output:e=>(0,fe.toBase64)(new Uint8Array(e))})),dependencies:fe.bcs.vector(Vn),package:Vn,ticket:Dn})}),p2=fe.bcs.struct("ProgrammableTransaction",{inputs:fe.bcs.vector(f2),commands:fe.bcs.vector(h2)}),m2=fe.bcs.enum("TransactionKind",{ProgrammableTransaction:p2,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),g2=fe.bcs.enum("TransactionExpiration",{None:null,Epoch:cM()}),v2=fe.bcs.struct("StructTag",{address:Vn,module:fe.bcs.string(),name:fe.bcs.string(),typeParams:fe.bcs.vector(Fh)}),y2=fe.bcs.struct("GasData",{payment:fe.bcs.vector(bu),owner:Vn,price:fe.bcs.u64(),budget:fe.bcs.u64()}),b2=fe.bcs.struct("TransactionDataV1",{kind:m2,sender:Vn,gasData:y2,expiration:g2}),w2=fe.bcs.enum("TransactionData",{V1:b2}),_2=fe.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),x2=fe.bcs.enum("IntentVersion",{V0:null}),S2=fe.bcs.enum("AppId",{Sui:null}),E2=fe.bcs.struct("Intent",{scope:_2,version:x2,appId:S2});function C2(e){return fe.bcs.struct(`IntentMessage<${e.name}>`,{intent:E2,value:e})}const M2=fe.bcs.enum("CompressedSignature",{ED25519:fe.bcs.fixedArray(64,fe.bcs.u8()),Secp256k1:fe.bcs.fixedArray(64,fe.bcs.u8()),Secp256r1:fe.bcs.fixedArray(64,fe.bcs.u8()),ZkLogin:fe.bcs.vector(fe.bcs.u8())}),A2=fe.bcs.enum("PublicKey",{ED25519:fe.bcs.fixedArray(32,fe.bcs.u8()),Secp256k1:fe.bcs.fixedArray(33,fe.bcs.u8()),Secp256r1:fe.bcs.fixedArray(33,fe.bcs.u8()),ZkLogin:fe.bcs.vector(fe.bcs.u8())}),T2=fe.bcs.struct("MultiSigPkMap",{pubKey:A2,weight:fe.bcs.u8()}),O2=fe.bcs.struct("MultiSigPublicKey",{pk_map:fe.bcs.vector(T2),threshold:fe.bcs.u16()}),lM=fe.bcs.struct("MultiSig",{sigs:fe.bcs.vector(M2),bitmap:fe.bcs.u16(),multisig_pk:O2}),I2=fe.bcs.vector(fe.bcs.u8()).transform({input:e=>typeof e=="string"?(0,fe.fromBase64)(e):e,output:e=>(0,fe.toBase64)(new Uint8Array(e))}),P2=fe.bcs.struct("SenderSignedTransaction",{intentMessage:C2(w2),txSignatures:fe.bcs.vector(I2)}),fM=fe.bcs.vector(P2,{name:"SenderSignedData"}),dM=fe.bcs.struct("PasskeyAuthenticator",{authenticatorData:fe.bcs.vector(fe.bcs.u8()),clientDataJson:fe.bcs.string(),userSignature:fe.bcs.vector(fe.bcs.u8())});var zh=Object.defineProperty,hM=Object.getOwnPropertyDescriptor,pM=Object.getOwnPropertyNames,mM=Object.prototype.hasOwnProperty,gM=(e,t)=>{for(var r in t)zh(e,r,{get:t[r],enumerable:!0})},vM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pM(t))!mM.call(e,i)&&i!==r&&zh(e,i,{get:()=>t[i],enumerable:!(n=hM(t,i))||n.enumerable});return e},yM=e=>vM(zh({},"__esModule",{value:!0}),e),k2={};gM(k2,{TransactionEffects:()=>kM});var bM=yM(k2),pe=Or,Lt=a2;const wM=pe.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:pe.bcs.struct("UnableToFetchPackage",{packageId:Lt.Address}),NotAPackage:pe.bcs.struct("NotAPackage",{objectId:Lt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:pe.bcs.struct("DigestDoesNotMatch",{digest:pe.bcs.vector(pe.bcs.u8())}),UnknownUpgradePolicy:pe.bcs.struct("UnknownUpgradePolicy",{policy:pe.bcs.u8()}),PackageIDDoesNotMatch:pe.bcs.struct("PackageIDDoesNotMatch",{packageId:Lt.Address,ticketId:Lt.Address})}),_M=pe.bcs.struct("ModuleId",{address:Lt.Address,name:pe.bcs.string()}),V0=pe.bcs.struct("MoveLocation",{module:_M,function:pe.bcs.u16(),instruction:pe.bcs.u16(),functionName:pe.bcs.option(pe.bcs.string())}),xM=pe.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:pe.bcs.struct("IndexOutOfBounds",{idx:pe.bcs.u16()}),SecondaryIndexOutOfBounds:pe.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:pe.bcs.u16(),secondaryIdx:pe.bcs.u16()}),InvalidResultArity:pe.bcs.struct("InvalidResultArity",{resultIdx:pe.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),SM=pe.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),EM=pe.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:pe.bcs.struct("MoveObjectTooBig",{objectSize:pe.bcs.u64(),maxObjectSize:pe.bcs.u64()}),MovePackageTooBig:pe.bcs.struct("MovePackageTooBig",{objectSize:pe.bcs.u64(),maxObjectSize:pe.bcs.u64()}),CircularObjectOwnership:pe.bcs.struct("CircularObjectOwnership",{object:Lt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:pe.bcs.option(V0),MoveAbort:pe.bcs.tuple([V0,pe.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:pe.bcs.struct("CommandArgumentError",{argIdx:pe.bcs.u16(),kind:xM}),TypeArgumentError:pe.bcs.struct("TypeArgumentError",{argumentIdx:pe.bcs.u16(),kind:SM}),UnusedValueWithoutDrop:pe.bcs.struct("UnusedValueWithoutDrop",{resultIdx:pe.bcs.u16(),secondaryIdx:pe.bcs.u16()}),InvalidPublicFunctionReturnType:pe.bcs.struct("InvalidPublicFunctionReturnType",{idx:pe.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:pe.bcs.struct("EffectsTooLarge",{currentSize:pe.bcs.u64(),maxSize:pe.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:pe.bcs.struct("PackageUpgradeError",{upgradeError:wM}),WrittenObjectsTooLarge:pe.bcs.struct("WrittenObjectsTooLarge",{currentSize:pe.bcs.u64(),maxSize:pe.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:pe.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:pe.bcs.vector(Lt.Address)}),AddressDeniedForCoin:pe.bcs.struct("AddressDeniedForCoin",{address:Lt.Address,coinType:pe.bcs.string()}),CoinTypeGlobalPause:pe.bcs.struct("CoinTypeGlobalPause",{coinType:pe.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),j2=pe.bcs.enum("ExecutionStatus",{Success:null,Failed:pe.bcs.struct("ExecutionFailed",{error:EM,command:pe.bcs.option(pe.bcs.u64())})}),R2=pe.bcs.struct("GasCostSummary",{computationCost:pe.bcs.u64(),storageCost:pe.bcs.u64(),storageRebate:pe.bcs.u64(),nonRefundableStorageFee:pe.bcs.u64()}),lo=pe.bcs.enum("Owner",{AddressOwner:Lt.Address,ObjectOwner:Lt.Address,Shared:pe.bcs.struct("Shared",{initialSharedVersion:pe.bcs.u64()}),Immutable:null}),CM=pe.bcs.struct("TransactionEffectsV1",{status:j2,executedEpoch:pe.bcs.u64(),gasUsed:R2,modifiedAtVersions:pe.bcs.vector(pe.bcs.tuple([Lt.Address,pe.bcs.u64()])),sharedObjects:pe.bcs.vector(Lt.SuiObjectRef),transactionDigest:Lt.ObjectDigest,created:pe.bcs.vector(pe.bcs.tuple([Lt.SuiObjectRef,lo])),mutated:pe.bcs.vector(pe.bcs.tuple([Lt.SuiObjectRef,lo])),unwrapped:pe.bcs.vector(pe.bcs.tuple([Lt.SuiObjectRef,lo])),deleted:pe.bcs.vector(Lt.SuiObjectRef),unwrappedThenDeleted:pe.bcs.vector(Lt.SuiObjectRef),wrapped:pe.bcs.vector(Lt.SuiObjectRef),gasObject:pe.bcs.tuple([Lt.SuiObjectRef,lo]),eventsDigest:pe.bcs.option(Lt.ObjectDigest),dependencies:pe.bcs.vector(Lt.ObjectDigest)}),Vh=pe.bcs.tuple([pe.bcs.u64(),Lt.ObjectDigest]),MM=pe.bcs.enum("ObjectIn",{NotExist:null,Exist:pe.bcs.tuple([Vh,lo])}),AM=pe.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:pe.bcs.tuple([Lt.ObjectDigest,lo]),PackageWrite:Vh}),TM=pe.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),OM=pe.bcs.struct("EffectsObjectChange",{inputState:MM,outputState:AM,idOperation:TM}),IM=pe.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:Vh,MutateDeleted:pe.bcs.u64(),ReadDeleted:pe.bcs.u64(),Cancelled:pe.bcs.u64(),PerEpochConfig:null}),PM=pe.bcs.struct("TransactionEffectsV2",{status:j2,executedEpoch:pe.bcs.u64(),gasUsed:R2,transactionDigest:Lt.ObjectDigest,gasObjectIndex:pe.bcs.option(pe.bcs.u32()),eventsDigest:pe.bcs.option(Lt.ObjectDigest),dependencies:pe.bcs.vector(Lt.ObjectDigest),lamportVersion:pe.bcs.u64(),changedObjects:pe.bcs.vector(pe.bcs.tuple([Lt.Address,OM])),unchangedSharedObjects:pe.bcs.vector(pe.bcs.tuple([Lt.Address,IM])),auxDataDigest:pe.bcs.option(Lt.ObjectDigest)}),kM=pe.bcs.enum("TransactionEffects",{V1:CM,V2:PM});var qh=Object.defineProperty,jM=Object.getOwnPropertyDescriptor,RM=Object.getOwnPropertyNames,NM=Object.prototype.hasOwnProperty,DM=(e,t)=>{for(var r in t)qh(e,r,{get:t[r],enumerable:!0})},BM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of RM(t))!NM.call(e,i)&&i!==r&&qh(e,i,{get:()=>t[i],enumerable:!(n=jM(t,i))||n.enumerable});return e},$M=e=>BM(qh({},"__esModule",{value:!0}),e),N2={};DM(N2,{BcsType:()=>UM.BcsType,TypeTagSerializer:()=>FM.TypeTagSerializer,bcs:()=>zM});var Qn=$M(N2),Pn=Or,$t=a2,LM=bM,FM=s2,UM=Or;const zM={...Pn.bcs,U8:Pn.bcs.u8(),U16:Pn.bcs.u16(),U32:Pn.bcs.u32(),U64:Pn.bcs.u64(),U128:Pn.bcs.u128(),U256:Pn.bcs.u256(),ULEB128:Pn.bcs.uleb128(),Bool:Pn.bcs.bool(),String:Pn.bcs.string(),Address:$t.Address,AppId:$t.AppId,Argument:$t.Argument,CallArg:$t.CallArg,CompressedSignature:$t.CompressedSignature,GasData:$t.GasData,Intent:$t.Intent,IntentMessage:$t.IntentMessage,IntentScope:$t.IntentScope,IntentVersion:$t.IntentVersion,MultiSig:$t.MultiSig,MultiSigPkMap:$t.MultiSigPkMap,MultiSigPublicKey:$t.MultiSigPublicKey,ObjectArg:$t.ObjectArg,ObjectDigest:$t.ObjectDigest,ProgrammableMoveCall:$t.ProgrammableMoveCall,ProgrammableTransaction:$t.ProgrammableTransaction,PublicKey:$t.PublicKey,SenderSignedData:$t.SenderSignedData,SenderSignedTransaction:$t.SenderSignedTransaction,SharedObjectRef:$t.SharedObjectRef,StructTag:$t.StructTag,SuiObjectRef:$t.SuiObjectRef,Command:$t.Command,TransactionData:$t.TransactionData,TransactionDataV1:$t.TransactionDataV1,TransactionExpiration:$t.TransactionExpiration,TransactionKind:$t.TransactionKind,TypeTag:$t.TypeTag,TransactionEffects:LM.TransactionEffects,PasskeyAuthenticator:$t.PasskeyAuthenticator};var Hh=Object.defineProperty,VM=Object.getOwnPropertyDescriptor,qM=Object.getOwnPropertyNames,HM=Object.prototype.hasOwnProperty,WM=(e,t)=>{for(var r in t)Hh(e,r,{get:t[r],enumerable:!0})},GM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qM(t))!HM.call(e,i)&&i!==r&&Hh(e,i,{get:()=>t[i],enumerable:!(n=VM(t,i))||n.enumerable});return e},KM=e=>GM(Hh({},"__esModule",{value:!0}),e),D2={};WM(D2,{deriveDynamicFieldID:()=>ZM});var XM=KM(D2),JM=Or,YM=Ds,uf=Qn;function ZM(e,t,r){const n=uf.bcs.Address.serialize(e).toBytes(),i=uf.bcs.TypeTag.serialize(t).toBytes(),s=uf.bcs.u64().serialize(r.length).toBytes(),o=YM.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,JM.toHex)(o.digest().slice(0,32))}`}var Wh=Object.defineProperty,QM=Object.getOwnPropertyDescriptor,eA=Object.getOwnPropertyNames,tA=Object.prototype.hasOwnProperty,rA=(e,t)=>{for(var r in t)Wh(e,r,{get:t[r],enumerable:!0})},nA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eA(t))!tA.call(e,i)&&i!==r&&Wh(e,i,{get:()=>t[i],enumerable:!(n=QM(t,i))||n.enumerable});return e},iA=e=>nA(Wh({},"__esModule",{value:!0}),e),B2={};rA(B2,{MIST_PER_SUI:()=>ai.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>ai.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>ki.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>ai.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>ai.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>ai.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>ai.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>ai.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>ai.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>ai.SUI_TYPE_ARG,deriveDynamicFieldID:()=>sA.deriveDynamicFieldID,formatAddress:()=>q0.formatAddress,formatDigest:()=>q0.formatDigest,fromB64:()=>kn.fromB64,fromBase58:()=>kn.fromBase58,fromBase64:()=>kn.fromBase64,fromHEX:()=>kn.fromHEX,fromHex:()=>kn.fromHex,isValidNamedPackage:()=>W0.isValidNamedPackage,isValidNamedType:()=>W0.isValidNamedType,isValidSuiAddress:()=>ki.isValidSuiAddress,isValidSuiNSName:()=>H0.isValidSuiNSName,isValidSuiObjectId:()=>ki.isValidSuiObjectId,isValidTransactionDigest:()=>ki.isValidTransactionDigest,normalizeStructTag:()=>ki.normalizeStructTag,normalizeSuiAddress:()=>ki.normalizeSuiAddress,normalizeSuiNSName:()=>H0.normalizeSuiNSName,normalizeSuiObjectId:()=>ki.normalizeSuiObjectId,parseStructTag:()=>ki.parseStructTag,toB64:()=>kn.toB64,toBase58:()=>kn.toBase58,toBase64:()=>kn.toBase64,toHEX:()=>kn.toHEX,toHex:()=>kn.toHex});var Sn=iA(B2),q0=XE,ki=Kr,kn=Or,H0=Kw,ai=MC,W0=t2,sA=XM,Gh=Object.defineProperty,oA=Object.getOwnPropertyDescriptor,aA=Object.getOwnPropertyNames,cA=Object.prototype.hasOwnProperty,uA=(e,t)=>{for(var r in t)Gh(e,r,{get:t[r],enumerable:!0})},lA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aA(t))!cA.call(e,i)&&i!==r&&Gh(e,i,{get:()=>t[i],enumerable:!(n=oA(t,i))||n.enumerable});return e},fA=e=>lA(Gh({},"__esModule",{value:!0}),e),$2={};uA($2,{getPureBcsSchema:()=>_d,isTxContext:()=>wA,normalizedTypeToMoveTypeSignature:()=>_A,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>F2});var L2=fA($2),Yt=Qn,G0=Sn,Ea=Kr;const dA="object",hA="ID",pA="ascii",mA="String",gA="string",vA="String",yA="option",bA="Option";function wA(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,Ea.normalizeSuiAddress)(t.package)===(0,Ea.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function _d(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Yt.bcs.vector(Yt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=_d(e.vector);return t?Yt.bcs.vector(t):null}if("datatype"in e){const t=(0,Ea.normalizeSuiAddress)(e.datatype.package);if(t===(0,Ea.normalizeSuiAddress)(G0.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===pA&&e.datatype.type===mA||e.datatype.module===gA&&e.datatype.type===vA)return Yt.bcs.String;if(e.datatype.module===yA&&e.datatype.type===bA){const r=_d(e.datatype.typeParameters[0]);return r?Yt.bcs.vector(r):null}}if(t===(0,Ea.normalizeSuiAddress)(G0.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===dA&&e.datatype.type===hA)return Yt.bcs.Address}return null}function _A(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:Ca(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:Ca(e.MutableReference)}:{ref:null,body:Ca(e)}}function Ca(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:Ca(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(Ca)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function F2(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Yt.bcs.vector(F2(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var Kh=Object.defineProperty,xA=Object.getOwnPropertyDescriptor,SA=Object.getOwnPropertyNames,EA=Object.prototype.hasOwnProperty,CA=(e,t)=>{for(var r in t)Kh(e,r,{get:t[r],enumerable:!0})},MA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of SA(t))!EA.call(e,i)&&i!==r&&Kh(e,i,{get:()=>t[i],enumerable:!(n=xA(t,i))||n.enumerable});return e},AA=e=>MA(Kh({},"__esModule",{value:!0}),e),U2={};CA(U2,{Inputs:()=>IA});var il=AA(U2),TA=Or,lf=Kr;function OA(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,TA.toBase64)(e):e.toBase64()}}}const IA={Pure:OA,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,lf.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,lf.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,lf.normalizeSuiAddress)(e)}}}}};var Xh=Object.defineProperty,PA=Object.getOwnPropertyDescriptor,kA=Object.getOwnPropertyNames,jA=Object.prototype.hasOwnProperty,RA=(e,t)=>{for(var r in t)Xh(e,r,{get:t[r],enumerable:!0})},NA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kA(t))!jA.call(e,i)&&i!==r&&Xh(e,i,{get:()=>t[i],enumerable:!(n=PA(t,i))||n.enumerable});return e},DA=e=>NA(Xh({},"__esModule",{value:!0}),e),z2={};RA(z2,{$Intent:()=>H2,Argument:()=>Zr,BCSBytes:()=>Ba,Command:()=>W2,GasData:()=>V2,JsonU64:()=>Xi,NormalizedCallArg:()=>FA,ObjectArg:()=>Jh,ObjectID:()=>js,ObjectRef:()=>wu,OpenMoveTypeSignature:()=>q2,OpenMoveTypeSignatureBody:()=>_u,StructTag:()=>BA,SuiAddress:()=>ac,TransactionData:()=>UA,TransactionExpiration:()=>G2,safeEnum:()=>$o});var Bo=DA(z2),ce=is,K0=Kr;function $o(e){const t=Object.entries(e).map(([r,n])=>(0,ce.object)({[r]:n}));return(0,ce.pipe)((0,ce.union)(t),(0,ce.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const ac=(0,ce.pipe)((0,ce.string)(),(0,ce.transform)(e=>(0,K0.normalizeSuiAddress)(e)),(0,ce.check)(K0.isValidSuiAddress)),js=ac,Ba=(0,ce.string)(),Xi=(0,ce.pipe)((0,ce.union)([(0,ce.string)(),(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())]),(0,ce.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),wu=(0,ce.object)({objectId:ac,version:Xi,digest:(0,ce.string)()}),Zr=(0,ce.pipe)((0,ce.union)([(0,ce.object)({GasCoin:(0,ce.literal)(!0)}),(0,ce.object)({Input:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),type:(0,ce.optional)((0,ce.literal)("pure"))}),(0,ce.object)({Input:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),type:(0,ce.optional)((0,ce.literal)("object"))}),(0,ce.object)({Result:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())}),(0,ce.object)({NestedResult:(0,ce.tuple)([(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())])})]),(0,ce.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),V2=(0,ce.object)({budget:(0,ce.nullable)(Xi),price:(0,ce.nullable)(Xi),owner:(0,ce.nullable)(ac),payment:(0,ce.nullable)((0,ce.array)(wu))}),BA=(0,ce.object)({address:(0,ce.string)(),module:(0,ce.string)(),name:(0,ce.string)(),typeParams:(0,ce.array)((0,ce.string)())}),_u=(0,ce.union)([(0,ce.literal)("address"),(0,ce.literal)("bool"),(0,ce.literal)("u8"),(0,ce.literal)("u16"),(0,ce.literal)("u32"),(0,ce.literal)("u64"),(0,ce.literal)("u128"),(0,ce.literal)("u256"),(0,ce.object)({vector:(0,ce.lazy)(()=>_u)}),(0,ce.object)({datatype:(0,ce.object)({package:(0,ce.string)(),module:(0,ce.string)(),type:(0,ce.string)(),typeParameters:(0,ce.array)((0,ce.lazy)(()=>_u))})}),(0,ce.object)({typeParameter:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())})]),q2=(0,ce.object)({ref:(0,ce.nullable)((0,ce.union)([(0,ce.literal)("&"),(0,ce.literal)("&mut")])),body:_u}),$A=(0,ce.object)({package:js,module:(0,ce.string)(),function:(0,ce.string)(),typeArguments:(0,ce.array)((0,ce.string)()),arguments:(0,ce.array)(Zr),_argumentTypes:(0,ce.optional)((0,ce.nullable)((0,ce.array)(q2)))}),H2=(0,ce.object)({name:(0,ce.string)(),inputs:(0,ce.record)((0,ce.string)(),(0,ce.union)([Zr,(0,ce.array)(Zr)])),data:(0,ce.record)((0,ce.string)(),(0,ce.unknown)())}),W2=$o({MoveCall:$A,TransferObjects:(0,ce.object)({objects:(0,ce.array)(Zr),address:Zr}),SplitCoins:(0,ce.object)({coin:Zr,amounts:(0,ce.array)(Zr)}),MergeCoins:(0,ce.object)({destination:Zr,sources:(0,ce.array)(Zr)}),Publish:(0,ce.object)({modules:(0,ce.array)(Ba),dependencies:(0,ce.array)(js)}),MakeMoveVec:(0,ce.object)({type:(0,ce.nullable)((0,ce.string)()),elements:(0,ce.array)(Zr)}),Upgrade:(0,ce.object)({modules:(0,ce.array)(Ba),dependencies:(0,ce.array)(js),package:js,ticket:Zr}),$Intent:H2}),Jh=$o({ImmOrOwnedObject:wu,SharedObject:(0,ce.object)({objectId:js,initialSharedVersion:Xi,mutable:(0,ce.boolean)()}),Receiving:wu}),LA=$o({Object:Jh,Pure:(0,ce.object)({bytes:Ba}),UnresolvedPure:(0,ce.object)({value:(0,ce.unknown)()}),UnresolvedObject:(0,ce.object)({objectId:js,version:(0,ce.optional)((0,ce.nullable)(Xi)),digest:(0,ce.optional)((0,ce.nullable)((0,ce.string)())),initialSharedVersion:(0,ce.optional)((0,ce.nullable)(Xi))})}),FA=$o({Object:Jh,Pure:(0,ce.object)({bytes:Ba})}),G2=$o({None:(0,ce.literal)(!0),Epoch:Xi}),UA=(0,ce.object)({version:(0,ce.literal)(2),sender:(0,ce.nullish)(ac),expiration:(0,ce.nullish)(G2),gasData:V2,inputs:(0,ce.array)(LA),commands:(0,ce.array)(W2)});var Yh=Object.defineProperty,zA=Object.getOwnPropertyDescriptor,VA=Object.getOwnPropertyNames,qA=Object.prototype.hasOwnProperty,HA=(e,t)=>{for(var r in t)Yh(e,r,{get:t[r],enumerable:!0})},WA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of VA(t))!qA.call(e,i)&&i!==r&&Yh(e,i,{get:()=>t[i],enumerable:!(n=zA(t,i))||n.enumerable});return e},GA=e=>WA(Yh({},"__esModule",{value:!0}),e),K2={};HA(K2,{Commands:()=>KA,UpgradePolicy:()=>X2});var Zh=GA(K2),X0=Or,jn=is,J0=Kr,Rn=Bo,X2=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(X2||{});const KA={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,jn.parse)(Rn.Argument,r)),address:(0,jn.parse)(Rn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,jn.parse)(Rn.Argument,e),amounts:t.map(r=>(0,jn.parse)(Rn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,jn.parse)(Rn.Argument,e),sources:t.map(r=>(0,jn.parse)(Rn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,X0.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,J0.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,X0.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,J0.normalizeSuiObjectId)(i)),package:r,ticket:(0,jn.parse)(Rn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,jn.parse)(Rn.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,jn.parse)(Rn.Argument,s)):(0,jn.parse)(Rn.Argument,i)])),data:r}}}};var Qh=Object.defineProperty,XA=Object.getOwnPropertyDescriptor,JA=Object.getOwnPropertyNames,YA=Object.prototype.hasOwnProperty,ZA=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},QA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of JA(t))!YA.call(e,i)&&i!==r&&Qh(e,i,{get:()=>t[i],enumerable:!(n=XA(t,i))||n.enumerable});return e},eT=e=>QA(Qh({},"__esModule",{value:!0}),e),J2={};ZA(J2,{NormalizedCallArg:()=>xd,ObjectRef:()=>xu,SerializedTransactionDataV1:()=>pT,StructTag:()=>e_,TransactionArgument:()=>Gn,TypeTag:()=>sl,serializeV1TransactionData:()=>mT,transactionDataFromV1:()=>gT});var Y2=eT(J2),_o=Or,ne=is,Z2=Qn,Ma=Bo;const xu=(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)()])}),tT=(0,Ma.safeEnum)({ImmOrOwned:xu,Shared:(0,ne.object)({objectId:Ma.ObjectID,initialSharedVersion:Ma.JsonU64,mutable:(0,ne.boolean)()}),Receiving:xu}),xd=(0,Ma.safeEnum)({Object:tT,Pure:(0,ne.array)((0,ne.pipe)((0,ne.number)(),(0,ne.integer)()))}),Q2=(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")})]),rT=(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))})]),Y0=(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}})),sl=(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)(()=>sl)}),(0,ne.object)({struct:(0,ne.lazy)(()=>e_)}),(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))})]),e_=(0,ne.object)({address:(0,ne.string)(),module:(0,ne.string)(),name:(0,ne.string)(),typeParams:(0,ne.array)(sl)}),nT=(0,ne.object)({budget:(0,ne.optional)(Y0),price:(0,ne.optional)(Y0),payment:(0,ne.optional)((0,ne.array)(xu)),owner:(0,ne.optional)((0,ne.string)())}),iT=[Q2,(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)())})],Gn=(0,ne.union)([...iT]),sT=(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)(Gn)}),oT=(0,ne.object)({kind:(0,ne.literal)("TransferObjects"),objects:(0,ne.array)(Gn),address:Gn}),aT=(0,ne.object)({kind:(0,ne.literal)("SplitCoins"),coin:Gn,amounts:(0,ne.array)(Gn)}),cT=(0,ne.object)({kind:(0,ne.literal)("MergeCoins"),destination:Gn,sources:(0,ne.array)(Gn)}),uT=(0,ne.object)({kind:(0,ne.literal)("MakeMoveVec"),type:(0,ne.union)([(0,ne.object)({Some:sl}),(0,ne.object)({None:(0,ne.nullable)((0,ne.literal)(!0))})]),objects:(0,ne.array)(Gn)}),lT=(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)())}),fT=(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:Gn}),dT=[sT,oT,aT,cT,lT,fT,uT],hT=(0,ne.union)([...dT]),pT=(0,ne.object)({version:(0,ne.literal)(1),sender:(0,ne.optional)((0,ne.string)()),expiration:(0,ne.nullish)(rT),gasConfig:nT,inputs:(0,ne.array)(Q2),transactions:(0,ne.array)(hT)});function mT(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,_o.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:Z2.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>ci(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:ci(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>ci(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=>ci(i,t))};if(n.Publish)return{kind:"Publish",modules:n.Publish.modules.map(i=>Array.from((0,_o.fromBase64)(i))),dependencies:n.Publish.dependencies};if(n.SplitCoins)return{kind:"SplitCoins",coin:ci(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>ci(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>ci(i,t)),address:ci(n.TransferObjects.address,t)};if(n.Upgrade)return{kind:"Upgrade",modules:n.Upgrade.modules.map(i=>Array.from((0,_o.fromBase64)(i))),dependencies:n.Upgrade.dependencies,packageId:n.Upgrade.package,ticket:ci(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function ci(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 gT(e){var t,r,n;return(0,ne.parse)(Ma.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)(xd,i.value)){const s=(0,ne.parse)(xd,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,_o.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?Z2.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>ui(s))}};case"MergeCoins":return{MergeCoins:{destination:ui(i.destination),sources:i.sources.map(s=>ui(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=>ui(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,_o.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:ui(i.coin),amounts:i.amounts.map(s=>ui(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>ui(s)),address:ui(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,_o.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:ui(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function ui(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 ep=Object.defineProperty,vT=Object.getOwnPropertyDescriptor,yT=Object.getOwnPropertyNames,bT=Object.prototype.hasOwnProperty,wT=(e,t)=>{for(var r in t)ep(e,r,{get:t[r],enumerable:!0})},_T=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yT(t))!bT.call(e,i)&&i!==r&&ep(e,i,{get:()=>t[i],enumerable:!(n=vT(t,i))||n.enumerable});return e},xT=e=>_T(ep({},"__esModule",{value:!0}),e),t_={};wT(t_,{SerializedTransactionDataV2:()=>PT});var ST=xT(t_),Pe=is,ar=Bo;function cc(e){return(0,Pe.union)(Object.entries(e).map(([t,r])=>(0,Pe.object)({[t]:r})))}const fn=cc({GasCoin:(0,Pe.literal)(!0),Input:(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)()),Result:(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)()),NestedResult:(0,Pe.tuple)([(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)()),(0,Pe.pipe)((0,Pe.number)(),(0,Pe.integer)())])}),ET=(0,Pe.object)({budget:(0,Pe.nullable)(ar.JsonU64),price:(0,Pe.nullable)(ar.JsonU64),owner:(0,Pe.nullable)(ar.SuiAddress),payment:(0,Pe.nullable)((0,Pe.array)(ar.ObjectRef))}),CT=(0,Pe.object)({package:ar.ObjectID,module:(0,Pe.string)(),function:(0,Pe.string)(),typeArguments:(0,Pe.array)((0,Pe.string)()),arguments:(0,Pe.array)(fn)}),MT=(0,Pe.object)({name:(0,Pe.string)(),inputs:(0,Pe.record)((0,Pe.string)(),(0,Pe.union)([fn,(0,Pe.array)(fn)])),data:(0,Pe.record)((0,Pe.string)(),(0,Pe.unknown)())}),AT=cc({MoveCall:CT,TransferObjects:(0,Pe.object)({objects:(0,Pe.array)(fn),address:fn}),SplitCoins:(0,Pe.object)({coin:fn,amounts:(0,Pe.array)(fn)}),MergeCoins:(0,Pe.object)({destination:fn,sources:(0,Pe.array)(fn)}),Publish:(0,Pe.object)({modules:(0,Pe.array)(ar.BCSBytes),dependencies:(0,Pe.array)(ar.ObjectID)}),MakeMoveVec:(0,Pe.object)({type:(0,Pe.nullable)((0,Pe.string)()),elements:(0,Pe.array)(fn)}),Upgrade:(0,Pe.object)({modules:(0,Pe.array)(ar.BCSBytes),dependencies:(0,Pe.array)(ar.ObjectID),package:ar.ObjectID,ticket:fn}),$Intent:MT}),TT=cc({ImmOrOwnedObject:ar.ObjectRef,SharedObject:(0,Pe.object)({objectId:ar.ObjectID,initialSharedVersion:ar.JsonU64,mutable:(0,Pe.boolean)()}),Receiving:ar.ObjectRef}),OT=cc({Object:TT,Pure:(0,Pe.object)({bytes:ar.BCSBytes}),UnresolvedPure:(0,Pe.object)({value:(0,Pe.unknown)()}),UnresolvedObject:(0,Pe.object)({objectId:ar.ObjectID,version:(0,Pe.optional)((0,Pe.nullable)(ar.JsonU64)),digest:(0,Pe.optional)((0,Pe.nullable)((0,Pe.string)())),initialSharedVersion:(0,Pe.optional)((0,Pe.nullable)(ar.JsonU64))})}),IT=cc({None:(0,Pe.literal)(!0),Epoch:ar.JsonU64}),PT=(0,Pe.object)({version:(0,Pe.literal)(2),sender:(0,Pe.nullish)(ar.SuiAddress),expiration:(0,Pe.nullish)(IT),gasData:ET,inputs:(0,Pe.array)(OT),commands:(0,Pe.array)(AT)});var tp=Object.defineProperty,kT=Object.getOwnPropertyDescriptor,jT=Object.getOwnPropertyNames,RT=Object.prototype.hasOwnProperty,NT=(e,t)=>{for(var r in t)tp(e,r,{get:t[r],enumerable:!0})},DT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jT(t))!RT.call(e,i)&&i!==r&&tp(e,i,{get:()=>t[i],enumerable:!(n=kT(t,i))||n.enumerable});return e},BT=e=>DT(tp({},"__esModule",{value:!0}),e),r_={};NT(r_,{getClient:()=>Lo,resolveTransactionData:()=>VT});var n_=BT(r_),$T=is,Z0=Qn,Sd=Sn,LT=Bo,Aa=il,ff=L2;const FT=50,UT=1000n,zT=5e10;async function VT(e,t,r){return await KT(e,t),await GT(e,t),t.onlyTransactionKind||(await qT(e,t),await HT(e,t),await WT(e,t)),await XT(e),await r()}async function qT(e,t){e.gasConfig.price||(e.gasConfig.price=String(await Lo(t).getReferenceGasPrice()))}async function HT(e,t){if(e.gasConfig.budget)return;const r=await Lo(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(zT),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=UT*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 WT(e,t){if(!e.gasConfig.payment){const n=(await Lo(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Sd.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,$T.parse)(LT.ObjectRef,i))}}async function GT(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,Sd.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?QT(n,FT):[],s=(await Promise.all(i.map(l=>Lo(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,Sd.normalizeSuiAddress)(f.UnresolvedObject.objectId),b=u.get(y);f.UnresolvedObject.initialSharedVersion??(b==null?void 0:b.initialSharedVersion)?h=Aa.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(b==null?void 0:b.initialSharedVersion),mutable:JT(e,l)}):YT(e,l)&&(h=Aa.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??Aa.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 KT(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=>{Q0(c,Z0.bcs.U64,e)});break;case"TransferObjects":Q0(a.TransferObjects.address,Z0.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=Lo(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,ff.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,ff.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),T=(0,ff.getPureBcsSchema)(f.body);if(T){y.type="pure",r[r.indexOf(b)]=Aa.Inputs.Pure(T.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 XT(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 Q0(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=Aa.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function JT(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 YT(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=ZT(i.MoveCall._argumentTypes[s])||r}}),r}function ZT(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 Lo(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 QT(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var rp=Object.defineProperty,e5=Object.getOwnPropertyDescriptor,t5=Object.getOwnPropertyNames,r5=Object.prototype.hasOwnProperty,n5=(e,t)=>{for(var r in t)rp(e,r,{get:t[r],enumerable:!0})},i5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of t5(t))!r5.call(e,i)&&i!==r&&rp(e,i,{get:()=>t[i],enumerable:!(n=e5(t,i))||n.enumerable});return e},s5=e=>i5(rp({},"__esModule",{value:!0}),e),i_={};n5(i_,{createObjectMethods:()=>o5});var s_=s5(i_);function o5(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 np=Object.defineProperty,a5=Object.getOwnPropertyDescriptor,c5=Object.getOwnPropertyNames,u5=Object.prototype.hasOwnProperty,l5=(e,t)=>{for(var r in t)np(e,r,{get:t[r],enumerable:!0})},f5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of c5(t))!u5.call(e,i)&&i!==r&&np(e,i,{get:()=>t[i],enumerable:!(n=a5(t,i))||n.enumerable});return e},d5=e=>f5(np({},"__esModule",{value:!0}),e),o_={};l5(o_,{createPure:()=>p5});var a_=d5(o_),h5=Or,rr=Qn;function p5(e){function t(r,n){if(typeof r=="string")return e(Ta(r).serialize(n));if(r instanceof Uint8Array||(0,h5.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(Ta(r)).serialize(n)),t.option=(r,n)=>e(rr.bcs.option(Ta(r)).serialize(n)),t}function Ta(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(Ta(n)):rr.bcs.option(Ta(n))}throw new Error(`Invalid Pure type name: ${e}`)}var ip=Object.defineProperty,m5=Object.getOwnPropertyDescriptor,g5=Object.getOwnPropertyNames,v5=Object.prototype.hasOwnProperty,y5=(e,t)=>{for(var r in t)ip(e,r,{get:t[r],enumerable:!0})},b5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of g5(t))!v5.call(e,i)&&i!==r&&ip(e,i,{get:()=>t[i],enumerable:!(n=m5(t,i))||n.enumerable});return e},w5=e=>b5(ip({},"__esModule",{value:!0}),e),c_={};y5(c_,{hashTypedData:()=>S5});var _5=w5(c_),x5=Ds;function S5(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,x5.blake2b)(n,{dkLen:32})}var sp=Object.defineProperty,E5=Object.getOwnPropertyDescriptor,C5=Object.getOwnPropertyNames,M5=Object.prototype.hasOwnProperty,A5=(e,t)=>{for(var r in t)sp(e,r,{get:t[r],enumerable:!0})},T5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of C5(t))!M5.call(e,i)&&i!==r&&sp(e,i,{get:()=>t[i],enumerable:!(n=E5(t,i))||n.enumerable});return e},O5=e=>T5(sp({},"__esModule",{value:!0}),e),u_={};A5(u_,{TransactionDataBuilder:()=>Cs});var op=O5(u_),I5=Or,df=is,Ac=Qn,P5=Kr,hf=Bo,k5=Y2,j5=_5;function em(e){return(0,P5.normalizeSuiAddress)(e).replace("0x","")}class Cs{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=Ac.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Cs.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=Ac.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 Cs.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 Cs((0,df.parse)(hf.TransactionData,t)):new Cs((0,df.parse)(hf.TransactionData,(0,k5.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,j5.hashTypedData)("TransactionData",t);return(0,I5.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 Ac.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:em(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:em(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return Ac.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 Cs.getDigestFromBytes(t)}snapshot(){return(0,df.parse)(hf.TransactionData,this)}}var ap=Object.defineProperty,R5=Object.getOwnPropertyDescriptor,N5=Object.getOwnPropertyNames,D5=Object.prototype.hasOwnProperty,B5=(e,t)=>{for(var r in t)ap(e,r,{get:t[r],enumerable:!0})},$5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of N5(t))!D5.call(e,i)&&i!==r&&ap(e,i,{get:()=>t[i],enumerable:!(n=R5(t,i))||n.enumerable});return e},L5=e=>$5(ap({},"__esModule",{value:!0}),e),l_={};B5(l_,{extractMutableReference:()=>f_,extractReference:()=>d_,extractStructTag:()=>U5,getIdFromCallArg:()=>z5});var F5=L5(l_),sa=Kr;function f_(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function d_(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function U5(e){if(typeof e=="object"&&"Struct"in e)return e;const t=d_(e),r=f_(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function z5(e){if(typeof e=="string")return(0,sa.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,sa.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,sa.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,sa.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,sa.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var cp=Object.defineProperty,V5=Object.getOwnPropertyDescriptor,q5=Object.getOwnPropertyNames,H5=Object.prototype.hasOwnProperty,h_=e=>{throw TypeError(e)},W5=(e,t)=>{for(var r in t)cp(e,r,{get:t[r],enumerable:!0})},G5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of q5(t))!H5.call(e,i)&&i!==r&&cp(e,i,{get:()=>t[i],enumerable:!(n=V5(t,i))||n.enumerable});return e},K5=e=>G5(cp({},"__esModule",{value:!0}),e),up=(e,t,r)=>t.has(e)||h_("Cannot "+r),Mt=(e,t,r)=>(up(e,t,"read from private field"),r?r.call(e):t.get(e)),oa=(e,t,r)=>t.has(e)?h_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),us=(e,t,r,n)=>(up(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),fi=(e,t,r)=>(up(e,t,"access private method"),r),p_={};W5(p_,{Transaction:()=>tO,isTransaction:()=>g_});var ol=K5(p_),qc=Or,Bi=is,X5=Kr,ls=Zh,Ms=Bo,tm=Y2,J5=ST,Tc=il,Y5=n_,Z5=s_,Q5=a_,aa=op,rm=F5,ya,Oa,bs,Ot,dn,Hc,lp,Ed,fp;function nm(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 m_=Symbol.for("@mysten/transaction");function g_(e){return!!e&&typeof e=="object"&&e[m_]===!0}const im={buildPlugins:new Map,serializationPlugins:new Map},pf=Symbol.for("@mysten/transaction/registry");function ca(){try{const e=globalThis;return e[pf]||(e[pf]=im),e[pf]}catch{return im}}const eO=class Cd{constructor(){oa(this,dn),oa(this,ya),oa(this,Oa),oa(this,bs,new Map),oa(this,Ot),this.object=(0,Z5.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Bi.is)(Ms.Argument,r))return r;const n=(0,rm.getIdFromCallArg)(r),i=Mt(this,Ot).inputs.find(a=>n===(0,rm.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:Mt(this,Ot).inputs.indexOf(i),type:"object"}:Mt(this,Ot).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,X5.normalizeSuiAddress)(r)}}:r)});const t=ca();us(this,Ot,new aa.TransactionDataBuilder),us(this,Oa,[...t.buildPlugins.values()]),us(this,ya,[...t.serializationPlugins.values()])}static fromKind(t){const r=new Cd;return us(r,Ot,aa.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,qc.fromBase64)(t):t)),r}static from(t){const r=new Cd;return g_(t)?us(r,Ot,new aa.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?us(r,Ot,aa.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,qc.fromBase64)(t):t)):us(r,Ot,aa.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){ca().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){ca().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){ca().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){ca().buildPlugins.delete(t)}addSerializationPlugin(t){Mt(this,ya).push(t)}addBuildPlugin(t){Mt(this,Oa).push(t)}addIntentResolver(t,r){if(Mt(this,bs).has(t)&&Mt(this,bs).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Mt(this,bs).set(t,r)}setSender(t){Mt(this,Ot).sender=t}setSenderIfNotSet(t){Mt(this,Ot).sender||(Mt(this,Ot).sender=t)}setExpiration(t){Mt(this,Ot).expiration=t?(0,Bi.parse)(Ms.TransactionExpiration,t):null}setGasPrice(t){Mt(this,Ot).gasConfig.price=String(t)}setGasBudget(t){Mt(this,Ot).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Mt(this,Ot).gasData.budget==null&&(Mt(this,Ot).gasConfig.budget=String(t))}setGasOwner(t){Mt(this,Ot).gasConfig.owner=t}setGasPayment(t){Mt(this,Ot).gasConfig.payment=t.map(r=>(0,Bi.parse)(Ms.ObjectRef,r))}get blockData(){return(0,tm.serializeV1TransactionData)(Mt(this,Ot).snapshot())}getData(){return Mt(this,Ot).snapshot()}get[m_](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,Q5.createPure)(t=>(0,qc.isSerializedBcs)(t)?Mt(this,Ot).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Mt(this,Ot).addInput("pure",(0,Bi.is)(Ms.NormalizedCallArg,t)?(0,Bi.parse)(Ms.NormalizedCallArg,t):t instanceof Uint8Array?Tc.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(Tc.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(Tc.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(Tc.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Mt(this,Ot).commands.push(t);return nm(r-1)}splitCoins(t,r){const n=ls.Commands.SplitCoins(typeof t=="string"?this.object(t):fi(this,dn,lp).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):fi(this,dn,Hc).call(this,s))),i=Mt(this,Ot).commands.push(n);return nm(i-1,r.length)}mergeCoins(t,r){return this.add(ls.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(ls.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(ls.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(ls.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>fi(this,dn,Hc).call(this,n))}))}transferObjects(t,r){return this.add(ls.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):fi(this,dn,Hc).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(ls.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,tm.serializeV1TransactionData)(Mt(this,Ot).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Bi.parse)(J5.SerializedTransactionDataV2,Mt(this,Ot).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 fi(this,dn,Ed).call(this,t),Mt(this,Ot).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await fi(this,dn,Ed).call(this,t),Mt(this,Ot).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Mt(this,Ot).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Mt(this,ya)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Mt(this,bs).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Mt(this,bs).get(s))}await fi(this,dn,fp).call(this,n,t)}};ya=new WeakMap;Oa=new WeakMap;bs=new WeakMap;Ot=new WeakMap;dn=new WeakSet;Hc=function(e){return(0,qc.isSerializedBcs)(e)?this.pure(e):fi(this,dn,lp).call(this,e)};lp=function(e){return typeof e=="function"?(0,Bi.parse)(Ms.Argument,e(this)):(0,Bi.parse)(Ms.Argument,e)};Ed=async function(e){if(!e.onlyTransactionKind&&!Mt(this,Ot).sender)throw new Error("Missing transaction sender");await fi(this,dn,fp).call(this,[...Mt(this,Oa),Y5.resolveTransactionData],e)};fp=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(Mt(this,Ot),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 tO=eO;var dp=Object.defineProperty,rO=Object.getOwnPropertyDescriptor,nO=Object.getOwnPropertyNames,iO=Object.prototype.hasOwnProperty,v_=e=>{throw TypeError(e)},sO=(e,t)=>{for(var r in t)dp(e,r,{get:t[r],enumerable:!0})},oO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nO(t))!iO.call(e,i)&&i!==r&&dp(e,i,{get:()=>t[i],enumerable:!(n=rO(t,i))||n.enumerable});return e},aO=e=>oO(dp({},"__esModule",{value:!0}),e),y_=(e,t,r)=>t.has(e)||v_("Cannot "+r),fr=(e,t,r)=>(y_(e,t,"read from private field"),r?r.call(e):t.get(e)),Md=(e,t,r)=>t.has(e)?v_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),sm=(e,t,r,n)=>(y_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),b_={};sO(b_,{AsyncCache:()=>__,InMemoryCache:()=>x_,ObjectCache:()=>cO});var w_=aO(b_),mf=Kr,ws,Er,Wc;class __{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,mf.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,mf.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,mf.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 x_ extends __{constructor(){super(...arguments),Md(this,ws,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return fr(this,ws)[t].get(r)??null}async set(t,r,n){fr(this,ws)[t].set(r,n)}async delete(t,r){fr(this,ws)[t].delete(r)}async clear(t){if(t)fr(this,ws)[t].clear();else for(const r of Object.values(fr(this,ws)))r.clear()}}ws=new WeakMap;class cO{constructor({cache:t=new x_,onEffects:r}){Md(this,Er),Md(this,Wc),sm(this,Er,t),sm(this,Wc,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await fr(this,Er).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 fr(this,Er).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await fr(this,Er).clear()}async getMoveFunctionDefinition(t){return fr(this,Er).getMoveFunctionDefinition(t)}async getObjects(t){return fr(this,Er).getObjects(t)}async deleteObjects(t){return fr(this,Er).deleteObjects(t)}async clearOwnedObjects(){await fr(this,Er).clear("OwnedObject")}async clearCustom(){await fr(this,Er).clear("Custom")}async getCustom(t){return fr(this,Er).getCustom(t)}async setCustom(t,r){return fr(this,Er).setCustom(t,r)}async deleteCustom(t){return fr(this,Er).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([fr(this,Er).addObjects(o),fr(this,Er).deleteObjects(s),(r=fr(this,Wc))==null?void 0:r.call(this,t)])}}Er=new WeakMap;Wc=new WeakMap;var hp=Object.defineProperty,uO=Object.getOwnPropertyDescriptor,lO=Object.getOwnPropertyNames,fO=Object.prototype.hasOwnProperty,S_=e=>{throw TypeError(e)},dO=(e,t)=>{for(var r in t)hp(e,r,{get:t[r],enumerable:!0})},hO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lO(t))!fO.call(e,i)&&i!==r&&hp(e,i,{get:()=>t[i],enumerable:!(n=uO(t,i))||n.enumerable});return e},pO=e=>hO(hp({},"__esModule",{value:!0}),e),E_=(e,t,r)=>t.has(e)||S_("Cannot "+r),ua=(e,t,r)=>(E_(e,t,"read from private field"),r?r.call(e):t.get(e)),om=(e,t,r)=>t.has(e)?S_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),gf=(e,t,r,n)=>(E_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),C_={};dO(C_,{CachingTransactionExecutor:()=>yO});var M_=pO(C_),mO=Qn,gO=w_,vO=ol,ao,co;class yO{constructor({client:t,...r}){om(this,ao),om(this,co,null),gf(this,ao,t),this.cache=new gO.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,ao),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,vO.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await ua(this,ao).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=mO.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;gf(this,co,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){ua(this,co)&&(await ua(this,ao).waitForTransaction({digest:ua(this,co)}),gf(this,co,null))}}ao=new WeakMap;co=new WeakMap;var pp=Object.defineProperty,bO=Object.getOwnPropertyDescriptor,wO=Object.getOwnPropertyNames,_O=Object.prototype.hasOwnProperty,A_=e=>{throw TypeError(e)},xO=(e,t)=>{for(var r in t)pp(e,r,{get:t[r],enumerable:!0})},SO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wO(t))!_O.call(e,i)&&i!==r&&pp(e,i,{get:()=>t[i],enumerable:!(n=bO(t,i))||n.enumerable});return e},EO=e=>SO(pp({},"__esModule",{value:!0}),e),CO=(e,t,r)=>t.has(e)||A_("Cannot "+r),mn=(e,t,r)=>(CO(e,t,"read from private field"),r?r.call(e):t.get(e)),T_=(e,t,r)=>t.has(e)?A_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),O_={};xO(O_,{ParallelQueue:()=>AO,SerialQueue:()=>MO});var I_=EO(O_),Ri,_s;class MO{constructor(){T_(this,Ri,[])}async runTask(t){return new Promise((r,n)=>{mn(this,Ri).push(()=>{t().finally(()=>{mn(this,Ri).shift(),mn(this,Ri).length>0&&mn(this,Ri)[0]()}).then(r,n)}),mn(this,Ri).length===1&&mn(this,Ri)[0]()})}}Ri=new WeakMap;class AO{constructor(t){T_(this,_s,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{mn(this,_s).length>0?mn(this,_s).shift()():this.activeTasks--}).then(r,n)):mn(this,_s).push(()=>{t().finally(()=>{mn(this,_s).length>0?mn(this,_s).shift()():this.activeTasks--}).then(r,n)})})}}_s=new WeakMap;var mp=Object.defineProperty,TO=Object.getOwnPropertyDescriptor,OO=Object.getOwnPropertyNames,IO=Object.prototype.hasOwnProperty,P_=e=>{throw TypeError(e)},PO=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},kO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of OO(t))!IO.call(e,i)&&i!==r&&mp(e,i,{get:()=>t[i],enumerable:!(n=TO(t,i))||n.enumerable});return e},jO=e=>kO(mp({},"__esModule",{value:!0}),e),k_=(e,t,r)=>t.has(e)||P_("Cannot "+r),Sr=(e,t,r)=>(k_(e,t,"read from private field"),r?r.call(e):t.get(e)),Xs=(e,t,r)=>t.has(e)?P_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),vf=(e,t,r,n)=>(k_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),j_={};PO(j_,{SerialTransactionExecutor:()=>BO,getGasCoinFromEffects:()=>N_});var R_=jO(j_),RO=Or,am=ol,NO=M_,DO=I_,Gc,ba,ln,Kc,Ad,Xc;class BO{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){Xs(this,Gc,new DO.SerialQueue),Xs(this,ba),Xs(this,ln),Xs(this,Kc),Xs(this,Ad,async i=>{if(!i.V2)return;const s=N_(i).ref;s?Sr(this,ln).cache.setCustom("gasCoin",s):Sr(this,ln).cache.deleteCustom("gasCoin")}),Xs(this,Xc,async i=>{const s=await Sr(this,ln).cache.getCustom("gasCoin"),o=am.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(Sr(this,Kc)),o.setSenderIfNotSet(Sr(this,ba).toSuiAddress()),Sr(this,ln).buildTransaction({transaction:o})}),vf(this,ba,t),vf(this,Kc,r),vf(this,ln,new NO.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>Sr(this,Ad).call(this,i)}))}async applyEffects(t){return Sr(this,ln).applyEffects(t)}async buildTransaction(t){return Sr(this,Gc).runTask(()=>Sr(this,Xc).call(this,t))}resetCache(){return Sr(this,ln).reset()}waitForLastTransaction(){return Sr(this,ln).waitForLastTransaction()}executeTransaction(t,r){return Sr(this,Gc).runTask(async()=>{const n=(0,am.isTransaction)(t)?await Sr(this,Xc).call(this,t):t,{signature:i}=await Sr(this,ba).signTransaction(n),s=await Sr(this,ln).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,RO.toBase64)(o),data:s}})}}Gc=new WeakMap;ba=new WeakMap;ln=new WeakMap;Kc=new WeakMap;Ad=new WeakMap;Xc=new WeakMap;function N_(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 gp=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,LO=Object.getOwnPropertyNames,FO=Object.prototype.hasOwnProperty,D_=e=>{throw TypeError(e)},UO=(e,t)=>{for(var r in t)gp(e,r,{get:t[r],enumerable:!0})},zO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LO(t))!FO.call(e,i)&&i!==r&&gp(e,i,{get:()=>t[i],enumerable:!(n=$O(t,i))||n.enumerable});return e},VO=e=>zO(gp({},"__esModule",{value:!0}),e),vp=(e,t,r)=>t.has(e)||D_("Cannot "+r),qe=(e,t,r)=>(vp(e,t,"read from private field"),r?r.call(e):t.get(e)),lr=(e,t,r)=>t.has(e)?D_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),tr=(e,t,r,n)=>(vp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),tn=(e,t,r)=>(vp(e,t,"access private method"),r),cm=(e,t,r,n)=>({set _(i){tr(e,t,i,r)},get _(){return qe(e,t,n)}}),B_={};UO(B_,{ParallelTransactionExecutor:()=>XO});var qO=VO(B_),HO=Or,$_=Qn,WO=ol,GO=op,KO=M_,um=I_,L_=R_,Wi,qn,Su,$a,Ia,La,Eu,xo,jr,Gi,Rs,Is,yp,Jc,Fa,fo,Ao,hi,$r,F_,U_,Ua,bp,z_,Td,V_;const la={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class XO{constructor(t){lr(this,$r),lr(this,Wi),lr(this,qn),lr(this,Su),lr(this,$a),lr(this,Ia),lr(this,La),lr(this,Eu),lr(this,xo),lr(this,jr),lr(this,Gi,[]),lr(this,Rs),lr(this,Is,new Map),lr(this,yp,new um.SerialQueue),lr(this,Jc),lr(this,Fa,null),lr(this,fo,null),lr(this,Ao,0),lr(this,hi,null),tr(this,Wi,t.signer),tr(this,qn,t.client),tr(this,Su,t.coinBatchSize??la.coinBatchSize),tr(this,$a,t.initialCoinBalance??la.initialCoinBalance),tr(this,Ia,t.minimumCoinBalance??la.minimumCoinBalance),tr(this,Eu,t.defaultGasBudget??qe(this,Ia)),tr(this,La,t.epochBoundaryWindow??la.epochBoundaryWindow),tr(this,xo,t.maxPoolSize??la.maxPoolSize),tr(this,Rs,new KO.CachingTransactionExecutor({client:t.client,cache:t.cache})),tr(this,Jc,new um.ParallelQueue(qe(this,xo))),tr(this,jr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return tr(this,hi,null),tn(this,$r,Ua).call(this,()=>qe(this,Rs).reset())}async waitForLastTransaction(){await tn(this,$r,Ua).call(this,()=>tn(this,$r,bp).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=JO(),o=await tn(this,$r,F_).call(this,t),a=()=>{qe(this,Jc).runTask(()=>tn(this,$r,U_).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{qe(this,Is).get(u)?(c.add(u),qe(this,Is).get(u).push(()=>{c.delete(u),c.size===0&&a()})):qe(this,Is).set(u,[])}),c.size===0&&a(),n}}Wi=new WeakMap;qn=new WeakMap;Su=new WeakMap;$a=new WeakMap;Ia=new WeakMap;La=new WeakMap;Eu=new WeakMap;xo=new WeakMap;jr=new WeakMap;Gi=new WeakMap;Rs=new WeakMap;Is=new WeakMap;yp=new WeakMap;Jc=new WeakMap;Fa=new WeakMap;fo=new WeakMap;Ao=new WeakMap;hi=new WeakMap;$r=new WeakSet;F_=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,qn)}),t};U_=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(qe(this,Wi).toSuiAddress()),await qe(this,yp).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await tn(this,$r,Td).call(this)),e.setGasBudgetIfNotSet(qe(this,Eu)),await tn(this,$r,Ua).call(this),n=await tn(this,$r,z_).call(this),cm(this,Ao)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await qe(this,Rs).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:qe(this,qn)}),{signature:o}=await qe(this,Wi).signTransaction(s),a=await qe(this,Rs).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=$_.bcs.TransactionEffects.parse(c),l=(0,L_.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===qe(this,Wi).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new GO.TransactionDataBuilder(e.getData()).mapArguments(b=>(b.$kind==="GasCoin"&&(y=!0),b)),!y&&n.balance>=qe(this,Ia)?qe(this,Gi).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(qe(this,jr)||tr(this,jr,new Map),qe(this,jr).set(l.ref.objectId,l.ref))}return tr(this,Fa,a.digest),{digest:a.digest,effects:(0,HO.toBase64)(c),data:a}}catch(s){throw n&&(qe(this,jr)||tr(this,jr,new Map),qe(this,jr).set(n.id,null)),await tn(this,$r,Ua).call(this,async()=>{await Promise.all([qe(this,Rs).cache.deleteObjects([...t]),tn(this,$r,bp).call(this)])}),s}finally{t.forEach(s=>{const o=qe(this,Is).get(s);o&&o.length>0?o.shift()():o&&qe(this,Is).delete(s)}),cm(this,Ao)._--}};Ua=async function(e){qe(this,fo)&&await qe(this,fo),tr(this,fo,(e==null?void 0:e().then(()=>{tr(this,fo,null)},()=>{}))??null)};bp=async function(){const e=qe(this,Fa);e&&(tr(this,Fa,null),await qe(this,qn).waitForTransaction({digest:e}))};z_=async function(){if(qe(this,Gi).length===0&&qe(this,Ao)<=qe(this,xo)&&await tn(this,$r,V_).call(this),qe(this,Gi).length===0)throw new Error("No coins available");return qe(this,Gi).shift()};Td=async function(){if((qe(this,hi)?qe(this,hi).expiration-qe(this,La)-Date.now():0)>0)return qe(this,hi).price;if(qe(this,hi)){const r=Math.max(qe(this,hi).expiration+qe(this,La)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await qe(this,qn).getLatestSuiSystemState();return tr(this,hi,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),tn(this,$r,Td).call(this)};V_=async function(){var u;const e=Math.min(qe(this,Su),qe(this,xo)-(qe(this,Gi).length+qe(this,Ao))+1);if(e===0)return;const t=new WO.Transaction,r=qe(this,Wi).toSuiAddress();if(t.setSender(r),qe(this,jr)){const l=[],f=[];for(const[h,y]of qe(this,jr))y?l.push(y):f.push(h);if(f.length>0){const h=await qe(this,qn).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),tr(this,jr,new Map)}const n=new Array(e).fill(qe(this,$a)),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,qn).signAndExecuteTransaction({transaction:t,signer:qe(this,Wi),options:{showRawEffects:!0}}),a=$_.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,Gi).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(qe(this,$a))})}),qe(this,jr)||tr(this,jr,new Map);const c=(0,L_.getGasCoinFromEffects)(a).ref;qe(this,jr).set(c.objectId,c),await qe(this,qn).waitForTransaction({digest:o.digest})};function JO(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var wp=Object.defineProperty,YO=Object.getOwnPropertyDescriptor,ZO=Object.getOwnPropertyNames,QO=Object.prototype.hasOwnProperty,eI=(e,t)=>{for(var r in t)wp(e,r,{get:t[r],enumerable:!0})},tI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ZO(t))!QO.call(e,i)&&i!==r&&wp(e,i,{get:()=>t[i],enumerable:!(n=YO(t,i))||n.enumerable});return e},rI=e=>tI(wp({},"__esModule",{value:!0}),e),q_={};eI(q_,{coinWithBalance:()=>oI});var nI=rI(q_),Yc=is,iI=Qn,H_=Kr,Zc=Zh,lm=il,sI=n_;const Cu="CoinWithBalance",fm=(0,H_.normalizeStructTag)("0x2::sui::SUI");function oI({type:e=fm,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(Cu,cI);const i=e==="gas"?e:(0,H_.normalizeStructTag)(e);return n.add(Zc.Commands.Intent({name:Cu,inputs:{},data:{type:i===fm&&r?"gas":i,balance:BigInt(t)}}))}}const aI=(0,Yc.object)({type:(0,Yc.string)(),balance:(0,Yc.bigint)()});async function cI(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===Cu){const{type:h,balance:y}=(0,Yc.parse)(aI,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,sI.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await uI({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!==Cu)continue;const{type:y,balance:b}=h.$Intent.data;if(b===0n){e.replaceCommand(f,Zc.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[T,...P]=o.get(y).map(R=>e.addInput("object",lm.Inputs.ObjectRef({objectId:R.coinObjectId,digest:R.digest,version:R.version})));P.length>0&&w.push(Zc.Commands.MergeCoins(T,P)),c.set(y,T)}w.push(Zc.Commands.SplitCoins(c.get(y),[e.addInput("pure",lm.Inputs.Pure(iI.bcs.u64().serialize(b)))])),e.replaceCommand(f,w),e.mapArguments(T=>T.$kind==="Result"&&T.Result===f?{$kind:"NestedResult",NestedResult:[f+w.length-1,0]}:T)}return r()}async function uI({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 _p=Object.defineProperty,lI=Object.getOwnPropertyDescriptor,fI=Object.getOwnPropertyNames,dI=Object.prototype.hasOwnProperty,hI=(e,t)=>{for(var r in t)_p(e,r,{get:t[r],enumerable:!0})},pI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fI(t))!dI.call(e,i)&&i!==r&&_p(e,i,{get:()=>t[i],enumerable:!(n=lI(t,i))||n.enumerable});return e},mI=e=>pI(_p({},"__esModule",{value:!0}),e),W_={};hI(W_,{Arguments:()=>bI});var gI=mI(W_),vI=s_,yI=a_;const bI={pure:(0,yI.createPure)(e=>t=>t.pure(e)),object:(0,vI.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 xp=Object.defineProperty,wI=Object.getOwnPropertyDescriptor,_I=Object.getOwnPropertyNames,xI=Object.prototype.hasOwnProperty,SI=(e,t)=>{for(var r in t)xp(e,r,{get:t[r],enumerable:!0})},EI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _I(t))!xI.call(e,i)&&i!==r&&xp(e,i,{get:()=>t[i],enumerable:!(n=wI(t,i))||n.enumerable});return e},CI=e=>EI(xp({},"__esModule",{value:!0}),e),G_={};SI(G_,{findTransactionBlockNames:()=>AI,listToRequests:()=>OI,replaceNames:()=>TI});var MI=CI(G_),K_=t2;const ho="/",AI=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){dm([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(ho)){if(!(0,K_.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}dm(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function dm(e){const t=new Set;for(const r of e)if(r.includes(ho)){if(!(0,K_.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const TI=(e,t)=>{var r;for(const n of e.commands){if((r=n.MakeMoveVec)!=null&&r.type){if(!n.MakeMoveVec.type.includes(ho))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(ho)&&!t.packages[o])throw new Error(`No address found for package: ${o}`);o.includes(ho)&&(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(ho)){if(!t.types[a[c]])throw new Error(`No resolution found for type: ${a[c]}`);a[c]=t.types[a[c]]}i.typeArguments=a}}},OI=(e,t)=>{const r=[],n=hm(e.packages),i=hm(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 II(r,t)},hm=e=>[...new Set(e)],II=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var Sp=Object.defineProperty,PI=Object.getOwnPropertyDescriptor,kI=Object.getOwnPropertyNames,jI=Object.prototype.hasOwnProperty,RI=(e,t)=>{for(var r in t)Sp(e,r,{get:t[r],enumerable:!0})},NI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kI(t))!jI.call(e,i)&&i!==r&&Sp(e,i,{get:()=>t[i],enumerable:!(n=PI(t,i))||n.enumerable});return e},DI=e=>NI(Sp({},"__esModule",{value:!0}),e),X_={};RI(X_,{namedPackagesPlugin:()=>$I});var BI=DI(X_),yf=MI;const $I=({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,yf.findTransactionBlockNames)(s),u=(0,yf.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,yf.replaceNames)(s,n),await a()};async function i(s,o){const a={packages:{},types:{}};if(o.length===0)return a;const c=`{
|
|
25
|
-
${o.map(l=>{const f=l.type==="package"?"packageByName":"typeByName",h=l.type==="package"?"address":"repr";return`${
|
|
24
|
+
<%s key={someKey} {...props} />`,mr,nr,on,nr),K[nr+mr]=!0}}return z===n?B(Nt):M(Nt),Nt}}function ee(z,ne,he){return Z(z,ne,he,!0)}function Be(z,ne,he){return Z(z,ne,he,!1)}var tt=Be,Ne=ee;Zo.Fragment=n,Zo.jsx=tt,Zo.jsxs=Ne}()),Zo}Wi.env.NODE_ENV==="production"?Of.exports=E3():Of.exports=M3();var b=Of.exports;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);function $n(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 C3="1.18.0",A3="1.40.0",T3={"-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 Rd extends Error{}class Nd extends Rd{constructor(t,r){super(t),this.code=r,this.type=T3[r]??"ServerError"}}class Gg extends Rd{constructor(t,r,n){super(t),this.status=r,this.statusText=n}}var Hg=e=>{throw TypeError(e)},Dd=(e,t,r)=>t.has(e)||Hg("Cannot "+r),er=(e,t,r)=>(Dd(e,t,"read from private field"),r?r.call(e):t.get(e)),cs=(e,t,r)=>t.has(e)?Hg("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),mo=(e,t,r,n)=>(Dd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Wg=(e,t,r)=>(Dd(e,t,"access private method"),r),O3=(e,t,r,n)=>({set _(i){mo(e,t,i,r)},get _(){return er(e,t,n)}}),ms,ya,ci,As,ka,go,ru,Kg,Xg;function I3(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}const k3={WebSocketConstructor:typeof WebSocket<"u"?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class j3{constructor(t,r={}){if(cs(this,ru),cs(this,ms,0),cs(this,ya,0),cs(this,ci,null),cs(this,As,null),cs(this,ka,new Set),cs(this,go,new Map),this.endpoint=t,this.options={...k3,...r},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=I3(this.endpoint))}async makeRequest(t,r){const n=await Wg(this,ru,Kg).call(this);return new Promise((i,s)=>{mo(this,ms,er(this,ms)+1),er(this,go).set(er(this,ms),{resolve:i,reject:s,timeout:setTimeout(()=>{er(this,go).delete(er(this,ms)),s(new Error(`Request timeout: ${t}`))},this.options.callTimeout)}),n.send(JSON.stringify({jsonrpc:"2.0",id:er(this,ms),method:t,params:r}))}).then(({error:i,result:s})=>{if(i)throw new Nd(i.message,i.code);return s})}async subscribe(t){const r=new P3(t);return er(this,ka).add(r),await r.subscribe(this),()=>r.unsubscribe(this)}}ms=new WeakMap;ya=new WeakMap;ci=new WeakMap;As=new WeakMap;ka=new WeakMap;go=new WeakMap;ru=new WeakSet;Kg=function(){return er(this,As)?er(this,As):(mo(this,As,new Promise(e=>{var t;(t=er(this,ci))==null||t.close(),mo(this,ci,new this.options.WebSocketConstructor(this.endpoint)),er(this,ci).addEventListener("open",()=>{mo(this,ya,0),e(er(this,ci))}),er(this,ci).addEventListener("close",()=>{O3(this,ya)._++,er(this,ya)<=this.options.maxReconnects&&setTimeout(()=>{Wg(this,ru,Xg).call(this)},this.options.reconnectTimeout)}),er(this,ci).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&&er(this,go).has(n.id)){const{resolve:i,timeout:s}=er(this,go).get(n.id);clearTimeout(s),i(n)}else if("params"in n){const{params:i}=n;er(this,ka).forEach(s=>{s.subscriptionId===i.subscription&&i.subscription===s.subscriptionId&&s.onMessage(i.result)})}})})),er(this,As))};Xg=async function(){var e;return(e=er(this,ci))==null||e.close(),mo(this,As,null),Promise.allSettled([...er(this,ka)].map(t=>t.subscribe(this)))};class P3{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 Yg=e=>{throw TypeError(e)},$d=(e,t,r)=>t.has(e)||Yg("Cannot "+r),Zr=(e,t,r)=>($d(e,t,"read from private field"),r?r.call(e):t.get(e)),gc=(e,t,r)=>t.has(e)?Yg("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),If=(e,t,r,n)=>($d(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),R3=(e,t,r)=>($d(e,t,"access private method"),r),fa,dn,ba,kf,Jg;class Zg{constructor(t){gc(this,kf),gc(this,fa,0),gc(this,dn),gc(this,ba),If(this,dn,t)}fetch(t,r){const n=Zr(this,dn).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;If(this,fa,Zr(this,fa)+1);const r=await this.fetch(((i=Zr(this,dn).rpc)==null?void 0:i.url)??Zr(this,dn).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":C3,"Client-Target-Api-Version":A3,"Client-Request-Method":t.method,...(s=Zr(this,dn).rpc)==null?void 0:s.headers},body:JSON.stringify({jsonrpc:"2.0",id:Zr(this,fa),method:t.method,params:t.params})});if(!r.ok)throw new Gg(`Unexpected status code: ${r.status}`,r.status,r.statusText);const n=await r.json();if("error"in n&&n.error!=null)throw new Nd(n.error.message,n.error.code);return n.result}async subscribe(t){const r=await R3(this,kf,Jg).call(this).subscribe(t);return async()=>!!await r()}}fa=new WeakMap;dn=new WeakMap;ba=new WeakMap;kf=new WeakSet;Jg=function(){var e;if(!Zr(this,ba)){const t=Zr(this,dn).WebSocketConstructor??WebSocket;if(!t)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");If(this,ba,new j3(((e=Zr(this,dn).websocket)==null?void 0:e.url)??Zr(this,dn).url,{WebSocketConstructor:t,...Zr(this,dn).websocket}))}return Zr(this,ba)};function Qg(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 N3(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 _=(y-h)*s+1>>>0,w=new Uint8Array(_);for(;h!==y;){let P=u[h],N=0;for(let F=_-1;(P!==0||N<f)&&F!==-1;F--,N++)P+=256*w[F]>>>0,w[F]=P%r>>>0,P=P/r>>>0;if(P!==0)throw new Error("Non-zero carry");f=N,h++}let A=_-f;for(;A!==_&&w[A]===0;)A++;let I=n.repeat(l);for(;A<_;++A)I+=e.charAt(w[A]);return I}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,_=new Uint8Array(y);for(;u[l];){let P=t[u.charCodeAt(l)];if(P===255)return;let N=0;for(let F=y-1;(P!==0||N<h)&&F!==-1;F--,N++)P+=r*_[F]>>>0,_[F]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");h=N,l++}let w=y-h;for(;w!==y&&_[w]===0;)w++;const A=new Uint8Array(f+(y-w));let I=f;for(;w!==y;)A[I++]=_[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 D3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const ev=N3(D3),Io=e=>ev.encode(e),wi=e=>ev.decode(e),$3=Io,B3=wi;function xn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const $l=8192;function zr(e){if(e.length<$l)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=$l){const n=e.slice(r,r+$l);t+=String.fromCharCode(...n)}return btoa(t)}const tv=zr,rv=xn;function ko(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 _i(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}const nv=_i,iv=ko;function Bd(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 L3(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 sv{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}=L3(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 ov(e,t){switch(t){case"base58":return Io(e);case"base64":return zr(e);case"hex":return _i(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function U3(e,t){switch(t){case"base58":return wi(e);case"base64":return xn(e);case"hex":return ko(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function Ld(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 av{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 Bl(BigInt(t),8).forEach(r=>this.write8(r)),this}write128(t){return Bl(BigInt(t),16).forEach(r=>this.write8(r)),this}write256(t){return Bl(BigInt(t),32).forEach(r=>this.write8(r)),this}writeULEB(t){return Bd(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 ov(this.toBytes(),t)}}function Bl(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 cv=e=>{throw TypeError(e)},uv=(e,t,r)=>t.has(e)||cv("Cannot "+r),hn=(e,t,r)=>(uv(e,t,"read from private field"),r?r.call(e):t.get(e)),nu=(e,t,r)=>t.has(e)?cv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),iu=(e,t,r,n)=>(uv(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),eo,da,kc,Ri;const F3=class lv{constructor(t){nu(this,eo),nu(this,da),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),iu(this,eo,t.write),iu(this,da,t.serialize??((r,n)=>{const i=new av({initialSize:this.serializedSize(r)??void 0,...n});return hn(this,eo).call(this,r,i),i.toBytes()})),this.validate=t.validate??(()=>{})}write(t,r){this.validate(t),hn(this,eo).call(this,t,r)}serialize(t,r){return this.validate(t),new dv(this,hn(this,da).call(this,t,r))}parse(t){const r=new sv(t);return this.read(r)}fromHex(t){return this.parse(ko(t))}fromBase58(t){return this.parse(wi(t))}fromBase64(t){return this.parse(xn(t))}transform({name:t,input:r,output:n,validate:i}){return new lv({name:t??this.name,read:s=>n(this.read(s)),write:(s,o)=>hn(this,eo).call(this,r(s),o),serializedSize:s=>this.serializedSize(r(s)),serialize:(s,o)=>hn(this,da).call(this,r(s),o),validate:s=>{i==null||i(s),this.validate(r(s))}})}};eo=new WeakMap;da=new WeakMap;let Bn=F3;const fv=Symbol.for("@mysten/serialized-bcs");function z3(e){return!!e&&typeof e=="object"&&e[fv]===!0}class dv{constructor(t,r){nu(this,kc),nu(this,Ri),iu(this,kc,t),iu(this,Ri,r)}get[fv](){return!0}toBytes(){return hn(this,Ri)}toHex(){return _i(hn(this,Ri))}toBase64(){return zr(hn(this,Ri))}toBase58(){return Io(hn(this,Ri))}parse(){return hn(this,kc).parse(hn(this,Ri))}}kc=new WeakMap;Ri=new WeakMap;function su({size:e,...t}){return new Bn({...t,serializedSize:()=>e})}function Ll({readMethod:e,writeMethod:t,...r}){return su({...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 Ul({readMethod:e,writeMethod:t,...r}){return su({...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 V3({serialize:e,...t}){const r=new Bn({...t,serialize:e,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function q3({toBytes:e,fromBytes:t,...r}){return new Bn({...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=Bd(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 G3(e){let t=null;function r(){return t||(t=e()),t}return new Bn({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 G={u8(e){return Ll({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...e})},u16(e){return Ll({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...e})},u32(e){return Ll({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e})},u64(e){return Ul({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e})},u128(e){return Ul({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e})},u256(e){return Ul({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e})},bool(e){return su({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 V3({name:"uleb128",read:t=>t.readULEB(),serialize:t=>Uint8Array.from(Bd(t)),...e})},bytes(e,t){return su({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 q3({name:"string",toBytes:t=>new TextEncoder().encode(t),fromBytes:t=>new TextDecoder().decode(t),...e})},fixedArray(e,t,r){return new Bn({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 G.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 Bn({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 Bn({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 Bn({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 Bn({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 G.vector(G.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 G3(e)}},H3=Object.freeze(Object.defineProperty({__proto__:null,BcsReader:sv,BcsType:Bn,BcsWriter:av,SerializedBcs:dv,bcs:G,decodeStr:U3,encodeStr:ov,fromB58:B3,fromB64:rv,fromBase58:wi,fromBase64:xn,fromHEX:iv,fromHex:ko,isSerializedBcs:z3,splitGenericParameters:Ld,toB58:$3,toB64:tv,toBase58:Io,toBase64:zr,toHEX:nv,toHex:_i},Symbol.toStringTag,{value:"Module"})),W3=32;function jf(e){try{return wi(e).length===W3}catch{return!1}}const zu=32;function ui(e){return X3(e)&&Y3(e)===zu}function ha(e){return ui(e)}function K3(e){return e.includes("::")?Ud(e):e}function Ud(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("<")?Ld(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>K3(o.trim())):[];return{address:Nr(t),module:r,name:i,typeParams:s}}function hv(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?Ud(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:hv(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function Nr(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(zu*2,"0")}`}function hi(e,t=!1){return Nr(e,t)}function X3(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function Y3(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}const J3=/^vector<(.+)>$/,Z3=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;let rp=class to{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(J3);if(n)return{vector:to.parseFromStr(n[1],r)};const i=t.match(Z3);if(i)return{struct:{address:r?Nr(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:to.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return Ld(t).map(n=>to.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<${to.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(to.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}};function Q3(e){return G.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function eS(e){return G.enum("Option",{None:null,Some:e})}const Zt=G.bytes(zu).transform({validate:e=>{const t=typeof e=="string"?e:_i(e);if(!t||!ui(Nr(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?ko(Nr(e)):e,output:e=>Nr(_i(e))}),gn=G.vector(G.u8()).transform({name:"ObjectDigest",input:e=>wi(e),output:e=>Io(new Uint8Array(e)),validate:e=>{if(wi(e).length!==32)throw new Error("ObjectDigest must be 32 bytes")}}),Yr=G.struct("SuiObjectRef",{objectId:Zt,version:G.u64(),digest:gn}),pv=G.struct("SharedObjectRef",{objectId:Zt,initialSharedVersion:G.u64(),mutable:G.bool()}),mv=G.enum("ObjectArg",{ImmOrOwnedObject:Yr,SharedObject:pv,Receiving:Yr}),gv=G.enum("CallArg",{Pure:G.struct("Pure",{bytes:G.vector(G.u8()).transform({input:e=>typeof e=="string"?xn(e):e,output:e=>zr(new Uint8Array(e))})}),Object:mv}),Fd=G.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:G.lazy(()=>Fd),struct:G.lazy(()=>xv),u16:null,u32:null,u256:null}),zd=Fd.transform({input:e=>typeof e=="string"?rp.parseFromStr(e,!0):e,output:e=>rp.tagToString(e)}),Pn=G.enum("Argument",{GasCoin:null,Input:G.u16(),Result:G.u16(),NestedResult:G.tuple([G.u16(),G.u16()])}),vv=G.struct("ProgrammableMoveCall",{package:Zt,module:G.string(),function:G.string(),typeArguments:G.vector(zd),arguments:G.vector(Pn)}),yv=G.enum("Command",{MoveCall:vv,TransferObjects:G.struct("TransferObjects",{objects:G.vector(Pn),address:Pn}),SplitCoins:G.struct("SplitCoins",{coin:Pn,amounts:G.vector(Pn)}),MergeCoins:G.struct("MergeCoins",{destination:Pn,sources:G.vector(Pn)}),Publish:G.struct("Publish",{modules:G.vector(G.vector(G.u8()).transform({input:e=>typeof e=="string"?xn(e):e,output:e=>zr(new Uint8Array(e))})),dependencies:G.vector(Zt)}),MakeMoveVec:G.struct("MakeMoveVec",{type:eS(zd).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:G.vector(Pn)}),Upgrade:G.struct("Upgrade",{modules:G.vector(G.vector(G.u8()).transform({input:e=>typeof e=="string"?xn(e):e,output:e=>zr(new Uint8Array(e))})),dependencies:G.vector(Zt),package:Zt,ticket:Pn})}),bv=G.struct("ProgrammableTransaction",{inputs:G.vector(gv),commands:G.vector(yv)}),wv=G.enum("TransactionKind",{ProgrammableTransaction:bv,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),_v=G.enum("TransactionExpiration",{None:null,Epoch:Q3()}),xv=G.struct("StructTag",{address:Zt,module:G.string(),name:G.string(),typeParams:G.vector(Fd)}),Sv=G.struct("GasData",{payment:G.vector(Yr),owner:Zt,price:G.u64(),budget:G.u64()}),Ev=G.struct("TransactionDataV1",{kind:wv,sender:Zt,gasData:Sv,expiration:_v}),Mv=G.enum("TransactionData",{V1:Ev}),Cv=G.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),Av=G.enum("IntentVersion",{V0:null}),Tv=G.enum("AppId",{Sui:null}),Ov=G.struct("Intent",{scope:Cv,version:Av,appId:Tv});function Iv(e){return G.struct(`IntentMessage<${e.name}>`,{intent:Ov,value:e})}const kv=G.enum("CompressedSignature",{ED25519:G.fixedArray(64,G.u8()),Secp256k1:G.fixedArray(64,G.u8()),Secp256r1:G.fixedArray(64,G.u8()),ZkLogin:G.vector(G.u8())}),jv=G.enum("PublicKey",{ED25519:G.fixedArray(32,G.u8()),Secp256k1:G.fixedArray(33,G.u8()),Secp256r1:G.fixedArray(33,G.u8()),ZkLogin:G.vector(G.u8())}),Pv=G.struct("MultiSigPkMap",{pubKey:jv,weight:G.u8()}),Rv=G.struct("MultiSigPublicKey",{pk_map:G.vector(Pv),threshold:G.u16()}),tS=G.struct("MultiSig",{sigs:G.vector(kv),bitmap:G.u16(),multisig_pk:Rv}),rS=G.vector(G.u8()).transform({input:e=>typeof e=="string"?xn(e):e,output:e=>zr(new Uint8Array(e))}),Nv=G.struct("SenderSignedTransaction",{intentMessage:Iv(Mv),txSignatures:G.vector(rS)}),nS=G.vector(Nv,{name:"SenderSignedData"}),iS=G.struct("PasskeyAuthenticator",{authenticatorData:G.vector(G.u8()),clientDataJson:G.string(),userSignature:G.vector(G.u8())}),sS=G.enum("PackageUpgradeError",{UnableToFetchPackage:G.struct("UnableToFetchPackage",{packageId:Zt}),NotAPackage:G.struct("NotAPackage",{objectId:Zt}),IncompatibleUpgrade:null,DigestDoesNotMatch:G.struct("DigestDoesNotMatch",{digest:G.vector(G.u8())}),UnknownUpgradePolicy:G.struct("UnknownUpgradePolicy",{policy:G.u8()}),PackageIDDoesNotMatch:G.struct("PackageIDDoesNotMatch",{packageId:Zt,ticketId:Zt})}),oS=G.struct("ModuleId",{address:Zt,name:G.string()}),np=G.struct("MoveLocation",{module:oS,function:G.u16(),instruction:G.u16(),functionName:G.option(G.string())}),aS=G.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:G.struct("IndexOutOfBounds",{idx:G.u16()}),SecondaryIndexOutOfBounds:G.struct("SecondaryIndexOutOfBounds",{resultIdx:G.u16(),secondaryIdx:G.u16()}),InvalidResultArity:G.struct("InvalidResultArity",{resultIdx:G.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),cS=G.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),uS=G.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:G.struct("MoveObjectTooBig",{objectSize:G.u64(),maxObjectSize:G.u64()}),MovePackageTooBig:G.struct("MovePackageTooBig",{objectSize:G.u64(),maxObjectSize:G.u64()}),CircularObjectOwnership:G.struct("CircularObjectOwnership",{object:Zt}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:G.option(np),MoveAbort:G.tuple([np,G.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:G.struct("CommandArgumentError",{argIdx:G.u16(),kind:aS}),TypeArgumentError:G.struct("TypeArgumentError",{argumentIdx:G.u16(),kind:cS}),UnusedValueWithoutDrop:G.struct("UnusedValueWithoutDrop",{resultIdx:G.u16(),secondaryIdx:G.u16()}),InvalidPublicFunctionReturnType:G.struct("InvalidPublicFunctionReturnType",{idx:G.u16()}),InvalidTransferObject:null,EffectsTooLarge:G.struct("EffectsTooLarge",{currentSize:G.u64(),maxSize:G.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:G.struct("PackageUpgradeError",{upgradeError:sS}),WrittenObjectsTooLarge:G.struct("WrittenObjectsTooLarge",{currentSize:G.u64(),maxSize:G.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:G.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:G.vector(Zt)}),AddressDeniedForCoin:G.struct("AddressDeniedForCoin",{address:Zt,coinType:G.string()}),CoinTypeGlobalPause:G.struct("CoinTypeGlobalPause",{coinType:G.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),Dv=G.enum("ExecutionStatus",{Success:null,Failed:G.struct("ExecutionFailed",{error:uS,command:G.option(G.u64())})}),$v=G.struct("GasCostSummary",{computationCost:G.u64(),storageCost:G.u64(),storageRebate:G.u64(),nonRefundableStorageFee:G.u64()}),so=G.enum("Owner",{AddressOwner:Zt,ObjectOwner:Zt,Shared:G.struct("Shared",{initialSharedVersion:G.u64()}),Immutable:null}),lS=G.struct("TransactionEffectsV1",{status:Dv,executedEpoch:G.u64(),gasUsed:$v,modifiedAtVersions:G.vector(G.tuple([Zt,G.u64()])),sharedObjects:G.vector(Yr),transactionDigest:gn,created:G.vector(G.tuple([Yr,so])),mutated:G.vector(G.tuple([Yr,so])),unwrapped:G.vector(G.tuple([Yr,so])),deleted:G.vector(Yr),unwrappedThenDeleted:G.vector(Yr),wrapped:G.vector(Yr),gasObject:G.tuple([Yr,so]),eventsDigest:G.option(gn),dependencies:G.vector(gn)}),Vd=G.tuple([G.u64(),gn]),fS=G.enum("ObjectIn",{NotExist:null,Exist:G.tuple([Vd,so])}),dS=G.enum("ObjectOut",{NotExist:null,ObjectWrite:G.tuple([gn,so]),PackageWrite:Vd}),hS=G.enum("IDOperation",{None:null,Created:null,Deleted:null}),pS=G.struct("EffectsObjectChange",{inputState:fS,outputState:dS,idOperation:hS}),mS=G.enum("UnchangedSharedKind",{ReadOnlyRoot:Vd,MutateDeleted:G.u64(),ReadDeleted:G.u64(),Cancelled:G.u64(),PerEpochConfig:null}),gS=G.struct("TransactionEffectsV2",{status:Dv,executedEpoch:G.u64(),gasUsed:$v,transactionDigest:gn,gasObjectIndex:G.option(G.u32()),eventsDigest:G.option(gn),dependencies:G.vector(gn),lamportVersion:G.u64(),changedObjects:G.vector(G.tuple([Zt,pS])),unchangedSharedObjects:G.vector(G.tuple([Zt,mS])),auxDataDigest:G.option(gn)}),vS=G.enum("TransactionEffects",{V1:lS,V2:gS}),Fl={...G,U8:G.u8(),U16:G.u16(),U32:G.u32(),U64:G.u64(),U128:G.u128(),U256:G.u256(),ULEB128:G.uleb128(),Bool:G.bool(),String:G.string(),Address:Zt,AppId:Tv,Argument:Pn,CallArg:gv,CompressedSignature:kv,GasData:Sv,Intent:Ov,IntentMessage:Iv,IntentScope:Cv,IntentVersion:Av,MultiSig:tS,MultiSigPkMap:Pv,MultiSigPublicKey:Rv,ObjectArg:mv,ObjectDigest:gn,ProgrammableMoveCall:vv,ProgrammableTransaction:bv,PublicKey:jv,SenderSignedData:nS,SenderSignedTransaction:Nv,SharedObjectRef:pv,StructTag:xv,SuiObjectRef:Yr,Command:yv,TransactionData:Mv,TransactionDataV1:Ev,TransactionExpiration:_v,TransactionKind:wv,TypeTag:zd,TransactionEffects:vS,PasskeyAuthenticator:iS},Bv="…";function yS(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${Bv}${e.slice(-4)}`}function bS(e){return`${e.slice(0,10)}${Bv}`}const Lv=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,Uv=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,wS=235;function Fv(e){return e.length>wS?!1:e.includes("@")?Lv.test(e):Uv.test(e)}function zv(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!Lv.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!Uv.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 _S=9,xS=BigInt(1e9),SS="0x1",Vv="0x2",ES="0x3",MS=hi("0x6"),CS="sui_system",qd=`${Vv}::sui::SUI`,AS=hi("0x5"),TS=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,OS=/^\d+$/,IS=64,qv="/",Gv=e=>{const t=e.split(qv);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!OS.test(i)||!Fv(r)?!1:TS.test(n)&&n.length<IS},kS=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(qv)&&!Gv(r))return!1;return!0};function zl(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function jS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Hv(e,...t){if(!jS(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 ip(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 PS(e,t){Hv(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 ou=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),gs=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),Wv=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,oi=gs?e=>e:e=>Wv(e);function Vs(e){for(let t=0;t<e.length;t++)e[t]=Wv(e[t])}function RS(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function wa(e){return typeof e=="string"&&(e=RS(e)),Hv(e),e}let NS=class{clone(){return this._cloneInto()}};function DS(e){const t=(n,i)=>e(i).update(wa(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}const $S=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 BS extends NS{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,zl(t),zl(r),zl(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=ou(this.buffer)}update(t){ip(this);const{blockLen:r,buffer:n,buffer32:i}=this;t=wa(t);const s=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<s;){this.pos===r&&(gs||Vs(i),this.compress(i,0,!1),gs||Vs(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));gs||Vs(f);for(let h=0;c+r<s;h+=i.length,c+=r)this.length+=r,this.compress(f,h,!1);gs||Vs(f);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(t){ip(this),PS(t,this);const{pos:r,buffer32:n}=this;this.finished=!0,this.buffer.subarray(r).fill(0),gs||Vs(n),this.compress(n,0,!0),gs||Vs(n);const i=ou(t);this.get().forEach((s,o)=>i[o]=oi(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),Pf=BigInt(32);function Kv(e,t=!1){return t?{h:Number(e&vc),l:Number(e>>Pf&vc)}:{h:Number(e>>Pf&vc)|0,l:Number(e&vc)|0}}function LS(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}=Kv(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]}const US=(e,t)=>BigInt(e>>>0)<<Pf|BigInt(t>>>0),FS=(e,t,r)=>e>>>r,zS=(e,t,r)=>e<<32-r|t>>>r,VS=(e,t,r)=>e>>>r|t<<32-r,qS=(e,t,r)=>e<<32-r|t>>>r,GS=(e,t,r)=>e<<64-r|t>>>r-32,HS=(e,t,r)=>e>>>r-32|t<<64-r,WS=(e,t)=>t,KS=(e,t)=>e,XS=(e,t,r)=>e<<r|t>>>32-r,YS=(e,t,r)=>t<<r|e>>>32-r,JS=(e,t,r)=>t<<r-32|e>>>64-r,ZS=(e,t,r)=>e<<r-32|t>>>64-r;function QS(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const eE=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),tE=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,rE=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),nE=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,iE=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),sE=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,oE={fromBig:Kv,split:LS,toBig:US,shrSH:FS,shrSL:zS,rotrSH:VS,rotrSL:qS,rotrBH:GS,rotrBL:HS,rotr32H:WS,rotr32L:KS,rotlSH:XS,rotlSL:YS,rotlBH:JS,rotlBL:ZS,add:QS,add3L:eE,add3H:tE,add4L:rE,add4H:nE,add5H:sE,add5L:iE},Ir=oE,ur=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),ke=new Uint32Array(32);function ki(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=ke[2*e],u=ke[2*e+1],l=ke[2*t],f=ke[2*t+1],h=ke[2*r],y=ke[2*r+1],_=ke[2*n],w=ke[2*n+1],A=Ir.add3L(c,l,o);u=Ir.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:_}={Dh:w^u,Dl:_^c},{Dh:w,Dl:_}={Dh:Ir.rotr32H(w,_),Dl:Ir.rotr32L(w,_)},{h:y,l:h}=Ir.add(y,h,w,_),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Ir.rotrSH(f,l,24),Bl:Ir.rotrSL(f,l,24)},ke[2*e]=c,ke[2*e+1]=u,ke[2*t]=l,ke[2*t+1]=f,ke[2*r]=h,ke[2*r+1]=y,ke[2*n]=_,ke[2*n+1]=w}function ji(e,t,r,n,i,s){const o=i[s],a=i[s+1];let c=ke[2*e],u=ke[2*e+1],l=ke[2*t],f=ke[2*t+1],h=ke[2*r],y=ke[2*r+1],_=ke[2*n],w=ke[2*n+1],A=Ir.add3L(c,l,o);u=Ir.add3H(A,u,f,a),c=A|0,{Dh:w,Dl:_}={Dh:w^u,Dl:_^c},{Dh:w,Dl:_}={Dh:Ir.rotrSH(w,_,16),Dl:Ir.rotrSL(w,_,16)},{h:y,l:h}=Ir.add(y,h,w,_),{Bh:f,Bl:l}={Bh:f^y,Bl:l^h},{Bh:f,Bl:l}={Bh:Ir.rotrBH(f,l,63),Bl:Ir.rotrBL(f,l,63)},ke[2*e]=c,ke[2*e+1]=u,ke[2*t]=l,ke[2*t+1]=f,ke[2*r]=h,ke[2*r+1]=y,ke[2*n]=_,ke[2*n+1]=w}class Xv extends BS{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=ur[0]|0,this.v0h=ur[1]|0,this.v1l=ur[2]|0,this.v1h=ur[3]|0,this.v2l=ur[4]|0,this.v2h=ur[5]|0,this.v3l=ur[6]|0,this.v3h=ur[7]|0,this.v4l=ur[8]|0,this.v4h=ur[9]|0,this.v5l=ur[10]|0,this.v5h=ur[11]|0,this.v6l=ur[12]|0,this.v6h=ur[13]|0,this.v7l=ur[14]|0,this.v7h=ur[15]|0;const r=t.key?t.key.length:0;if(this.v0l^=this.outputLen|r<<8|65536|1<<24,t.salt){const n=ou(wa(t.salt));this.v4l^=oi(n[0]),this.v4h^=oi(n[1]),this.v5l^=oi(n[2]),this.v5h^=oi(n[3])}if(t.personalization){const n=ou(wa(t.personalization));this.v6l^=oi(n[0]),this.v6h^=oi(n[1]),this.v7l^=oi(n[2]),this.v7h^=oi(n[3])}if(t.key){const n=new Uint8Array(this.blockLen);n.set(wa(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:_,v7l:w,v7h:A}=this;return[t,r,n,i,s,o,a,c,u,l,f,h,y,_,w,A]}set(t,r,n,i,s,o,a,c,u,l,f,h,y,_,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=_|0,this.v7l=w|0,this.v7h=A|0}compress(t,r,n){this.get().forEach((c,u)=>ke[u]=c),ke.set(ur,16);let{h:i,l:s}=Ir.fromBig(BigInt(this.length));ke[24]=ur[8]^s,ke[25]=ur[9]^i,n&&(ke[28]=~ke[28],ke[29]=~ke[29]);let o=0;const a=$S;for(let c=0;c<12;c++)ki(0,4,8,12,t,r+2*a[o++]),ji(0,4,8,12,t,r+2*a[o++]),ki(1,5,9,13,t,r+2*a[o++]),ji(1,5,9,13,t,r+2*a[o++]),ki(2,6,10,14,t,r+2*a[o++]),ji(2,6,10,14,t,r+2*a[o++]),ki(3,7,11,15,t,r+2*a[o++]),ji(3,7,11,15,t,r+2*a[o++]),ki(0,5,10,15,t,r+2*a[o++]),ji(0,5,10,15,t,r+2*a[o++]),ki(1,6,11,12,t,r+2*a[o++]),ji(1,6,11,12,t,r+2*a[o++]),ki(2,7,8,13,t,r+2*a[o++]),ji(2,7,8,13,t,r+2*a[o++]),ki(3,4,9,14,t,r+2*a[o++]),ji(3,4,9,14,t,r+2*a[o++]);this.v0l^=ke[0]^ke[16],this.v0h^=ke[1]^ke[17],this.v1l^=ke[2]^ke[18],this.v1h^=ke[3]^ke[19],this.v2l^=ke[4]^ke[20],this.v2h^=ke[5]^ke[21],this.v3l^=ke[6]^ke[22],this.v3h^=ke[7]^ke[23],this.v4l^=ke[8]^ke[24],this.v4h^=ke[9]^ke[25],this.v5l^=ke[10]^ke[26],this.v5h^=ke[11]^ke[27],this.v6l^=ke[12]^ke[28],this.v6h^=ke[13]^ke[29],this.v7l^=ke[14]^ke[30],this.v7h^=ke[15]^ke[31],ke.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 Yv=DS(e=>new Xv(e)),aE=Object.freeze(Object.defineProperty({__proto__:null,BLAKE2b:Xv,blake2b:Yv},Symbol.toStringTag,{value:"Module"}));function cE(e,t,r){const n=Fl.Address.serialize(e).toBytes(),i=Fl.TypeTag.serialize(t).toBytes(),s=Fl.u64().serialize(r.length).toBytes(),o=Yv.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${_i(o.digest().slice(0,32))}`}const uE=Object.freeze(Object.defineProperty({__proto__:null,MIST_PER_SUI:xS,MOVE_STDLIB_ADDRESS:SS,SUI_ADDRESS_LENGTH:zu,SUI_CLOCK_OBJECT_ID:MS,SUI_DECIMALS:_S,SUI_FRAMEWORK_ADDRESS:Vv,SUI_SYSTEM_ADDRESS:ES,SUI_SYSTEM_MODULE_NAME:CS,SUI_SYSTEM_STATE_OBJECT_ID:AS,SUI_TYPE_ARG:qd,deriveDynamicFieldID:cE,formatAddress:yS,formatDigest:bS,fromB64:rv,fromBase58:wi,fromBase64:xn,fromHEX:iv,fromHex:ko,isValidNamedPackage:Gv,isValidNamedType:kS,isValidSuiAddress:ui,isValidSuiNSName:Fv,isValidSuiObjectId:ha,isValidTransactionDigest:jf,normalizeStructTag:hv,normalizeSuiAddress:Nr,normalizeSuiNSName:zv,normalizeSuiObjectId:hi,parseStructTag:Ud,toB64:tv,toBase58:Io,toBase64:zr,toHEX:nv,toHex:_i},Symbol.toStringTag,{value:"Module"}));var Gd=Object.defineProperty,lE=Object.getOwnPropertyDescriptor,fE=Object.getOwnPropertyNames,dE=Object.prototype.hasOwnProperty,hE=(e,t)=>{for(var r in t)Gd(e,r,{get:t[r],enumerable:!0})},pE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fE(t))!dE.call(e,i)&&i!==r&&Gd(e,i,{get:()=>t[i],enumerable:!(n=lE(t,i))||n.enumerable});return e},mE=e=>pE(Gd({},"__esModule",{value:!0}),e),Jv={};hE(Jv,{BIC_REGEX:()=>Qv,CUID2_REGEX:()=>e1,DECIMAL_REGEX:()=>t1,EMAIL_REGEX:()=>r1,EMOJI_REGEX:()=>n1,HEXADECIMAL_REGEX:()=>i1,HEX_COLOR_REGEX:()=>s1,IMEI_REGEX:()=>o1,IPV4_REGEX:()=>a1,IPV6_REGEX:()=>c1,IP_REGEX:()=>u1,ISO_DATE_REGEX:()=>l1,ISO_DATE_TIME_REGEX:()=>f1,ISO_TIMESTAMP_REGEX:()=>p1,ISO_TIME_REGEX:()=>d1,ISO_TIME_SECOND_REGEX:()=>h1,ISO_WEEK_REGEX:()=>m1,MAC48_REGEX:()=>g1,MAC64_REGEX:()=>v1,MAC_REGEX:()=>y1,OCTAL_REGEX:()=>b1,ULID_REGEX:()=>w1,UUID_REGEX:()=>_1,ValiError:()=>Vu,_addIssue:()=>le,_isLuhnAlgo:()=>Hd,_isValidObjectKey:()=>$s,_stringify:()=>Pr,any:()=>tb,array:()=>rb,arrayAsync:()=>nb,awaitAsync:()=>Zv,bic:()=>C1,bigint:()=>ib,blob:()=>sb,boolean:()=>ob,brand:()=>A1,bytes:()=>T1,check:()=>O1,checkAsync:()=>I1,checkItems:()=>k1,config:()=>PE,creditCard:()=>j1,cuid2:()=>P1,custom:()=>ab,customAsync:()=>cb,date:()=>ub,decimal:()=>R1,deleteGlobalConfig:()=>vE,deleteGlobalMessage:()=>bE,deleteSchemaMessage:()=>_E,deleteSpecificMessage:()=>SE,email:()=>N1,emoji:()=>D1,empty:()=>$1,endsWith:()=>B1,entriesFromList:()=>ME,enum:()=>Bf,enum_:()=>Bf,everyItem:()=>L1,excludes:()=>U1,fallback:()=>RE,fallbackAsync:()=>NE,file:()=>lb,filterItems:()=>F1,findItem:()=>z1,finite:()=>V1,flatten:()=>DE,forward:()=>$E,forwardAsync:()=>BE,function:()=>Lf,function_:()=>Lf,getDefault:()=>Ci,getDefaults:()=>Rf,getDefaultsAsync:()=>Nf,getDotPath:()=>M1,getFallback:()=>tc,getFallbacks:()=>Df,getFallbacksAsync:()=>$f,getGlobalConfig:()=>ec,getGlobalMessage:()=>x1,getSchemaMessage:()=>S1,getSpecificMessage:()=>E1,hash:()=>q1,hexColor:()=>H1,hexadecimal:()=>G1,imei:()=>W1,includes:()=>K1,instance:()=>fb,integer:()=>X1,intersect:()=>db,intersectAsync:()=>hb,ip:()=>Y1,ipv4:()=>J1,ipv6:()=>Z1,is:()=>LE,isOfKind:()=>CE,isOfType:()=>AE,isValiError:()=>TE,isoDate:()=>Q1,isoDateTime:()=>ey,isoTime:()=>ty,isoTimeSecond:()=>ry,isoTimestamp:()=>ny,isoWeek:()=>iy,keyof:()=>UE,lazy:()=>pb,lazyAsync:()=>mb,length:()=>sy,literal:()=>gb,looseObject:()=>vb,looseObjectAsync:()=>yb,looseTuple:()=>bb,looseTupleAsync:()=>wb,mac:()=>oy,mac48:()=>ay,mac64:()=>cy,map:()=>_b,mapAsync:()=>xb,mapItems:()=>uy,maxBytes:()=>ly,maxLength:()=>fy,maxSize:()=>dy,maxValue:()=>hy,mimeType:()=>py,minBytes:()=>my,minLength:()=>gy,minSize:()=>vy,minValue:()=>yy,multipleOf:()=>by,nan:()=>Sb,never:()=>Eb,nonEmpty:()=>wy,nonNullable:()=>Mb,nonNullableAsync:()=>Cb,nonNullish:()=>Ab,nonNullishAsync:()=>Tb,nonOptional:()=>Wd,nonOptionalAsync:()=>Kd,normalize:()=>_y,notBytes:()=>xy,notLength:()=>Sy,notSize:()=>Ey,notValue:()=>My,null:()=>Uf,null_:()=>Uf,nullable:()=>Ob,nullableAsync:()=>Ib,nullish:()=>kb,nullishAsync:()=>jb,number:()=>Pb,object:()=>Rb,objectAsync:()=>Nb,objectWithRest:()=>Db,objectWithRestAsync:()=>$b,octal:()=>Cy,omit:()=>FE,optional:()=>Xd,optionalAsync:()=>Yd,parse:()=>iw,parseAsync:()=>sw,parser:()=>zE,parserAsync:()=>VE,partial:()=>qE,partialAsync:()=>GE,partialCheck:()=>Ty,partialCheckAsync:()=>Oy,pick:()=>HE,picklist:()=>Jd,pipe:()=>WE,pipeAsync:()=>KE,promise:()=>Bb,rawCheck:()=>Iy,rawCheckAsync:()=>ky,rawTransform:()=>jy,rawTransformAsync:()=>Py,readonly:()=>Ry,record:()=>Lb,recordAsync:()=>Ub,reduceItems:()=>Ny,regex:()=>Dy,required:()=>XE,requiredAsync:()=>YE,safeInteger:()=>$y,safeParse:()=>ow,safeParseAsync:()=>aw,safeParser:()=>JE,safeParserAsync:()=>ZE,set:()=>Fb,setAsync:()=>zb,setGlobalConfig:()=>gE,setGlobalMessage:()=>yE,setSchemaMessage:()=>wE,setSpecificMessage:()=>xE,size:()=>By,someItem:()=>Ly,sortItems:()=>Uy,startsWith:()=>Fy,strictObject:()=>Vb,strictObjectAsync:()=>qb,strictTuple:()=>Gb,strictTupleAsync:()=>Hb,string:()=>Wb,symbol:()=>Kb,toLowerCase:()=>zy,toMaxValue:()=>Vy,toMinValue:()=>qy,toUpperCase:()=>Gy,transform:()=>Hy,transformAsync:()=>Wy,trim:()=>Ky,trimEnd:()=>Xy,trimStart:()=>Yy,tuple:()=>Xb,tupleAsync:()=>Yb,tupleWithRest:()=>Jb,tupleWithRestAsync:()=>Zb,ulid:()=>Jy,undefined:()=>Ff,undefined_:()=>Ff,union:()=>Qb,unionAsync:()=>ew,unknown:()=>tw,unwrap:()=>QE,url:()=>Zy,uuid:()=>Qy,value:()=>eb,variant:()=>rw,variantAsync:()=>nw,void:()=>zf,void_:()=>zf});var is=mE(Jv);function Zv(){return{kind:"transformation",type:"await",reference:Zv,async:!0,async _run(e){return e.value=await e.value,e}}}var Qv=/^[A-Z]{6}(?!00)[A-Z\d]{2}(?:[A-Z\d]{3})?$/u,e1=/^[a-z][\da-z]*$/u,t1=/^\d+$/u,r1=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,n1=/^[\p{Extended_Pictographic}\p{Emoji_Component}]+$/u,i1=/^(?:0h|0x)?[\da-f]+$/iu,s1=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/iu,o1=/^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u,a1=/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u,c1=/^(?:(?:[\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,u1=/^(?:(?:[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,l1=/^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u,f1=/^\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,d1=/^(?:0\d|1\d|2[0-3]):[0-5]\d$/u,h1=/^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u,p1=/^\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,m1=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u,g1=/^(?:[\da-f]{2}:){5}[\da-f]{2}$|^(?:[\da-f]{2}-){5}[\da-f]{2}$|^(?:[\da-f]{4}\.){2}[\da-f]{4}$/iu,v1=/^(?:[\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,y1=/^(?:[\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,b1=/^(?:0o)?[0-7]+$/iu,w1=/^[\da-hjkmnp-tv-z]{26}$/iu,_1=/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu,Xr;function gE(e){Xr={...Xr,...e}}function ec(e){return{lang:(e==null?void 0:e.lang)??(Xr==null?void 0:Xr.lang),message:e==null?void 0:e.message,abortEarly:(e==null?void 0:e.abortEarly)??(Xr==null?void 0:Xr.abortEarly),abortPipeEarly:(e==null?void 0:e.abortPipeEarly)??(Xr==null?void 0:Xr.abortPipeEarly)}}function vE(){Xr=void 0}var gi;function yE(e,t){gi||(gi=new Map),gi.set(t,e)}function x1(e){return gi==null?void 0:gi.get(e)}function bE(e){gi==null||gi.delete(e)}var vi;function wE(e,t){vi||(vi=new Map),vi.set(t,e)}function S1(e){return vi==null?void 0:vi.get(e)}function _E(e){vi==null||vi.delete(e)}var mn;function xE(e,t,r){mn||(mn=new Map),mn.get(e)||mn.set(e,new Map),mn.get(e).set(r,t)}function E1(e,t){var r;return(r=mn==null?void 0:mn.get(e))==null?void 0:r.get(t)}function SE(e,t){var r;(r=mn==null?void 0:mn.get(e))==null||r.delete(t)}function Pr(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)??Pr(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??E1(e.reference,c.lang)??(u?S1(c.lang):null)??n.message??x1(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 EE=/\D/gu;function Hd(e){const t=e.replace(EE,"");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 $s(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function ME(e,t){const r={};for(const n of e)r[n]=t;return r}function M1(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 CE(e,t){return t.kind===e}function AE(e,t){return t.type===e}function TE(e){return e instanceof Vu}var Vu=class extends Error{constructor(t){super(t[0].message);Q0(this,"issues");this.name="ValiError",this.issues=t}};function C1(e){return{kind:"validation",type:"bic",reference:C1,async:!1,expects:null,requirement:Qv,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"BIC",t,r),t}}}function A1(e){return{kind:"transformation",type:"brand",reference:A1,async:!1,name:e,_run(t){return t}}}function T1(e,t){return{kind:"validation",type:"bytes",reference:T1,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 O1(e,t){return{kind:"validation",type:"check",reference:O1,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 I1(e,t){return{kind:"validation",type:"check",reference:I1,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 k1(e,t){return{kind:"validation",type:"check_items",reference:k1,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 OE=/^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u,IE=/[- ]/gu,kE=[/^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 j1(e){return{kind:"validation",type:"credit_card",reference:j1,async:!1,expects:null,requirement(t){let r;return OE.test(t)&&(r=t.replace(IE,""))&&kE.some(n=>n.test(r))&&Hd(r)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"credit card",t,r),t}}}function P1(e){return{kind:"validation",type:"cuid2",reference:P1,async:!1,expects:null,requirement:e1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"Cuid2",t,r),t}}}function R1(e){return{kind:"validation",type:"decimal",reference:R1,async:!1,expects:null,requirement:t1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"decimal",t,r),t}}}function N1(e){return{kind:"validation",type:"email",reference:N1,expects:null,async:!1,requirement:r1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"email",t,r),t}}}function D1(e){return{kind:"validation",type:"emoji",reference:D1,async:!1,expects:null,requirement:n1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"emoji",t,r),t}}}function $1(e){return{kind:"validation",type:"empty",reference:$1,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 B1(e,t){return{kind:"validation",type:"ends_with",reference:B1,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 L1(e,t){return{kind:"validation",type:"every_item",reference:L1,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 U1(e,t){const r=Pr(e);return{kind:"validation",type:"excludes",reference:U1,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 F1(e){return{kind:"transformation",type:"filter_items",reference:F1,async:!1,operation:e,_run(t){return t.value=t.value.filter(this.operation),t}}}function z1(e){return{kind:"transformation",type:"find_item",reference:z1,async:!1,operation:e,_run(t){return t.value=t.value.find(this.operation),t}}}function V1(e){return{kind:"validation",type:"finite",reference:V1,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 jE={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 q1(e,t){return{kind:"validation",type:"hash",reference:q1,expects:null,async:!1,requirement:RegExp(e.map(r=>`^[a-f0-9]{${jE[r]}}$`).join("|"),"iu"),message:t,_run(r,n){return r.typed&&!this.requirement.test(r.value)&&le(this,"hash",r,n),r}}}function G1(e){return{kind:"validation",type:"hexadecimal",reference:G1,async:!1,expects:null,requirement:i1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hexadecimal",t,r),t}}}function H1(e){return{kind:"validation",type:"hex_color",reference:H1,async:!1,expects:null,requirement:s1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"hex color",t,r),t}}}function W1(e){return{kind:"validation",type:"imei",reference:W1,async:!1,expects:null,requirement(t){return o1.test(t)&&Hd(t)},message:e,_run(t,r){return t.typed&&!this.requirement(t.value)&&le(this,"IMEI",t,r),t}}}function K1(e,t){const r=Pr(e);return{kind:"validation",type:"includes",reference:K1,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 X1(e){return{kind:"validation",type:"integer",reference:X1,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 Y1(e){return{kind:"validation",type:"ip",reference:Y1,async:!1,expects:null,requirement:u1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IP",t,r),t}}}function J1(e){return{kind:"validation",type:"ipv4",reference:J1,async:!1,expects:null,requirement:a1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv4",t,r),t}}}function Z1(e){return{kind:"validation",type:"ipv6",reference:Z1,async:!1,expects:null,requirement:c1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"IPv6",t,r),t}}}function Q1(e){return{kind:"validation",type:"iso_date",reference:Q1,async:!1,expects:null,requirement:l1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date",t,r),t}}}function ey(e){return{kind:"validation",type:"iso_date_time",reference:ey,async:!1,expects:null,requirement:f1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"date-time",t,r),t}}}function ty(e){return{kind:"validation",type:"iso_time",reference:ty,async:!1,expects:null,requirement:d1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time",t,r),t}}}function ry(e){return{kind:"validation",type:"iso_time_second",reference:ry,async:!1,expects:null,requirement:h1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"time-second",t,r),t}}}function ny(e){return{kind:"validation",type:"iso_timestamp",reference:ny,async:!1,expects:null,requirement:p1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"timestamp",t,r),t}}}function iy(e){return{kind:"validation",type:"iso_week",reference:iy,async:!1,expects:null,requirement:m1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"week",t,r),t}}}function sy(e,t){return{kind:"validation",type:"length",reference:sy,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 oy(e){return{kind:"validation",type:"mac",reference:oy,async:!1,expects:null,requirement:y1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"MAC",t,r),t}}}function ay(e){return{kind:"validation",type:"mac48",reference:ay,async:!1,expects:null,requirement:g1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"48-bit MAC",t,r),t}}}function cy(e){return{kind:"validation",type:"mac64",reference:cy,async:!1,expects:null,requirement:v1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"64-bit MAC",t,r),t}}}function uy(e){return{kind:"transformation",type:"map_items",reference:uy,async:!1,operation:e,_run(t){return t.value=t.value.map(this.operation),t}}}function ly(e,t){return{kind:"validation",type:"max_bytes",reference:ly,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 fy(e,t){return{kind:"validation",type:"max_length",reference:fy,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 dy(e,t){return{kind:"validation",type:"max_size",reference:dy,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 hy(e,t){return{kind:"validation",type:"max_value",reference:hy,async:!1,expects:`<=${e instanceof Date?e.toJSON():Pr(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():Pr(r.value)}),r}}}function py(e,t){return{kind:"validation",type:"mime_type",reference:py,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 my(e,t){return{kind:"validation",type:"min_bytes",reference:my,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 gy(e,t){return{kind:"validation",type:"min_length",reference:gy,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 vy(e,t){return{kind:"validation",type:"min_size",reference:vy,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 yy(e,t){return{kind:"validation",type:"min_value",reference:yy,async:!1,expects:`>=${e instanceof Date?e.toJSON():Pr(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():Pr(r.value)}),r}}}function by(e,t){return{kind:"validation",type:"multiple_of",reference:by,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 wy(e){return{kind:"validation",type:"non_empty",reference:wy,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 _y(e){return{kind:"transformation",type:"normalize",reference:_y,async:!1,form:e,_run(t){return t.value=t.value.normalize(this.form),t}}}function xy(e,t){return{kind:"validation",type:"not_bytes",reference:xy,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 Sy(e,t){return{kind:"validation",type:"not_length",reference:Sy,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 Ey(e,t){return{kind:"validation",type:"not_size",reference:Ey,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 My(e,t){return{kind:"validation",type:"not_value",reference:My,async:!1,expects:e instanceof Date?`!${e.toJSON()}`:`!${Pr(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():Pr(r.value)}),r}}}function Cy(e){return{kind:"validation",type:"octal",reference:Cy,async:!1,expects:null,requirement:b1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"octal",t,r),t}}}function Ay(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 Ty(e,t,r){return{kind:"validation",type:"partial_check",reference:Ty,async:!1,expects:null,requirement:t,message:r,_run(n,i){return Ay(n,e)&&!this.requirement(n.value)&&le(this,"input",n,i),n}}}function Oy(e,t,r){return{kind:"validation",type:"partial_check",reference:Oy,async:!0,expects:null,requirement:t,message:r,async _run(n,i){return Ay(n,e)&&!await this.requirement(n.value)&&le(this,"input",n,i),n}}}function Iy(e){return{kind:"validation",type:"raw_check",reference:Iy,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 ky(e){return{kind:"validation",type:"raw_check",reference:ky,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 jy(e){return{kind:"transformation",type:"raw_transform",reference:jy,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 Py(e){return{kind:"transformation",type:"raw_transform",reference:Py,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 Ry(){return{kind:"transformation",type:"readonly",reference:Ry,async:!1,_run(e){return e}}}function Ny(e,t){return{kind:"transformation",type:"reduce_items",reference:Ny,async:!1,operation:e,initial:t,_run(r){return r.value=r.value.reduce(this.operation,this.initial),r}}}function Dy(e,t){return{kind:"validation",type:"regex",reference:Dy,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 $y(e){return{kind:"validation",type:"safe_integer",reference:$y,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 By(e,t){return{kind:"validation",type:"size",reference:By,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 Ly(e,t){return{kind:"validation",type:"some_item",reference:Ly,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 Uy(e){return{kind:"transformation",type:"sort_items",reference:Uy,async:!1,operation:e,_run(t){return t.value=t.value.sort(this.operation),t}}}function Fy(e,t){return{kind:"validation",type:"starts_with",reference:Fy,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 zy(){return{kind:"transformation",type:"to_lower_case",reference:zy,async:!1,_run(e){return e.value=e.value.toLowerCase(),e}}}function Vy(e){return{kind:"transformation",type:"to_max_value",reference:Vy,async:!1,requirement:e,_run(t){return t.value=t.value>this.requirement?this.requirement:t.value,t}}}function qy(e){return{kind:"transformation",type:"to_min_value",reference:qy,async:!1,requirement:e,_run(t){return t.value=t.value<this.requirement?this.requirement:t.value,t}}}function Gy(){return{kind:"transformation",type:"to_upper_case",reference:Gy,async:!1,_run(e){return e.value=e.value.toUpperCase(),e}}}function Hy(e){return{kind:"transformation",type:"transform",reference:Hy,async:!1,operation:e,_run(t){return t.value=this.operation(t.value),t}}}function Wy(e){return{kind:"transformation",type:"transform",reference:Wy,async:!0,operation:e,async _run(t){return t.value=await this.operation(t.value),t}}}function Ky(){return{kind:"transformation",type:"trim",reference:Ky,async:!1,_run(e){return e.value=e.value.trim(),e}}}function Xy(){return{kind:"transformation",type:"trim_end",reference:Xy,async:!1,_run(e){return e.value=e.value.trimEnd(),e}}}function Yy(){return{kind:"transformation",type:"trim_start",reference:Yy,async:!1,_run(e){return e.value=e.value.trimStart(),e}}}function Jy(e){return{kind:"validation",type:"ulid",reference:Jy,async:!1,expects:null,requirement:w1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"ULID",t,r),t}}}function Zy(e){return{kind:"validation",type:"url",reference:Zy,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 Qy(e){return{kind:"validation",type:"uuid",reference:Qy,async:!1,expects:null,requirement:_1,message:e,_run(t,r){return t.typed&&!this.requirement.test(t.value)&&le(this,"UUID",t,r),t}}}function eb(e,t){return{kind:"validation",type:"value",reference:eb,async:!1,expects:e instanceof Date?e.toJSON():Pr(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():Pr(r.value)}),r}}}function PE(e,t){return{...e,_run(r,n){return e._run(r,{...n,...t})}}}function tc(e,t,r){return typeof e.fallback=="function"?e.fallback(t,r):e.fallback}function RE(e,t){return{...e,fallback:t,_run(r,n){return e._run(r,n),r.issues?{typed:!0,value:tc(this,r,n)}:r}}}function NE(e,t){return{...e,fallback:t,async:!0,async _run(r,n){return e._run(r,n),r.issues?{typed:!0,value:await tc(this,r,n)}:r}}}function DE(e){const t={};for(const r of e)if(r.path){const n=M1(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 $E(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 BE(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 Ci(e,t,r){return typeof e.default=="function"?e.default(t,r):e.default}function Rf(e){if("entries"in e){const t={};for(const r in e.entries)t[r]=Rf(e.entries[r]);return t}return"items"in e?e.items.map(Rf):Ci(e)}async function Nf(e){return"entries"in e?Object.fromEntries(await Promise.all(Object.entries(e.entries).map(async([t,r])=>[t,await Nf(r)]))):"items"in e?Promise.all(e.items.map(Nf)):Ci(e)}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):tc(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)):tc(e)}function LE(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function tb(){return{kind:"schema",type:"any",reference:tb,expects:"any",async:!1,_run(e){return e.typed=!0,e}}}function rb(e,t){return{kind:"schema",type:"array",reference:rb,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 nb(e,t){return{kind:"schema",type:"array",reference:nb,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 ib(e){return{kind:"schema",type:"bigint",reference:ib,expects:"bigint",async:!1,message:e,_run(t,r){return typeof t.value=="bigint"?t.typed=!0:le(this,"type",t,r),t}}}function sb(e){return{kind:"schema",type:"blob",reference:sb,expects:"Blob",async:!1,message:e,_run(t,r){return t.value instanceof Blob?t.typed=!0:le(this,"type",t,r),t}}}function ob(e){return{kind:"schema",type:"boolean",reference:ob,expects:"boolean",async:!1,message:e,_run(t,r){return typeof t.value=="boolean"?t.typed=!0:le(this,"type",t,r),t}}}function ab(e,t){return{kind:"schema",type:"custom",reference:ab,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 cb(e,t){return{kind:"schema",type:"custom",reference:cb,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 ub(e){return{kind:"schema",type:"date",reference:ub,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 Bf(e,t){const r=Object.entries(e).filter(([n])=>isNaN(+n)).map(([,n])=>n);return{kind:"schema",type:"enum",reference:Bf,expects:r.map(Pr).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 lb(e){return{kind:"schema",type:"file",reference:lb,expects:"File",async:!1,message:e,_run(t,r){return t.value instanceof File?t.typed=!0:le(this,"type",t,r),t}}}function Lf(e){return{kind:"schema",type:"function",reference:Lf,expects:"Function",async:!1,message:e,_run(t,r){return typeof t.value=="function"?t.typed=!0:le(this,"type",t,r),t}}}function fb(e,t){return{kind:"schema",type:"instance",reference:fb,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 au(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=au(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=au(e[r],t[r]);if(n.issue)return n;e[r]=n.value}return{value:e}}}return{issue:!0}}function db(e,t){return{kind:"schema",type:"intersect",reference:db,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=au(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 hb(e,t){return{kind:"schema",type:"intersect",reference:hb,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=au(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 pb(e){return{kind:"schema",type:"lazy",reference:pb,expects:"unknown",async:!1,getter:e,_run(t,r){return this.getter(t.value)._run(t,r)}}}function mb(e){return{kind:"schema",type:"lazy",reference:mb,expects:"unknown",async:!0,getter:e,async _run(t,r){return(await this.getter(t.value))._run(t,r)}}}function gb(e,t){return{kind:"schema",type:"literal",reference:gb,expects:Pr(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 vb(e,t){return{kind:"schema",type:"loose_object",reference:vb,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)$s(i,o)&&!(o in this.entries)&&(r.value[o]=i[o])}else le(this,"type",r,n);return r}}}function yb(e,t){return{kind:"schema",type:"loose_object",reference:yb,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)$s(i,a)&&!(a in this.entries)&&(r.value[a]=i[a])}else le(this,"type",r,n);return r}}}function bb(e,t){return{kind:"schema",type:"loose_tuple",reference:bb,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 wb(e,t){return{kind:"schema",type:"loose_tuple",reference:wb,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 _b(e,t,r){return{kind:"schema",type:"map",reference:_b,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 xb(e,t,r){return{kind:"schema",type:"map",reference:xb,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 _ of f.issues)_.path?_.path.unshift(y):_.path=[y],(o=n.issues)==null||o.push(_);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 _ of h.issues)_.path?_.path.unshift(y):_.path=[y],(a=n.issues)==null||a.push(_);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 Sb(e){return{kind:"schema",type:"nan",reference:Sb,expects:"NaN",async:!1,message:e,_run(t,r){return Number.isNaN(t.value)?t.typed=!0:le(this,"type",t,r),t}}}function Eb(e){return{kind:"schema",type:"never",reference:Eb,expects:"never",async:!1,message:e,_run(t,r){return le(this,"type",t,r),t}}}function Mb(e,t){return{kind:"schema",type:"non_nullable",reference:Mb,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 Cb(e,t){return{kind:"schema",type:"non_nullable",reference:Cb,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 Ab(e,t){return{kind:"schema",type:"non_nullish",reference:Ab,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 Tb(e,t){return{kind:"schema",type:"non_nullish",reference:Tb,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 Wd(e,t){return{kind:"schema",type:"non_optional",reference:Wd,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 Kd(e,t){return{kind:"schema",type:"non_optional",reference:Kd,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 Uf(e){return{kind:"schema",type:"null",reference:Uf,expects:"null",async:!1,message:e,_run(t,r){return t.value===null?t.typed=!0:le(this,"type",t,r),t}}}function Ob(e,...t){const r={kind:"schema",type:"nullable",reference:Ob,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(n,i){return n.value===null&&("default"in this&&(n.value=Ci(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 Ib(e,...t){const r={kind:"schema",type:"nullable",reference:Ib,expects:`${e.expects} | null`,async:!0,wrapped:e,async _run(n,i){return n.value===null&&("default"in this&&(n.value=await Ci(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 kb(e,...t){const r={kind:"schema",type:"nullish",reference:kb,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=Ci(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 jb(e,...t){const r={kind:"schema",type:"nullish",reference:jb,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 Ci(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 Pb(e){return{kind:"schema",type:"number",reference:Pb,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 Rb(e,t){return{kind:"schema",type:"object",reference:Rb,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 Nb(e,t){return{kind:"schema",type:"object",reference:Nb,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 Db(e,t,r){return{kind:"schema",type:"object_with_rest",reference:Db,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($s(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 $b(e,t,r){return{kind:"schema",type:"object_with_rest",reference:$b,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])=>$s(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 _ of h.issues)_.path?_.path.unshift(y):_.path=[y],(o=n.issues)==null||o.push(_);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 _ of h.issues)_.path?_.path.unshift(y):_.path=[y],(a=n.issues)==null||a.push(_);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 Xd(e,...t){const r={kind:"schema",type:"optional",reference:Xd,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(n,i){return n.value===void 0&&("default"in this&&(n.value=Ci(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 Yd(e,...t){const r={kind:"schema",type:"optional",reference:Yd,expects:`${e.expects} | undefined`,async:!0,wrapped:e,async _run(n,i){return n.value===void 0&&("default"in this&&(n.value=await Ci(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 Jd(e,t){return{kind:"schema",type:"picklist",reference:Jd,expects:e.map(Pr).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 Bb(e){return{kind:"schema",type:"promise",reference:Bb,expects:"Promise",async:!1,message:e,_run(t,r){return t.value instanceof Promise?t.typed=!0:le(this,"type",t,r),t}}}function Lb(e,t,r){return{kind:"schema",type:"record",reference:Lb,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($s(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 Ub(e,t,r){return{kind:"schema",type:"record",reference:Ub,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])=>$s(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 _ of f.issues)_.path=[y],(o=n.issues)==null||o.push(_);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 _ of h.issues)_.path?_.path.unshift(y):_.path=[y],(a=n.issues)==null||a.push(_);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 Fb(e,t){return{kind:"schema",type:"set",reference:Fb,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 zb(e,t){return{kind:"schema",type:"set",reference:zb,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 Vb(e,t){return{kind:"schema",type:"strict_object",reference:Vb,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 qb(e,t){return{kind:"schema",type:"strict_object",reference:qb,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 Gb(e,t){return{kind:"schema",type:"strict_tuple",reference:Gb,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 Hb(e,t){return{kind:"schema",type:"strict_tuple",reference:Hb,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 Wb(e){return{kind:"schema",type:"string",reference:Wb,expects:"string",async:!1,message:e,_run(t,r){return typeof t.value=="string"?t.typed=!0:le(this,"type",t,r),t}}}function Kb(e){return{kind:"schema",type:"symbol",reference:Kb,expects:"symbol",async:!1,message:e,_run(t,r){return typeof t.value=="symbol"?t.typed=!0:le(this,"type",t,r),t}}}function Xb(e,t){return{kind:"schema",type:"tuple",reference:Xb,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 Yb(e,t){return{kind:"schema",type:"tuple",reference:Yb,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 Jb(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:Jb,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 Zb(e,t,r){return{kind:"schema",type:"tuple_with_rest",reference:Zb,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 _ of h.issues)_.path?_.path.unshift(y):_.path=[y],(o=n.issues)==null||o.push(_);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 _ of h.issues)_.path?_.path.unshift(y):_.path=[y],(a=n.issues)==null||a.push(_);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 Ff(e){return{kind:"schema",type:"undefined",reference:Ff,expects:"undefined",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function cu(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function Qb(e,t){return{kind:"schema",type:"union",reference:Qb,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:cu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:cu(o)})}return r}}}function ew(e,t){return{kind:"schema",type:"union",reference:ew,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:cu(s)}),r.typed=!0}else{if((o==null?void 0:o.length)===1)return o[0];le(this,"type",r,n,{issues:cu(o)})}return r}}}function tw(){return{kind:"schema",type:"unknown",reference:tw,expects:"unknown",async:!1,_run(e){return e.typed=!0,e}}}function Zd(e,t,r=new Set){for(const n of t)n.type==="variant"?Zd(e,n.options,r):r.add(n.entries[e].expects);return r}function rw(e,t,r){let n;return{kind:"schema",type:"variant",reference:rw,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=[...Zd(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 nw(e,t,r){let n;return{kind:"schema",type:"variant",reference:nw,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=[...Zd(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 zf(e){return{kind:"schema",type:"void",reference:zf,expects:"void",async:!1,message:e,_run(t,r){return t.value===void 0?t.typed=!0:le(this,"type",t,r),t}}}function UE(e,t){return Jd(Object.keys(e.entries),t)}function FE(e,t){const r={...e.entries};for(const n of t)delete r[n];return{...e,entries:r}}function iw(e,t,r){const n=e._run({typed:!1,value:t},ec(r));if(n.issues)throw new Vu(n.issues);return n.value}async function sw(e,t,r){const n=await e._run({typed:!1,value:t},ec(r));if(n.issues)throw new Vu(n.issues);return n.value}function zE(e,t){const r=n=>iw(e,n,t);return r.schema=e,r.config=t,r}function VE(e,t){const r=n=>sw(e,n,t);return r.schema=e,r.config=t,r}function qE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Xd(e.entries[n]):e.entries[n];return{...e,entries:r}}function GE(e,t){const r={};for(const n in e.entries)r[n]=!t||t.includes(n)?Yd(e.entries[n]):e.entries[n];return{...e,entries:r}}function HE(e,t){const r={};for(const n of t)r[n]=e.entries[n];return{...e,entries:r}}function WE(...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 KE(...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 XE(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)?Wd(e.entries[o],i):e.entries[o];return{...e,entries:s}}function YE(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)?Kd(e.entries[o],i):e.entries[o];return{...e,entries:s}}function ow(e,t,r){const n=e._run({typed:!1,value:t},ec(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}async function aw(e,t,r){const n=await e._run({typed:!1,value:t},ec(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}function JE(e,t){const r=n=>ow(e,n,t);return r.schema=e,r.config=t,r}function ZE(e,t){const r=n=>aw(e,n,t);return r.schema=e,r.config=t,r}function QE(e){return e.wrapped}const eM=Symbol.for("@mysten/transaction");function tM(e){return!!e&&typeof e=="object"&&e[eM]===!0}const cw=Symbol.for("@mysten/SuiClient");function rM(e){return typeof e=="object"&&e!==null&&e[cw]===!0}class ja{get[cw](){return!0}constructor(t){this.transport=t.transport??new Zg({url:t.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(t){if(!t.owner||!ui(Nr(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||!ui(Nr(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||!ui(Nr(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||!ui(Nr(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||!ui(Nr(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||!ha(hi(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||!ha(hi(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(!jf(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(!jf(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:zr(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||!ui(Nr(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||!ha(hi(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(tM(t.transactionBlock))t.transactionBlock.setSenderIfNotSet(t.sender),r=zr(await t.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if(typeof t.transactionBlock=="string")r=t.transactionBlock;else if(t.transactionBlock instanceof Uint8Array)r=zr(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:zr(t.transactionBlock)]})}async getDynamicFields(t){if(!t.parentId||!ha(hi(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=wi(t.digest);return _i(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=>zv(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 nM=Object.freeze(Object.defineProperty({__proto__:null,JsonRpcError:Nd,SuiClient:ja,SuiHTTPStatusError:Gg,SuiHTTPTransport:Zg,SuiHTTPTransportError:Rd,getFullnodeUrl:Qg,isSuiClient:rM},Symbol.toStringTag,{value:"Module"})),iM=Fu(nM),sM=Fu(uE),Tr=Fu(H3);var Qd=Object.defineProperty,oM=Object.getOwnPropertyDescriptor,aM=Object.getOwnPropertyNames,cM=Object.prototype.hasOwnProperty,uM=(e,t)=>{for(var r in t)Qd(e,r,{get:t[r],enumerable:!0})},lM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aM(t))!cM.call(e,i)&&i!==r&&Qd(e,i,{get:()=>t[i],enumerable:!(n=oM(t,i))||n.enumerable});return e},fM=e=>lM(Qd({},"__esModule",{value:!0}),e),uw={};uM(uw,{SUI_ADDRESS_LENGTH:()=>eh,isValidSuiAddress:()=>fw,isValidSuiObjectId:()=>pM,isValidTransactionDigest:()=>hM,normalizeStructTag:()=>dw,normalizeSuiAddress:()=>rh,normalizeSuiObjectId:()=>gM,parseStructTag:()=>th});var Hr=fM(uw),lw=Tr;const dM=32;function hM(e){try{return(0,lw.fromBase58)(e).length===dM}catch{return!1}}const eh=32;function fw(e){return vM(e)&&yM(e)===eh}function pM(e){return fw(e)}function mM(e){return e.includes("::")?th(e):e}function th(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,lw.splitGenericParameters)(n.slice(n.indexOf("<")+1,n.lastIndexOf(">"))).map(o=>mM(o.trim())):[];return{address:rh(t),module:r,name:i,typeParams:s}}function dw(e){const{address:t,module:r,name:n,typeParams:i}=typeof e=="string"?th(e):e,s=(i==null?void 0:i.length)>0?`<${i.map(o=>typeof o=="string"?o:dw(o)).join(",")}>`:"";return`${t}::${r}::${n}${s}`}function rh(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(eh*2,"0")}`}function gM(e,t=!1){return rh(e,t)}function vM(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2===0}function yM(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}var nh=Object.defineProperty,bM=Object.getOwnPropertyDescriptor,wM=Object.getOwnPropertyNames,_M=Object.prototype.hasOwnProperty,xM=(e,t)=>{for(var r in t)nh(e,r,{get:t[r],enumerable:!0})},SM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wM(t))!_M.call(e,i)&&i!==r&&nh(e,i,{get:()=>t[i],enumerable:!(n=bM(t,i))||n.enumerable});return e},EM=e=>SM(nh({},"__esModule",{value:!0}),e),hw={};xM(hw,{TypeTagSerializer:()=>xs});var pw=EM(hw),MM=Tr,CM=Hr;const AM=/^vector<(.+)>$/,TM=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class xs{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(AM);if(n)return{vector:xs.parseFromStr(n[1],r)};const i=t.match(TM);if(i)return{struct:{address:r?(0,CM.normalizeSuiAddress)(i[1]):i[1],module:i[2],name:i[3],typeParams:i[5]===void 0?[]:xs.parseStructTypeArgs(i[5],r)}};throw new Error(`Encountered unexpected token when parsing type args for ${t}`)}static parseStructTypeArgs(t,r=!1){return(0,MM.splitGenericParameters)(t).map(n=>xs.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<${xs.tagToString(t.vector)}>`;if("struct"in t){const r=t.struct,n=r.typeParams.map(xs.tagToString).join(", ");return`${r.address}::${r.module}::${r.name}${n?`<${n}>`:""}`}throw new Error("Invalid TypeTag")}}var ih=Object.defineProperty,OM=Object.getOwnPropertyDescriptor,IM=Object.getOwnPropertyNames,kM=Object.prototype.hasOwnProperty,jM=(e,t)=>{for(var r in t)ih(e,r,{get:t[r],enumerable:!0})},PM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of IM(t))!kM.call(e,i)&&i!==r&&ih(e,i,{get:()=>t[i],enumerable:!(n=OM(t,i))||n.enumerable});return e},RM=e=>PM(ih({},"__esModule",{value:!0}),e),mw={};jM(mw,{Address:()=>Fn,AppId:()=>jw,Argument:()=>Rn,CallArg:()=>ww,Command:()=>xw,CompressedSignature:()=>Nw,GasData:()=>Aw,Intent:()=>Pw,IntentMessage:()=>Rw,IntentScope:()=>Iw,IntentVersion:()=>kw,MultiSig:()=>$M,MultiSigPkMap:()=>$w,MultiSigPublicKey:()=>Bw,ObjectArg:()=>bw,ObjectDigest:()=>vw,PasskeyAuthenticator:()=>LM,ProgrammableMoveCall:()=>_w,ProgrammableTransaction:()=>Sw,PublicKey:()=>Dw,SenderSignedData:()=>BM,SenderSignedTransaction:()=>Uw,SharedObjectRef:()=>yw,StructTag:()=>Cw,SuiObjectRef:()=>uu,TransactionData:()=>Ow,TransactionDataV1:()=>Tw,TransactionExpiration:()=>Mw,TransactionKind:()=>Ew,TypeTag:()=>oh,base64String:()=>Lw});var gw=RM(mw),de=Tr,Qo=Hr,sp=pw;function NM(e){return de.bcs.u64({name:"unsafe_u64",...e}).transform({input:t=>t,output:t=>Number(t)})}function DM(e){return de.bcs.enum("Option",{None:null,Some:e})}const Fn=de.bcs.bytes(Qo.SUI_ADDRESS_LENGTH).transform({validate:e=>{const t=typeof e=="string"?e:(0,de.toHex)(e);if(!t||!(0,Qo.isValidSuiAddress)((0,Qo.normalizeSuiAddress)(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>typeof e=="string"?(0,de.fromHex)((0,Qo.normalizeSuiAddress)(e)):e,output:e=>(0,Qo.normalizeSuiAddress)((0,de.toHex)(e))}),vw=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")}}),uu=de.bcs.struct("SuiObjectRef",{objectId:Fn,version:de.bcs.u64(),digest:vw}),yw=de.bcs.struct("SharedObjectRef",{objectId:Fn,initialSharedVersion:de.bcs.u64(),mutable:de.bcs.bool()}),bw=de.bcs.enum("ObjectArg",{ImmOrOwnedObject:uu,SharedObject:yw,Receiving:uu}),ww=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:bw}),sh=de.bcs.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:de.bcs.lazy(()=>sh),struct:de.bcs.lazy(()=>Cw),u16:null,u32:null,u256:null}),oh=sh.transform({input:e=>typeof e=="string"?sp.TypeTagSerializer.parseFromStr(e,!0):e,output:e=>sp.TypeTagSerializer.tagToString(e)}),Rn=de.bcs.enum("Argument",{GasCoin:null,Input:de.bcs.u16(),Result:de.bcs.u16(),NestedResult:de.bcs.tuple([de.bcs.u16(),de.bcs.u16()])}),_w=de.bcs.struct("ProgrammableMoveCall",{package:Fn,module:de.bcs.string(),function:de.bcs.string(),typeArguments:de.bcs.vector(oh),arguments:de.bcs.vector(Rn)}),xw=de.bcs.enum("Command",{MoveCall:_w,TransferObjects:de.bcs.struct("TransferObjects",{objects:de.bcs.vector(Rn),address:Rn}),SplitCoins:de.bcs.struct("SplitCoins",{coin:Rn,amounts:de.bcs.vector(Rn)}),MergeCoins:de.bcs.struct("MergeCoins",{destination:Rn,sources:de.bcs.vector(Rn)}),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(Fn)}),MakeMoveVec:de.bcs.struct("MakeMoveVec",{type:DM(oh).transform({input:e=>e===null?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:de.bcs.vector(Rn)}),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(Fn),package:Fn,ticket:Rn})}),Sw=de.bcs.struct("ProgrammableTransaction",{inputs:de.bcs.vector(ww),commands:de.bcs.vector(xw)}),Ew=de.bcs.enum("TransactionKind",{ProgrammableTransaction:Sw,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Mw=de.bcs.enum("TransactionExpiration",{None:null,Epoch:NM()}),Cw=de.bcs.struct("StructTag",{address:Fn,module:de.bcs.string(),name:de.bcs.string(),typeParams:de.bcs.vector(sh)}),Aw=de.bcs.struct("GasData",{payment:de.bcs.vector(uu),owner:Fn,price:de.bcs.u64(),budget:de.bcs.u64()}),Tw=de.bcs.struct("TransactionDataV1",{kind:Ew,sender:Fn,gasData:Aw,expiration:Mw}),Ow=de.bcs.enum("TransactionData",{V1:Tw}),Iw=de.bcs.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),kw=de.bcs.enum("IntentVersion",{V0:null}),jw=de.bcs.enum("AppId",{Sui:null}),Pw=de.bcs.struct("Intent",{scope:Iw,version:kw,appId:jw});function Rw(e){return de.bcs.struct(`IntentMessage<${e.name}>`,{intent:Pw,value:e})}const Nw=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())}),Dw=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())}),$w=de.bcs.struct("MultiSigPkMap",{pubKey:Dw,weight:de.bcs.u8()}),Bw=de.bcs.struct("MultiSigPublicKey",{pk_map:de.bcs.vector($w),threshold:de.bcs.u16()}),$M=de.bcs.struct("MultiSig",{sigs:de.bcs.vector(Nw),bitmap:de.bcs.u16(),multisig_pk:Bw}),Lw=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))}),Uw=de.bcs.struct("SenderSignedTransaction",{intentMessage:Rw(Ow),txSignatures:de.bcs.vector(Lw)}),BM=de.bcs.vector(Uw,{name:"SenderSignedData"}),LM=de.bcs.struct("PasskeyAuthenticator",{authenticatorData:de.bcs.vector(de.bcs.u8()),clientDataJson:de.bcs.string(),userSignature:de.bcs.vector(de.bcs.u8())});var ah=Object.defineProperty,UM=Object.getOwnPropertyDescriptor,FM=Object.getOwnPropertyNames,zM=Object.prototype.hasOwnProperty,VM=(e,t)=>{for(var r in t)ah(e,r,{get:t[r],enumerable:!0})},qM=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FM(t))!zM.call(e,i)&&i!==r&&ah(e,i,{get:()=>t[i],enumerable:!(n=UM(t,i))||n.enumerable});return e},GM=e=>qM(ah({},"__esModule",{value:!0}),e),Fw={};VM(Fw,{TransactionEffects:()=>sC});var HM=GM(Fw),ge=Tr,Bt=gw;const WM=ge.bcs.enum("PackageUpgradeError",{UnableToFetchPackage:ge.bcs.struct("UnableToFetchPackage",{packageId:Bt.Address}),NotAPackage:ge.bcs.struct("NotAPackage",{objectId:Bt.Address}),IncompatibleUpgrade:null,DigestDoesNotMatch:ge.bcs.struct("DigestDoesNotMatch",{digest:ge.bcs.vector(ge.bcs.u8())}),UnknownUpgradePolicy:ge.bcs.struct("UnknownUpgradePolicy",{policy:ge.bcs.u8()}),PackageIDDoesNotMatch:ge.bcs.struct("PackageIDDoesNotMatch",{packageId:Bt.Address,ticketId:Bt.Address})}),KM=ge.bcs.struct("ModuleId",{address:Bt.Address,name:ge.bcs.string()}),op=ge.bcs.struct("MoveLocation",{module:KM,function:ge.bcs.u16(),instruction:ge.bcs.u16(),functionName:ge.bcs.option(ge.bcs.string())}),XM=ge.bcs.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:ge.bcs.struct("IndexOutOfBounds",{idx:ge.bcs.u16()}),SecondaryIndexOutOfBounds:ge.bcs.struct("SecondaryIndexOutOfBounds",{resultIdx:ge.bcs.u16(),secondaryIdx:ge.bcs.u16()}),InvalidResultArity:ge.bcs.struct("InvalidResultArity",{resultIdx:ge.bcs.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),YM=ge.bcs.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),JM=ge.bcs.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:ge.bcs.struct("MoveObjectTooBig",{objectSize:ge.bcs.u64(),maxObjectSize:ge.bcs.u64()}),MovePackageTooBig:ge.bcs.struct("MovePackageTooBig",{objectSize:ge.bcs.u64(),maxObjectSize:ge.bcs.u64()}),CircularObjectOwnership:ge.bcs.struct("CircularObjectOwnership",{object:Bt.Address}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:ge.bcs.option(op),MoveAbort:ge.bcs.tuple([op,ge.bcs.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:ge.bcs.struct("CommandArgumentError",{argIdx:ge.bcs.u16(),kind:XM}),TypeArgumentError:ge.bcs.struct("TypeArgumentError",{argumentIdx:ge.bcs.u16(),kind:YM}),UnusedValueWithoutDrop:ge.bcs.struct("UnusedValueWithoutDrop",{resultIdx:ge.bcs.u16(),secondaryIdx:ge.bcs.u16()}),InvalidPublicFunctionReturnType:ge.bcs.struct("InvalidPublicFunctionReturnType",{idx:ge.bcs.u16()}),InvalidTransferObject:null,EffectsTooLarge:ge.bcs.struct("EffectsTooLarge",{currentSize:ge.bcs.u64(),maxSize:ge.bcs.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:ge.bcs.struct("PackageUpgradeError",{upgradeError:WM}),WrittenObjectsTooLarge:ge.bcs.struct("WrittenObjectsTooLarge",{currentSize:ge.bcs.u64(),maxSize:ge.bcs.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null,ExecutionCancelledDueToSharedObjectCongestion:ge.bcs.struct("ExecutionCancelledDueToSharedObjectCongestion",{congestedObjects:ge.bcs.vector(Bt.Address)}),AddressDeniedForCoin:ge.bcs.struct("AddressDeniedForCoin",{address:Bt.Address,coinType:ge.bcs.string()}),CoinTypeGlobalPause:ge.bcs.struct("CoinTypeGlobalPause",{coinType:ge.bcs.string()}),ExecutionCancelledDueToRandomnessUnavailable:null}),zw=ge.bcs.enum("ExecutionStatus",{Success:null,Failed:ge.bcs.struct("ExecutionFailed",{error:JM,command:ge.bcs.option(ge.bcs.u64())})}),Vw=ge.bcs.struct("GasCostSummary",{computationCost:ge.bcs.u64(),storageCost:ge.bcs.u64(),storageRebate:ge.bcs.u64(),nonRefundableStorageFee:ge.bcs.u64()}),oo=ge.bcs.enum("Owner",{AddressOwner:Bt.Address,ObjectOwner:Bt.Address,Shared:ge.bcs.struct("Shared",{initialSharedVersion:ge.bcs.u64()}),Immutable:null}),ZM=ge.bcs.struct("TransactionEffectsV1",{status:zw,executedEpoch:ge.bcs.u64(),gasUsed:Vw,modifiedAtVersions:ge.bcs.vector(ge.bcs.tuple([Bt.Address,ge.bcs.u64()])),sharedObjects:ge.bcs.vector(Bt.SuiObjectRef),transactionDigest:Bt.ObjectDigest,created:ge.bcs.vector(ge.bcs.tuple([Bt.SuiObjectRef,oo])),mutated:ge.bcs.vector(ge.bcs.tuple([Bt.SuiObjectRef,oo])),unwrapped:ge.bcs.vector(ge.bcs.tuple([Bt.SuiObjectRef,oo])),deleted:ge.bcs.vector(Bt.SuiObjectRef),unwrappedThenDeleted:ge.bcs.vector(Bt.SuiObjectRef),wrapped:ge.bcs.vector(Bt.SuiObjectRef),gasObject:ge.bcs.tuple([Bt.SuiObjectRef,oo]),eventsDigest:ge.bcs.option(Bt.ObjectDigest),dependencies:ge.bcs.vector(Bt.ObjectDigest)}),ch=ge.bcs.tuple([ge.bcs.u64(),Bt.ObjectDigest]),QM=ge.bcs.enum("ObjectIn",{NotExist:null,Exist:ge.bcs.tuple([ch,oo])}),eC=ge.bcs.enum("ObjectOut",{NotExist:null,ObjectWrite:ge.bcs.tuple([Bt.ObjectDigest,oo]),PackageWrite:ch}),tC=ge.bcs.enum("IDOperation",{None:null,Created:null,Deleted:null}),rC=ge.bcs.struct("EffectsObjectChange",{inputState:QM,outputState:eC,idOperation:tC}),nC=ge.bcs.enum("UnchangedSharedKind",{ReadOnlyRoot:ch,MutateDeleted:ge.bcs.u64(),ReadDeleted:ge.bcs.u64(),Cancelled:ge.bcs.u64(),PerEpochConfig:null}),iC=ge.bcs.struct("TransactionEffectsV2",{status:zw,executedEpoch:ge.bcs.u64(),gasUsed:Vw,transactionDigest:Bt.ObjectDigest,gasObjectIndex:ge.bcs.option(ge.bcs.u32()),eventsDigest:ge.bcs.option(Bt.ObjectDigest),dependencies:ge.bcs.vector(Bt.ObjectDigest),lamportVersion:ge.bcs.u64(),changedObjects:ge.bcs.vector(ge.bcs.tuple([Bt.Address,rC])),unchangedSharedObjects:ge.bcs.vector(ge.bcs.tuple([Bt.Address,nC])),auxDataDigest:ge.bcs.option(Bt.ObjectDigest)}),sC=ge.bcs.enum("TransactionEffects",{V1:ZM,V2:iC});var uh=Object.defineProperty,oC=Object.getOwnPropertyDescriptor,aC=Object.getOwnPropertyNames,cC=Object.prototype.hasOwnProperty,uC=(e,t)=>{for(var r in t)uh(e,r,{get:t[r],enumerable:!0})},lC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aC(t))!cC.call(e,i)&&i!==r&&uh(e,i,{get:()=>t[i],enumerable:!(n=oC(t,i))||n.enumerable});return e},fC=e=>lC(uh({},"__esModule",{value:!0}),e),qw={};uC(qw,{BcsType:()=>pC.BcsType,TypeTagSerializer:()=>hC.TypeTagSerializer,bcs:()=>mC});var Ai=fC(qw),Tn=Tr,$t=gw,dC=HM,hC=pw,pC=Tr;const mC={...Tn.bcs,U8:Tn.bcs.u8(),U16:Tn.bcs.u16(),U32:Tn.bcs.u32(),U64:Tn.bcs.u64(),U128:Tn.bcs.u128(),U256:Tn.bcs.u256(),ULEB128:Tn.bcs.uleb128(),Bool:Tn.bcs.bool(),String:Tn.bcs.string(),Address:$t.Address,AppId:$t.AppId,Argument:$t.Argument,CallArg:$t.CallArg,CompressedSignature:$t.CompressedSignature,GasData:$t.GasData,Intent:$t.Intent,IntentMessage:$t.IntentMessage,IntentScope:$t.IntentScope,IntentVersion:$t.IntentVersion,MultiSig:$t.MultiSig,MultiSigPkMap:$t.MultiSigPkMap,MultiSigPublicKey:$t.MultiSigPublicKey,ObjectArg:$t.ObjectArg,ObjectDigest:$t.ObjectDigest,ProgrammableMoveCall:$t.ProgrammableMoveCall,ProgrammableTransaction:$t.ProgrammableTransaction,PublicKey:$t.PublicKey,SenderSignedData:$t.SenderSignedData,SenderSignedTransaction:$t.SenderSignedTransaction,SharedObjectRef:$t.SharedObjectRef,StructTag:$t.StructTag,SuiObjectRef:$t.SuiObjectRef,Command:$t.Command,TransactionData:$t.TransactionData,TransactionDataV1:$t.TransactionDataV1,TransactionExpiration:$t.TransactionExpiration,TransactionKind:$t.TransactionKind,TypeTag:$t.TypeTag,TransactionEffects:dC.TransactionEffects,PasskeyAuthenticator:$t.PasskeyAuthenticator};var lh=Object.defineProperty,gC=Object.getOwnPropertyDescriptor,vC=Object.getOwnPropertyNames,yC=Object.prototype.hasOwnProperty,bC=(e,t)=>{for(var r in t)lh(e,r,{get:t[r],enumerable:!0})},wC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vC(t))!yC.call(e,i)&&i!==r&&lh(e,i,{get:()=>t[i],enumerable:!(n=gC(t,i))||n.enumerable});return e},_C=e=>wC(lh({},"__esModule",{value:!0}),e),Gw={};bC(Gw,{formatAddress:()=>SC,formatDigest:()=>EC});var xC=_C(Gw);const Hw="…";function SC(e){if(e.length<=6)return e;const t=e.startsWith("0x")?2:0;return`0x${e.slice(t,t+4)}${Hw}${e.slice(-4)}`}function EC(e){return`${e.slice(0,10)}${Hw}`}var fh=Object.defineProperty,MC=Object.getOwnPropertyDescriptor,CC=Object.getOwnPropertyNames,AC=Object.prototype.hasOwnProperty,TC=(e,t)=>{for(var r in t)fh(e,r,{get:t[r],enumerable:!0})},OC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of CC(t))!AC.call(e,i)&&i!==r&&fh(e,i,{get:()=>t[i],enumerable:!(n=MC(t,i))||n.enumerable});return e},IC=e=>OC(fh({},"__esModule",{value:!0}),e),Ww={};TC(Ww,{isValidSuiNSName:()=>jC,normalizeSuiNSName:()=>PC});var Kw=IC(Ww);const Xw=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,Yw=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,kC=235;function jC(e){return e.length>kC?!1:e.includes("@")?Xw.test(e):Yw.test(e)}function PC(e,t="at"){const r=e.toLowerCase();let n;if(r.includes("@")){if(!Xw.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[i,s]=r.split("@");n=[...i?i.split("."):[],s]}else{if(!Yw.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 dh=Object.defineProperty,RC=Object.getOwnPropertyDescriptor,NC=Object.getOwnPropertyNames,DC=Object.prototype.hasOwnProperty,$C=(e,t)=>{for(var r in t)dh(e,r,{get:t[r],enumerable:!0})},BC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NC(t))!DC.call(e,i)&&i!==r&&dh(e,i,{get:()=>t[i],enumerable:!(n=RC(t,i))||n.enumerable});return e},LC=e=>BC(dh({},"__esModule",{value:!0}),e),Jw={};$C(Jw,{MIST_PER_SUI:()=>zC,MOVE_STDLIB_ADDRESS:()=>VC,SUI_CLOCK_OBJECT_ID:()=>GC,SUI_DECIMALS:()=>FC,SUI_FRAMEWORK_ADDRESS:()=>Qw,SUI_SYSTEM_ADDRESS:()=>qC,SUI_SYSTEM_MODULE_NAME:()=>HC,SUI_SYSTEM_STATE_OBJECT_ID:()=>KC,SUI_TYPE_ARG:()=>WC});var UC=LC(Jw),Zw=Hr;const FC=9,zC=BigInt(1e9),VC="0x1",Qw="0x2",qC="0x3",GC=(0,Zw.normalizeSuiObjectId)("0x6"),HC="sui_system",WC=`${Qw}::sui::SUI`,KC=(0,Zw.normalizeSuiObjectId)("0x5");var hh=Object.defineProperty,XC=Object.getOwnPropertyDescriptor,YC=Object.getOwnPropertyNames,JC=Object.prototype.hasOwnProperty,ZC=(e,t)=>{for(var r in t)hh(e,r,{get:t[r],enumerable:!0})},QC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YC(t))!JC.call(e,i)&&i!==r&&hh(e,i,{get:()=>t[i],enumerable:!(n=XC(t,i))||n.enumerable});return e},e5=e=>QC(hh({},"__esModule",{value:!0}),e),e2={};ZC(e2,{isValidNamedPackage:()=>n2,isValidNamedType:()=>s5});var t2=e5(e2),t5=Kw;const r5=/^([a-z0-9]+(?:-[a-z0-9]+)*)$/,n5=/^\d+$/,i5=64,r2="/",n2=e=>{const t=e.split(r2);if(t.length<2||t.length>3)return!1;const[r,n,i]=t;return i!==void 0&&!n5.test(i)||!(0,t5.isValidSuiNSName)(r)?!1:r5.test(n)&&n.length<i5},s5=e=>{const t=e.split(/::|<|>|,/);for(const r of t)if(r.includes(r2)&&!n2(r))return!1;return!0},i2=Fu(aE);var ph=Object.defineProperty,o5=Object.getOwnPropertyDescriptor,a5=Object.getOwnPropertyNames,c5=Object.prototype.hasOwnProperty,u5=(e,t)=>{for(var r in t)ph(e,r,{get:t[r],enumerable:!0})},l5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a5(t))!c5.call(e,i)&&i!==r&&ph(e,i,{get:()=>t[i],enumerable:!(n=o5(t,i))||n.enumerable});return e},f5=e=>l5(ph({},"__esModule",{value:!0}),e),s2={};u5(s2,{deriveDynamicFieldID:()=>m5});var d5=f5(s2),h5=Tr,p5=i2,Vl=Ai;function m5(e,t,r){const n=Vl.bcs.Address.serialize(e).toBytes(),i=Vl.bcs.TypeTag.serialize(t).toBytes(),s=Vl.bcs.u64().serialize(r.length).toBytes(),o=p5.blake2b.create({dkLen:32});return o.update(new Uint8Array([240])),o.update(n),o.update(s),o.update(r),o.update(i),`0x${(0,h5.toHex)(o.digest().slice(0,32))}`}var mh=Object.defineProperty,g5=Object.getOwnPropertyDescriptor,v5=Object.getOwnPropertyNames,y5=Object.prototype.hasOwnProperty,b5=(e,t)=>{for(var r in t)mh(e,r,{get:t[r],enumerable:!0})},w5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of v5(t))!y5.call(e,i)&&i!==r&&mh(e,i,{get:()=>t[i],enumerable:!(n=g5(t,i))||n.enumerable});return e},_5=e=>w5(mh({},"__esModule",{value:!0}),e),o2={};b5(o2,{MIST_PER_SUI:()=>ni.MIST_PER_SUI,MOVE_STDLIB_ADDRESS:()=>ni.MOVE_STDLIB_ADDRESS,SUI_ADDRESS_LENGTH:()=>Pi.SUI_ADDRESS_LENGTH,SUI_CLOCK_OBJECT_ID:()=>ni.SUI_CLOCK_OBJECT_ID,SUI_DECIMALS:()=>ni.SUI_DECIMALS,SUI_FRAMEWORK_ADDRESS:()=>ni.SUI_FRAMEWORK_ADDRESS,SUI_SYSTEM_ADDRESS:()=>ni.SUI_SYSTEM_ADDRESS,SUI_SYSTEM_MODULE_NAME:()=>ni.SUI_SYSTEM_MODULE_NAME,SUI_SYSTEM_STATE_OBJECT_ID:()=>ni.SUI_SYSTEM_STATE_OBJECT_ID,SUI_TYPE_ARG:()=>ni.SUI_TYPE_ARG,deriveDynamicFieldID:()=>x5.deriveDynamicFieldID,formatAddress:()=>ap.formatAddress,formatDigest:()=>ap.formatDigest,fromB64:()=>On.fromB64,fromBase58:()=>On.fromBase58,fromBase64:()=>On.fromBase64,fromHEX:()=>On.fromHEX,fromHex:()=>On.fromHex,isValidNamedPackage:()=>up.isValidNamedPackage,isValidNamedType:()=>up.isValidNamedType,isValidSuiAddress:()=>Pi.isValidSuiAddress,isValidSuiNSName:()=>cp.isValidSuiNSName,isValidSuiObjectId:()=>Pi.isValidSuiObjectId,isValidTransactionDigest:()=>Pi.isValidTransactionDigest,normalizeStructTag:()=>Pi.normalizeStructTag,normalizeSuiAddress:()=>Pi.normalizeSuiAddress,normalizeSuiNSName:()=>cp.normalizeSuiNSName,normalizeSuiObjectId:()=>Pi.normalizeSuiObjectId,parseStructTag:()=>Pi.parseStructTag,toB64:()=>On.toB64,toBase58:()=>On.toBase58,toBase64:()=>On.toBase64,toHEX:()=>On.toHEX,toHex:()=>On.toHex});var a2=_5(o2),ap=xC,Pi=Hr,On=Tr,cp=Kw,ni=UC,up=t2,x5=d5,gh=Object.defineProperty,S5=Object.getOwnPropertyDescriptor,E5=Object.getOwnPropertyNames,M5=Object.prototype.hasOwnProperty,C5=(e,t)=>{for(var r in t)gh(e,r,{get:t[r],enumerable:!0})},A5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of E5(t))!M5.call(e,i)&&i!==r&&gh(e,i,{get:()=>t[i],enumerable:!(n=S5(t,i))||n.enumerable});return e},T5=e=>A5(gh({},"__esModule",{value:!0}),e),c2={};C5(c2,{getPureBcsSchema:()=>Vf,isTxContext:()=>$5,normalizedTypeToMoveTypeSignature:()=>B5,pureBcsSchemaFromOpenMoveTypeSignatureBody:()=>l2});var u2=T5(c2),Yt=Ai,lp=a2,_a=Hr;const O5="object",I5="ID",k5="ascii",j5="String",P5="string",R5="String",N5="option",D5="Option";function $5(e){const t=typeof e.body=="object"&&"datatype"in e.body?e.body.datatype:null;return!!t&&(0,_a.normalizeSuiAddress)(t.package)===(0,_a.normalizeSuiAddress)("0x2")&&t.module==="tx_context"&&t.type==="TxContext"}function Vf(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if(e.vector==="u8")return Yt.bcs.vector(Yt.bcs.U8).transform({input:r=>typeof r=="string"?new TextEncoder().encode(r):r,output:r=>r});const t=Vf(e.vector);return t?Yt.bcs.vector(t):null}if("datatype"in e){const t=(0,_a.normalizeSuiAddress)(e.datatype.package);if(t===(0,_a.normalizeSuiAddress)(lp.MOVE_STDLIB_ADDRESS)){if(e.datatype.module===k5&&e.datatype.type===j5||e.datatype.module===P5&&e.datatype.type===R5)return Yt.bcs.String;if(e.datatype.module===N5&&e.datatype.type===D5){const r=Vf(e.datatype.typeParameters[0]);return r?Yt.bcs.vector(r):null}}if(t===(0,_a.normalizeSuiAddress)(lp.SUI_FRAMEWORK_ADDRESS)&&e.datatype.module===O5&&e.datatype.type===I5)return Yt.bcs.Address}return null}function B5(e){return typeof e=="object"&&"Reference"in e?{ref:"&",body:xa(e.Reference)}:typeof e=="object"&&"MutableReference"in e?{ref:"&mut",body:xa(e.MutableReference)}:{ref:null,body:xa(e)}}function xa(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:xa(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(xa)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}function l2(e){if(typeof e=="string")switch(e){case"address":return Yt.bcs.Address;case"bool":return Yt.bcs.Bool;case"u8":return Yt.bcs.U8;case"u16":return Yt.bcs.U16;case"u32":return Yt.bcs.U32;case"u64":return Yt.bcs.U64;case"u128":return Yt.bcs.U128;case"u256":return Yt.bcs.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e)return Yt.bcs.vector(l2(e.vector));throw new Error(`Expected pure typeSignature, but got ${JSON.stringify(e)}`)}var vh=Object.defineProperty,L5=Object.getOwnPropertyDescriptor,U5=Object.getOwnPropertyNames,F5=Object.prototype.hasOwnProperty,z5=(e,t)=>{for(var r in t)vh(e,r,{get:t[r],enumerable:!0})},V5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of U5(t))!F5.call(e,i)&&i!==r&&vh(e,i,{get:()=>t[i],enumerable:!(n=L5(t,i))||n.enumerable});return e},q5=e=>V5(vh({},"__esModule",{value:!0}),e),f2={};z5(f2,{Inputs:()=>W5});var qu=q5(f2),G5=Tr,ql=Hr;function H5(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?(0,G5.toBase64)(e):e.toBase64()}}}const W5={Pure:H5,ObjectRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:(0,ql.normalizeSuiAddress)(e)}}}},SharedObjectRef({objectId:e,mutable:t,initialSharedVersion:r}){return{$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:(0,ql.normalizeSuiAddress)(e)}}}},ReceivingRef({objectId:e,digest:t,version:r}){return{$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:(0,ql.normalizeSuiAddress)(e)}}}}};var yh=Object.defineProperty,K5=Object.getOwnPropertyDescriptor,X5=Object.getOwnPropertyNames,Y5=Object.prototype.hasOwnProperty,J5=(e,t)=>{for(var r in t)yh(e,r,{get:t[r],enumerable:!0})},Z5=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X5(t))!Y5.call(e,i)&&i!==r&&yh(e,i,{get:()=>t[i],enumerable:!(n=K5(t,i))||n.enumerable});return e},Q5=e=>Z5(yh({},"__esModule",{value:!0}),e),d2={};J5(d2,{$Intent:()=>m2,Argument:()=>Jr,BCSBytes:()=>Pa,Command:()=>g2,GasData:()=>h2,JsonU64:()=>Ki,NormalizedCallArg:()=>nA,ObjectArg:()=>bh,ObjectID:()=>Is,ObjectRef:()=>lu,OpenMoveTypeSignature:()=>p2,OpenMoveTypeSignatureBody:()=>fu,StructTag:()=>eA,SuiAddress:()=>rc,TransactionData:()=>iA,TransactionExpiration:()=>v2,safeEnum:()=>Po});var jo=Q5(d2),ce=is,fp=Hr;function Po(e){const t=Object.entries(e).map(([r,n])=>(0,ce.object)({[r]:n}));return(0,ce.pipe)((0,ce.union)(t),(0,ce.transform)(r=>({...r,$kind:Object.keys(r)[0]})))}const rc=(0,ce.pipe)((0,ce.string)(),(0,ce.transform)(e=>(0,fp.normalizeSuiAddress)(e)),(0,ce.check)(fp.isValidSuiAddress)),Is=rc,Pa=(0,ce.string)(),Ki=(0,ce.pipe)((0,ce.union)([(0,ce.string)(),(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())]),(0,ce.check)(e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}},"Invalid u64")),lu=(0,ce.object)({objectId:rc,version:Ki,digest:(0,ce.string)()}),Jr=(0,ce.pipe)((0,ce.union)([(0,ce.object)({GasCoin:(0,ce.literal)(!0)}),(0,ce.object)({Input:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),type:(0,ce.optional)((0,ce.literal)("pure"))}),(0,ce.object)({Input:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),type:(0,ce.optional)((0,ce.literal)("object"))}),(0,ce.object)({Result:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())}),(0,ce.object)({NestedResult:(0,ce.tuple)([(0,ce.pipe)((0,ce.number)(),(0,ce.integer)()),(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())])})]),(0,ce.transform)(e=>({...e,$kind:Object.keys(e)[0]}))),h2=(0,ce.object)({budget:(0,ce.nullable)(Ki),price:(0,ce.nullable)(Ki),owner:(0,ce.nullable)(rc),payment:(0,ce.nullable)((0,ce.array)(lu))}),eA=(0,ce.object)({address:(0,ce.string)(),module:(0,ce.string)(),name:(0,ce.string)(),typeParams:(0,ce.array)((0,ce.string)())}),fu=(0,ce.union)([(0,ce.literal)("address"),(0,ce.literal)("bool"),(0,ce.literal)("u8"),(0,ce.literal)("u16"),(0,ce.literal)("u32"),(0,ce.literal)("u64"),(0,ce.literal)("u128"),(0,ce.literal)("u256"),(0,ce.object)({vector:(0,ce.lazy)(()=>fu)}),(0,ce.object)({datatype:(0,ce.object)({package:(0,ce.string)(),module:(0,ce.string)(),type:(0,ce.string)(),typeParameters:(0,ce.array)((0,ce.lazy)(()=>fu))})}),(0,ce.object)({typeParameter:(0,ce.pipe)((0,ce.number)(),(0,ce.integer)())})]),p2=(0,ce.object)({ref:(0,ce.nullable)((0,ce.union)([(0,ce.literal)("&"),(0,ce.literal)("&mut")])),body:fu}),tA=(0,ce.object)({package:Is,module:(0,ce.string)(),function:(0,ce.string)(),typeArguments:(0,ce.array)((0,ce.string)()),arguments:(0,ce.array)(Jr),_argumentTypes:(0,ce.optional)((0,ce.nullable)((0,ce.array)(p2)))}),m2=(0,ce.object)({name:(0,ce.string)(),inputs:(0,ce.record)((0,ce.string)(),(0,ce.union)([Jr,(0,ce.array)(Jr)])),data:(0,ce.record)((0,ce.string)(),(0,ce.unknown)())}),g2=Po({MoveCall:tA,TransferObjects:(0,ce.object)({objects:(0,ce.array)(Jr),address:Jr}),SplitCoins:(0,ce.object)({coin:Jr,amounts:(0,ce.array)(Jr)}),MergeCoins:(0,ce.object)({destination:Jr,sources:(0,ce.array)(Jr)}),Publish:(0,ce.object)({modules:(0,ce.array)(Pa),dependencies:(0,ce.array)(Is)}),MakeMoveVec:(0,ce.object)({type:(0,ce.nullable)((0,ce.string)()),elements:(0,ce.array)(Jr)}),Upgrade:(0,ce.object)({modules:(0,ce.array)(Pa),dependencies:(0,ce.array)(Is),package:Is,ticket:Jr}),$Intent:m2}),bh=Po({ImmOrOwnedObject:lu,SharedObject:(0,ce.object)({objectId:Is,initialSharedVersion:Ki,mutable:(0,ce.boolean)()}),Receiving:lu}),rA=Po({Object:bh,Pure:(0,ce.object)({bytes:Pa}),UnresolvedPure:(0,ce.object)({value:(0,ce.unknown)()}),UnresolvedObject:(0,ce.object)({objectId:Is,version:(0,ce.optional)((0,ce.nullable)(Ki)),digest:(0,ce.optional)((0,ce.nullable)((0,ce.string)())),initialSharedVersion:(0,ce.optional)((0,ce.nullable)(Ki))})}),nA=Po({Object:bh,Pure:(0,ce.object)({bytes:Pa})}),v2=Po({None:(0,ce.literal)(!0),Epoch:Ki}),iA=(0,ce.object)({version:(0,ce.literal)(2),sender:(0,ce.nullish)(rc),expiration:(0,ce.nullish)(v2),gasData:h2,inputs:(0,ce.array)(rA),commands:(0,ce.array)(g2)});var wh=Object.defineProperty,sA=Object.getOwnPropertyDescriptor,oA=Object.getOwnPropertyNames,aA=Object.prototype.hasOwnProperty,cA=(e,t)=>{for(var r in t)wh(e,r,{get:t[r],enumerable:!0})},uA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oA(t))!aA.call(e,i)&&i!==r&&wh(e,i,{get:()=>t[i],enumerable:!(n=sA(t,i))||n.enumerable});return e},lA=e=>uA(wh({},"__esModule",{value:!0}),e),y2={};cA(y2,{Commands:()=>fA,UpgradePolicy:()=>b2});var _h=lA(y2),dp=Tr,In=is,hp=Hr,kn=jo,b2=(e=>(e[e.COMPATIBLE=0]="COMPATIBLE",e[e.ADDITIVE=128]="ADDITIVE",e[e.DEP_ONLY=192]="DEP_ONLY",e))(b2||{});const fA={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,In.parse)(kn.Argument,r)),address:(0,In.parse)(kn.Argument,t)}}},SplitCoins(e,t){return{$kind:"SplitCoins",SplitCoins:{coin:(0,In.parse)(kn.Argument,e),amounts:t.map(r=>(0,In.parse)(kn.Argument,r))}}},MergeCoins(e,t){return{$kind:"MergeCoins",MergeCoins:{destination:(0,In.parse)(kn.Argument,e),sources:t.map(r=>(0,In.parse)(kn.Argument,r))}}},Publish({modules:e,dependencies:t}){return{$kind:"Publish",Publish:{modules:e.map(r=>typeof r=="string"?r:(0,dp.toBase64)(new Uint8Array(r))),dependencies:t.map(r=>(0,hp.normalizeSuiObjectId)(r))}}},Upgrade({modules:e,dependencies:t,package:r,ticket:n}){return{$kind:"Upgrade",Upgrade:{modules:e.map(i=>typeof i=="string"?i:(0,dp.toBase64)(new Uint8Array(i))),dependencies:t.map(i=>(0,hp.normalizeSuiObjectId)(i)),package:r,ticket:(0,In.parse)(kn.Argument,n)}}},MakeMoveVec({type:e,elements:t}){return{$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map(r=>(0,In.parse)(kn.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,In.parse)(kn.Argument,s)):(0,In.parse)(kn.Argument,i)])),data:r}}}};var xh=Object.defineProperty,dA=Object.getOwnPropertyDescriptor,hA=Object.getOwnPropertyNames,pA=Object.prototype.hasOwnProperty,mA=(e,t)=>{for(var r in t)xh(e,r,{get:t[r],enumerable:!0})},gA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hA(t))!pA.call(e,i)&&i!==r&&xh(e,i,{get:()=>t[i],enumerable:!(n=dA(t,i))||n.enumerable});return e},vA=e=>gA(xh({},"__esModule",{value:!0}),e),w2={};mA(w2,{NormalizedCallArg:()=>qf,ObjectRef:()=>du,SerializedTransactionDataV1:()=>kA,StructTag:()=>E2,TransactionArgument:()=>Gn,TypeTag:()=>Gu,serializeV1TransactionData:()=>jA,transactionDataFromV1:()=>PA});var _2=vA(w2),vo=Tr,te=is,x2=Ai,Sa=jo;const du=(0,te.object)({digest:(0,te.string)(),objectId:(0,te.string)(),version:(0,te.union)([(0,te.pipe)((0,te.number)(),(0,te.integer)()),(0,te.string)(),(0,te.bigint)()])}),yA=(0,Sa.safeEnum)({ImmOrOwned:du,Shared:(0,te.object)({objectId:Sa.ObjectID,initialSharedVersion:Sa.JsonU64,mutable:(0,te.boolean)()}),Receiving:du}),qf=(0,Sa.safeEnum)({Object:yA,Pure:(0,te.array)((0,te.pipe)((0,te.number)(),(0,te.integer)()))}),S2=(0,te.union)([(0,te.object)({kind:(0,te.literal)("Input"),index:(0,te.pipe)((0,te.number)(),(0,te.integer)()),value:(0,te.unknown)(),type:(0,te.optional)((0,te.literal)("object"))}),(0,te.object)({kind:(0,te.literal)("Input"),index:(0,te.pipe)((0,te.number)(),(0,te.integer)()),value:(0,te.unknown)(),type:(0,te.literal)("pure")})]),bA=(0,te.union)([(0,te.object)({Epoch:(0,te.pipe)((0,te.number)(),(0,te.integer)())}),(0,te.object)({None:(0,te.nullable)((0,te.literal)(!0))})]),pp=(0,te.pipe)((0,te.union)([(0,te.number)(),(0,te.string)(),(0,te.bigint)()]),(0,te.check)(e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}})),Gu=(0,te.union)([(0,te.object)({bool:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({u8:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({u64:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({u128:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({address:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({signer:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({vector:(0,te.lazy)(()=>Gu)}),(0,te.object)({struct:(0,te.lazy)(()=>E2)}),(0,te.object)({u16:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({u32:(0,te.nullable)((0,te.literal)(!0))}),(0,te.object)({u256:(0,te.nullable)((0,te.literal)(!0))})]),E2=(0,te.object)({address:(0,te.string)(),module:(0,te.string)(),name:(0,te.string)(),typeParams:(0,te.array)(Gu)}),wA=(0,te.object)({budget:(0,te.optional)(pp),price:(0,te.optional)(pp),payment:(0,te.optional)((0,te.array)(du)),owner:(0,te.optional)((0,te.string)())}),_A=[S2,(0,te.object)({kind:(0,te.literal)("GasCoin")}),(0,te.object)({kind:(0,te.literal)("Result"),index:(0,te.pipe)((0,te.number)(),(0,te.integer)())}),(0,te.object)({kind:(0,te.literal)("NestedResult"),index:(0,te.pipe)((0,te.number)(),(0,te.integer)()),resultIndex:(0,te.pipe)((0,te.number)(),(0,te.integer)())})],Gn=(0,te.union)([..._A]),xA=(0,te.object)({kind:(0,te.literal)("MoveCall"),target:(0,te.pipe)((0,te.string)(),(0,te.check)(e=>e.split("::").length===3)),typeArguments:(0,te.array)((0,te.string)()),arguments:(0,te.array)(Gn)}),SA=(0,te.object)({kind:(0,te.literal)("TransferObjects"),objects:(0,te.array)(Gn),address:Gn}),EA=(0,te.object)({kind:(0,te.literal)("SplitCoins"),coin:Gn,amounts:(0,te.array)(Gn)}),MA=(0,te.object)({kind:(0,te.literal)("MergeCoins"),destination:Gn,sources:(0,te.array)(Gn)}),CA=(0,te.object)({kind:(0,te.literal)("MakeMoveVec"),type:(0,te.union)([(0,te.object)({Some:Gu}),(0,te.object)({None:(0,te.nullable)((0,te.literal)(!0))})]),objects:(0,te.array)(Gn)}),AA=(0,te.object)({kind:(0,te.literal)("Publish"),modules:(0,te.array)((0,te.array)((0,te.pipe)((0,te.number)(),(0,te.integer)()))),dependencies:(0,te.array)((0,te.string)())}),TA=(0,te.object)({kind:(0,te.literal)("Upgrade"),modules:(0,te.array)((0,te.array)((0,te.pipe)((0,te.number)(),(0,te.integer)()))),dependencies:(0,te.array)((0,te.string)()),packageId:(0,te.string)(),ticket:Gn}),OA=[xA,SA,EA,MA,AA,TA,CA],IA=(0,te.union)([...OA]),kA=(0,te.object)({version:(0,te.literal)(1),sender:(0,te.optional)((0,te.string)()),expiration:(0,te.nullish)(bA),gasConfig:wA,inputs:(0,te.array)(S2),transactions:(0,te.array)(IA)});function jA(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:x2.TypeTagSerializer.parseFromStr(n.MakeMoveVec.type)},objects:n.MakeMoveVec.elements.map(i=>ii(i,t))};if(n.MergeCoins)return{kind:"MergeCoins",destination:ii(n.MergeCoins.destination,t),sources:n.MergeCoins.sources.map(i=>ii(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=>ii(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:ii(n.SplitCoins.coin,t),amounts:n.SplitCoins.amounts.map(i=>ii(i,t))};if(n.TransferObjects)return{kind:"TransferObjects",objects:n.TransferObjects.objects.map(i=>ii(i,t)),address:ii(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:ii(n.Upgrade.ticket,t)};throw new Error(`Unknown transaction ${Object.keys(n)}`)})}}function ii(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 PA(e){var t,r,n;return(0,te.parse)(Sa.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,te.is)(qf,i.value)){const s=(0,te.parse)(qf,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?x2.TypeTagSerializer.tagToString(i.type.Some):null,elements:i.objects.map(s=>si(s))}};case"MergeCoins":return{MergeCoins:{destination:si(i.destination),sources:i.sources.map(s=>si(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=>si(c))}}}case"Publish":return{Publish:{modules:i.modules.map(s=>(0,vo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies}};case"SplitCoins":return{SplitCoins:{coin:si(i.coin),amounts:i.amounts.map(s=>si(s))}};case"TransferObjects":return{TransferObjects:{objects:i.objects.map(s=>si(s)),address:si(i.address)}};case"Upgrade":return{Upgrade:{modules:i.modules.map(s=>(0,vo.toBase64)(Uint8Array.from(s))),dependencies:i.dependencies,package:i.packageId,ticket:si(i.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(i)}`)})})}function si(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 Sh=Object.defineProperty,RA=Object.getOwnPropertyDescriptor,NA=Object.getOwnPropertyNames,DA=Object.prototype.hasOwnProperty,$A=(e,t)=>{for(var r in t)Sh(e,r,{get:t[r],enumerable:!0})},BA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of NA(t))!DA.call(e,i)&&i!==r&&Sh(e,i,{get:()=>t[i],enumerable:!(n=RA(t,i))||n.enumerable});return e},LA=e=>BA(Sh({},"__esModule",{value:!0}),e),M2={};$A(M2,{SerializedTransactionDataV2:()=>KA});var UA=LA(M2),je=is,ar=jo;function nc(e){return(0,je.union)(Object.entries(e).map(([t,r])=>(0,je.object)({[t]:r})))}const ln=nc({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)())])}),FA=(0,je.object)({budget:(0,je.nullable)(ar.JsonU64),price:(0,je.nullable)(ar.JsonU64),owner:(0,je.nullable)(ar.SuiAddress),payment:(0,je.nullable)((0,je.array)(ar.ObjectRef))}),zA=(0,je.object)({package:ar.ObjectID,module:(0,je.string)(),function:(0,je.string)(),typeArguments:(0,je.array)((0,je.string)()),arguments:(0,je.array)(ln)}),VA=(0,je.object)({name:(0,je.string)(),inputs:(0,je.record)((0,je.string)(),(0,je.union)([ln,(0,je.array)(ln)])),data:(0,je.record)((0,je.string)(),(0,je.unknown)())}),qA=nc({MoveCall:zA,TransferObjects:(0,je.object)({objects:(0,je.array)(ln),address:ln}),SplitCoins:(0,je.object)({coin:ln,amounts:(0,je.array)(ln)}),MergeCoins:(0,je.object)({destination:ln,sources:(0,je.array)(ln)}),Publish:(0,je.object)({modules:(0,je.array)(ar.BCSBytes),dependencies:(0,je.array)(ar.ObjectID)}),MakeMoveVec:(0,je.object)({type:(0,je.nullable)((0,je.string)()),elements:(0,je.array)(ln)}),Upgrade:(0,je.object)({modules:(0,je.array)(ar.BCSBytes),dependencies:(0,je.array)(ar.ObjectID),package:ar.ObjectID,ticket:ln}),$Intent:VA}),GA=nc({ImmOrOwnedObject:ar.ObjectRef,SharedObject:(0,je.object)({objectId:ar.ObjectID,initialSharedVersion:ar.JsonU64,mutable:(0,je.boolean)()}),Receiving:ar.ObjectRef}),HA=nc({Object:GA,Pure:(0,je.object)({bytes:ar.BCSBytes}),UnresolvedPure:(0,je.object)({value:(0,je.unknown)()}),UnresolvedObject:(0,je.object)({objectId:ar.ObjectID,version:(0,je.optional)((0,je.nullable)(ar.JsonU64)),digest:(0,je.optional)((0,je.nullable)((0,je.string)())),initialSharedVersion:(0,je.optional)((0,je.nullable)(ar.JsonU64))})}),WA=nc({None:(0,je.literal)(!0),Epoch:ar.JsonU64}),KA=(0,je.object)({version:(0,je.literal)(2),sender:(0,je.nullish)(ar.SuiAddress),expiration:(0,je.nullish)(WA),gasData:FA,inputs:(0,je.array)(HA),commands:(0,je.array)(qA)});var Eh=Object.defineProperty,XA=Object.getOwnPropertyDescriptor,YA=Object.getOwnPropertyNames,JA=Object.prototype.hasOwnProperty,ZA=(e,t)=>{for(var r in t)Eh(e,r,{get:t[r],enumerable:!0})},QA=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YA(t))!JA.call(e,i)&&i!==r&&Eh(e,i,{get:()=>t[i],enumerable:!(n=XA(t,i))||n.enumerable});return e},eT=e=>QA(Eh({},"__esModule",{value:!0}),e),C2={};ZA(C2,{getClient:()=>Ro,resolveTransactionData:()=>oT});var A2=eT(C2),tT=is,mp=Ai,Gf=a2,rT=jo,Ea=qu,Gl=u2;const nT=50,iT=1000n,sT=5e10;async function oT(e,t,r){return await fT(e,t),await lT(e,t),t.onlyTransactionKind||(await aT(e,t),await cT(e,t),await uT(e,t)),await dT(e),await r()}async function aT(e,t){e.gasConfig.price||(e.gasConfig.price=String(await Ro(t).getReferenceGasPrice()))}async function cT(e,t){if(e.gasConfig.budget)return;const r=await Ro(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(sT),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=iT*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 uT(e,t){if(!e.gasConfig.payment){const n=(await Ro(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:Gf.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,tT.parse)(rT.ObjectRef,i))}}async function lT(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,Gf.normalizeSuiObjectId)(l.UnresolvedObject.objectId)))],i=n.length?gT(n,nT):[],s=(await Promise.all(i.map(l=>Ro(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,Gf.normalizeSuiAddress)(f.UnresolvedObject.objectId),_=u.get(y);f.UnresolvedObject.initialSharedVersion??(_==null?void 0:_.initialSharedVersion)?h=Ea.Inputs.SharedObjectRef({objectId:y,initialSharedVersion:f.UnresolvedObject.initialSharedVersion||(_==null?void 0:_.initialSharedVersion),mutable:hT(e,l)}):pT(e,l)&&(h=Ea.Inputs.ReceivingRef({objectId:y,digest:f.UnresolvedObject.digest??(_==null?void 0:_.digest),version:f.UnresolvedObject.version??(_==null?void 0:_.version)})),e.inputs[e.inputs.indexOf(f)]=h??Ea.Inputs.ObjectRef({objectId:y,digest:f.UnresolvedObject.digest??(_==null?void 0:_.digest),version:f.UnresolvedObject.version??(_==null?void 0:_.version)})}}async function fT(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=>{gp(c,mp.bcs.U64,e)});break;case"TransferObjects":gp(a.TransferObjects.address,mp.bcs.Address,e);break}});const o=new Map;if(s.size>0){const a=Ro(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,Gl.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,Gl.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 P,N;const y=c.arguments[h];if(y.$kind!=="Input")return;const _=r[y.Input];if(!_.UnresolvedPure&&!_.UnresolvedObject)return;const w=((P=_.UnresolvedPure)==null?void 0:P.value)??((N=_.UnresolvedObject)==null?void 0:N.objectId),A=(0,Gl.getPureBcsSchema)(f.body);if(A){y.type="pure",r[r.indexOf(_)]=Ea.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 I=_.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:w}}:_;r[y.Input]=I})}})}function dT(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 gp(e,t,r){if(e.$kind!=="Input")return;const n=r.inputs[e.Input];n.$kind==="UnresolvedPure"&&(r.inputs[e.Input]=Ea.Inputs.Pure(t.serialize(n.UnresolvedPure.value)))}function hT(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 pT(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=mT(i.MoveCall._argumentTypes[s])||r}}),r}function mT(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 Ro(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 gT(e,t){return Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,n*t+t))}var Mh=Object.defineProperty,vT=Object.getOwnPropertyDescriptor,yT=Object.getOwnPropertyNames,bT=Object.prototype.hasOwnProperty,wT=(e,t)=>{for(var r in t)Mh(e,r,{get:t[r],enumerable:!0})},_T=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yT(t))!bT.call(e,i)&&i!==r&&Mh(e,i,{get:()=>t[i],enumerable:!(n=vT(t,i))||n.enumerable});return e},xT=e=>_T(Mh({},"__esModule",{value:!0}),e),T2={};wT(T2,{createObjectMethods:()=>ST});var O2=xT(T2);function ST(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 Ch=Object.defineProperty,ET=Object.getOwnPropertyDescriptor,MT=Object.getOwnPropertyNames,CT=Object.prototype.hasOwnProperty,AT=(e,t)=>{for(var r in t)Ch(e,r,{get:t[r],enumerable:!0})},TT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of MT(t))!CT.call(e,i)&&i!==r&&Ch(e,i,{get:()=>t[i],enumerable:!(n=ET(t,i))||n.enumerable});return e},OT=e=>TT(Ch({},"__esModule",{value:!0}),e),I2={};AT(I2,{createPure:()=>kT});var k2=OT(I2),IT=Tr,rr=Ai;function kT(e){function t(r,n){if(typeof r=="string")return e(Ma(r).serialize(n));if(r instanceof Uint8Array||(0,IT.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(Ma(r)).serialize(n)),t.option=(r,n)=>e(rr.bcs.option(Ma(r)).serialize(n)),t}function Ma(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(Ma(n)):rr.bcs.option(Ma(n))}throw new Error(`Invalid Pure type name: ${e}`)}var Ah=Object.defineProperty,jT=Object.getOwnPropertyDescriptor,PT=Object.getOwnPropertyNames,RT=Object.prototype.hasOwnProperty,NT=(e,t)=>{for(var r in t)Ah(e,r,{get:t[r],enumerable:!0})},DT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of PT(t))!RT.call(e,i)&&i!==r&&Ah(e,i,{get:()=>t[i],enumerable:!(n=jT(t,i))||n.enumerable});return e},$T=e=>DT(Ah({},"__esModule",{value:!0}),e),j2={};NT(j2,{hashTypedData:()=>UT});var BT=$T(j2),LT=i2;function UT(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,LT.blake2b)(n,{dkLen:32})}var Th=Object.defineProperty,FT=Object.getOwnPropertyDescriptor,zT=Object.getOwnPropertyNames,VT=Object.prototype.hasOwnProperty,qT=(e,t)=>{for(var r in t)Th(e,r,{get:t[r],enumerable:!0})},GT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zT(t))!VT.call(e,i)&&i!==r&&Th(e,i,{get:()=>t[i],enumerable:!(n=FT(t,i))||n.enumerable});return e},HT=e=>GT(Th({},"__esModule",{value:!0}),e),P2={};qT(P2,{TransactionDataBuilder:()=>Ss});var Oh=HT(P2),WT=Tr,Hl=is,yc=Ai,KT=Hr,Wl=jo,XT=_2,YT=BT;function vp(e){return(0,KT.normalizeSuiAddress)(e).replace("0x","")}class Ss{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=yc.bcs.TransactionKind.parse(t).ProgrammableTransaction;if(!n)throw new Error("Unable to deserialize from bytes.");return Ss.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=yc.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 Ss.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 Ss((0,Hl.parse)(Wl.TransactionData,t)):new Ss((0,Hl.parse)(Wl.TransactionData,(0,XT.transactionDataFromV1)(t)))}static getDigestFromBytes(t){const r=(0,YT.hashTypedData)("TransactionData",t);return(0,WT.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 yc.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:vp(c),expiration:a||{None:!0},gasData:{payment:u.payment,owner:vp(this.gasData.owner??c),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:i,commands:s}}};return yc.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 Ss.getDigestFromBytes(t)}snapshot(){return(0,Hl.parse)(Wl.TransactionData,this)}}var Ih=Object.defineProperty,JT=Object.getOwnPropertyDescriptor,ZT=Object.getOwnPropertyNames,QT=Object.prototype.hasOwnProperty,eO=(e,t)=>{for(var r in t)Ih(e,r,{get:t[r],enumerable:!0})},tO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ZT(t))!QT.call(e,i)&&i!==r&&Ih(e,i,{get:()=>t[i],enumerable:!(n=JT(t,i))||n.enumerable});return e},rO=e=>tO(Ih({},"__esModule",{value:!0}),e),R2={};eO(R2,{extractMutableReference:()=>N2,extractReference:()=>D2,extractStructTag:()=>iO,getIdFromCallArg:()=>sO});var nO=rO(R2),ea=Hr;function N2(e){return typeof e=="object"&&"MutableReference"in e?e.MutableReference:void 0}function D2(e){return typeof e=="object"&&"Reference"in e?e.Reference:void 0}function iO(e){if(typeof e=="object"&&"Struct"in e)return e;const t=D2(e),r=N2(e);if(typeof t=="object"&&"Struct"in t)return t;if(typeof r=="object"&&"Struct"in r)return r}function sO(e){if(typeof e=="string")return(0,ea.normalizeSuiAddress)(e);if(e.Object)return e.Object.ImmOrOwnedObject?(0,ea.normalizeSuiAddress)(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?(0,ea.normalizeSuiAddress)(e.Object.Receiving.objectId):(0,ea.normalizeSuiAddress)(e.Object.SharedObject.objectId);if(e.UnresolvedObject)return(0,ea.normalizeSuiAddress)(e.UnresolvedObject.objectId)}var kh=Object.defineProperty,oO=Object.getOwnPropertyDescriptor,aO=Object.getOwnPropertyNames,cO=Object.prototype.hasOwnProperty,$2=e=>{throw TypeError(e)},uO=(e,t)=>{for(var r in t)kh(e,r,{get:t[r],enumerable:!0})},lO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aO(t))!cO.call(e,i)&&i!==r&&kh(e,i,{get:()=>t[i],enumerable:!(n=oO(t,i))||n.enumerable});return e},fO=e=>lO(kh({},"__esModule",{value:!0}),e),jh=(e,t,r)=>t.has(e)||$2("Cannot "+r),Et=(e,t,r)=>(jh(e,t,"read from private field"),r?r.call(e):t.get(e)),ta=(e,t,r)=>t.has(e)?$2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),us=(e,t,r,n)=>(jh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ai=(e,t,r)=>(jh(e,t,"access private method"),r),B2={};uO(B2,{Transaction:()=>yO,isTransaction:()=>U2});var Hu=fO(B2),jc=Tr,Bi=is,dO=Hr,ls=_h,Es=jo,yp=_2,hO=UA,bc=qu,pO=A2,mO=O2,gO=k2,ra=Oh,bp=nO,pa,Ca,vs,At,fn,Pc,Ph,Hf,Rh;function wp(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 L2=Symbol.for("@mysten/transaction");function U2(e){return!!e&&typeof e=="object"&&e[L2]===!0}const _p={buildPlugins:new Map,serializationPlugins:new Map},Kl=Symbol.for("@mysten/transaction/registry");function na(){try{const e=globalThis;return e[Kl]||(e[Kl]=_p),e[Kl]}catch{return _p}}const vO=class Wf{constructor(){ta(this,fn),ta(this,pa),ta(this,Ca),ta(this,vs,new Map),ta(this,At),this.object=(0,mO.createObjectMethods)(r=>{var s,o;if(typeof r=="function")return this.object(r(this));if(typeof r=="object"&&(0,Bi.is)(Es.Argument,r))return r;const n=(0,bp.getIdFromCallArg)(r),i=Et(this,At).inputs.find(a=>n===(0,bp.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:Et(this,At).inputs.indexOf(i),type:"object"}:Et(this,At).addInput("object",typeof r=="string"?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:(0,dO.normalizeSuiAddress)(r)}}:r)});const t=na();us(this,At,new ra.TransactionDataBuilder),us(this,Ca,[...t.buildPlugins.values()]),us(this,pa,[...t.serializationPlugins.values()])}static fromKind(t){const r=new Wf;return us(r,At,ra.TransactionDataBuilder.fromKindBytes(typeof t=="string"?(0,jc.fromBase64)(t):t)),r}static from(t){const r=new Wf;return U2(t)?us(r,At,new ra.TransactionDataBuilder(t.getData())):typeof t!="string"||!t.startsWith("{")?us(r,At,ra.TransactionDataBuilder.fromBytes(typeof t=="string"?(0,jc.fromBase64)(t):t)):us(r,At,ra.TransactionDataBuilder.restore(JSON.parse(t))),r}static registerGlobalSerializationPlugin(t,r){na().serializationPlugins.set(t,r??t)}static unregisterGlobalSerializationPlugin(t){na().serializationPlugins.delete(t)}static registerGlobalBuildPlugin(t,r){na().buildPlugins.set(t,r??t)}static unregisterGlobalBuildPlugin(t){na().buildPlugins.delete(t)}addSerializationPlugin(t){Et(this,pa).push(t)}addBuildPlugin(t){Et(this,Ca).push(t)}addIntentResolver(t,r){if(Et(this,vs).has(t)&&Et(this,vs).get(t)!==r)throw new Error(`Intent resolver for ${t} already exists`);Et(this,vs).set(t,r)}setSender(t){Et(this,At).sender=t}setSenderIfNotSet(t){Et(this,At).sender||(Et(this,At).sender=t)}setExpiration(t){Et(this,At).expiration=t?(0,Bi.parse)(Es.TransactionExpiration,t):null}setGasPrice(t){Et(this,At).gasConfig.price=String(t)}setGasBudget(t){Et(this,At).gasConfig.budget=String(t)}setGasBudgetIfNotSet(t){Et(this,At).gasData.budget==null&&(Et(this,At).gasConfig.budget=String(t))}setGasOwner(t){Et(this,At).gasConfig.owner=t}setGasPayment(t){Et(this,At).gasConfig.payment=t.map(r=>(0,Bi.parse)(Es.ObjectRef,r))}get blockData(){return(0,yp.serializeV1TransactionData)(Et(this,At).snapshot())}getData(){return Et(this,At).snapshot()}get[L2](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:(0,gO.createPure)(t=>(0,jc.isSerializedBcs)(t)?Et(this,At).addInput("pure",{$kind:"Pure",Pure:{bytes:t.toBase64()}}):Et(this,At).addInput("pure",(0,Bi.is)(Es.NormalizedCallArg,t)?(0,Bi.parse)(Es.NormalizedCallArg,t):t instanceof Uint8Array?bc.Inputs.Pure(t):{$kind:"UnresolvedPure",UnresolvedPure:{value:t}}))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...t){return this.object(bc.Inputs.ObjectRef(...t))}receivingRef(...t){return this.object(bc.Inputs.ReceivingRef(...t))}sharedObjectRef(...t){return this.object(bc.Inputs.SharedObjectRef(...t))}add(t){if(typeof t=="function")return t(this);const r=Et(this,At).commands.push(t);return wp(r-1)}splitCoins(t,r){const n=ls.Commands.SplitCoins(typeof t=="string"?this.object(t):ai(this,fn,Ph).call(this,t),r.map(s=>typeof s=="number"||typeof s=="bigint"||typeof s=="string"?this.pure.u64(s):ai(this,fn,Pc).call(this,s))),i=Et(this,At).commands.push(n);return wp(i-1,r.length)}mergeCoins(t,r){return this.add(ls.Commands.MergeCoins(this.object(t),r.map(n=>this.object(n))))}publish({modules:t,dependencies:r}){return this.add(ls.Commands.Publish({modules:t,dependencies:r}))}upgrade({modules:t,dependencies:r,package:n,ticket:i}){return this.add(ls.Commands.Upgrade({modules:t,dependencies:r,package:n,ticket:this.object(i)}))}moveCall({arguments:t,...r}){return this.add(ls.Commands.MoveCall({...r,arguments:t==null?void 0:t.map(n=>ai(this,fn,Pc).call(this,n))}))}transferObjects(t,r){return this.add(ls.Commands.TransferObjects(t.map(n=>this.object(n)),typeof r=="string"?this.pure.address(r):ai(this,fn,Pc).call(this,r)))}makeMoveVec({type:t,elements:r}){return this.add(ls.Commands.MakeMoveVec({type:t,elements:r.map(n=>this.object(n))}))}serialize(){return JSON.stringify((0,yp.serializeV1TransactionData)(Et(this,At).snapshot()))}async toJSON(t={}){return await this.prepareForSerialization(t),JSON.stringify((0,Bi.parse)(hO.SerializedTransactionDataV2,Et(this,At).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 ai(this,fn,Hf).call(this,t),Et(this,At).build({onlyTransactionKind:t.onlyTransactionKind})}async getDigest(t={}){return await ai(this,fn,Hf).call(this,t),Et(this,At).getDigest()}async prepareForSerialization(t){var i;const r=new Set;for(const s of Et(this,At).commands)s.$Intent&&r.add(s.$Intent.name);const n=[...Et(this,pa)];for(const s of r)if(!((i=t.supportedIntents)!=null&&i.includes(s))){if(!Et(this,vs).has(s))throw new Error(`Missing intent resolver for ${s}`);n.push(Et(this,vs).get(s))}await ai(this,fn,Rh).call(this,n,t)}};pa=new WeakMap;Ca=new WeakMap;vs=new WeakMap;At=new WeakMap;fn=new WeakSet;Pc=function(e){return(0,jc.isSerializedBcs)(e)?this.pure(e):ai(this,fn,Ph).call(this,e)};Ph=function(e){return typeof e=="function"?(0,Bi.parse)(Es.Argument,e(this)):(0,Bi.parse)(Es.Argument,e)};Hf=async function(e){if(!e.onlyTransactionKind&&!Et(this,At).sender)throw new Error("Missing transaction sender");await ai(this,fn,Rh).call(this,[...Et(this,Ca),pO.resolveTransactionData],e)};Rh=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(Et(this,At),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 yO=vO;var Nh=Object.defineProperty,bO=Object.getOwnPropertyDescriptor,wO=Object.getOwnPropertyNames,_O=Object.prototype.hasOwnProperty,F2=e=>{throw TypeError(e)},xO=(e,t)=>{for(var r in t)Nh(e,r,{get:t[r],enumerable:!0})},SO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wO(t))!_O.call(e,i)&&i!==r&&Nh(e,i,{get:()=>t[i],enumerable:!(n=bO(t,i))||n.enumerable});return e},EO=e=>SO(Nh({},"__esModule",{value:!0}),e),z2=(e,t,r)=>t.has(e)||F2("Cannot "+r),fr=(e,t,r)=>(z2(e,t,"read from private field"),r?r.call(e):t.get(e)),Kf=(e,t,r)=>t.has(e)?F2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xp=(e,t,r,n)=>(z2(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),V2={};xO(V2,{AsyncCache:()=>G2,InMemoryCache:()=>H2,ObjectCache:()=>MO});var q2=EO(V2),Xl=Hr,ys,Sr,Rc;class G2{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,Xl.normalizeSuiAddress)(t.package)}::${t.module}::${t.function}`;return this.get("MoveFunction",r)}async addMoveFunctionDefinition(t){const r=(0,Xl.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,Xl.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 H2 extends G2{constructor(){super(...arguments),Kf(this,ys,{OwnedObject:new Map,SharedOrImmutableObject:new Map,MoveFunction:new Map,Custom:new Map})}async get(t,r){return fr(this,ys)[t].get(r)??null}async set(t,r,n){fr(this,ys)[t].set(r,n)}async delete(t,r){fr(this,ys)[t].delete(r)}async clear(t){if(t)fr(this,ys)[t].clear();else for(const r of Object.values(fr(this,ys)))r.clear()}}ys=new WeakMap;class MO{constructor({cache:t=new H2,onEffects:r}){Kf(this,Sr),Kf(this,Rc),xp(this,Sr,t),xp(this,Rc,r)}asPlugin(){return async(t,r,n)=>{const i=t.inputs.filter(a=>a.UnresolvedObject).map(a=>a.UnresolvedObject.objectId),s=(await fr(this,Sr).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 fr(this,Sr).addMoveFunctionDefinition({package:a.MoveCall.package,module:a.MoveCall.module,function:a.MoveCall.function,parameters:a.MoveCall._argumentTypes})}))}}async clear(){await fr(this,Sr).clear()}async getMoveFunctionDefinition(t){return fr(this,Sr).getMoveFunctionDefinition(t)}async getObjects(t){return fr(this,Sr).getObjects(t)}async deleteObjects(t){return fr(this,Sr).deleteObjects(t)}async clearOwnedObjects(){await fr(this,Sr).clear("OwnedObject")}async clearCustom(){await fr(this,Sr).clear("Custom")}async getCustom(t){return fr(this,Sr).getCustom(t)}async setCustom(t,r){return fr(this,Sr).setCustom(t,r)}async deleteCustom(t){return fr(this,Sr).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([fr(this,Sr).addObjects(o),fr(this,Sr).deleteObjects(s),(r=fr(this,Rc))==null?void 0:r.call(this,t)])}}Sr=new WeakMap;Rc=new WeakMap;var Dh=Object.defineProperty,CO=Object.getOwnPropertyDescriptor,AO=Object.getOwnPropertyNames,TO=Object.prototype.hasOwnProperty,W2=e=>{throw TypeError(e)},OO=(e,t)=>{for(var r in t)Dh(e,r,{get:t[r],enumerable:!0})},IO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of AO(t))!TO.call(e,i)&&i!==r&&Dh(e,i,{get:()=>t[i],enumerable:!(n=CO(t,i))||n.enumerable});return e},kO=e=>IO(Dh({},"__esModule",{value:!0}),e),K2=(e,t,r)=>t.has(e)||W2("Cannot "+r),ia=(e,t,r)=>(K2(e,t,"read from private field"),r?r.call(e):t.get(e)),Sp=(e,t,r)=>t.has(e)?W2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Yl=(e,t,r,n)=>(K2(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),X2={};OO(X2,{CachingTransactionExecutor:()=>NO});var Y2=kO(X2),jO=Ai,PO=q2,RO=Hu,ro,no;class NO{constructor({client:t,...r}){Sp(this,ro),Sp(this,no,null),Yl(this,ro,t),this.cache=new PO.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:ia(this,ro),...r})}async executeTransaction({transaction:t,options:r,...n}){const i=(0,RO.isTransaction)(t)?await this.buildTransaction({transaction:t}):t,s=await ia(this,ro).executeTransactionBlock({...n,transactionBlock:i,options:{...r,showRawEffects:!0}});if(s.rawEffects){const o=jO.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;Yl(this,no,((r=t.V2)==null?void 0:r.transactionDigest)??null),await this.cache.applyEffects(t)}async waitForLastTransaction(){ia(this,no)&&(await ia(this,ro).waitForTransaction({digest:ia(this,no)}),Yl(this,no,null))}}ro=new WeakMap;no=new WeakMap;var $h=Object.defineProperty,DO=Object.getOwnPropertyDescriptor,$O=Object.getOwnPropertyNames,BO=Object.prototype.hasOwnProperty,J2=e=>{throw TypeError(e)},LO=(e,t)=>{for(var r in t)$h(e,r,{get:t[r],enumerable:!0})},UO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $O(t))!BO.call(e,i)&&i!==r&&$h(e,i,{get:()=>t[i],enumerable:!(n=DO(t,i))||n.enumerable});return e},FO=e=>UO($h({},"__esModule",{value:!0}),e),zO=(e,t,r)=>t.has(e)||J2("Cannot "+r),pn=(e,t,r)=>(zO(e,t,"read from private field"),r?r.call(e):t.get(e)),Z2=(e,t,r)=>t.has(e)?J2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Q2={};LO(Q2,{ParallelQueue:()=>qO,SerialQueue:()=>VO});var e_=FO(Q2),Ni,bs;class VO{constructor(){Z2(this,Ni,[])}async runTask(t){return new Promise((r,n)=>{pn(this,Ni).push(()=>{t().finally(()=>{pn(this,Ni).shift(),pn(this,Ni).length>0&&pn(this,Ni)[0]()}).then(r,n)}),pn(this,Ni).length===1&&pn(this,Ni)[0]()})}}Ni=new WeakMap;class qO{constructor(t){Z2(this,bs,[]),this.activeTasks=0,this.maxTasks=t}runTask(t){return new Promise((r,n)=>{this.activeTasks<this.maxTasks?(this.activeTasks++,t().finally(()=>{pn(this,bs).length>0?pn(this,bs).shift()():this.activeTasks--}).then(r,n)):pn(this,bs).push(()=>{t().finally(()=>{pn(this,bs).length>0?pn(this,bs).shift()():this.activeTasks--}).then(r,n)})})}}bs=new WeakMap;var Bh=Object.defineProperty,GO=Object.getOwnPropertyDescriptor,HO=Object.getOwnPropertyNames,WO=Object.prototype.hasOwnProperty,t_=e=>{throw TypeError(e)},KO=(e,t)=>{for(var r in t)Bh(e,r,{get:t[r],enumerable:!0})},XO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of HO(t))!WO.call(e,i)&&i!==r&&Bh(e,i,{get:()=>t[i],enumerable:!(n=GO(t,i))||n.enumerable});return e},YO=e=>XO(Bh({},"__esModule",{value:!0}),e),r_=(e,t,r)=>t.has(e)||t_("Cannot "+r),xr=(e,t,r)=>(r_(e,t,"read from private field"),r?r.call(e):t.get(e)),qs=(e,t,r)=>t.has(e)?t_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Jl=(e,t,r,n)=>(r_(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),n_={};KO(n_,{SerialTransactionExecutor:()=>e7,getGasCoinFromEffects:()=>s_});var i_=YO(n_),JO=Tr,Ep=Hu,ZO=Y2,QO=e_,Nc,ma,un,Dc,Xf,$c;class e7{constructor({signer:t,defaultGasBudget:r=50000000n,...n}){qs(this,Nc,new QO.SerialQueue),qs(this,ma),qs(this,un),qs(this,Dc),qs(this,Xf,async i=>{if(!i.V2)return;const s=s_(i).ref;s?xr(this,un).cache.setCustom("gasCoin",s):xr(this,un).cache.deleteCustom("gasCoin")}),qs(this,$c,async i=>{const s=await xr(this,un).cache.getCustom("gasCoin"),o=Ep.Transaction.from(i);return s&&o.setGasPayment([s]),o.setGasBudgetIfNotSet(xr(this,Dc)),o.setSenderIfNotSet(xr(this,ma).toSuiAddress()),xr(this,un).buildTransaction({transaction:o})}),Jl(this,ma,t),Jl(this,Dc,r),Jl(this,un,new ZO.CachingTransactionExecutor({client:n.client,cache:n.cache,onEffects:i=>xr(this,Xf).call(this,i)}))}async applyEffects(t){return xr(this,un).applyEffects(t)}async buildTransaction(t){return xr(this,Nc).runTask(()=>xr(this,$c).call(this,t))}resetCache(){return xr(this,un).reset()}waitForLastTransaction(){return xr(this,un).waitForLastTransaction()}executeTransaction(t,r){return xr(this,Nc).runTask(async()=>{const n=(0,Ep.isTransaction)(t)?await xr(this,$c).call(this,t):t,{signature:i}=await xr(this,ma).signTransaction(n),s=await xr(this,un).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,JO.toBase64)(o),data:s}})}}Nc=new WeakMap;ma=new WeakMap;un=new WeakMap;Dc=new WeakMap;Xf=new WeakMap;$c=new WeakMap;function s_(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 Lh=Object.defineProperty,t7=Object.getOwnPropertyDescriptor,r7=Object.getOwnPropertyNames,n7=Object.prototype.hasOwnProperty,o_=e=>{throw TypeError(e)},i7=(e,t)=>{for(var r in t)Lh(e,r,{get:t[r],enumerable:!0})},s7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of r7(t))!n7.call(e,i)&&i!==r&&Lh(e,i,{get:()=>t[i],enumerable:!(n=t7(t,i))||n.enumerable});return e},o7=e=>s7(Lh({},"__esModule",{value:!0}),e),Uh=(e,t,r)=>t.has(e)||o_("Cannot "+r),Ge=(e,t,r)=>(Uh(e,t,"read from private field"),r?r.call(e):t.get(e)),lr=(e,t,r)=>t.has(e)?o_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),tr=(e,t,r,n)=>(Uh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Qr=(e,t,r)=>(Uh(e,t,"access private method"),r),Mp=(e,t,r,n)=>({set _(i){tr(e,t,i,r)},get _(){return Ge(e,t,n)}}),a_={};i7(a_,{ParallelTransactionExecutor:()=>d7});var a7=o7(a_),c7=Tr,c_=Ai,u7=Hu,l7=Oh,f7=Y2,Cp=e_,u_=i_,qi,zn,hu,Ra,Aa,Na,pu,yo,jr,Gi,ks,Ts,Fh,Bc,Da,ao,xo,li,Dr,l_,f_,$a,zh,d_,Yf,h_;const sa={coinBatchSize:20,initialCoinBalance:200000000n,minimumCoinBalance:50000000n,maxPoolSize:50,epochBoundaryWindow:1e3};class d7{constructor(t){lr(this,Dr),lr(this,qi),lr(this,zn),lr(this,hu),lr(this,Ra),lr(this,Aa),lr(this,Na),lr(this,pu),lr(this,yo),lr(this,jr),lr(this,Gi,[]),lr(this,ks),lr(this,Ts,new Map),lr(this,Fh,new Cp.SerialQueue),lr(this,Bc),lr(this,Da,null),lr(this,ao,null),lr(this,xo,0),lr(this,li,null),tr(this,qi,t.signer),tr(this,zn,t.client),tr(this,hu,t.coinBatchSize??sa.coinBatchSize),tr(this,Ra,t.initialCoinBalance??sa.initialCoinBalance),tr(this,Aa,t.minimumCoinBalance??sa.minimumCoinBalance),tr(this,pu,t.defaultGasBudget??Ge(this,Aa)),tr(this,Na,t.epochBoundaryWindow??sa.epochBoundaryWindow),tr(this,yo,t.maxPoolSize??sa.maxPoolSize),tr(this,ks,new f7.CachingTransactionExecutor({client:t.client,cache:t.cache})),tr(this,Bc,new Cp.ParallelQueue(Ge(this,yo))),tr(this,jr,t.sourceCoins?new Map(t.sourceCoins.map(r=>[r,null])):null)}resetCache(){return tr(this,li,null),Qr(this,Dr,$a).call(this,()=>Ge(this,ks).reset())}async waitForLastTransaction(){await Qr(this,Dr,$a).call(this,()=>Qr(this,Dr,zh).call(this))}async executeTransaction(t,r){const{promise:n,resolve:i,reject:s}=h7(),o=await Qr(this,Dr,l_).call(this,t),a=()=>{Ge(this,Bc).runTask(()=>Qr(this,Dr,f_).call(this,t,o,r).then(i,s))},c=new Set;return o.forEach(u=>{Ge(this,Ts).get(u)?(c.add(u),Ge(this,Ts).get(u).push(()=>{c.delete(u),c.size===0&&a()})):Ge(this,Ts).set(u,[])}),c.size===0&&a(),n}}qi=new WeakMap;zn=new WeakMap;hu=new WeakMap;Ra=new WeakMap;Aa=new WeakMap;Na=new WeakMap;pu=new WeakMap;yo=new WeakMap;jr=new WeakMap;Gi=new WeakMap;ks=new WeakMap;Ts=new WeakMap;Fh=new WeakMap;Bc=new WeakMap;Da=new WeakMap;ao=new WeakMap;xo=new WeakMap;li=new WeakMap;Dr=new WeakSet;l_=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:Ge(this,zn)}),t};f_=async function(e,t,r){var i;let n;try{e.setSenderIfNotSet(Ge(this,qi).toSuiAddress()),await Ge(this,Fh).runTask(async()=>{e.getData().gasData.price||e.setGasPrice(await Qr(this,Dr,Yf).call(this)),e.setGasBudgetIfNotSet(Ge(this,pu)),await Qr(this,Dr,$a).call(this),n=await Qr(this,Dr,d_).call(this),Mp(this,xo)._++,e.setGasPayment([{objectId:n.id,version:n.version,digest:n.digest}]),await Ge(this,ks).buildTransaction({transaction:e,onlyTransactionKind:!0})});const s=await e.build({client:Ge(this,zn)}),{signature:o}=await Ge(this,qi).signTransaction(s),a=await Ge(this,ks).executeTransaction({transaction:s,signature:o,options:{...r,showEffects:!0}}),c=Uint8Array.from(a.rawEffects),u=c_.bcs.TransactionEffects.parse(c),l=(0,u_.getGasCoinFromEffects)(u),f=(i=u.V2)==null?void 0:i.gasUsed;if(n&&f&&l.owner===Ge(this,qi).toSuiAddress()){const h=BigInt(f.computationCost)+BigInt(f.storageCost)+BigInt(f.storageCost)-BigInt(f.storageRebate);let y=!1;new l7.TransactionDataBuilder(e.getData()).mapArguments(_=>(_.$kind==="GasCoin"&&(y=!0),_)),!y&&n.balance>=Ge(this,Aa)?Ge(this,Gi).push({id:l.ref.objectId,version:l.ref.version,digest:l.ref.digest,balance:n.balance-h}):(Ge(this,jr)||tr(this,jr,new Map),Ge(this,jr).set(l.ref.objectId,l.ref))}return tr(this,Da,a.digest),{digest:a.digest,effects:(0,c7.toBase64)(c),data:a}}catch(s){throw n&&(Ge(this,jr)||tr(this,jr,new Map),Ge(this,jr).set(n.id,null)),await Qr(this,Dr,$a).call(this,async()=>{await Promise.all([Ge(this,ks).cache.deleteObjects([...t]),Qr(this,Dr,zh).call(this)])}),s}finally{t.forEach(s=>{const o=Ge(this,Ts).get(s);o&&o.length>0?o.shift()():o&&Ge(this,Ts).delete(s)}),Mp(this,xo)._--}};$a=async function(e){Ge(this,ao)&&await Ge(this,ao),tr(this,ao,(e==null?void 0:e().then(()=>{tr(this,ao,null)},()=>{}))??null)};zh=async function(){const e=Ge(this,Da);e&&(tr(this,Da,null),await Ge(this,zn).waitForTransaction({digest:e}))};d_=async function(){if(Ge(this,Gi).length===0&&Ge(this,xo)<=Ge(this,yo)&&await Qr(this,Dr,h_).call(this),Ge(this,Gi).length===0)throw new Error("No coins available");return Ge(this,Gi).shift()};Yf=async function(){if((Ge(this,li)?Ge(this,li).expiration-Ge(this,Na)-Date.now():0)>0)return Ge(this,li).price;if(Ge(this,li)){const r=Math.max(Ge(this,li).expiration+Ge(this,Na)-Date.now(),1e3);await new Promise(n=>setTimeout(n,r))}const t=await Ge(this,zn).getLatestSuiSystemState();return tr(this,li,{price:BigInt(t.referenceGasPrice),expiration:Number.parseInt(t.epochStartTimestampMs,10)+Number.parseInt(t.epochDurationMs,10)}),Qr(this,Dr,Yf).call(this)};h_=async function(){var u;const e=Math.min(Ge(this,hu),Ge(this,yo)-(Ge(this,Gi).length+Ge(this,xo))+1);if(e===0)return;const t=new u7.Transaction,r=Ge(this,qi).toSuiAddress();if(t.setSender(r),Ge(this,jr)){const l=[],f=[];for(const[h,y]of Ge(this,jr))y?l.push(y):f.push(h);if(f.length>0){const h=await Ge(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),tr(this,jr,new Map)}const n=new Array(e).fill(Ge(this,Ra)),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 Ge(this,zn).signAndExecuteTransaction({transaction:t,signer:Ge(this,qi),options:{showRawEffects:!0}}),a=c_.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||Ge(this,Gi).push({id:l,version:a.V2.lamportVersion,digest:f.ObjectWrite[0],balance:BigInt(Ge(this,Ra))})}),Ge(this,jr)||tr(this,jr,new Map);const c=(0,u_.getGasCoinFromEffects)(a).ref;Ge(this,jr).set(c.objectId,c),await Ge(this,zn).waitForTransaction({digest:o.digest})};function h7(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}var Vh=Object.defineProperty,p7=Object.getOwnPropertyDescriptor,m7=Object.getOwnPropertyNames,g7=Object.prototype.hasOwnProperty,v7=(e,t)=>{for(var r in t)Vh(e,r,{get:t[r],enumerable:!0})},y7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of m7(t))!g7.call(e,i)&&i!==r&&Vh(e,i,{get:()=>t[i],enumerable:!(n=p7(t,i))||n.enumerable});return e},b7=e=>y7(Vh({},"__esModule",{value:!0}),e),p_={};v7(p_,{coinWithBalance:()=>S7});var w7=b7(p_),Lc=is,_7=Ai,m_=Hr,Uc=_h,Ap=qu,x7=A2;const mu="CoinWithBalance",Tp=(0,m_.normalizeStructTag)("0x2::sui::SUI");function S7({type:e=Tp,balance:t,useGasCoin:r=!0}){return n=>{n.addIntentResolver(mu,M7);const i=e==="gas"?e:(0,m_.normalizeStructTag)(e);return n.add(Uc.Commands.Intent({name:mu,inputs:{},data:{type:i===Tp&&r?"gas":i,balance:BigInt(t)}}))}}const E7=(0,Lc.object)({type:(0,Lc.string)(),balance:(0,Lc.bigint)()});async function M7(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===mu){const{type:h,balance:y}=(0,Lc.parse)(E7,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,x7.getClient)(t);await Promise.all([...n].map(async f=>{o.set(f,await C7({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!==mu)continue;const{type:y,balance:_}=h.$Intent.data;if(_===0n){e.replaceCommand(f,Uc.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const w=[];if(!c.has(y)){const[A,...I]=o.get(y).map(P=>e.addInput("object",Ap.Inputs.ObjectRef({objectId:P.coinObjectId,digest:P.digest,version:P.version})));I.length>0&&w.push(Uc.Commands.MergeCoins(A,I)),c.set(y,A)}w.push(Uc.Commands.SplitCoins(c.get(y),[e.addInput("pure",Ap.Inputs.Pure(_7.bcs.u64().serialize(_)))])),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 C7({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,_)=>Number(BigInt(_.balance)-BigInt(y.balance)));for(const y of h){if(i.has(y.coinObjectId))continue;const _=BigInt(y.balance);if(o.push(y),s-=_,s<=0)return o}if(l)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}var qh=Object.defineProperty,A7=Object.getOwnPropertyDescriptor,T7=Object.getOwnPropertyNames,O7=Object.prototype.hasOwnProperty,I7=(e,t)=>{for(var r in t)qh(e,r,{get:t[r],enumerable:!0})},k7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of T7(t))!O7.call(e,i)&&i!==r&&qh(e,i,{get:()=>t[i],enumerable:!(n=A7(t,i))||n.enumerable});return e},j7=e=>k7(qh({},"__esModule",{value:!0}),e),g_={};I7(g_,{Arguments:()=>D7});var P7=j7(g_),R7=O2,N7=k2;const D7={pure:(0,N7.createPure)(e=>t=>t.pure(e)),object:(0,R7.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 Gh=Object.defineProperty,$7=Object.getOwnPropertyDescriptor,B7=Object.getOwnPropertyNames,L7=Object.prototype.hasOwnProperty,U7=(e,t)=>{for(var r in t)Gh(e,r,{get:t[r],enumerable:!0})},F7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of B7(t))!L7.call(e,i)&&i!==r&&Gh(e,i,{get:()=>t[i],enumerable:!(n=$7(t,i))||n.enumerable});return e},z7=e=>F7(Gh({},"__esModule",{value:!0}),e),v_={};U7(v_,{findTransactionBlockNames:()=>q7,listToRequests:()=>H7,replaceNames:()=>G7});var V7=z7(v_),y_=t2;const co="/",q7=e=>{var n;const t=new Set,r=new Set;for(const i of e.commands){if((n=i.MakeMoveVec)!=null&&n.type){Op([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,y_.isValidNamedPackage)(o))throw new Error(`Invalid package name: ${o}`);t.add(o)}Op(s.typeArguments??[]).forEach(a=>{r.add(a)})}return{packages:[...t],types:[...r]}};function Op(e){const t=new Set;for(const r of e)if(r.includes(co)){if(!(0,y_.isValidNamedType)(r))throw new Error(`Invalid type with names: ${r}`);t.add(r)}return[...t]}const G7=(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}}},H7=(e,t)=>{const r=[],n=Ip(e.packages),i=Ip(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 W7(r,t)},Ip=e=>[...new Set(e)],W7=(e,t)=>{const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r};var Hh=Object.defineProperty,K7=Object.getOwnPropertyDescriptor,X7=Object.getOwnPropertyNames,Y7=Object.prototype.hasOwnProperty,J7=(e,t)=>{for(var r in t)Hh(e,r,{get:t[r],enumerable:!0})},Z7=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X7(t))!Y7.call(e,i)&&i!==r&&Hh(e,i,{get:()=>t[i],enumerable:!(n=K7(t,i))||n.enumerable});return e},Q7=e=>Z7(Hh({},"__esModule",{value:!0}),e),b_={};J7(b_,{namedPackagesPlugin:()=>tI});var eI=Q7(b_),Zl=V7;const tI=({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,Zl.findTransactionBlockNames)(s),u=(0,Zl.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,Zl.replaceNames)(s,n),await a()};async function i(s,o){const a={packages:{},types:{}};if(o.length===0)return a;const c=`{
|
|
25
|
+
${o.map(l=>{const f=l.type==="package"?"packageByName":"typeByName",h=l.type==="package"?"address":"repr";return`${kp(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=pm(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}},pm=e=>`key_${e}`;var Ep=Object.defineProperty,LI=Object.getOwnPropertyDescriptor,FI=Object.getOwnPropertyNames,UI=Object.prototype.hasOwnProperty,zI=(e,t)=>{for(var r in t)Ep(e,r,{get:t[r],enumerable:!0})},VI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of FI(t))!UI.call(e,i)&&i!==r&&Ep(e,i,{get:()=>t[i],enumerable:!(n=LI(t,i))||n.enumerable});return e},qI=e=>VI(Ep({},"__esModule",{value:!0}),e),J_={};zI(J_,{Arguments:()=>JI.Arguments,AsyncCache:()=>ym.AsyncCache,Commands:()=>gm.Commands,Inputs:()=>HI.Inputs,ObjectCache:()=>ym.ObjectCache,ParallelTransactionExecutor:()=>KI.ParallelTransactionExecutor,SerialTransactionExecutor:()=>GI.SerialTransactionExecutor,Transaction:()=>vm.Transaction,TransactionDataBuilder:()=>WI.TransactionDataBuilder,UpgradePolicy:()=>gm.UpgradePolicy,coinWithBalance:()=>XI.coinWithBalance,getPureBcsSchema:()=>mm.getPureBcsSchema,isTransaction:()=>vm.isTransaction,namedPackagesPlugin:()=>YI.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>mm.normalizedTypeToMoveTypeSignature});var po=qI(J_),mm=L2,HI=il,gm=Zh,vm=ol,WI=op,ym=w_,GI=R_,KI=qO,XI=nI,JI=gI,YI=BI,Y_={},al={},Cp={},cl={},Mp={},ul={};Object.defineProperty(ul,"__esModule",{value:!0});ul.Convert=void 0;class ZI{static toPriceFeed(t){return bf(t,pi("PriceFeed"))}static priceFeedToJson(t){return wf(t,pi("PriceFeed"))}static toPrice(t){return bf(t,pi("Price"))}static priceToJson(t){return wf(t,pi("Price"))}static toPriceFeedMetadata(t){return bf(t,pi("PriceFeedMetadata"))}static priceFeedMetadataToJson(t){return wf(t,pi("PriceFeedMetadata"))}}ul.Convert=ZI;function li(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 QI(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 e7(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 mo(e,t,r,n=""){function i(l,f){return typeof l==typeof f?f:li(l,f,n)}function s(l,f){const h=l.length;for(let y=0;y<h;y++){const b=l[y];try{return mo(f,b,r)}catch{}}return li(l,f)}function o(l,f){return l.indexOf(f)!==-1?f:li(l,f)}function a(l,f){return Array.isArray(f)?f.map(h=>mo(h,l,r)):li("array",f)}function c(l){if(l===null)return null;const f=new Date(l);return isNaN(f.valueOf())?li("Date",l):f}function u(l,f,h){if(h===null||typeof h!="object"||Array.isArray(h))return li("object",h);const y={};return Object.getOwnPropertyNames(l).forEach(b=>{const w=l[b],T=Object.prototype.hasOwnProperty.call(h,b)?h[b]:void 0;y[w.key]=mo(T,w.typ,r,w.key)}),Object.getOwnPropertyNames(h).forEach(b=>{Object.prototype.hasOwnProperty.call(l,b)||(y[b]=mo(h[b],f,r,b))}),y}if(t==="any")return e;if(t===null)return e===null?e:li(t,e);if(t===!1)return li(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):li(t,e):t===Date&&typeof e!="number"?c(e):i(t,e)}function bf(e,t){return mo(e,t,QI)}function wf(e,t){return mo(e,t,e7)}function fs(...e){return{unionMembers:e}}function _f(e,t){return{props:e,additional:t}}function pi(e){return{ref:e}}const t7={PriceFeed:_f([{json:"ema_price",js:"ema_price",typ:pi("Price")},{json:"id",js:"id",typ:""},{json:"metadata",js:"metadata",typ:fs(void 0,pi("PriceFeedMetadata"))},{json:"price",js:"price",typ:pi("Price")},{json:"vaa",js:"vaa",typ:fs(void 0,"")}],"any"),Price:_f([{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:_f([{json:"attestation_time",js:"attestation_time",typ:fs(void 0,0)},{json:"emitter_chain",js:"emitter_chain",typ:0},{json:"prev_publish_time",js:"prev_publish_time",typ:fs(void 0,0)},{json:"price_service_receive_time",js:"price_service_receive_time",typ:fs(void 0,0)},{json:"sequence_number",js:"sequence_number",typ:fs(void 0,0)},{json:"slot",js:"slot",typ:fs(void 0,0)}],"any")};var uc={};(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(R){var N=R.length;if(N%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var z=R.indexOf("=");z===-1&&(z=N);var F=z===N?0:4-z%4;return[z,F]}function l(R){var N=u(R),z=N[0],F=N[1];return(z+F)*3/4-F}function f(R,N,z){return(N+z)*3/4-z}function h(R){var N,z=u(R),F=z[0],W=z[1],q=new s(f(R,F,W)),K=0,te=W>0?F-4:F,se;for(se=0;se<te;se+=4)N=i[R.charCodeAt(se)]<<18|i[R.charCodeAt(se+1)]<<12|i[R.charCodeAt(se+2)]<<6|i[R.charCodeAt(se+3)],q[K++]=N>>16&255,q[K++]=N>>8&255,q[K++]=N&255;return W===2&&(N=i[R.charCodeAt(se)]<<2|i[R.charCodeAt(se+1)]>>4,q[K++]=N&255),W===1&&(N=i[R.charCodeAt(se)]<<10|i[R.charCodeAt(se+1)]<<4|i[R.charCodeAt(se+2)]>>2,q[K++]=N>>8&255,q[K++]=N&255),q}function y(R){return n[R>>18&63]+n[R>>12&63]+n[R>>6&63]+n[R&63]}function b(R,N,z){for(var F,W=[],q=N;q<z;q+=3)F=(R[q]<<16&16711680)+(R[q+1]<<8&65280)+(R[q+2]&255),W.push(y(F));return W.join("")}function w(R){for(var N,z=R.length,F=z%3,W=[],q=16383,K=0,te=z-F;K<te;K+=q)W.push(b(R,K,K+q>te?te:K+q));return F===1?(N=R[z-1],W.push(n[N>>2]+n[N<<4&63]+"==")):F===2&&(N=(R[z-2]<<8)+R[z-1],W.push(n[N>>10]+n[N>>4&63]+n[N<<2&63]+"=")),W.join("")}var T={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */T.read=function(R,N,z,F,W){var q,K,te=W*8-F-1,se=(1<<te)-1,H=se>>1,L=-7,D=z?W-1:0,p=z?-1:1,d=R[N+D];for(D+=p,q=d&(1<<-L)-1,d>>=-L,L+=te;L>0;q=q*256+R[N+D],D+=p,L-=8);for(K=q&(1<<-L)-1,q>>=-L,L+=F;L>0;K=K*256+R[N+D],D+=p,L-=8);if(q===0)q=1-H;else{if(q===se)return K?NaN:(d?-1:1)*(1/0);K=K+Math.pow(2,F),q=q-H}return(d?-1:1)*K*Math.pow(2,q-F)},T.write=function(R,N,z,F,W,q){var K,te,se,H=q*8-W-1,L=(1<<H)-1,D=L>>1,p=W===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=F?0:q-1,m=F?1:-1,x=N<0||N===0&&1/N<0?1:0;for(N=Math.abs(N),isNaN(N)||N===1/0?(te=isNaN(N)?1:0,K=L):(K=Math.floor(Math.log(N)/Math.LN2),N*(se=Math.pow(2,-K))<1&&(K--,se*=2),K+D>=1?N+=p/se:N+=p*Math.pow(2,1-D),N*se>=2&&(K++,se/=2),K+D>=L?(te=0,K=L):K+D>=1?(te=(N*se-1)*Math.pow(2,W),K=K+D):(te=N*Math.pow(2,D-1)*Math.pow(2,W),K=0));W>=8;R[z+d]=te&255,d+=m,te/=256,W-=8);for(K=K<<W|te,H+=W;H>0;R[z+d]=K&255,d+=m,K/=256,H-=8);R[z+d-m]|=x*128};/*!
|
|
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=kp(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}},kp=e=>`key_${e}`;var Wh=Object.defineProperty,rI=Object.getOwnPropertyDescriptor,nI=Object.getOwnPropertyNames,iI=Object.prototype.hasOwnProperty,sI=(e,t)=>{for(var r in t)Wh(e,r,{get:t[r],enumerable:!0})},oI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nI(t))!iI.call(e,i)&&i!==r&&Wh(e,i,{get:()=>t[i],enumerable:!(n=rI(t,i))||n.enumerable});return e},aI=e=>oI(Wh({},"__esModule",{value:!0}),e),w_={};sI(w_,{Arguments:()=>hI.Arguments,AsyncCache:()=>Np.AsyncCache,Commands:()=>Pp.Commands,Inputs:()=>cI.Inputs,ObjectCache:()=>Np.ObjectCache,ParallelTransactionExecutor:()=>fI.ParallelTransactionExecutor,SerialTransactionExecutor:()=>lI.SerialTransactionExecutor,Transaction:()=>Rp.Transaction,TransactionDataBuilder:()=>uI.TransactionDataBuilder,UpgradePolicy:()=>Pp.UpgradePolicy,coinWithBalance:()=>dI.coinWithBalance,getPureBcsSchema:()=>jp.getPureBcsSchema,isTransaction:()=>Rp.isTransaction,namedPackagesPlugin:()=>pI.namedPackagesPlugin,normalizedTypeToMoveTypeSignature:()=>jp.normalizedTypeToMoveTypeSignature});var uo=aI(w_),jp=u2,cI=qu,Pp=_h,Rp=Hu,uI=Oh,Np=q2,lI=i_,fI=a7,dI=w7,hI=P7,pI=eI,Dp=iM,Jf=sM,mI=uo,gI=Object.create,Kh=Object.defineProperty,vI=Object.defineProperties,yI=Object.getOwnPropertyDescriptor,bI=Object.getOwnPropertyDescriptors,__=Object.getOwnPropertyNames,$p=Object.getOwnPropertySymbols,wI=Object.getPrototypeOf,x_=Object.prototype.hasOwnProperty,_I=Object.prototype.propertyIsEnumerable,Bp=(e,t,r)=>t in e?Kh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xI=(e,t)=>{for(var r in t||(t={}))x_.call(t,r)&&Bp(e,r,t[r]);if($p)for(var r of $p(t))_I.call(t,r)&&Bp(e,r,t[r]);return e},SI=(e,t)=>vI(e,bI(t)),EI=(e=>typeof $n<"u"?$n:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof $n<"u"?$n:t)[r]}):e)(function(e){if(typeof $n<"u")return $n.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),MI=(e,t)=>function(){return t||(0,e[__(e)[0]])((t={exports:{}}).exports,t),t.exports},CI=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of __(t))!x_.call(e,i)&&i!==r&&Kh(e,i,{get:()=>t[i],enumerable:!(n=yI(t,i))||n.enumerable});return e},No=(e,t,r)=>(r=e!=null?gI(wI(e)):{},CI(!e||!e.__esModule?Kh(r,"default",{value:e,enumerable:!0}):r,e)),Tt=(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())}),Do=MI({"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=EI("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 E=0;d[0]==="-"&&(E++,this.negative=1),E<d.length&&(m===16?this._parseHex(d,E,x):(this._parseBase(d,m,E),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 E=0;E<this.length;E++)this.words[E]=0;var C,k,T=0;if(x==="be")for(E=d.length-1,C=0;E>=0;E-=3)k=d[E]|d[E-1]<<8|d[E-2]<<16,this.words[C]|=k<<T&67108863,this.words[C+1]=k>>>26-T&67108863,T+=24,T>=26&&(T-=26,C++);else if(x==="le")for(E=0,C=0;E<d.length;E+=3)k=d[E]|d[E+1]<<8|d[E+2]<<16,this.words[C]|=k<<T&67108863,this.words[C+1]=k>>>26-T&67108863,T+=24,T>=26&&(T-=26,C++);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 E=0;E<this.length;E++)this.words[E]=0;var C=0,k=0,T;if(x==="be")for(E=d.length-1;E>=m;E-=2)T=u(d,m,E)<<C,this.words[k]|=T&67108863,C>=18?(C-=18,k+=1,this.words[k]|=T>>>26):C+=8;else{var g=d.length-m;for(E=g%2===0?m+1:m;E<d.length;E+=2)T=u(d,m,E)<<C,this.words[k]|=T&67108863,C>=18?(C-=18,k+=1,this.words[k]|=T>>>26):C+=8}this._strip()};function l(p,d,m,x){for(var E=0,C=0,k=Math.min(p.length,m),T=d;T<k;T++){var g=p.charCodeAt(T)-48;E*=x,g>=49?C=g-49+10:g>=17?C=g-17+10:C=g,i(g>=0&&C<x,"Invalid character"),E+=C}return E}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var E=0,C=1;C<=67108863;C*=m)E++;E--,C=C/m|0;for(var k=d.length-x,T=k%E,g=Math.min(k,k-T)+x,v=0,R=x;R<g;R+=E)v=l(d,R,R+E,m),this.imuln(C),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(T!==0){var se=1;for(v=l(d,R,d.length,m),R=0;R<T;R++)se*=m;this.imuln(se),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"],_=[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 E=0,C=0,k=0;k<this.length;k++){var T=this.words[k],g=((T<<E|C)&16777215).toString(16);C=T>>>24-E&16777215,E+=2,E>=26&&(E-=26,k--),C!==0||k!==this.length-1?x=y[6-g.length]+g+x:x=g+x}for(C!==0&&(x=C.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=_[d],R=w[d];x="";var se=this.clone();for(se.negative=0;!se.isZero();){var ue=se.modrn(R).toString(d);se=se.idivn(R),se.isZero()?x=ue+x:x=y[v-ue.length]+ue+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 E=this.byteLength(),C=x||Math.max(1,E);i(E<=C,"byte array longer than desired length"),i(C>0,"Requested array length <= 0");var k=A(d,C),T=m==="le"?"LE":"BE";return this["_toArrayLike"+T](k,E),k},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,E=0,C=0,k=0;C<this.length;C++){var T=this.words[C]<<k|E;d[x++]=T&255,x<d.length&&(d[x++]=T>>8&255),x<d.length&&(d[x++]=T>>16&255),k===6?(x<d.length&&(d[x++]=T>>24&255),E=0,k=0):(E=T>>>24,k+=2)}if(x<d.length)for(d[x++]=E;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,E=0,C=0,k=0;C<this.length;C++){var T=this.words[C]<<k|E;d[x--]=T&255,x>=0&&(d[x--]=T>>8&255),x>=0&&(d[x--]=T>>16&255),k===6?(x>=0&&(d[x--]=T>>24&255),E=0,k=0):(E=T>>>24,k+=2)}if(x>=0)for(d[x--]=E;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 I(p){for(var d=new Array(p.bitLength()),m=0;m<d.length;m++){var x=m/26|0,E=m%26;d[m]=p.words[x]>>>E&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 E=0;E<x.length;E++)this.words[E]=m.words[E]^x.words[E];if(this!==m)for(;E<m.length;E++)this.words[E]=m.words[E];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 E=0;E<m;E++)this.words[E]=~this.words[E]&67108863;return x>0&&(this.words[E]=~this.words[E]&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,E=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<E:this.words[x]=this.words[x]&~(1<<E),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,E;this.length>d.length?(x=this,E=d):(x=d,E=this);for(var C=0,k=0;k<E.length;k++)m=(x.words[k]|0)+(E.words[k]|0)+C,this.words[k]=m&67108863,C=m>>>26;for(;C!==0&&k<x.length;k++)m=(x.words[k]|0)+C,this.words[k]=m&67108863,C=m>>>26;if(this.length=x.length,C!==0)this.words[this.length]=C,this.length++;else if(x!==this)for(;k<x.length;k++)this.words[k]=x.words[k];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 E,C;x>0?(E=this,C=d):(E=d,C=this);for(var k=0,T=0;T<C.length;T++)m=(E.words[T]|0)-(C.words[T]|0)+k,k=m>>26,this.words[T]=m&67108863;for(;k!==0&&T<E.length;T++)m=(E.words[T]|0)+k,k=m>>26,this.words[T]=m&67108863;if(k===0&&T<E.length&&E!==this)for(;T<E.length;T++)this.words[T]=E.words[T];return this.length=Math.max(this.length,T),E!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(d){return this.clone().isub(d)};function P(p,d,m){m.negative=d.negative^p.negative;var x=p.length+d.length|0;m.length=x,x=x-1|0;var E=p.words[0]|0,C=d.words[0]|0,k=E*C,T=k&67108863,g=k/67108864|0;m.words[0]=T;for(var v=1;v<x;v++){for(var R=g>>>26,se=g&67108863,ue=Math.min(v,d.length-1),xe=Math.max(0,v-p.length+1);xe<=ue;xe++){var be=v-xe|0;E=p.words[be]|0,C=d.words[xe]|0,k=E*C+se,R+=k/67108864|0,se=k&67108863}m.words[v]=se|0,g=R|0}return g!==0?m.words[v]=g|0:m.length--,m._strip()}var N=function(d,m,x){var E=d.words,C=m.words,k=x.words,T=0,g,v,R,se=E[0]|0,ue=se&8191,xe=se>>>13,be=E[1]|0,Ce=be&8191,Me=be>>>13,Ke=E[2]|0,Ue=Ke&8191,lt=Ke>>>13,ht=E[3]|0,$e=ht&8191,mt=ht>>>13,we=E[4]|0,me=we&8191,Te=we>>>13,qe=E[5]|0,De=qe&8191,Oe=qe>>>13,Ie=E[6]|0,Le=Ie&8191,ft=Ie>>>13,dt=E[7]|0,He=dt&8191,kt=dt>>>13,_t=E[8]|0,Ze=_t&8191,Mt=_t>>>13,Rt=E[9]|0,nt=Rt&8191,xt=Rt>>>13,Ct=C[0]|0,st=Ct&8191,jt=Ct>>>13,Ot=C[1]|0,it=Ot&8191,yt=Ot>>>13,St=C[2]|0,Je=St&8191,gt=St>>>13,It=C[3]|0,ot=It&8191,bt=It>>>13,Lt=C[4]|0,j=Lt&8191,S=Lt>>>13,M=C[5]|0,B=M&8191,K=M>>>13,Z=C[6]|0,ee=Z&8191,Be=Z>>>13,tt=C[7]|0,Ne=tt&8191,z=tt>>>13,ne=C[8]|0,he=ne&8191,Pe=ne>>>13,We=C[9]|0,Re=We&8191,Fe=We>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(ue,st),v=Math.imul(ue,jt),v=v+Math.imul(xe,st)|0,R=Math.imul(xe,jt);var at=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(at>>>26)|0,at&=67108863,g=Math.imul(Ce,st),v=Math.imul(Ce,jt),v=v+Math.imul(Me,st)|0,R=Math.imul(Me,jt),g=g+Math.imul(ue,it)|0,v=v+Math.imul(ue,yt)|0,v=v+Math.imul(xe,it)|0,R=R+Math.imul(xe,yt)|0;var Ht=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,g=Math.imul(Ue,st),v=Math.imul(Ue,jt),v=v+Math.imul(lt,st)|0,R=Math.imul(lt,jt),g=g+Math.imul(Ce,it)|0,v=v+Math.imul(Ce,yt)|0,v=v+Math.imul(Me,it)|0,R=R+Math.imul(Me,yt)|0,g=g+Math.imul(ue,Je)|0,v=v+Math.imul(ue,gt)|0,v=v+Math.imul(xe,Je)|0,R=R+Math.imul(xe,gt)|0;var Pt=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,g=Math.imul($e,st),v=Math.imul($e,jt),v=v+Math.imul(mt,st)|0,R=Math.imul(mt,jt),g=g+Math.imul(Ue,it)|0,v=v+Math.imul(Ue,yt)|0,v=v+Math.imul(lt,it)|0,R=R+Math.imul(lt,yt)|0,g=g+Math.imul(Ce,Je)|0,v=v+Math.imul(Ce,gt)|0,v=v+Math.imul(Me,Je)|0,R=R+Math.imul(Me,gt)|0,g=g+Math.imul(ue,ot)|0,v=v+Math.imul(ue,bt)|0,v=v+Math.imul(xe,ot)|0,R=R+Math.imul(xe,bt)|0;var Nt=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,g=Math.imul(me,st),v=Math.imul(me,jt),v=v+Math.imul(Te,st)|0,R=Math.imul(Te,jt),g=g+Math.imul($e,it)|0,v=v+Math.imul($e,yt)|0,v=v+Math.imul(mt,it)|0,R=R+Math.imul(mt,yt)|0,g=g+Math.imul(Ue,Je)|0,v=v+Math.imul(Ue,gt)|0,v=v+Math.imul(lt,Je)|0,R=R+Math.imul(lt,gt)|0,g=g+Math.imul(Ce,ot)|0,v=v+Math.imul(Ce,bt)|0,v=v+Math.imul(Me,ot)|0,R=R+Math.imul(Me,bt)|0,g=g+Math.imul(ue,j)|0,v=v+Math.imul(ue,S)|0,v=v+Math.imul(xe,j)|0,R=R+Math.imul(xe,S)|0;var Qt=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(De,st),v=Math.imul(De,jt),v=v+Math.imul(Oe,st)|0,R=Math.imul(Oe,jt),g=g+Math.imul(me,it)|0,v=v+Math.imul(me,yt)|0,v=v+Math.imul(Te,it)|0,R=R+Math.imul(Te,yt)|0,g=g+Math.imul($e,Je)|0,v=v+Math.imul($e,gt)|0,v=v+Math.imul(mt,Je)|0,R=R+Math.imul(mt,gt)|0,g=g+Math.imul(Ue,ot)|0,v=v+Math.imul(Ue,bt)|0,v=v+Math.imul(lt,ot)|0,R=R+Math.imul(lt,bt)|0,g=g+Math.imul(Ce,j)|0,v=v+Math.imul(Ce,S)|0,v=v+Math.imul(Me,j)|0,R=R+Math.imul(Me,S)|0,g=g+Math.imul(ue,B)|0,v=v+Math.imul(ue,K)|0,v=v+Math.imul(xe,B)|0,R=R+Math.imul(xe,K)|0;var gr=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(gr>>>26)|0,gr&=67108863,g=Math.imul(Le,st),v=Math.imul(Le,jt),v=v+Math.imul(ft,st)|0,R=Math.imul(ft,jt),g=g+Math.imul(De,it)|0,v=v+Math.imul(De,yt)|0,v=v+Math.imul(Oe,it)|0,R=R+Math.imul(Oe,yt)|0,g=g+Math.imul(me,Je)|0,v=v+Math.imul(me,gt)|0,v=v+Math.imul(Te,Je)|0,R=R+Math.imul(Te,gt)|0,g=g+Math.imul($e,ot)|0,v=v+Math.imul($e,bt)|0,v=v+Math.imul(mt,ot)|0,R=R+Math.imul(mt,bt)|0,g=g+Math.imul(Ue,j)|0,v=v+Math.imul(Ue,S)|0,v=v+Math.imul(lt,j)|0,R=R+Math.imul(lt,S)|0,g=g+Math.imul(Ce,B)|0,v=v+Math.imul(Ce,K)|0,v=v+Math.imul(Me,B)|0,R=R+Math.imul(Me,K)|0,g=g+Math.imul(ue,ee)|0,v=v+Math.imul(ue,Be)|0,v=v+Math.imul(xe,ee)|0,R=R+Math.imul(xe,Be)|0;var nr=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(He,st),v=Math.imul(He,jt),v=v+Math.imul(kt,st)|0,R=Math.imul(kt,jt),g=g+Math.imul(Le,it)|0,v=v+Math.imul(Le,yt)|0,v=v+Math.imul(ft,it)|0,R=R+Math.imul(ft,yt)|0,g=g+Math.imul(De,Je)|0,v=v+Math.imul(De,gt)|0,v=v+Math.imul(Oe,Je)|0,R=R+Math.imul(Oe,gt)|0,g=g+Math.imul(me,ot)|0,v=v+Math.imul(me,bt)|0,v=v+Math.imul(Te,ot)|0,R=R+Math.imul(Te,bt)|0,g=g+Math.imul($e,j)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(mt,j)|0,R=R+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,R=R+Math.imul(lt,K)|0,g=g+Math.imul(Ce,ee)|0,v=v+Math.imul(Ce,Be)|0,v=v+Math.imul(Me,ee)|0,R=R+Math.imul(Me,Be)|0,g=g+Math.imul(ue,Ne)|0,v=v+Math.imul(ue,z)|0,v=v+Math.imul(xe,Ne)|0,R=R+Math.imul(xe,z)|0;var Wt=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(Ze,st),v=Math.imul(Ze,jt),v=v+Math.imul(Mt,st)|0,R=Math.imul(Mt,jt),g=g+Math.imul(He,it)|0,v=v+Math.imul(He,yt)|0,v=v+Math.imul(kt,it)|0,R=R+Math.imul(kt,yt)|0,g=g+Math.imul(Le,Je)|0,v=v+Math.imul(Le,gt)|0,v=v+Math.imul(ft,Je)|0,R=R+Math.imul(ft,gt)|0,g=g+Math.imul(De,ot)|0,v=v+Math.imul(De,bt)|0,v=v+Math.imul(Oe,ot)|0,R=R+Math.imul(Oe,bt)|0,g=g+Math.imul(me,j)|0,v=v+Math.imul(me,S)|0,v=v+Math.imul(Te,j)|0,R=R+Math.imul(Te,S)|0,g=g+Math.imul($e,B)|0,v=v+Math.imul($e,K)|0,v=v+Math.imul(mt,B)|0,R=R+Math.imul(mt,K)|0,g=g+Math.imul(Ue,ee)|0,v=v+Math.imul(Ue,Be)|0,v=v+Math.imul(lt,ee)|0,R=R+Math.imul(lt,Be)|0,g=g+Math.imul(Ce,Ne)|0,v=v+Math.imul(Ce,z)|0,v=v+Math.imul(Me,Ne)|0,R=R+Math.imul(Me,z)|0,g=g+Math.imul(ue,he)|0,v=v+Math.imul(ue,Pe)|0,v=v+Math.imul(xe,he)|0,R=R+Math.imul(xe,Pe)|0;var mr=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(mr>>>26)|0,mr&=67108863,g=Math.imul(nt,st),v=Math.imul(nt,jt),v=v+Math.imul(xt,st)|0,R=Math.imul(xt,jt),g=g+Math.imul(Ze,it)|0,v=v+Math.imul(Ze,yt)|0,v=v+Math.imul(Mt,it)|0,R=R+Math.imul(Mt,yt)|0,g=g+Math.imul(He,Je)|0,v=v+Math.imul(He,gt)|0,v=v+Math.imul(kt,Je)|0,R=R+Math.imul(kt,gt)|0,g=g+Math.imul(Le,ot)|0,v=v+Math.imul(Le,bt)|0,v=v+Math.imul(ft,ot)|0,R=R+Math.imul(ft,bt)|0,g=g+Math.imul(De,j)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(Oe,j)|0,R=R+Math.imul(Oe,S)|0,g=g+Math.imul(me,B)|0,v=v+Math.imul(me,K)|0,v=v+Math.imul(Te,B)|0,R=R+Math.imul(Te,K)|0,g=g+Math.imul($e,ee)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(mt,ee)|0,R=R+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,R=R+Math.imul(lt,z)|0,g=g+Math.imul(Ce,he)|0,v=v+Math.imul(Ce,Pe)|0,v=v+Math.imul(Me,he)|0,R=R+Math.imul(Me,Pe)|0,g=g+Math.imul(ue,Re)|0,v=v+Math.imul(ue,Fe)|0,v=v+Math.imul(xe,Re)|0,R=R+Math.imul(xe,Fe)|0;var on=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(on>>>26)|0,on&=67108863,g=Math.imul(nt,it),v=Math.imul(nt,yt),v=v+Math.imul(xt,it)|0,R=Math.imul(xt,yt),g=g+Math.imul(Ze,Je)|0,v=v+Math.imul(Ze,gt)|0,v=v+Math.imul(Mt,Je)|0,R=R+Math.imul(Mt,gt)|0,g=g+Math.imul(He,ot)|0,v=v+Math.imul(He,bt)|0,v=v+Math.imul(kt,ot)|0,R=R+Math.imul(kt,bt)|0,g=g+Math.imul(Le,j)|0,v=v+Math.imul(Le,S)|0,v=v+Math.imul(ft,j)|0,R=R+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,R=R+Math.imul(Oe,K)|0,g=g+Math.imul(me,ee)|0,v=v+Math.imul(me,Be)|0,v=v+Math.imul(Te,ee)|0,R=R+Math.imul(Te,Be)|0,g=g+Math.imul($e,Ne)|0,v=v+Math.imul($e,z)|0,v=v+Math.imul(mt,Ne)|0,R=R+Math.imul(mt,z)|0,g=g+Math.imul(Ue,he)|0,v=v+Math.imul(Ue,Pe)|0,v=v+Math.imul(lt,he)|0,R=R+Math.imul(lt,Pe)|0,g=g+Math.imul(Ce,Re)|0,v=v+Math.imul(Ce,Fe)|0,v=v+Math.imul(Me,Re)|0,R=R+Math.imul(Me,Fe)|0;var Rr=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,g=Math.imul(nt,Je),v=Math.imul(nt,gt),v=v+Math.imul(xt,Je)|0,R=Math.imul(xt,gt),g=g+Math.imul(Ze,ot)|0,v=v+Math.imul(Ze,bt)|0,v=v+Math.imul(Mt,ot)|0,R=R+Math.imul(Mt,bt)|0,g=g+Math.imul(He,j)|0,v=v+Math.imul(He,S)|0,v=v+Math.imul(kt,j)|0,R=R+Math.imul(kt,S)|0,g=g+Math.imul(Le,B)|0,v=v+Math.imul(Le,K)|0,v=v+Math.imul(ft,B)|0,R=R+Math.imul(ft,K)|0,g=g+Math.imul(De,ee)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(Oe,ee)|0,R=R+Math.imul(Oe,Be)|0,g=g+Math.imul(me,Ne)|0,v=v+Math.imul(me,z)|0,v=v+Math.imul(Te,Ne)|0,R=R+Math.imul(Te,z)|0,g=g+Math.imul($e,he)|0,v=v+Math.imul($e,Pe)|0,v=v+Math.imul(mt,he)|0,R=R+Math.imul(mt,Pe)|0,g=g+Math.imul(Ue,Re)|0,v=v+Math.imul(Ue,Fe)|0,v=v+Math.imul(lt,Re)|0,R=R+Math.imul(lt,Fe)|0;var an=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(an>>>26)|0,an&=67108863,g=Math.imul(nt,ot),v=Math.imul(nt,bt),v=v+Math.imul(xt,ot)|0,R=Math.imul(xt,bt),g=g+Math.imul(Ze,j)|0,v=v+Math.imul(Ze,S)|0,v=v+Math.imul(Mt,j)|0,R=R+Math.imul(Mt,S)|0,g=g+Math.imul(He,B)|0,v=v+Math.imul(He,K)|0,v=v+Math.imul(kt,B)|0,R=R+Math.imul(kt,K)|0,g=g+Math.imul(Le,ee)|0,v=v+Math.imul(Le,Be)|0,v=v+Math.imul(ft,ee)|0,R=R+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,R=R+Math.imul(Oe,z)|0,g=g+Math.imul(me,he)|0,v=v+Math.imul(me,Pe)|0,v=v+Math.imul(Te,he)|0,R=R+Math.imul(Te,Pe)|0,g=g+Math.imul($e,Re)|0,v=v+Math.imul($e,Fe)|0,v=v+Math.imul(mt,Re)|0,R=R+Math.imul(mt,Fe)|0;var Qn=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,g=Math.imul(nt,j),v=Math.imul(nt,S),v=v+Math.imul(xt,j)|0,R=Math.imul(xt,S),g=g+Math.imul(Ze,B)|0,v=v+Math.imul(Ze,K)|0,v=v+Math.imul(Mt,B)|0,R=R+Math.imul(Mt,K)|0,g=g+Math.imul(He,ee)|0,v=v+Math.imul(He,Be)|0,v=v+Math.imul(kt,ee)|0,R=R+Math.imul(kt,Be)|0,g=g+Math.imul(Le,Ne)|0,v=v+Math.imul(Le,z)|0,v=v+Math.imul(ft,Ne)|0,R=R+Math.imul(ft,z)|0,g=g+Math.imul(De,he)|0,v=v+Math.imul(De,Pe)|0,v=v+Math.imul(Oe,he)|0,R=R+Math.imul(Oe,Pe)|0,g=g+Math.imul(me,Re)|0,v=v+Math.imul(me,Fe)|0,v=v+Math.imul(Te,Re)|0,R=R+Math.imul(Te,Fe)|0;var ei=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(ei>>>26)|0,ei&=67108863,g=Math.imul(nt,B),v=Math.imul(nt,K),v=v+Math.imul(xt,B)|0,R=Math.imul(xt,K),g=g+Math.imul(Ze,ee)|0,v=v+Math.imul(Ze,Be)|0,v=v+Math.imul(Mt,ee)|0,R=R+Math.imul(Mt,Be)|0,g=g+Math.imul(He,Ne)|0,v=v+Math.imul(He,z)|0,v=v+Math.imul(kt,Ne)|0,R=R+Math.imul(kt,z)|0,g=g+Math.imul(Le,he)|0,v=v+Math.imul(Le,Pe)|0,v=v+Math.imul(ft,he)|0,R=R+Math.imul(ft,Pe)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,Fe)|0,v=v+Math.imul(Oe,Re)|0,R=R+Math.imul(Oe,Fe)|0;var cn=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(cn>>>26)|0,cn&=67108863,g=Math.imul(nt,ee),v=Math.imul(nt,Be),v=v+Math.imul(xt,ee)|0,R=Math.imul(xt,Be),g=g+Math.imul(Ze,Ne)|0,v=v+Math.imul(Ze,z)|0,v=v+Math.imul(Mt,Ne)|0,R=R+Math.imul(Mt,z)|0,g=g+Math.imul(He,he)|0,v=v+Math.imul(He,Pe)|0,v=v+Math.imul(kt,he)|0,R=R+Math.imul(kt,Pe)|0,g=g+Math.imul(Le,Re)|0,v=v+Math.imul(Le,Fe)|0,v=v+Math.imul(ft,Re)|0,R=R+Math.imul(ft,Fe)|0;var ti=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(ti>>>26)|0,ti&=67108863,g=Math.imul(nt,Ne),v=Math.imul(nt,z),v=v+Math.imul(xt,Ne)|0,R=Math.imul(xt,z),g=g+Math.imul(Ze,he)|0,v=v+Math.imul(Ze,Pe)|0,v=v+Math.imul(Mt,he)|0,R=R+Math.imul(Mt,Pe)|0,g=g+Math.imul(He,Re)|0,v=v+Math.imul(He,Fe)|0,v=v+Math.imul(kt,Re)|0,R=R+Math.imul(kt,Fe)|0;var ri=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(ri>>>26)|0,ri&=67108863,g=Math.imul(nt,he),v=Math.imul(nt,Pe),v=v+Math.imul(xt,he)|0,R=Math.imul(xt,Pe),g=g+Math.imul(Ze,Re)|0,v=v+Math.imul(Ze,Fe)|0,v=v+Math.imul(Mt,Re)|0,R=R+Math.imul(Mt,Fe)|0;var D=(T+g|0)+((v&8191)<<13)|0;T=(R+(v>>>13)|0)+(D>>>26)|0,D&=67108863,g=Math.imul(nt,Re),v=Math.imul(nt,Fe),v=v+Math.imul(xt,Re)|0,R=Math.imul(xt,Fe);var W=(T+g|0)+((v&8191)<<13)|0;return T=(R+(v>>>13)|0)+(W>>>26)|0,W&=67108863,k[0]=at,k[1]=Ht,k[2]=Pt,k[3]=Nt,k[4]=Qt,k[5]=gr,k[6]=nr,k[7]=Wt,k[8]=mr,k[9]=on,k[10]=Rr,k[11]=an,k[12]=Qn,k[13]=ei,k[14]=cn,k[15]=ti,k[16]=ri,k[17]=D,k[18]=W,T!==0&&(k[19]=T,x.length++),x};Math.imul||(N=P);function F(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,E=0,C=0;C<m.length-1;C++){var k=E;E=0;for(var T=x&67108863,g=Math.min(C,d.length-1),v=Math.max(0,C-p.length+1);v<=g;v++){var R=C-v,se=p.words[R]|0,ue=d.words[v]|0,xe=se*ue,be=xe&67108863;k=k+(xe/67108864|0)|0,be=be+T|0,T=be&67108863,k=k+(be>>>26)|0,E+=k>>>26,k&=67108863}m.words[C]=T,x=k,k=E}return x!==0?m.words[C]=x:m.length--,m._strip()}function L(p,d,m){return F(p,d,m)}o.prototype.mulTo=function(d,m){var x,E=this.length+d.length;return this.length===10&&d.length===10?x=N(this,d,m):E<63?x=P(this,d,m):E<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,E=0;E<this.length;E++){var C=(this.words[E]|0)*d,k=(C&67108863)+(x&67108863);x>>=26,x+=C/67108864|0,x+=k>>>26,this.words[E]=k&67108863}return x!==0&&(this.words[E]=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=I(d);if(m.length===0)return new o(1);for(var x=this,E=0;E<m.length&&m[E]===0;E++,x=x.sqr());if(++E<m.length)for(var C=x.sqr();E<m.length;E++,C=C.sqr())m[E]!==0&&(x=x.mul(C));return x},o.prototype.iushln=function(d){i(typeof d=="number"&&d>=0);var m=d%26,x=(d-m)/26,E=67108863>>>26-m<<26-m,C;if(m!==0){var k=0;for(C=0;C<this.length;C++){var T=this.words[C]&E,g=(this.words[C]|0)-T<<m;this.words[C]=g|k,k=T>>>26-m}k&&(this.words[C]=k,this.length++)}if(x!==0){for(C=this.length-1;C>=0;C--)this.words[C+x]=this.words[C];for(C=0;C<x;C++)this.words[C]=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 E;m?E=(m-m%26)/26:E=0;var C=d%26,k=Math.min((d-C)/26,this.length),T=67108863^67108863>>>C<<C,g=x;if(E-=k,E=Math.max(0,E),g){for(var v=0;v<k;v++)g.words[v]=this.words[v];g.length=k}if(k!==0)if(this.length>k)for(this.length-=k,v=0;v<this.length;v++)this.words[v]=this.words[v+k];else this.words[0]=0,this.length=1;var R=0;for(v=this.length-1;v>=0&&(R!==0||v>=E);v--){var se=this.words[v]|0;this.words[v]=R<<26-C|se>>>C,R=se&T}return g&&R!==0&&(g.words[g.length++]=R),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,E=1<<m;if(this.length<=x)return!1;var C=this.words[x];return!!(C&E)},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 E=67108863^67108863>>>m<<m;this.words[this.length-1]&=E}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 E=d.length+x,C;this._expand(E);var k,T=0;for(C=0;C<d.length;C++){k=(this.words[C+x]|0)+T;var g=(d.words[C]|0)*m;k-=g&67108863,T=(k>>26)-(g/67108864|0),this.words[C+x]=k&67108863}for(;C<this.length-x;C++)k=(this.words[C+x]|0)+T,T=k>>26,this.words[C+x]=k&67108863;if(T===0)return this._strip();for(i(T===-1),T=0,C=0;C<this.length;C++)k=-(this.words[C]|0)+T,T=k>>26,this.words[C]=k&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(d,m){var x=this.length-d.length,E=this.clone(),C=d,k=C.words[C.length-1]|0,T=this._countBits(k);x=26-T,x!==0&&(C=C.ushln(x),E.iushln(x),k=C.words[C.length-1]|0);var g=E.length-C.length,v;if(m!=="mod"){v=new o(null),v.length=g+1,v.words=new Array(v.length);for(var R=0;R<v.length;R++)v.words[R]=0}var se=E.clone()._ishlnsubmul(C,1,g);se.negative===0&&(E=se,v&&(v.words[g]=1));for(var ue=g-1;ue>=0;ue--){var xe=(E.words[C.length+ue]|0)*67108864+(E.words[C.length+ue-1]|0);for(xe=Math.min(xe/k|0,67108863),E._ishlnsubmul(C,xe,ue);E.negative!==0;)xe--,E.negative=0,E._ishlnsubmul(C,1,ue),E.isZero()||(E.negative^=1);v&&(v.words[ue]=xe)}return v&&v._strip(),E._strip(),m!=="div"&&x!==0&&E.iushrn(x),{div:v||null,mod:E}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var E,C,k;return this.negative!==0&&d.negative===0?(k=this.neg().divmod(d,m),m!=="mod"&&(E=k.div.neg()),m!=="div"&&(C=k.mod.neg(),x&&C.negative!==0&&C.iadd(d)),{div:E,mod:C}):this.negative===0&&d.negative!==0?(k=this.divmod(d.neg(),m),m!=="mod"&&(E=k.div.neg()),{div:E,mod:k.mod}):this.negative&d.negative?(k=this.neg().divmod(d.neg(),m),m!=="div"&&(C=k.mod.neg(),x&&C.negative!==0&&C.isub(d)),{div:k.div,mod:C}):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,E=d.ushrn(1),C=d.andln(1),k=x.cmp(E);return k<0||C===1&&k===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,E=0,C=this.length-1;C>=0;C--)E=(x*E+(this.words[C]|0))%d;return m?-E:E},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,E=this.length-1;E>=0;E--){var C=(this.words[E]|0)+x*67108864;this.words[E]=C/d|0,x=C%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 E=new o(1),C=new o(0),k=new o(0),T=new o(1),g=0;m.isEven()&&x.isEven();)m.iushrn(1),x.iushrn(1),++g;for(var v=x.clone(),R=m.clone();!m.isZero();){for(var se=0,ue=1;!(m.words[0]&ue)&&se<26;++se,ue<<=1);if(se>0)for(m.iushrn(se);se-- >0;)(E.isOdd()||C.isOdd())&&(E.iadd(v),C.isub(R)),E.iushrn(1),C.iushrn(1);for(var xe=0,be=1;!(x.words[0]&be)&&xe<26;++xe,be<<=1);if(xe>0)for(x.iushrn(xe);xe-- >0;)(k.isOdd()||T.isOdd())&&(k.iadd(v),T.isub(R)),k.iushrn(1),T.iushrn(1);m.cmp(x)>=0?(m.isub(x),E.isub(k),C.isub(T)):(x.isub(m),k.isub(E),T.isub(C))}return{a:k,b:T,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 E=new o(1),C=new o(0),k=x.clone();m.cmpn(1)>0&&x.cmpn(1)>0;){for(var T=0,g=1;!(m.words[0]&g)&&T<26;++T,g<<=1);if(T>0)for(m.iushrn(T);T-- >0;)E.isOdd()&&E.iadd(k),E.iushrn(1);for(var v=0,R=1;!(x.words[0]&R)&&v<26;++v,R<<=1);if(v>0)for(x.iushrn(v);v-- >0;)C.isOdd()&&C.iadd(k),C.iushrn(1);m.cmp(x)>=0?(m.isub(x),E.isub(C)):(x.isub(m),C.isub(E))}var se;return m.cmpn(1)===0?se=E:se=C,se.cmpn(0)<0&&se.iadd(d),se},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 E=0;m.isEven()&&x.isEven();E++)m.iushrn(1),x.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;x.isEven();)x.iushrn(1);var C=m.cmp(x);if(C<0){var k=m;m=x,x=k}else if(C===0||x.cmpn(1)===0)break;m.isub(x)}while(!0);return x.iushln(E)},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,E=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=E,this;for(var C=E,k=x;C!==0&&k<this.length;k++){var T=this.words[k]|0;T+=C,C=T>>>26,T&=67108863,this.words[k]=T}return C!==0&&(this.words[k]=C,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 E=this.words[0]|0;x=E===d?0:E<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 E=this.words[x]|0,C=d.words[x]|0;if(E!==C){E<C?m=-1:E>C&&(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 H={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 E=x<this.n?-1:m.ucmp(this.p);return E===0?(m.words[0]=0,m.length=1):E>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,E=Math.min(d.length,9),C=0;C<E;C++)m.words[C]=d.words[C];if(m.length=E,d.length<=9){d.words[0]=0,d.length=1;return}var k=d.words[9];for(m.words[m.length++]=k&x,C=10;C<d.length;C++){var T=d.words[C]|0;d.words[C-10]=(T&x)<<4|k>>>22,k=T}k>>>=22,d.words[C-10]=k,k===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 E=d.words[x]|0;m+=E*977,d.words[x]=m&67108863,m=E*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function re(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(re,q);function ae(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(ae,q);function oe(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(oe,q),oe.prototype.imulK=function(d){for(var m=0,x=0;x<d.length;x++){var E=(d.words[x]|0)*19+m,C=E&67108863;E>>>=26,d.words[x]=C,m=E}return m!==0&&(d.words[d.length++]=m),d},o._prime=function(d){if(H[d])return H[d];var m;if(d==="k256")m=new X;else if(d==="p224")m=new re;else if(d==="p192")m=new ae;else if(d==="p25519")m=new oe;else throw new Error("Unknown prime "+d);return H[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 E=this.m.subn(1),C=0;!E.isZero()&&E.andln(1)===0;)C++,E.iushrn(1);i(!E.isZero());var k=new o(1).toRed(this),T=k.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(T)!==0;)v.redIAdd(T);for(var R=this.pow(v,E),se=this.pow(d,E.addn(1).iushrn(1)),ue=this.pow(d,E),xe=C;ue.cmp(k)!==0;){for(var be=ue,Ce=0;be.cmp(k)!==0;Ce++)be=be.redSqr();i(Ce<xe);var Me=this.pow(R,new o(1).iushln(xe-Ce-1));se=se.redMul(Me),R=Me.redSqr(),ue=ue.redMul(R),xe=Ce}return se},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,E=new Array(1<<x);E[0]=new o(1).toRed(this),E[1]=d;for(var C=2;C<E.length;C++)E[C]=this.mul(E[C-1],d);var k=E[0],T=0,g=0,v=m.bitLength()%26;for(v===0&&(v=26),C=m.length-1;C>=0;C--){for(var R=m.words[C],se=v-1;se>=0;se--){var ue=R>>se&1;if(k!==E[0]&&(k=this.sqr(k)),ue===0&&T===0){g=0;continue}T<<=1,T|=ue,g++,!(g!==x&&(C!==0||se!==0))&&(k=this.mul(k,E[T]),g=0,T=0)}v=26}return k},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)};function $(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($,V),$.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},$.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},$.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var x=d.imul(m),E=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=x.isub(E).iushrn(this.shift),k=C;return C.cmp(this.m)>=0?k=C.isub(this.m):C.cmpn(0)<0&&(k=C.iadd(this.m)),k._forceRed(this)},$.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new o(0)._forceRed(this);var x=d.mul(m),E=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=x.isub(E).iushrn(this.shift),k=C;return C.cmp(this.m)>=0?k=C.isub(this.m):C.cmpn(0)<0&&(k=C.iadd(this.m)),k._forceRed(this)},$.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(typeof t>"u"||t,e)}}),lo=9e15,ss=1e9,Zf="0123456789abcdef",gu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",vu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Qf={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-lo,maxE:lo,crypto:!1},S_,pi,ct=!0,Wu="[DecimalError] ",Xi=Wu+"Invalid argument: ",E_=Wu+"Precision limit exceeded",M_=Wu+"crypto unavailable",C_="[object Decimal]",Cr=Math.floor,dr=Math.pow,AI=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,TI=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,OI=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,A_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,bn=1e7,Qe=7,II=9007199254740991,kI=gu.length-1,ed=vu.length-1,ve={toStringTag:C_};ve.absoluteValue=ve.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Xe(e)};ve.ceil=function(){return Xe(new this.constructor(this),this.e+1,2)};ve.clampedTo=ve.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(Xi+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};ve.comparedTo=ve.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};ve.cosine=ve.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=jI(n,j_(n,r)),n.precision=e,n.rounding=t,Xe(pi==2||pi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};ve.cubeRoot=ve.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*dr(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=dr(r,1/3),e=Cr((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=zt(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&&(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 ct=!0,Xe(n,e,f.rounding,t)};ve.decimalPlaces=ve.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Cr(this.e/Qe))*Qe,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};ve.dividedBy=ve.div=function(e){return zt(this,new this.constructor(e))};ve.dividedToIntegerBy=ve.divToInt=function(e){var t=this,r=t.constructor;return Xe(zt(t,new r(e),0,1,1),r.precision,r.rounding)};ve.equals=ve.eq=function(e){return this.cmp(e)===0};ve.floor=function(){return Xe(new this.constructor(this),this.e+1,3)};ve.greaterThan=ve.gt=function(e){return this.cmp(e)>0};ve.greaterThanOrEqualTo=ve.gte=function(e){var t=this.cmp(e);return t==1||t===0};ve.hyperbolicCosine=ve.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/Xu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=So(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)};ve.hyperbolicSine=ve.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=So(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Xu(5,e)),i=So(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)};ve.hyperbolicTangent=ve.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,zt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};ve.inverseCosine=ve.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()?vn(r,i,s):new r(0):new r(NaN):t.isZero()?vn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=vn(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))};ve.inverseHyperbolicCosine=ve.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)};ve.inverseHyperbolicSine=ve.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())};ve.inverseHyperbolicTangent=ve.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=zt(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)};ve.inverseSine=ve.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=vn(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)))};ve.inverseTangent=ve.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<=ed)return o=vn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=ed)return o=vn(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,Xe(o,l.precision=f,l.rounding=h,!0)};ve.isFinite=function(){return!!this.d};ve.isInteger=ve.isInt=function(){return!!this.d&&Cr(this.e/Qe)>this.d.length-2};ve.isNaN=function(){return!this.s};ve.isNegative=ve.isNeg=function(){return this.s<0};ve.isPositive=ve.isPos=function(){return this.s>0};ve.isZero=function(){return!!this.d&&this.d[0]===0};ve.lessThan=ve.lt=function(e){return this.cmp(e)<0};ve.lessThanOrEqualTo=ve.lte=function(e){return this.cmp(e)<1};ve.logarithm=ve.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=zi(u,a),n=t?yu(l,a+10):zi(e,a),c=zt(o,n,a,1),Ba(c.d,i=f,h))do if(a+=10,o=zi(u,a),n=t?yu(l,a+10):zi(e,a),c=zt(o,n,a,1),!s){+wr(c.d).slice(i+1,i+15)+1==1e14&&(c=Xe(c,f+1,0));break}while(Ba(c.d,i+=10,h));return ct=!0,Xe(c,f,h)};ve.minus=ve.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,_=y.constructor;if(e=new _(e),!y.d||!e.d)return!y.s||!e.s?e=new _(NaN):y.d?e.s=-e.s:e=new _(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=_.precision,c=_.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new _(y);else return new _(c===3?-0:0);return ct?Xe(e,a,c):e}if(r=Cr(e.e/Qe),l=Cr(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]=bn-1;--u[i],u[n]+=bn}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=Ku(u,r),ct?Xe(e,a,c):e):new _(c===3?-0:0)};ve.modulo=ve.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):(ct=!1,n.modulo==9?(t=zt(r,e.abs(),0,3,1),t.s*=e.s):t=zt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))};ve.naturalExponential=ve.exp=function(){return td(this)};ve.naturalLogarithm=ve.ln=function(){return zi(this)};ve.negated=ve.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Xe(e)};ve.plus=ve.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?Xe(e,a,c):e;if(s=Cr(f.e/Qe),n=Cr(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)/bn|0,u[i]%=bn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Ku(u,n),ct?Xe(e,a,c):e};ve.precision=ve.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Xi+e);return r.d?(t=T_(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};ve.round=function(){var e=this,t=e.constructor;return Xe(new t(e),e.e+1,t.rounding)};ve.sine=ve.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=RI(n,j_(n,r)),n.precision=e,n.rounding=t,Xe(pi>2?r.neg():r,e,t,!0)):new n(NaN)};ve.squareRoot=ve.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=Cr((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(zt(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&&(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 ct=!0,Xe(n,c,l.rounding,e)};ve.tangent=ve.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=zt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Xe(pi==2||pi==4?r.neg():r,e,t,!0)):new n(NaN)};ve.times=ve.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=Cr(l.e/Qe)+Cr(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%bn|0,t=a/bn|0;s[i]=(s[i]+t)%bn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Ku(s,r),ct?Xe(e,f.precision,f.rounding):e};ve.toBinary=function(e,t){return Xh(this,2,e,t)};ve.toDecimalPlaces=ve.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Br(e,0,ss),t===void 0?t=n.rounding:Br(t,0,8),Xe(r,e+r.e+1,t))};ve.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Hn(n,!0):(Br(e,0,ss),t===void 0?t=i.rounding:Br(t,0,8),n=Xe(new i(n),e+1,t),r=Hn(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};ve.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=Hn(i):(Br(e,0,ss),t===void 0?t=s.rounding:Br(t,0,8),n=Xe(new s(i),e+i.e+1,t),r=Hn(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};ve.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,_=y.d,w=y.constructor;if(!_)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=T_(_)-y.e-1,o=s%Qe,t.d[0]=dr(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(Xi+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new w(wr(_)),l=w.precision,w.precision=s=_.length*Qe*2;f=zt(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=zt(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=zt(u,n,s,1).minus(y).abs().cmp(zt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h};ve.toHexadecimal=ve.toHex=function(e,t){return Xh(this,16,e,t)};ve.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:Br(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=zt(r,e,0,t,1).times(e),ct=!0,Xe(r)):(e.s=r.s,r=e),r};ve.toNumber=function(){return+this};ve.toOctal=function(e,t){return Xh(this,8,e,t)};ve.toPower=ve.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(dr(+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=Cr(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=II)return i=O_(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=dr(+a,u),t=r==0||!isFinite(r)?Cr(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=td(e.times(zi(a,n+r)),n),i.d&&(i=Xe(i,n+5,1),Ba(i.d,n,s)&&(t=n+10,i=Xe(td(e.times(zi(a,t+r)),t),t+5,1),+wr(i.d).slice(n+1,n+15)+1==1e14&&(i=Xe(i,n+1,0)))),i.s=o,ct=!0,c.rounding=s,Xe(i,n,s))};ve.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Hn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Br(e,1,ss),t===void 0?t=i.rounding:Br(t,0,8),n=Xe(new i(n),e,t),r=Hn(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};ve.toSignificantDigits=ve.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Br(e,1,ss),t===void 0?t=n.rounding:Br(t,0,8)),Xe(new n(r),e,t)};ve.toString=function(){var e=this,t=e.constructor,r=Hn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};ve.truncated=ve.trunc=function(){return Xe(new this.constructor(this),this.e+1,1)};ve.valueOf=ve.toJSON=function(){var e=this,t=e.constructor,r=Hn(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+=Li(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=Li(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Br(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Xi+e)}function Ba(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=dr(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)==dr(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)==dr(10,t-3)-1,o}function Fc(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]+=Zf.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 jI(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Xu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=So(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 zt=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,_,w,A,I,P,N,F,L,H,q,X,re,ae,oe,V,$=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new $(!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=bn,y=Qe,l=Cr(n.e/y)-Cr(i.e/y)),oe=m.length,re=d.length,I=new $(p),P=I.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(H=s=$.precision,o=$.rounding):a?H=s+(n.e-i.e)+1:H=s,H<0)P.push(1),_=!0;else{if(H=H/y+2|0,f=0,oe==1){for(h=0,m=m[0],H++;(f<re||h)&&H--;f++)q=h*c+(d[f]||0),P[f]=q/m|0,h=q%m|0;_=h||f<re}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),oe=m.length,re=d.length),X=oe,N=d.slice(0,oe),F=N.length;F<oe;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,oe,F),u<0?(L=N[0],oe!=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,oe<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,oe,F),u<1&&(h++,r(N,oe<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),P[f++]=h,u&&N[0]?N[F++]=d[X]||0:(N=[d[X]],F=1);while((X++<re||N[0]!==void 0)&&H--);_=N[0]!==void 0}P[0]||P.shift()}if(y==1)I.e=l,S_=_;else{for(f=1,h=P[0];h>=10;h/=10)f++;I.e=f+l*y-1,Xe(I,a?s+I.e+1:s,o,_)}return I}}();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+=Qe,o=t,l=f[h=0],c=l/dr(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/dr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%dr(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/dr(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]=dr(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=dr(10,Qe-s),f[h]=o>0?(l/dr(10,i-o)%dr(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]==bn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=bn)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 Hn(e,t,r){if(!e.isFinite())return k_(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)+Li(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Li(-i-1)+s,r&&(n=r-o)>0&&(s+=Li(n))):i>=o?(s+=Li(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Li(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Li(n))),s}function Ku(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function yu(e,t,r){if(t>kI)throw ct=!0,r&&(e.precision=r),Error(E_);return Xe(new e(gu),t,1,!0)}function vn(e,t,r){if(t>ed)throw Error(E_);return Xe(new e(vu),t,r,!0)}function T_(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 Li(e){for(var t="";e--;)t+="0";return t}function O_(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),Up(s.d,o)&&(i=!0)),r=Cr(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),Up(t.d,o)}return ct=!0,s}function Lp(e){return e.d[e.d.length-1]&1}function I_(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 td(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,_=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=_):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(dr(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(zt(s,r,c,1)),wr(a.d).slice(0,c)===wr(o.d).slice(0,c)){for(i=f;i--;)o=Xe(o.times(o),c,1);if(t==null)if(u<3&&Ba(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=_,y,ct=!0);else return h.precision=_,o}o=a}}function zi(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,_=10,w=e,A=w.d,I=w.constructor,P=I.rounding,N=I.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new I(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ct=!1,l=N):l=t,I.precision=l+=_,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 I("0."+r),s++):w=new I(n+"."+r.slice(1))}else return u=yu(I,l+2,N).times(s+""),w=zi(new I(n+"."+r.slice(1)),l-_).plus(u),I.precision=N,t==null?Xe(w,N,P,ct=!0):w;for(f=w,c=o=w=zt(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(zt(o,new I(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(yu(I,l+2,N).times(s+""))),c=zt(c,new I(y),l,1),t==null)if(Ba(c.d,l-_,P,a))I.precision=l+=_,u=o=w=zt(f.minus(1),f.plus(1),l,1),h=Xe(w.times(w),l,1),i=a=1;else return Xe(c,I.precision=N,P,ct=!0);else return I.precision=N,c;c=u,i+=2}}function k_(e){return String(e.s*e.s/0)}function rd(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 PI(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),A_.test(t))return rd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(TI.test(t))r=16,t=t.toLowerCase();else if(AI.test(t))r=2;else if(OI.test(t))r=8;else throw Error(Xi+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=O_(n,new n(r),s,s*2)),u=Fc(t,r,bn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Ku(u,l),e.d=u,ct=!1,o&&(e=zt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?dr(2,c):ic.pow(2,c))),ct=!0,e)}function RI(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:So(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Xu(5,r)),t=So(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 So(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=zt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=zt(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 Xu(e,t){for(var r=e;--t;)r*=e;return r}function j_(e,t){var r,n=t.s<0,i=vn(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=Lp(r)?n?2:3:n?4:1,t;pi=Lp(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Xh(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,_=r!==void 0;if(_?(Br(r,1,ss),n===void 0?n=y.rounding:Br(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=k_(e);else{for(l=Hn(e),o=l.indexOf("."),_?(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=Fc(Hn(h),10,i),h.e=h.d.length),f=Fc(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=_?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=zt(e,h,r,n,0,i),f=e.d,s=e.e,u=S_),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+=Zf.charAt(f[o]);if(_){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=Fc(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Zf.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 Up(e,t){if(e.length>t)return e.length=t,!0}function NI(e){return new this(e).abs()}function DI(e){return new this(e).acos()}function $I(e){return new this(e).acosh()}function BI(e,t){return new this(e).plus(t)}function LI(e){return new this(e).asin()}function UI(e){return new this(e).asinh()}function FI(e){return new this(e).atan()}function zI(e){return new this(e).atanh()}function VI(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=vn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?vn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=vn(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(zt(e,t,s,1)),t=vn(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(zt(e,t,s,1)),r}function qI(e){return new this(e).cbrt()}function GI(e){return Xe(e=new this(e),e.e+1,2)}function HI(e,t,r){return new this(e).clamp(t,r)}function WI(e){if(!e||typeof e!="object")throw Error(Wu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,ss,"rounding",0,8,"toExpNeg",-lo,0,"toExpPos",0,lo,"maxE",0,lo,"minE",-lo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Qf[r]),(n=e[r])!==void 0)if(Cr(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(Xi+r+": "+n);if(r="crypto",i&&(this[r]=Qf[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(M_);else this[r]=!1;else throw Error(Xi+r+": "+n);return this}function KI(e){return new this(e).cos()}function XI(e){return new this(e).cosh()}function P_(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,Fp(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 rd(u,s.toString())}else if(c!=="string")throw Error(Xi+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),A_.test(s)?rd(u,s):PI(u,s)}if(i.prototype=ve,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=WI,i.clone=P_,i.isDecimal=Fp,i.abs=NI,i.acos=DI,i.acosh=$I,i.add=BI,i.asin=LI,i.asinh=UI,i.atan=FI,i.atanh=zI,i.atan2=VI,i.cbrt=qI,i.ceil=GI,i.clamp=HI,i.cos=KI,i.cosh=XI,i.div=YI,i.exp=JI,i.floor=ZI,i.hypot=QI,i.ln=e9,i.log=t9,i.log10=n9,i.log2=r9,i.max=i9,i.min=s9,i.mod=o9,i.mul=a9,i.pow=c9,i.random=u9,i.round=l9,i.sign=f9,i.sin=d9,i.sinh=h9,i.sqrt=p9,i.sub=m9,i.sum=g9,i.tan=v9,i.tanh=y9,i.trunc=b9,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 YI(e,t){return new this(e).div(t)}function JI(e){return new this(e).exp()}function ZI(e){return Xe(e=new this(e),e.e+1,3)}function QI(){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 Fp(e){return e instanceof ic||e&&e.toStringTag===C_||!1}function e9(e){return new this(e).ln()}function t9(e,t){return new this(e).log(t)}function r9(e){return new this(e).log(2)}function n9(e){return new this(e).log(10)}function i9(){return I_(this,arguments,"lt")}function s9(){return I_(this,arguments,"gt")}function o9(e,t){return new this(e).mod(t)}function a9(e,t){return new this(e).mul(t)}function c9(e,t){return new this(e).pow(t)}function u9(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Br(e,1,ss),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(M_);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=dr(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 l9(e){return Xe(e=new this(e),e.e+1,this.rounding)}function f9(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function d9(e){return new this(e).sin()}function h9(e){return new this(e).sinh()}function p9(e){return new this(e).sqrt()}function m9(e,t){return new this(e).sub(t)}function g9(){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,Xe(r,this.precision,this.rounding)}function v9(e){return new this(e).tan()}function y9(e){return new this(e).tanh()}function b9(e){return Xe(e=new this(e),e.e+1,1)}ve[Symbol.for("nodejs.util.inspect.custom")]=ve.toString;ve[Symbol.toStringTag]="Decimal";var ic=ve.constructor=P_(Qf);gu=new ic(gu);vu=new ic(vu);var zc=ic,fi=No(Do()),Ql=No(Do()),w9=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 Number(new Ql.default(e).mul(new Ql.default(this.slippage)).div(new Ql.default("1000000000000000000")).toString())}swap(e,t,r,n){return Tt(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})})}},zp="0x000000000000000000000000000000000000000000000000000000000000dee9",_9=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return Tt(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:zp,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 Tt(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${zp}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return Tt(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(Ji)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},x9=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return Tt(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})})}},S9=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return Tt(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(Ji)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},E9=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return Tt(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})})}},M9=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 Tt(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(Ji)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},C9=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return Tt(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(Ji),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},Vp=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(Ji)],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 Tt(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(Ji)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function qp(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 A9(e){return e.split("::")[0]}function js(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=js(r),u=SI(xI({},c),{type_arguments:i.map(l=>js(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>ws.isSuiCoin(l)?l:js(l).source_address),u.source_address=qp(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===R_||r===I9?"0x2":Jf.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=qp(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function Gp(e){return js(e).source_address}var T9="0x2::coin::Coin",O9=/^0x2::coin::Coin<(.+)>$/,R_="0x2::sui::SUI",I9="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",ws=class Di{static getCoinTypeArg(t){const r=t.type.match(O9);return r?r[1]:null}static isSUI(t){const r=Di.getCoinTypeArg(t);return r?Di.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`${T9}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{Gp(i.coinAddress)===Gp(t)&&n.push(i)}),n}static isSuiCoin(t){return js(t).full_address===R_}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=Di.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=Di.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=Di.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:Di.sortByBalance(a),remainingCoins:Di.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 Hp(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";default:return"Unknown error"}}function Yi(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 k9(e,t){e=Yi(e),t=Yi(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 N_(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function ef(e,t,r,n){const i=ws.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:N_(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(ws.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(ws.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=ws.sortByBalance(i);o.slice(0,3).reduce((f,h)=>f+h.balance,BigInt(0))<BigInt(r)&&(o=ws.sortByBalanceDes(i));let c=ws.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 j9(e,t=!0){return Tt(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 P9(e){return!(!e.startsWith("0x")||e.length!==66)}var Gs=No(Do()),wc=No(Do()),sc=No(Do()),fo=new sc.default(0);new sc.default(1);var R9=new sc.default(2);R9.pow(new sc.default(128));var N9=new sc.default("18446744073709551615"),Hs=1e9;function Wp(e,t,r){let n=fo;return t?n=e.mul(new wc.default(Hs-r*Hs)).div(new wc.default(Hs)):n=e.mul(new wc.default(Hs+r*Hs)).div(new wc.default(Hs)),Number(n.toString())}function D9(e,t,r){return new zc(e).mul(zc.pow(2,-64)).pow(2).mul(zc.pow(10,t-r))}function $9(e,t,r,n){return Tt(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,_=Yi(u),w=Yi(l),A=new mI.Transaction,I=k9(_,w),P=n===0?"0x15c0555d7601d98ca2659a8387d377a81b1e285ee0808484e101f96d05806187":"0x2918cf39850de6d5d94d8196dc878c8c722cd79db659318e00bff57fbb4e2ede",N=I?_:w,F=I?w:_,L=[N,F];console.log("typeArguments",L,P);for(let x=0;x<y.length;x++){const E=[A.object(y[x]),A.pure.bool(I),A.pure.bool(h),A.pure.u64(f.toString())];A.moveCall({target:`${P}::fetcher_script::calculate_swap_result`,arguments:E,typeArguments:L})}if(!P9(r))throw new AggregateError("Aggregator package not set","InvalidWallet");j9(A);const H=yield e.devInspectTransactionBlock({transactionBlock:A,sender:r});if(H.error!=null)throw console.log("simulateRes.error",H.error),new AggregateError("Aggregator package not set","SimulateError");const q=(i=H.events)==null?void 0:i.filter(x=>x.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==y.length)throw new AggregateError("Simulate event result error","simulateEventError");let X=h?fo:N9,re=0;for(let x=0;x<q.length;x+=1)if(!q[x].parsedJson.data.is_exceed)if(t.byAmountIn){const E=new Gs.BN(q[x].parsedJson.data.amount_out);E.gt(X)&&(re=x,X=E)}else{const E=new Gs.BN(q[x].parsedJson.data.amount_out);E.lt(X)&&(re=x,X=E)}const ae=q[re].parsedJson.data,oe=ae.step_results[0].current_sqrt_price,[V,$]=yield Promise.all([e.getCoinMetadata({coinType:N}).then(x=>x==null?void 0:x.decimals),e.getCoinMetadata({coinType:F}).then(x=>x==null?void 0:x.decimals)]);if(V==null||$==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=D9(oe,V,$),d={amountIn:new Gs.BN((s=ae.amount_in)!=null?s:0),amountOut:new Gs.BN((o=ae.amount_out)!=null?o:0),routes:[{path:[{id:y[re],direction:I,provider:"CETUS",from:_,target:w,feeRate:ae.fee_rate,amountIn:ae.amount_in,amountOut:ae.amount_out,extendedDetails:{afterSqrtPrice:ae.after_sqrt_price}}],amountIn:new Gs.BN((a=ae.amount_in)!=null?a:0),amountOut:new Gs.BN((c=ae.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:ae.is_exceed,routeData:d}})}var B9=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return Tt(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})})}},L9=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 Tt(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})})}},U9=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 Tt(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})})}},F9=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return Tt(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})})}},z9=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return Tt(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=N_(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(Ji)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},V9=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 Tt(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(Ji)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},D_="CETUS",q9="DEEPBOOK",G9="KRIYA",H9="FLOWX",W9="FLOWXV3",K9="KRIYAV3",$_="TURBOS",nd="AFTERMATH",X9="HAEDAL",Y9="VOLO",J9="AFSUI",Z9="BLUEMOVE",B_="DEEPBOOKV3",L_="SCALLOP",Q9="https://api-sui.cetus.zone/router_v2",ek=class{constructor(e,t,r,n){this.endpoint=e?rk(e):Q9,this.client=r||new Dp.SuiClient({url:Dp.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return Tt(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:js(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 Tt(this,null,function*(){return nk(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return Tt(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 _ of r[h].path)y=yield this.newDex(_.provider,i).swap(this,e,_,y,s);l.push(y)}return this.transferOrDestoryCoin(e,t,a),this.checkCoinThresholdAndMergeCoin(e,l,c,n)})}expectOutputSwap(e,t,r,n){return Tt(this,null,function*(){const i=[],s=[],o=[],a=new Vp(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],_=a.flash_swap(this,e,y,!1);i.unshift(_.targetCoin),s.unshift(_.flashReceipt)}let f=t;for(let h=0;h<l.path.length;h++){const y=l.path[h],_=a.repay_flash_swap(this,e,y,f,s[h]);f=i[h],h===0?t=_:this.transferOrDestoryCoin(e,_,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:`${Jf.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 Tt(this,null,function*(){let t;try{t=yield $9(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return Tt(this,null,function*(){const{routers:t,inputCoin:r,slippage:n,byAmountIn:i,txb:s,partner:o,deepbookv3DeepFee:a}=e,c=t.reduce((y,_)=>y.add(_.amountIn),new fi.default(0)),u=t.reduce((y,_)=>y.add(_.amountOut),new fi.default(0)),l=Wp(i?u:c,i,n);if(i)return yield this.expectInputSwap(s,r,t,new fi.default(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 Tt(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 fi.default(0)),y=t.reduce((N,F)=>N.add(F.amountOut),new fi.default(0)),_=Wp(r?y:h,r,n),A=ef(i,l,BigInt((r?h:_).toString()),u);let I;if(c&&c>0){let N=yield this.getCoins(this.deepbookv3DeepFeeType());I=ef(i,N,BigInt(c),this.deepbookv3DeepFeeType()).targetCoin}const P=yield this.routerSwap({routers:t,inputCoin:A.targetCoin,slippage:n,byAmountIn:r,txb:i,partner:s,deepbookv3DeepFee:I});if(o){let N=yield this.getCoins(f,a);const F=ef(i,N,BigInt(0),f);i.mergeCoins(F.targetCoin,[P]),F.isMintZeroCoin&&this.transferOrDestoryCoin(i,F.targetCoin,f)}else this.transferOrDestoryCoin(i,P,f)})}publishedAt(){return this.env===0?"0xec2108d2092dd6f1f6fe45def639500e323596e0bab9fabc206461aadf357e6a":"0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934"}publishedAtV2(){return this.env===0?"0x6d70ffa7aa3f924c3f0b573d27d29895a0ee666aaff821073f75cb14af7fd01a":"0x0ed287d6c3fe4962d0994ffddc1d19a15fba6a81533f3f0dcc2bbcedebce0637"}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:`${Jf.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 D_:return new Vp(this.env,t);case q9:return new _9(this.env);case B_:return new z9(this.env);case G9:return new x9(this.env);case K9:return new S9(this.env);case H9:return new E9(this.env);case W9:return new M9(this.env);case $_:return new C9(this.env);case nd:return new w9(this.env);case X9:return new B9(this.env);case J9:return new L9(this.env);case Y9:return new U9(this.env);case Z9:return new F9(this.env);case L_:return new V9(this.env);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return Tt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return Tt(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return Tt(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return Tt(this,null,function*(){const e=yield ok(this.endpoint);return e?e.data:null})}};function tk(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 fi.default(e.amount_in.toString()),amountOut:new fi.default(e.amount_out.toString()),insufficientLiquidity:!1,routes:e.routes.map(n=>({path:n.path.map(i=>{var s,o,a,c,u;let l;i.provider===nd&&(l=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let f;return(i.provider===$_||i.provider===nd||i.provider===D_||i.provider===B_||i.provider===L_)&&(f={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}),{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:f,version:l}}),amountIn:new fi.default(n.amount_in.toString()),amountOut:new fi.default(n.amount_out.toString()),initialPrice:new zc(n.initial_price.toString())})),totalDeepFee:t}}var Ji="0x0000000000000000000000000000000000000000000000000000000000000006";No(Do());function rk(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function nk(e,t){return Tt(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield sk(e,t):r=yield ik(e,t),!r)return null;if(!r.ok)return{amountIn:fo,amountOut:fo,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:Hp(10001)}};const n=yield r.json();if(n.data!=null)return tk(n.data);const i=n.msg==="liquidity is not enough";return{amountIn:fo,amountOut:fo,routes:[],insufficientLiquidity:i,error:{code:10003,msg:Hp(10003)}}})}function ik(e,t){return Tt(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=Yi(r),h=Yi(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=1000304",yield fetch(y)}catch(r){return console.error(r),null}})}function sk(e,t){return Tt(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=Yi(r),y=Yi(n),_=`${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(I=>({pool:I.poolID,tick_lower:I.ticklower,tick_upper:I.tickUpper,delta_liquidity:I.deltaLiquidity}))};try{return yield fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}catch(I){return console.error("Error:",I),null}})}function ok(e){return Tt(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var U_=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(U_||{}),F_=ek,ak=U_,Kp=A9,Ta=js,Yh={exports:{}},tf={},Xp;function z_(){return Xp||(Xp=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(P){var N=P.length;if(N%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=P.indexOf("=");F===-1&&(F=N);var L=F===N?0:4-F%4;return[F,L]}function l(P){var N=u(P),F=N[0],L=N[1];return(F+L)*3/4-L}function f(P,N,F){return(N+F)*3/4-F}function h(P){var N,F=u(P),L=F[0],H=F[1],q=new s(f(P,L,H)),X=0,re=H>0?L-4:L,ae;for(ae=0;ae<re;ae+=4)N=i[P.charCodeAt(ae)]<<18|i[P.charCodeAt(ae+1)]<<12|i[P.charCodeAt(ae+2)]<<6|i[P.charCodeAt(ae+3)],q[X++]=N>>16&255,q[X++]=N>>8&255,q[X++]=N&255;return H===2&&(N=i[P.charCodeAt(ae)]<<2|i[P.charCodeAt(ae+1)]>>4,q[X++]=N&255),H===1&&(N=i[P.charCodeAt(ae)]<<10|i[P.charCodeAt(ae+1)]<<4|i[P.charCodeAt(ae+2)]>>2,q[X++]=N>>8&255,q[X++]=N&255),q}function y(P){return n[P>>18&63]+n[P>>12&63]+n[P>>6&63]+n[P&63]}function _(P,N,F){for(var L,H=[],q=N;q<F;q+=3)L=(P[q]<<16&16711680)+(P[q+1]<<8&65280)+(P[q+2]&255),H.push(y(L));return H.join("")}function w(P){for(var N,F=P.length,L=F%3,H=[],q=16383,X=0,re=F-L;X<re;X+=q)H.push(_(P,X,X+q>re?re:X+q));return L===1?(N=P[F-1],H.push(n[N>>2]+n[N<<4&63]+"==")):L===2&&(N=(P[F-2]<<8)+P[F-1],H.push(n[N>>10]+n[N>>4&63]+n[N<<2&63]+"=")),H.join("")}var A={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */A.read=function(P,N,F,L,H){var q,X,re=H*8-L-1,ae=(1<<re)-1,oe=ae>>1,V=-7,$=F?H-1:0,p=F?-1:1,d=P[N+$];for($+=p,q=d&(1<<-V)-1,d>>=-V,V+=re;V>0;q=q*256+P[N+$],$+=p,V-=8);for(X=q&(1<<-V)-1,q>>=-V,V+=L;V>0;X=X*256+P[N+$],$+=p,V-=8);if(q===0)q=1-oe;else{if(q===ae)return X?NaN:(d?-1:1)*(1/0);X=X+Math.pow(2,L),q=q-oe}return(d?-1:1)*X*Math.pow(2,q-L)},A.write=function(P,N,F,L,H,q){var X,re,ae,oe=q*8-H-1,V=(1<<oe)-1,$=V>>1,p=H===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=L?0:q-1,m=L?1:-1,x=N<0||N===0&&1/N<0?1:0;for(N=Math.abs(N),isNaN(N)||N===1/0?(re=isNaN(N)?1:0,X=V):(X=Math.floor(Math.log(N)/Math.LN2),N*(ae=Math.pow(2,-X))<1&&(X--,ae*=2),X+$>=1?N+=p/ae:N+=p*Math.pow(2,1-$),N*ae>=2&&(X++,ae/=2),X+$>=V?(re=0,X=V):X+$>=1?(re=(N*ae-1)*Math.pow(2,H),X=X+$):(re=N*Math.pow(2,$-1)*Math.pow(2,H),X=0));H>=8;P[F+d]=re&255,d+=m,re/=256,H-=8);for(X=X<<H|re,oe+=H;oe>0;P[F+d]=X&255,d+=m,X/=256,oe-=8);P[F+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,z=T,F=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;R.Buffer=L,R.SlowBuffer=v,R.INSPECT_MAX_BYTES=50;const W=2147483647;R.kMaxLength=W;const{Uint8Array:q,ArrayBuffer:K,SharedArrayBuffer:te}=globalThis;L.TYPED_ARRAY_SUPPORT=se(),!L.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 se(){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(L.prototype,"parent",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.buffer}}),Object.defineProperty(L.prototype,"offset",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.byteOffset}});function H(j){if(j>W)throw new RangeError('The value "'+j+'" is invalid for option "size"');const S=new q(j);return Object.setPrototypeOf(S,L.prototype),S}function L(j,S,A){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,A)}L.poolSize=8192;function D(j,S,A){if(typeof j=="string")return x(j,S);if(K.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(mt(j,K)||j&&mt(j.buffer,K)||typeof te<"u"&&(mt(j,te)||j&&mt(j.buffer,te)))return O(j,S,A);if(typeof j=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=j.valueOf&&j.valueOf();if($!=null&&$!==j)return L.from($,S,A);const X=M(j);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof j[Symbol.toPrimitive]=="function")return L.from(j[Symbol.toPrimitive]("string"),S,A);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j)}L.from=function(j,S,A){return D(j,S,A)},Object.setPrototypeOf(L.prototype,q.prototype),Object.setPrototypeOf(L,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,A){return p(j),j<=0?H(j):S!==void 0?typeof A=="string"?H(j).fill(S,A):H(j).fill(S):H(j)}L.alloc=function(j,S,A){return d(j,S,A)};function m(j){return p(j),H(j<0?0:g(j)|0)}L.allocUnsafe=function(j){return m(j)},L.allocUnsafeSlow=function(j){return m(j)};function x(j,S){if((typeof S!="string"||S==="")&&(S="utf8"),!L.isEncoding(S))throw new TypeError("Unknown encoding: "+S);const A=k(j,S)|0;let $=H(A);const X=$.write(j,S);return X!==A&&($=$.slice(0,X)),$}function C(j){const S=j.length<0?0:g(j.length)|0,A=H(S);for(let $=0;$<S;$+=1)A[$]=j[$]&255;return A}function E(j){if(mt(j,q)){const S=new q(j);return O(S.buffer,S.byteOffset,S.byteLength)}return C(j)}function O(j,S,A){if(S<0||j.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(j.byteLength<S+(A||0))throw new RangeError('"length" is outside of buffer bounds');let $;return S===void 0&&A===void 0?$=new q(j):A===void 0?$=new q(j,S):$=new q(j,S,A),Object.setPrototypeOf($,L.prototype),$}function M(j){if(L.isBuffer(j)){const S=g(j.length)|0,A=H(S);return A.length===0||j.copy(A,0,0,S),A}if(j.length!==void 0)return typeof j.length!="number"||Pt(j.length)?H(0):C(j);if(j.type==="Buffer"&&Array.isArray(j.data))return C(j.data)}function g(j){if(j>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return j|0}function v(j){return+j!=j&&(j=0),L.alloc(+j)}L.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==L.prototype},L.compare=function(S,A){if(mt(S,q)&&(S=L.from(S,S.offset,S.byteLength)),mt(A,q)&&(A=L.from(A,A.offset,A.byteLength)),!L.isBuffer(S)||!L.isBuffer(A))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===A)return 0;let $=S.length,X=A.length;for(let Z=0,re=Math.min($,X);Z<re;++Z)if(S[Z]!==A[Z]){$=S[Z],X=A[Z];break}return $<X?-1:X<$?1:0},L.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}},L.concat=function(S,A){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return L.alloc(0);let $;if(A===void 0)for(A=0,$=0;$<S.length;++$)A+=S[$].length;const X=L.allocUnsafe(A);let Z=0;for($=0;$<S.length;++$){let re=S[$];if(mt(re,q))Z+re.length>X.length?(L.isBuffer(re)||(re=L.from(re)),re.copy(X,Z)):q.prototype.set.call(X,re,Z);else if(L.isBuffer(re))re.copy(X,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=re.length}return X};function k(j,S){if(L.isBuffer(j))return j.length;if(K.isView(j)||mt(j,K))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 A=j.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&A===0)return 0;let X=!1;for(;;)switch(S){case"ascii":case"latin1":case"binary":return A;case"utf8":case"utf-8":return It(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A*2;case"hex":return A>>>1;case"base64":return Ct(j).length;default:if(X)return $?-1:It(j).length;S=(""+S).toLowerCase(),X=!0}}L.byteLength=k;function ee(j,S,A){let $=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((A===void 0||A>this.length)&&(A=this.length),A<=0)||(A>>>=0,S>>>=0,A<=S))return"";for(j||(j="utf8");;)switch(j){case"hex":return Ue(this,S,A);case"utf8":case"utf-8":return De(this,S,A);case"ascii":return me(this,S,A);case"latin1":case"binary":return Ae(this,S,A);case"base64":return dt(this,S,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ne(this,S,A);default:if($)throw new TypeError("Unknown encoding: "+j);j=(j+"").toLowerCase(),$=!0}}L.prototype._isBuffer=!0;function ie(j,S,A){const $=j[S];j[S]=j[A],j[A]=$}L.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 A=0;A<S;A+=2)ie(this,A,A+1);return this},L.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 A=0;A<S;A+=4)ie(this,A,A+3),ie(this,A+1,A+2);return this},L.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 A=0;A<S;A+=8)ie(this,A,A+7),ie(this,A+1,A+6),ie(this,A+2,A+5),ie(this,A+3,A+4);return this},L.prototype.toString=function(){const S=this.length;return S===0?"":arguments.length===0?De(this,0,S):ee.apply(this,arguments)},L.prototype.toLocaleString=L.prototype.toString,L.prototype.equals=function(S){if(!L.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:L.compare(this,S)===0},L.prototype.inspect=function(){let S="";const A=R.INSPECT_MAX_BYTES;return S=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A&&(S+=" ... "),"<Buffer "+S+">"},F&&(L.prototype[F]=L.prototype.inspect),L.prototype.compare=function(S,A,$,X,Z){if(mt(S,q)&&(S=L.from(S,S.offset,S.byteLength)),!L.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(A===void 0&&(A=0),$===void 0&&($=S?S.length:0),X===void 0&&(X=0),Z===void 0&&(Z=this.length),A<0||$>S.length||X<0||Z>this.length)throw new RangeError("out of range index");if(X>=Z&&A>=$)return 0;if(X>=Z)return-1;if(A>=$)return 1;if(A>>>=0,$>>>=0,X>>>=0,Z>>>=0,this===S)return 0;let re=Z-X,Be=$-A;const et=Math.min(re,Be),Re=this.slice(X,Z),V=S.slice(A,$);for(let oe=0;oe<et;++oe)if(Re[oe]!==V[oe]){re=Re[oe],Be=V[oe];break}return re<Be?-1:Be<re?1:0};function ge(j,S,A,$,X){if(j.length===0)return-1;if(typeof A=="string"?($=A,A=0):A>2147483647?A=2147483647:A<-2147483648&&(A=-2147483648),A=+A,Pt(A)&&(A=X?0:j.length-1),A<0&&(A=j.length+A),A>=j.length){if(X)return-1;A=j.length-1}else if(A<0)if(X)A=0;else return-1;if(typeof S=="string"&&(S=L.from(S,$)),L.isBuffer(S))return S.length===0?-1:ve(j,S,A,$,X);if(typeof S=="number")return S=S&255,typeof q.prototype.indexOf=="function"?X?q.prototype.indexOf.call(j,S,A):q.prototype.lastIndexOf.call(j,S,A):ve(j,[S],A,$,X);throw new TypeError("val must be string, number or Buffer")}function ve(j,S,A,$,X){let Z=1,re=j.length,Be=S.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(j.length<2||S.length<2)return-1;Z=2,re/=2,Be/=2,A/=2}function et(V,oe){return Z===1?V[oe]:V.readUInt16BE(oe*Z)}let Re;if(X){let V=-1;for(Re=A;Re<re;Re++)if(et(j,Re)===et(S,V===-1?0:Re-V)){if(V===-1&&(V=Re),Re-V+1===Be)return V*Z}else V!==-1&&(Re-=Re-V),V=-1}else for(A+Be>re&&(A=re-Be),Re=A;Re>=0;Re--){let V=!0;for(let oe=0;oe<Be;oe++)if(et(j,Re+oe)!==et(S,oe)){V=!1;break}if(V)return Re}return-1}L.prototype.includes=function(S,A,$){return this.indexOf(S,A,$)!==-1},L.prototype.indexOf=function(S,A,$){return ge(this,S,A,$,!0)},L.prototype.lastIndexOf=function(S,A,$){return ge(this,S,A,$,!1)};function Se(j,S,A,$){A=Number(A)||0;const X=j.length-A;$?($=Number($),$>X&&($=X)):$=X;const Z=S.length;$>Z/2&&($=Z/2);let re;for(re=0;re<$;++re){const Be=parseInt(S.substr(re*2,2),16);if(Pt(Be))return re;j[A+re]=Be}return re}function xe(j,S,A,$){return Je(It(S,j.length-A),j,A,$)}function Xe(j,S,A,$){return Je(nt(S),j,A,$)}function Le(j,S,A,$){return Je(Ct(S),j,A,$)}function ot(j,S,A,$){return Je(bt(S,j.length-A),j,A,$)}L.prototype.write=function(S,A,$,X){if(A===void 0)X="utf8",$=this.length,A=0;else if($===void 0&&typeof A=="string")X=A,$=this.length,A=0;else if(isFinite(A))A=A>>>0,isFinite($)?($=$>>>0,X===void 0&&(X="utf8")):(X=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Z=this.length-A;if(($===void 0||$>Z)&&($=Z),S.length>0&&($<0||A<0)||A>this.length)throw new RangeError("Attempt to write outside buffer bounds");X||(X="utf8");let re=!1;for(;;)switch(X){case"hex":return Se(this,S,A,$);case"utf8":case"utf-8":return xe(this,S,A,$);case"ascii":case"latin1":case"binary":return Xe(this,S,A,$);case"base64":return Le(this,S,A,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,S,A,$);default:if(re)throw new TypeError("Unknown encoding: "+X);X=(""+X).toLowerCase(),re=!0}},L.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(j,S,A){return S===0&&A===j.length?N.fromByteArray(j):N.fromByteArray(j.slice(S,A))}function De(j,S,A){A=Math.min(j.length,A);const $=[];let X=S;for(;X<A;){const Z=j[X];let re=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(X+Be<=A){let et,Re,V,oe;switch(Be){case 1:Z<128&&(re=Z);break;case 2:et=j[X+1],(et&192)===128&&(oe=(Z&31)<<6|et&63,oe>127&&(re=oe));break;case 3:et=j[X+1],Re=j[X+2],(et&192)===128&&(Re&192)===128&&(oe=(Z&15)<<12|(et&63)<<6|Re&63,oe>2047&&(oe<55296||oe>57343)&&(re=oe));break;case 4:et=j[X+1],Re=j[X+2],V=j[X+3],(et&192)===128&&(Re&192)===128&&(V&192)===128&&(oe=(Z&15)<<18|(et&63)<<12|(Re&63)<<6|V&63,oe>65535&&oe<1114112&&(re=oe))}}re===null?(re=65533,Be=1):re>65535&&(re-=65536,$.push(re>>>10&1023|55296),re=56320|re&1023),$.push(re),X+=Be}return we($)}const vt=4096;function we(j){const S=j.length;if(S<=vt)return String.fromCharCode.apply(String,j);let A="",$=0;for(;$<S;)A+=String.fromCharCode.apply(String,j.slice($,$+=vt));return A}function me(j,S,A){let $="";A=Math.min(j.length,A);for(let X=S;X<A;++X)$+=String.fromCharCode(j[X]&127);return $}function Ae(j,S,A){let $="";A=Math.min(j.length,A);for(let X=S;X<A;++X)$+=String.fromCharCode(j[X]);return $}function Ue(j,S,A){const $=j.length;(!S||S<0)&&(S=0),(!A||A<0||A>$)&&(A=$);let X="";for(let Z=S;Z<A;++Z)X+=st[j[Z]];return X}function Ne(j,S,A){const $=j.slice(S,A);let X="";for(let Z=0;Z<$.length-1;Z+=2)X+=String.fromCharCode($[Z]+$[Z+1]*256);return X}L.prototype.slice=function(S,A){const $=this.length;S=~~S,A=A===void 0?$:~~A,S<0?(S+=$,S<0&&(S=0)):S>$&&(S=$),A<0?(A+=$,A<0&&(A=0)):A>$&&(A=$),A<S&&(A=S);const X=this.subarray(S,A);return Object.setPrototypeOf(X,L.prototype),X};function Te(j,S,A){if(j%1!==0||j<0)throw new RangeError("offset is not uint");if(j+S>A)throw new RangeError("Trying to access beyond buffer length")}L.prototype.readUintLE=L.prototype.readUIntLE=function(S,A,$){S=S>>>0,A=A>>>0,$||Te(S,A,this.length);let X=this[S],Z=1,re=0;for(;++re<A&&(Z*=256);)X+=this[S+re]*Z;return X},L.prototype.readUintBE=L.prototype.readUIntBE=function(S,A,$){S=S>>>0,A=A>>>0,$||Te(S,A,this.length);let X=this[S+--A],Z=1;for(;A>0&&(Z*=256);)X+=this[S+--A]*Z;return X},L.prototype.readUint8=L.prototype.readUInt8=function(S,A){return S=S>>>0,A||Te(S,1,this.length),this[S]},L.prototype.readUint16LE=L.prototype.readUInt16LE=function(S,A){return S=S>>>0,A||Te(S,2,this.length),this[S]|this[S+1]<<8},L.prototype.readUint16BE=L.prototype.readUInt16BE=function(S,A){return S=S>>>0,A||Te(S,2,this.length),this[S]<<8|this[S+1]},L.prototype.readUint32LE=L.prototype.readUInt32LE=function(S,A){return S=S>>>0,A||Te(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},L.prototype.readUint32BE=L.prototype.readUInt32BE=function(S,A){return S=S>>>0,A||Te(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},L.prototype.readBigUInt64LE=wt(function(S){S=S>>>0,St(S,"offset");const A=this[S],$=this[S+7];(A===void 0||$===void 0)&&Tt(S,this.length-8);const X=A+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24,Z=this[++S]+this[++S]*2**8+this[++S]*2**16+$*2**24;return BigInt(X)+(BigInt(Z)<<BigInt(32))}),L.prototype.readBigUInt64BE=wt(function(S){S=S>>>0,St(S,"offset");const A=this[S],$=this[S+7];(A===void 0||$===void 0)&&Tt(S,this.length-8);const X=A*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+$;return(BigInt(X)<<BigInt(32))+BigInt(Z)}),L.prototype.readIntLE=function(S,A,$){S=S>>>0,A=A>>>0,$||Te(S,A,this.length);let X=this[S],Z=1,re=0;for(;++re<A&&(Z*=256);)X+=this[S+re]*Z;return Z*=128,X>=Z&&(X-=Math.pow(2,8*A)),X},L.prototype.readIntBE=function(S,A,$){S=S>>>0,A=A>>>0,$||Te(S,A,this.length);let X=A,Z=1,re=this[S+--X];for(;X>0&&(Z*=256);)re+=this[S+--X]*Z;return Z*=128,re>=Z&&(re-=Math.pow(2,8*A)),re},L.prototype.readInt8=function(S,A){return S=S>>>0,A||Te(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},L.prototype.readInt16LE=function(S,A){S=S>>>0,A||Te(S,2,this.length);const $=this[S]|this[S+1]<<8;return $&32768?$|4294901760:$},L.prototype.readInt16BE=function(S,A){S=S>>>0,A||Te(S,2,this.length);const $=this[S+1]|this[S]<<8;return $&32768?$|4294901760:$},L.prototype.readInt32LE=function(S,A){return S=S>>>0,A||Te(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},L.prototype.readInt32BE=function(S,A){return S=S>>>0,A||Te(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},L.prototype.readBigInt64LE=wt(function(S){S=S>>>0,St(S,"offset");const A=this[S],$=this[S+7];(A===void 0||$===void 0)&&Tt(S,this.length-8);const X=this[S+4]+this[S+5]*2**8+this[S+6]*2**16+($<<24);return(BigInt(X)<<BigInt(32))+BigInt(A+this[++S]*2**8+this[++S]*2**16+this[++S]*2**24)}),L.prototype.readBigInt64BE=wt(function(S){S=S>>>0,St(S,"offset");const A=this[S],$=this[S+7];(A===void 0||$===void 0)&&Tt(S,this.length-8);const X=(A<<24)+this[++S]*2**16+this[++S]*2**8+this[++S];return(BigInt(X)<<BigInt(32))+BigInt(this[++S]*2**24+this[++S]*2**16+this[++S]*2**8+$)}),L.prototype.readFloatLE=function(S,A){return S=S>>>0,A||Te(S,4,this.length),z.read(this,S,!0,23,4)},L.prototype.readFloatBE=function(S,A){return S=S>>>0,A||Te(S,4,this.length),z.read(this,S,!1,23,4)},L.prototype.readDoubleLE=function(S,A){return S=S>>>0,A||Te(S,8,this.length),z.read(this,S,!0,52,8)},L.prototype.readDoubleBE=function(S,A){return S=S>>>0,A||Te(S,8,this.length),z.read(this,S,!1,52,8)};function Oe(j,S,A,$,X,Z){if(!L.isBuffer(j))throw new TypeError('"buffer" argument must be a Buffer instance');if(S>X||S<Z)throw new RangeError('"value" argument is out of bounds');if(A+$>j.length)throw new RangeError("Index out of range")}L.prototype.writeUintLE=L.prototype.writeUIntLE=function(S,A,$,X){if(S=+S,A=A>>>0,$=$>>>0,!X){const Be=Math.pow(2,8*$)-1;Oe(this,S,A,$,Be,0)}let Z=1,re=0;for(this[A]=S&255;++re<$&&(Z*=256);)this[A+re]=S/Z&255;return A+$},L.prototype.writeUintBE=L.prototype.writeUIntBE=function(S,A,$,X){if(S=+S,A=A>>>0,$=$>>>0,!X){const Be=Math.pow(2,8*$)-1;Oe(this,S,A,$,Be,0)}let Z=$-1,re=1;for(this[A+Z]=S&255;--Z>=0&&(re*=256);)this[A+Z]=S/re&255;return A+$},L.prototype.writeUint8=L.prototype.writeUInt8=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,1,255,0),this[A]=S&255,A+1},L.prototype.writeUint16LE=L.prototype.writeUInt16LE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,2,65535,0),this[A]=S&255,this[A+1]=S>>>8,A+2},L.prototype.writeUint16BE=L.prototype.writeUInt16BE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,2,65535,0),this[A]=S>>>8,this[A+1]=S&255,A+2},L.prototype.writeUint32LE=L.prototype.writeUInt32LE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,4,4294967295,0),this[A+3]=S>>>24,this[A+2]=S>>>16,this[A+1]=S>>>8,this[A]=S&255,A+4},L.prototype.writeUint32BE=L.prototype.writeUInt32BE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,4,4294967295,0),this[A]=S>>>24,this[A+1]=S>>>16,this[A+2]=S>>>8,this[A+3]=S&255,A+4};function $e(j,S,A,$,X){rt(S,$,X,j,A,7);let Z=Number(S&BigInt(4294967295));j[A++]=Z,Z=Z>>8,j[A++]=Z,Z=Z>>8,j[A++]=Z,Z=Z>>8,j[A++]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return j[A++]=re,re=re>>8,j[A++]=re,re=re>>8,j[A++]=re,re=re>>8,j[A++]=re,A}function lt(j,S,A,$,X){rt(S,$,X,j,A,7);let Z=Number(S&BigInt(4294967295));j[A+7]=Z,Z=Z>>8,j[A+6]=Z,Z=Z>>8,j[A+5]=Z,Z=Z>>8,j[A+4]=Z;let re=Number(S>>BigInt(32)&BigInt(4294967295));return j[A+3]=re,re=re>>8,j[A+2]=re,re=re>>8,j[A+1]=re,re=re>>8,j[A]=re,A+8}L.prototype.writeBigUInt64LE=wt(function(S,A=0){return $e(this,S,A,BigInt(0),BigInt("0xffffffffffffffff"))}),L.prototype.writeBigUInt64BE=wt(function(S,A=0){return lt(this,S,A,BigInt(0),BigInt("0xffffffffffffffff"))}),L.prototype.writeIntLE=function(S,A,$,X){if(S=+S,A=A>>>0,!X){const et=Math.pow(2,8*$-1);Oe(this,S,A,$,et-1,-et)}let Z=0,re=1,Be=0;for(this[A]=S&255;++Z<$&&(re*=256);)S<0&&Be===0&&this[A+Z-1]!==0&&(Be=1),this[A+Z]=(S/re>>0)-Be&255;return A+$},L.prototype.writeIntBE=function(S,A,$,X){if(S=+S,A=A>>>0,!X){const et=Math.pow(2,8*$-1);Oe(this,S,A,$,et-1,-et)}let Z=$-1,re=1,Be=0;for(this[A+Z]=S&255;--Z>=0&&(re*=256);)S<0&&Be===0&&this[A+Z+1]!==0&&(Be=1),this[A+Z]=(S/re>>0)-Be&255;return A+$},L.prototype.writeInt8=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,1,127,-128),S<0&&(S=255+S+1),this[A]=S&255,A+1},L.prototype.writeInt16LE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,2,32767,-32768),this[A]=S&255,this[A+1]=S>>>8,A+2},L.prototype.writeInt16BE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,2,32767,-32768),this[A]=S>>>8,this[A+1]=S&255,A+2},L.prototype.writeInt32LE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,4,2147483647,-2147483648),this[A]=S&255,this[A+1]=S>>>8,this[A+2]=S>>>16,this[A+3]=S>>>24,A+4},L.prototype.writeInt32BE=function(S,A,$){return S=+S,A=A>>>0,$||Oe(this,S,A,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[A]=S>>>24,this[A+1]=S>>>16,this[A+2]=S>>>8,this[A+3]=S&255,A+4},L.prototype.writeBigInt64LE=wt(function(S,A=0){return $e(this,S,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),L.prototype.writeBigInt64BE=wt(function(S,A=0){return lt(this,S,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pt(j,S,A,$,X,Z){if(A+$>j.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("Index out of range")}function He(j,S,A,$,X){return S=+S,A=A>>>0,X||pt(j,S,A,4),z.write(j,S,A,$,23,4),A+4}L.prototype.writeFloatLE=function(S,A,$){return He(this,S,A,!0,$)},L.prototype.writeFloatBE=function(S,A,$){return He(this,S,A,!1,$)};function kt(j,S,A,$,X){return S=+S,A=A>>>0,X||pt(j,S,A,8),z.write(j,S,A,$,52,8),A+8}L.prototype.writeDoubleLE=function(S,A,$){return kt(this,S,A,!0,$)},L.prototype.writeDoubleBE=function(S,A,$){return kt(this,S,A,!1,$)},L.prototype.copy=function(S,A,$,X){if(!L.isBuffer(S))throw new TypeError("argument should be a Buffer");if($||($=0),!X&&X!==0&&(X=this.length),A>=S.length&&(A=S.length),A||(A=0),X>0&&X<$&&(X=$),X===$||S.length===0||this.length===0)return 0;if(A<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),S.length-A<X-$&&(X=S.length-A+$);const Z=X-$;return this===S&&typeof q.prototype.copyWithin=="function"?this.copyWithin(A,$,X):q.prototype.set.call(S,this.subarray($,X),A),Z},L.prototype.fill=function(S,A,$,X){if(typeof S=="string"){if(typeof A=="string"?(X=A,A=0,$=this.length):typeof $=="string"&&(X=$,$=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!L.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(S.length===1){const re=S.charCodeAt(0);(X==="utf8"&&re<128||X==="latin1")&&(S=re)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(A<0||this.length<A||this.length<$)throw new RangeError("Out of range index");if($<=A)return this;A=A>>>0,$=$===void 0?this.length:$>>>0,S||(S=0);let Z;if(typeof S=="number")for(Z=A;Z<$;++Z)this[Z]=S;else{const re=L.isBuffer(S)?S:L.from(S,X),Be=re.length;if(Be===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Z=0;Z<$-A;++Z)this[Z+A]=re[Z%Be]}return this};const xt={};function Ye(j,S,A){xt[j]=class extends A{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(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${j}]: ${this.message}`}}}Ye("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ye("ERR_INVALID_ARG_TYPE",function(j,S){return`The "${j}" argument must be of type number. Received type ${typeof S}`},TypeError),Ye("ERR_OUT_OF_RANGE",function(j,S,A){let $=`The value of "${j}" is out of range.`,X=A;return Number.isInteger(A)&&Math.abs(A)>2**32?X=At(String(A)):typeof A=="bigint"&&(X=String(A),(A>BigInt(2)**BigInt(32)||A<-(BigInt(2)**BigInt(32)))&&(X=At(X)),X+="n"),$+=` It must be ${S}. Received ${X}`,$},RangeError);function At(j){let S="",A=j.length;const $=j[0]==="-"?1:0;for(;A>=$+4;A-=3)S=`_${j.slice(A-3,A)}${S}`;return`${j.slice(0,A)}${S}`}function Nt(j,S,A){St(S,"offset"),(j[S]===void 0||j[S+A]===void 0)&&Tt(S,j.length-(A+1))}function rt(j,S,A,$,X,Z){if(j>A||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 <= ${A}${re}`,new xt.ERR_OUT_OF_RANGE("value",Be,j)}Nt($,X,Z)}function St(j,S){if(typeof j!="number")throw new xt.ERR_INVALID_ARG_TYPE(S,"number",j)}function Tt(j,S,A){throw Math.floor(j)!==j?(St(j,A),new xt.ERR_OUT_OF_RANGE(A||"offset","an integer",j)):S<0?new xt.ERR_BUFFER_OUT_OF_BOUNDS:new xt.ERR_OUT_OF_RANGE(A||"offset",`>= ${A?1:0} and <= ${S}`,j)}const it=/[^+/0-9A-Za-z-_]/g;function jt(j){if(j=j.split("=")[0],j=j.trim().replace(it,""),j.length<2)return"";for(;j.length%4!==0;)j=j+"=";return j}function It(j,S){S=S||1/0;let A;const $=j.length;let X=null;const Z=[];for(let re=0;re<$;++re){if(A=j.charCodeAt(re),A>55295&&A<57344){if(!X){if(A>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(re+1===$){(S-=3)>-1&&Z.push(239,191,189);continue}X=A;continue}if(A<56320){(S-=3)>-1&&Z.push(239,191,189),X=A;continue}A=(X-55296<<10|A-56320)+65536}else X&&(S-=3)>-1&&Z.push(239,191,189);if(X=null,A<128){if((S-=1)<0)break;Z.push(A)}else if(A<2048){if((S-=2)<0)break;Z.push(A>>6|192,A&63|128)}else if(A<65536){if((S-=3)<0)break;Z.push(A>>12|224,A>>6&63|128,A&63|128)}else if(A<1114112){if((S-=4)<0)break;Z.push(A>>18|240,A>>12&63|128,A>>6&63|128,A&63|128)}else throw new Error("Invalid code point")}return Z}function nt(j){const S=[];for(let A=0;A<j.length;++A)S.push(j.charCodeAt(A)&255);return S}function bt(j,S){let A,$,X;const Z=[];for(let re=0;re<j.length&&!((S-=2)<0);++re)A=j.charCodeAt(re),$=A>>8,X=A%256,Z.push(X),Z.push($);return Z}function Ct(j){return N.toByteArray(jt(j))}function Je(j,S,A,$){let X;for(X=0;X<$&&!(X+A>=S.length||X>=j.length);++X)S[X+A]=j[X];return X}function mt(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 st=function(){const j="0123456789abcdef",S=new Array(256);for(let A=0;A<16;++A){const $=A*16;for(let X=0;X<16;++X)S[$+X]=j[A]+j[X]}return S}();function wt(j){return typeof BigInt>"u"?Ft:j}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})(uc);const Od=nc(uc);var zn={},Ap={exports:{}};Ap.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=uc.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 C,E,O=0;if(m==="be")for(x=p.length-1,C=0;x>=0;x-=3)E=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[C]|=E<<O&67108863,this.words[C+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,C++);else if(m==="le")for(x=0,C=0;x<p.length;x+=3)E=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[C]|=E<<O&67108863,this.words[C+1]=E>>>26-O&67108863,O+=24,O>=26&&(O-=26,C++);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 C=0,E=0,O;if(m==="be")for(x=p.length-1;x>=d;x-=2)O=c(p,d,x)<<C,this.words[E]|=O&67108863,C>=18?(C-=18,E+=1,this.words[E]|=O>>>26):C+=8;else{var M=p.length-d;for(x=M%2===0?d+1:d;x<p.length;x+=2)O=c(p,d,x)<<C,this.words[E]|=O&67108863,C>=18?(C-=18,E+=1,this.words[E]|=O>>>26):C+=8}this._strip()};function u(D,p,d,m){for(var x=0,C=0,E=Math.min(D.length,d),O=p;O<E;O++){var M=D.charCodeAt(O)-48;x*=m,M>=49?C=M-49+10:M>=17?C=M-17+10:C=M,n(M>=0&&C<m,"Invalid character"),x+=C}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,C=1;C<=67108863;C*=d)x++;x--,C=C/d|0;for(var E=p.length-m,O=E%x,M=Math.min(E,E-O)+m,g=0,v=m;v<M;v+=x)g=u(p,v,v+x,d),this.imuln(C),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,C=0,E=0;E<this.length;E++){var O=this.words[E],M=((O<<x|C)&16777215).toString(16);C=O>>>24-x&16777215,x+=2,x>=26&&(x-=26,E--),C!==0||E!==this.length-1?m=h[6-M.length]+M+m:m=M+m}for(C!==0&&(m=C.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(),C=m||Math.max(1,x);n(x<=C,"byte array longer than desired length"),n(C>0,"Requested array length <= 0");var E=w(p,C),O=d==="le"?"LE":"BE";return this["_toArrayLike"+O](E,x),E},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,C=0,E=0;C<this.length;C++){var O=this.words[C]<<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,C=0,E=0;C<this.length;C++){var O=this.words[C]<<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 T(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 C=0,E=0;E<x.length;E++)d=(m.words[E]|0)+(x.words[E]|0)+C,this.words[E]=d&67108863,C=d>>>26;for(;C!==0&&E<m.length;E++)d=(m.words[E]|0)+C,this.words[E]=d&67108863,C=d>>>26;if(this.length=m.length,C!==0)this.words[this.length]=C,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,C;m>0?(x=this,C=p):(x=p,C=this);for(var E=0,O=0;O<C.length;O++)d=(x.words[O]|0)-(C.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,C=p.words[0]|0,E=x*C,O=E&67108863,M=E/67108864|0;d.words[0]=O;for(var g=1;g<m;g++){for(var v=M>>>26,k=M&67108863,ee=Math.min(g,p.length-1),ie=Math.max(0,g-D.length+1);ie<=ee;ie++){var ge=g-ie|0;x=D.words[ge]|0,C=p.words[ie]|0,E=x*C+k,v+=E/67108864|0,k=E&67108863}d.words[g]=k|0,M=v|0}return M!==0?d.words[g]=M|0:d.length--,d._strip()}var R=function(p,d,m){var x=p.words,C=d.words,E=m.words,O=0,M,g,v,k=x[0]|0,ee=k&8191,ie=k>>>13,ge=x[1]|0,ve=ge&8191,Se=ge>>>13,xe=x[2]|0,Xe=xe&8191,Le=xe>>>13,ot=x[3]|0,dt=ot&8191,De=ot>>>13,vt=x[4]|0,we=vt&8191,me=vt>>>13,Ae=x[5]|0,Ue=Ae&8191,Ne=Ae>>>13,Te=x[6]|0,Oe=Te&8191,$e=Te>>>13,lt=x[7]|0,pt=lt&8191,He=lt>>>13,kt=x[8]|0,xt=kt&8191,Ye=kt>>>13,At=x[9]|0,Nt=At&8191,rt=At>>>13,St=C[0]|0,Tt=St&8191,it=St>>>13,jt=C[1]|0,It=jt&8191,nt=jt>>>13,bt=C[2]|0,Ct=bt&8191,Je=bt>>>13,mt=C[3]|0,Pt=mt&8191,st=mt>>>13,wt=C[4]|0,Ft=wt&8191,j=wt>>>13,S=C[5]|0,A=S&8191,$=S>>>13,X=C[6]|0,Z=X&8191,re=X>>>13,Be=C[7]|0,et=Be&8191,Re=Be>>>13,V=C[8]|0,oe=V&8191,de=V>>>13,ke=C[9]|0,We=ke&8191,je=ke>>>13;m.negative=p.negative^d.negative,m.length=19,M=Math.imul(ee,Tt),g=Math.imul(ee,it),g=g+Math.imul(ie,Tt)|0,v=Math.imul(ie,it);var Fe=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,M=Math.imul(ve,Tt),g=Math.imul(ve,it),g=g+Math.imul(Se,Tt)|0,v=Math.imul(Se,it),M=M+Math.imul(ee,It)|0,g=g+Math.imul(ee,nt)|0,g=g+Math.imul(ie,It)|0,v=v+Math.imul(ie,nt)|0;var at=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(Xe,Tt),g=Math.imul(Xe,it),g=g+Math.imul(Le,Tt)|0,v=Math.imul(Le,it),M=M+Math.imul(ve,It)|0,g=g+Math.imul(ve,nt)|0,g=g+Math.imul(Se,It)|0,v=v+Math.imul(Se,nt)|0,M=M+Math.imul(ee,Ct)|0,g=g+Math.imul(ee,Je)|0,g=g+Math.imul(ie,Ct)|0,v=v+Math.imul(ie,Je)|0;var Gt=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,M=Math.imul(dt,Tt),g=Math.imul(dt,it),g=g+Math.imul(De,Tt)|0,v=Math.imul(De,it),M=M+Math.imul(Xe,It)|0,g=g+Math.imul(Xe,nt)|0,g=g+Math.imul(Le,It)|0,v=v+Math.imul(Le,nt)|0,M=M+Math.imul(ve,Ct)|0,g=g+Math.imul(ve,Je)|0,g=g+Math.imul(Se,Ct)|0,v=v+Math.imul(Se,Je)|0,M=M+Math.imul(ee,Pt)|0,g=g+Math.imul(ee,st)|0,g=g+Math.imul(ie,Pt)|0,v=v+Math.imul(ie,st)|0;var Rt=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,M=Math.imul(we,Tt),g=Math.imul(we,it),g=g+Math.imul(me,Tt)|0,v=Math.imul(me,it),M=M+Math.imul(dt,It)|0,g=g+Math.imul(dt,nt)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,nt)|0,M=M+Math.imul(Xe,Ct)|0,g=g+Math.imul(Xe,Je)|0,g=g+Math.imul(Le,Ct)|0,v=v+Math.imul(Le,Je)|0,M=M+Math.imul(ve,Pt)|0,g=g+Math.imul(ve,st)|0,g=g+Math.imul(Se,Pt)|0,v=v+Math.imul(Se,st)|0,M=M+Math.imul(ee,Ft)|0,g=g+Math.imul(ee,j)|0,g=g+Math.imul(ie,Ft)|0,v=v+Math.imul(ie,j)|0;var Dt=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,M=Math.imul(Ue,Tt),g=Math.imul(Ue,it),g=g+Math.imul(Ne,Tt)|0,v=Math.imul(Ne,it),M=M+Math.imul(we,It)|0,g=g+Math.imul(we,nt)|0,g=g+Math.imul(me,It)|0,v=v+Math.imul(me,nt)|0,M=M+Math.imul(dt,Ct)|0,g=g+Math.imul(dt,Je)|0,g=g+Math.imul(De,Ct)|0,v=v+Math.imul(De,Je)|0,M=M+Math.imul(Xe,Pt)|0,g=g+Math.imul(Xe,st)|0,g=g+Math.imul(Le,Pt)|0,v=v+Math.imul(Le,st)|0,M=M+Math.imul(ve,Ft)|0,g=g+Math.imul(ve,j)|0,g=g+Math.imul(Se,Ft)|0,v=v+Math.imul(Se,j)|0,M=M+Math.imul(ee,A)|0,g=g+Math.imul(ee,$)|0,g=g+Math.imul(ie,A)|0,v=v+Math.imul(ie,$)|0;var Qt=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,M=Math.imul(Oe,Tt),g=Math.imul(Oe,it),g=g+Math.imul($e,Tt)|0,v=Math.imul($e,it),M=M+Math.imul(Ue,It)|0,g=g+Math.imul(Ue,nt)|0,g=g+Math.imul(Ne,It)|0,v=v+Math.imul(Ne,nt)|0,M=M+Math.imul(we,Ct)|0,g=g+Math.imul(we,Je)|0,g=g+Math.imul(me,Ct)|0,v=v+Math.imul(me,Je)|0,M=M+Math.imul(dt,Pt)|0,g=g+Math.imul(dt,st)|0,g=g+Math.imul(De,Pt)|0,v=v+Math.imul(De,st)|0,M=M+Math.imul(Xe,Ft)|0,g=g+Math.imul(Xe,j)|0,g=g+Math.imul(Le,Ft)|0,v=v+Math.imul(Le,j)|0,M=M+Math.imul(ve,A)|0,g=g+Math.imul(ve,$)|0,g=g+Math.imul(Se,A)|0,v=v+Math.imul(Se,$)|0,M=M+Math.imul(ee,Z)|0,g=g+Math.imul(ee,re)|0,g=g+Math.imul(ie,Z)|0,v=v+Math.imul(ie,re)|0;var gr=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(gr>>>26)|0,gr&=67108863,M=Math.imul(pt,Tt),g=Math.imul(pt,it),g=g+Math.imul(He,Tt)|0,v=Math.imul(He,it),M=M+Math.imul(Oe,It)|0,g=g+Math.imul(Oe,nt)|0,g=g+Math.imul($e,It)|0,v=v+Math.imul($e,nt)|0,M=M+Math.imul(Ue,Ct)|0,g=g+Math.imul(Ue,Je)|0,g=g+Math.imul(Ne,Ct)|0,v=v+Math.imul(Ne,Je)|0,M=M+Math.imul(we,Pt)|0,g=g+Math.imul(we,st)|0,g=g+Math.imul(me,Pt)|0,v=v+Math.imul(me,st)|0,M=M+Math.imul(dt,Ft)|0,g=g+Math.imul(dt,j)|0,g=g+Math.imul(De,Ft)|0,v=v+Math.imul(De,j)|0,M=M+Math.imul(Xe,A)|0,g=g+Math.imul(Xe,$)|0,g=g+Math.imul(Le,A)|0,v=v+Math.imul(Le,$)|0,M=M+Math.imul(ve,Z)|0,g=g+Math.imul(ve,re)|0,g=g+Math.imul(Se,Z)|0,v=v+Math.imul(Se,re)|0,M=M+Math.imul(ee,et)|0,g=g+Math.imul(ee,Re)|0,g=g+Math.imul(ie,et)|0,v=v+Math.imul(ie,Re)|0;var nr=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(nr>>>26)|0,nr&=67108863,M=Math.imul(xt,Tt),g=Math.imul(xt,it),g=g+Math.imul(Ye,Tt)|0,v=Math.imul(Ye,it),M=M+Math.imul(pt,It)|0,g=g+Math.imul(pt,nt)|0,g=g+Math.imul(He,It)|0,v=v+Math.imul(He,nt)|0,M=M+Math.imul(Oe,Ct)|0,g=g+Math.imul(Oe,Je)|0,g=g+Math.imul($e,Ct)|0,v=v+Math.imul($e,Je)|0,M=M+Math.imul(Ue,Pt)|0,g=g+Math.imul(Ue,st)|0,g=g+Math.imul(Ne,Pt)|0,v=v+Math.imul(Ne,st)|0,M=M+Math.imul(we,Ft)|0,g=g+Math.imul(we,j)|0,g=g+Math.imul(me,Ft)|0,v=v+Math.imul(me,j)|0,M=M+Math.imul(dt,A)|0,g=g+Math.imul(dt,$)|0,g=g+Math.imul(De,A)|0,v=v+Math.imul(De,$)|0,M=M+Math.imul(Xe,Z)|0,g=g+Math.imul(Xe,re)|0,g=g+Math.imul(Le,Z)|0,v=v+Math.imul(Le,re)|0,M=M+Math.imul(ve,et)|0,g=g+Math.imul(ve,Re)|0,g=g+Math.imul(Se,et)|0,v=v+Math.imul(Se,Re)|0,M=M+Math.imul(ee,oe)|0,g=g+Math.imul(ee,de)|0,g=g+Math.imul(ie,oe)|0,v=v+Math.imul(ie,de)|0;var Kt=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,M=Math.imul(Nt,Tt),g=Math.imul(Nt,it),g=g+Math.imul(rt,Tt)|0,v=Math.imul(rt,it),M=M+Math.imul(xt,It)|0,g=g+Math.imul(xt,nt)|0,g=g+Math.imul(Ye,It)|0,v=v+Math.imul(Ye,nt)|0,M=M+Math.imul(pt,Ct)|0,g=g+Math.imul(pt,Je)|0,g=g+Math.imul(He,Ct)|0,v=v+Math.imul(He,Je)|0,M=M+Math.imul(Oe,Pt)|0,g=g+Math.imul(Oe,st)|0,g=g+Math.imul($e,Pt)|0,v=v+Math.imul($e,st)|0,M=M+Math.imul(Ue,Ft)|0,g=g+Math.imul(Ue,j)|0,g=g+Math.imul(Ne,Ft)|0,v=v+Math.imul(Ne,j)|0,M=M+Math.imul(we,A)|0,g=g+Math.imul(we,$)|0,g=g+Math.imul(me,A)|0,v=v+Math.imul(me,$)|0,M=M+Math.imul(dt,Z)|0,g=g+Math.imul(dt,re)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,re)|0,M=M+Math.imul(Xe,et)|0,g=g+Math.imul(Xe,Re)|0,g=g+Math.imul(Le,et)|0,v=v+Math.imul(Le,Re)|0,M=M+Math.imul(ve,oe)|0,g=g+Math.imul(ve,de)|0,g=g+Math.imul(Se,oe)|0,v=v+Math.imul(Se,de)|0,M=M+Math.imul(ee,We)|0,g=g+Math.imul(ee,je)|0,g=g+Math.imul(ie,We)|0,v=v+Math.imul(ie,je)|0;var mr=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(mr>>>26)|0,mr&=67108863,M=Math.imul(Nt,It),g=Math.imul(Nt,nt),g=g+Math.imul(rt,It)|0,v=Math.imul(rt,nt),M=M+Math.imul(xt,Ct)|0,g=g+Math.imul(xt,Je)|0,g=g+Math.imul(Ye,Ct)|0,v=v+Math.imul(Ye,Je)|0,M=M+Math.imul(pt,Pt)|0,g=g+Math.imul(pt,st)|0,g=g+Math.imul(He,Pt)|0,v=v+Math.imul(He,st)|0,M=M+Math.imul(Oe,Ft)|0,g=g+Math.imul(Oe,j)|0,g=g+Math.imul($e,Ft)|0,v=v+Math.imul($e,j)|0,M=M+Math.imul(Ue,A)|0,g=g+Math.imul(Ue,$)|0,g=g+Math.imul(Ne,A)|0,v=v+Math.imul(Ne,$)|0,M=M+Math.imul(we,Z)|0,g=g+Math.imul(we,re)|0,g=g+Math.imul(me,Z)|0,v=v+Math.imul(me,re)|0,M=M+Math.imul(dt,et)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(De,et)|0,v=v+Math.imul(De,Re)|0,M=M+Math.imul(Xe,oe)|0,g=g+Math.imul(Xe,de)|0,g=g+Math.imul(Le,oe)|0,v=v+Math.imul(Le,de)|0,M=M+Math.imul(ve,We)|0,g=g+Math.imul(ve,je)|0,g=g+Math.imul(Se,We)|0,v=v+Math.imul(Se,je)|0;var an=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(an>>>26)|0,an&=67108863,M=Math.imul(Nt,Ct),g=Math.imul(Nt,Je),g=g+Math.imul(rt,Ct)|0,v=Math.imul(rt,Je),M=M+Math.imul(xt,Pt)|0,g=g+Math.imul(xt,st)|0,g=g+Math.imul(Ye,Pt)|0,v=v+Math.imul(Ye,st)|0,M=M+Math.imul(pt,Ft)|0,g=g+Math.imul(pt,j)|0,g=g+Math.imul(He,Ft)|0,v=v+Math.imul(He,j)|0,M=M+Math.imul(Oe,A)|0,g=g+Math.imul(Oe,$)|0,g=g+Math.imul($e,A)|0,v=v+Math.imul($e,$)|0,M=M+Math.imul(Ue,Z)|0,g=g+Math.imul(Ue,re)|0,g=g+Math.imul(Ne,Z)|0,v=v+Math.imul(Ne,re)|0,M=M+Math.imul(we,et)|0,g=g+Math.imul(we,Re)|0,g=g+Math.imul(me,et)|0,v=v+Math.imul(me,Re)|0,M=M+Math.imul(dt,oe)|0,g=g+Math.imul(dt,de)|0,g=g+Math.imul(De,oe)|0,v=v+Math.imul(De,de)|0,M=M+Math.imul(Xe,We)|0,g=g+Math.imul(Xe,je)|0,g=g+Math.imul(Le,We)|0,v=v+Math.imul(Le,je)|0;var Dr=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,M=Math.imul(Nt,Pt),g=Math.imul(Nt,st),g=g+Math.imul(rt,Pt)|0,v=Math.imul(rt,st),M=M+Math.imul(xt,Ft)|0,g=g+Math.imul(xt,j)|0,g=g+Math.imul(Ye,Ft)|0,v=v+Math.imul(Ye,j)|0,M=M+Math.imul(pt,A)|0,g=g+Math.imul(pt,$)|0,g=g+Math.imul(He,A)|0,v=v+Math.imul(He,$)|0,M=M+Math.imul(Oe,Z)|0,g=g+Math.imul(Oe,re)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,re)|0,M=M+Math.imul(Ue,et)|0,g=g+Math.imul(Ue,Re)|0,g=g+Math.imul(Ne,et)|0,v=v+Math.imul(Ne,Re)|0,M=M+Math.imul(we,oe)|0,g=g+Math.imul(we,de)|0,g=g+Math.imul(me,oe)|0,v=v+Math.imul(me,de)|0,M=M+Math.imul(dt,We)|0,g=g+Math.imul(dt,je)|0,g=g+Math.imul(De,We)|0,v=v+Math.imul(De,je)|0;var cn=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(cn>>>26)|0,cn&=67108863,M=Math.imul(Nt,Ft),g=Math.imul(Nt,j),g=g+Math.imul(rt,Ft)|0,v=Math.imul(rt,j),M=M+Math.imul(xt,A)|0,g=g+Math.imul(xt,$)|0,g=g+Math.imul(Ye,A)|0,v=v+Math.imul(Ye,$)|0,M=M+Math.imul(pt,Z)|0,g=g+Math.imul(pt,re)|0,g=g+Math.imul(He,Z)|0,v=v+Math.imul(He,re)|0,M=M+Math.imul(Oe,et)|0,g=g+Math.imul(Oe,Re)|0,g=g+Math.imul($e,et)|0,v=v+Math.imul($e,Re)|0,M=M+Math.imul(Ue,oe)|0,g=g+Math.imul(Ue,de)|0,g=g+Math.imul(Ne,oe)|0,v=v+Math.imul(Ne,de)|0,M=M+Math.imul(we,We)|0,g=g+Math.imul(we,je)|0,g=g+Math.imul(me,We)|0,v=v+Math.imul(me,je)|0;var ni=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ni>>>26)|0,ni&=67108863,M=Math.imul(Nt,A),g=Math.imul(Nt,$),g=g+Math.imul(rt,A)|0,v=Math.imul(rt,$),M=M+Math.imul(xt,Z)|0,g=g+Math.imul(xt,re)|0,g=g+Math.imul(Ye,Z)|0,v=v+Math.imul(Ye,re)|0,M=M+Math.imul(pt,et)|0,g=g+Math.imul(pt,Re)|0,g=g+Math.imul(He,et)|0,v=v+Math.imul(He,Re)|0,M=M+Math.imul(Oe,oe)|0,g=g+Math.imul(Oe,de)|0,g=g+Math.imul($e,oe)|0,v=v+Math.imul($e,de)|0,M=M+Math.imul(Ue,We)|0,g=g+Math.imul(Ue,je)|0,g=g+Math.imul(Ne,We)|0,v=v+Math.imul(Ne,je)|0;var ii=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(ii>>>26)|0,ii&=67108863,M=Math.imul(Nt,Z),g=Math.imul(Nt,re),g=g+Math.imul(rt,Z)|0,v=Math.imul(rt,re),M=M+Math.imul(xt,et)|0,g=g+Math.imul(xt,Re)|0,g=g+Math.imul(Ye,et)|0,v=v+Math.imul(Ye,Re)|0,M=M+Math.imul(pt,oe)|0,g=g+Math.imul(pt,de)|0,g=g+Math.imul(He,oe)|0,v=v+Math.imul(He,de)|0,M=M+Math.imul(Oe,We)|0,g=g+Math.imul(Oe,je)|0,g=g+Math.imul($e,We)|0,v=v+Math.imul($e,je)|0;var un=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(un>>>26)|0,un&=67108863,M=Math.imul(Nt,et),g=Math.imul(Nt,Re),g=g+Math.imul(rt,et)|0,v=Math.imul(rt,Re),M=M+Math.imul(xt,oe)|0,g=g+Math.imul(xt,de)|0,g=g+Math.imul(Ye,oe)|0,v=v+Math.imul(Ye,de)|0,M=M+Math.imul(pt,We)|0,g=g+Math.imul(pt,je)|0,g=g+Math.imul(He,We)|0,v=v+Math.imul(He,je)|0;var si=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(si>>>26)|0,si&=67108863,M=Math.imul(Nt,oe),g=Math.imul(Nt,de),g=g+Math.imul(rt,oe)|0,v=Math.imul(rt,de),M=M+Math.imul(xt,We)|0,g=g+Math.imul(xt,je)|0,g=g+Math.imul(Ye,We)|0,v=v+Math.imul(Ye,je)|0;var oi=(O+M|0)+((g&8191)<<13)|0;O=(v+(g>>>13)|0)+(oi>>>26)|0,oi&=67108863,M=Math.imul(Nt,We),g=Math.imul(Nt,je),g=g+Math.imul(rt,We)|0,v=Math.imul(rt,je);var B=(O+M|0)+((g&8191)<<13)|0;return O=(v+(g>>>13)|0)+(B>>>26)|0,B&=67108863,E[0]=Fe,E[1]=at,E[2]=Gt,E[3]=Rt,E[4]=Dt,E[5]=Qt,E[6]=gr,E[7]=nr,E[8]=Kt,E[9]=mr,E[10]=an,E[11]=Dr,E[12]=cn,E[13]=ni,E[14]=ii,E[15]=un,E[16]=si,E[17]=oi,E[18]=B,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,C=0;C<d.length-1;C++){var E=x;x=0;for(var O=m&67108863,M=Math.min(C,p.length-1),g=Math.max(0,C-D.length+1);g<=M;g++){var v=C-g,k=D.words[v]|0,ee=p.words[g]|0,ie=k*ee,ge=ie&67108863;E=E+(ie/67108864|0)|0,ge=ge+O|0,O=ge&67108863,E=E+(ge>>>26)|0,x+=E>>>26,E&=67108863}d.words[C]=O,m=E,E=x}return m!==0?d.words[C]=m:d.length--,d._strip()}function z(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=z(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),z(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 C=(this.words[x]|0)*p,E=(C&67108863)+(m&67108863);m>>=26,m+=C/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=T(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 C=m.sqr();x<d.length;x++,C=C.sqr())d[x]!==0&&(m=m.mul(C));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,C;if(d!==0){var E=0;for(C=0;C<this.length;C++){var O=this.words[C]&x,M=(this.words[C]|0)-O<<d;this.words[C]=M|E,E=O>>>26-d}E&&(this.words[C]=E,this.length++)}if(m!==0){for(C=this.length-1;C>=0;C--)this.words[C+m]=this.words[C];for(C=0;C<m;C++)this.words[C]=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 C=p%26,E=Math.min((p-C)/26,this.length),O=67108863^67108863>>>C<<C,M=m;if(x-=E,x=Math.max(0,x),M){for(var g=0;g<E;g++)M.words[g]=this.words[g];M.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-C|k>>>C,v=k&O}return M&&v!==0&&(M.words[M.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 C=this.words[m];return!!(C&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,C;this._expand(x);var E,O=0;for(C=0;C<p.length;C++){E=(this.words[C+m]|0)+O;var M=(p.words[C]|0)*d;E-=M&67108863,O=(E>>26)-(M/67108864|0),this.words[C+m]=E&67108863}for(;C<this.length-m;C++)E=(this.words[C+m]|0)+O,O=E>>26,this.words[C+m]=E&67108863;if(O===0)return this._strip();for(n(O===-1),O=0,C=0;C<this.length;C++)E=-(this.words[C]|0)+O,O=E>>26,this.words[C]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),C=p,E=C.words[C.length-1]|0,O=this._countBits(E);m=26-O,m!==0&&(C=C.ushln(m),x.iushln(m),E=C.words[C.length-1]|0);var M=x.length-C.length,g;if(d!=="mod"){g=new s(null),g.length=M+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var k=x.clone()._ishlnsubmul(C,1,M);k.negative===0&&(x=k,g&&(g.words[M]=1));for(var ee=M-1;ee>=0;ee--){var ie=(x.words[C.length+ee]|0)*67108864+(x.words[C.length+ee-1]|0);for(ie=Math.min(ie/E|0,67108863),x._ishlnsubmul(C,ie,ee);x.negative!==0;)ie--,x.negative=0,x._ishlnsubmul(C,1,ee),x.isZero()||(x.negative^=1);g&&(g.words[ee]=ie)}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,C,E;return this.negative!==0&&p.negative===0?(E=this.neg().divmod(p,d),d!=="mod"&&(x=E.div.neg()),d!=="div"&&(C=E.mod.neg(),m&&C.negative!==0&&C.iadd(p)),{div:x,mod:C}):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"&&(C=E.mod.neg(),m&&C.negative!==0&&C.isub(p)),{div:E.div,mod:C}):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),C=p.andln(1),E=m.cmp(x);return E<0||C===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,C=this.length-1;C>=0;C--)x=(m*x+(this.words[C]|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 C=(this.words[x]|0)+m*67108864;this.words[x]=C/p|0,m=C%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),C=new s(0),E=new s(0),O=new s(1),M=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++M;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()||C.isOdd())&&(x.iadd(g),C.isub(v)),x.iushrn(1),C.iushrn(1);for(var ie=0,ge=1;!(m.words[0]&ge)&&ie<26;++ie,ge<<=1);if(ie>0)for(m.iushrn(ie);ie-- >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),C.isub(O)):(m.isub(d),E.isub(x),O.isub(C))}return{a:E,b:O,gcd:m.iushln(M)}},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),C=new s(0),E=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var O=0,M=1;!(d.words[0]&M)&&O<26;++O,M<<=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;)C.isOdd()&&C.iadd(E),C.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(C)):(m.isub(d),C.isub(x))}var k;return d.cmpn(1)===0?k=x:k=C,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 C=d.cmp(m);if(C<0){var E=d;d=m,m=E}else if(C===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 C=x,E=m;C!==0&&E<this.length;E++){var O=this.words[E]|0;O+=C,C=O>>>26,O&=67108863,this.words[E]=O}return C!==0&&(this.words[E]=C,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,C=p.words[m]|0;if(x!==C){x<C?d=-1:x>C&&(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 H(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 F={k256:null,p224:null,p192:null,p25519:null};function W(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()}W.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},W.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},W.prototype.split=function(p,d){p.iushrn(this.n,0,d)},W.prototype.imulK=function(p){return p.imul(this.k)};function q(){W.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,W),q.prototype.split=function(p,d){for(var m=4194303,x=Math.min(p.length,9),C=0;C<x;C++)d.words[C]=p.words[C];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,C=10;C<p.length;C++){var O=p.words[C]|0;p.words[C-10]=(O&m)<<4|E>>>22,E=O}E>>>=22,p.words[C-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 K(){W.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(K,W);function te(){W.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(te,W);function se(){W.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(se,W),se.prototype.imulK=function(p){for(var d=0,m=0;m<p.length;m++){var x=(p.words[m]|0)*19+d,C=x&67108863;x>>>=26,p.words[m]=C,d=x}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(F[p])return F[p];var d;if(p==="k256")d=new q;else if(p==="p224")d=new K;else if(p==="p192")d=new te;else if(p==="p25519")d=new se;else throw new Error("Unknown prime "+p);return F[p]=d,d};function H(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}H.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},H.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")},H.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},H.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},H.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)},H.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},H.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)},H.prototype.isub=function(p,d){this._verify2(p,d);var m=p.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},H.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},H.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},H.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},H.prototype.isqr=function(p){return this.imul(p,p.clone())},H.prototype.sqr=function(p){return this.mul(p,p)},H.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),C=0;!x.isZero()&&x.andln(1)===0;)C++,x.iushrn(1);n(!x.isZero());var E=new s(1).toRed(this),O=E.redNeg(),M=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,M).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),ie=C;ee.cmp(E)!==0;){for(var ge=ee,ve=0;ge.cmp(E)!==0;ve++)ge=ge.redSqr();n(ve<ie);var Se=this.pow(v,new s(1).iushln(ie-ve-1));k=k.redMul(Se),v=Se.redSqr(),ee=ee.redMul(v),ie=ve}return k},H.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},H.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 C=2;C<x.length;C++)x[C]=this.mul(x[C-1],p);var E=x[0],O=0,M=0,g=d.bitLength()%26;for(g===0&&(g=26),C=d.length-1;C>=0;C--){for(var v=d.words[C],k=g-1;k>=0;k--){var ee=v>>k&1;if(E!==x[0]&&(E=this.sqr(E)),ee===0&&O===0){M=0;continue}O<<=1,O|=ee,M++,!(M!==m&&(C!==0||k!==0))&&(E=this.mul(E,x[O]),M=0,O=0)}g=26}return E},H.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},H.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new L(p)};function L(D){H.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(L,H),L.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},L.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},L.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),C=m.isub(x).iushrn(this.shift),E=C;return C.cmp(this.m)>=0?E=C.isub(this.m):C.cmpn(0)<0&&(E=C.iadd(this.m)),E._forceRed(this)},L.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),C=m.isub(x).iushrn(this.shift),E=C;return C.cmp(this.m)>=0?E=C.isub(this.m):C.cmpn(0)<0&&(E=C.iadd(this.m)),E._forceRed(this)},L.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,Rr)})(Ap);var Z_=Ap.exports;const bm=nc(Z_);var r7=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zn,"__esModule",{value:!0});zn.parseAccumulatorUpdateData=zn.sliceAccumulatorUpdateData=zn.parsePriceFeedMessage=zn.isAccumulatorUpdateData=void 0;const Js=r7(Z_),n7="504e4155",i7=1,s7=0,Id=20,o7=0;function Tp(e){return e.toString("hex").slice(0,8)===n7&&e[4]===i7&&e[5]===s7}zn.isAccumulatorUpdateData=Tp;function a7(e){let t=0;if(e.readUInt8(t)!==o7)throw new Error("Not a price feed message");t+=1;const n=e.subarray(t,t+32);t+=32;const i=new Js.default(e.subarray(t,t+8),"be");t+=8;const s=new Js.default(e.subarray(t,t+8),"be");t+=8;const o=e.readInt32BE(t);t+=4;const a=new Js.default(e.subarray(t,t+8),"be");t+=8;const c=new Js.default(e.subarray(t,t+8),"be");t+=8;const u=new Js.default(e.subarray(t,t+8),"be");t+=8;const l=new Js.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}}zn.parsePriceFeedMessage=a7;function c7(e,t,r){if(!Tp(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+=Id*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 Od.concat([e.subarray(0,o),Od.from([u.length]),...a.slice(t,r)])}zn.sliceAccumulatorUpdateData=c7;function u7(e){if(!Tp(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+Id))),t+=Id;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}}zn.parseAccumulatorUpdateData=u7;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.PriceFeedMetadata=e.Price=e.parsePriceFeedMessage=e.parseAccumulatorUpdateData=e.sliceAccumulatorUpdateData=e.isAccumulatorUpdateData=void 0;const t=ul;var r=zn;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}});class n{constructor(a){gt(this,"conf");gt(this,"expo");gt(this,"price");gt(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){gt(this,"attestationTime");gt(this,"emitterChain");gt(this,"priceServiceReceiveTime");gt(this,"sequenceNumber");gt(this,"slot");gt(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 Q_{constructor(a){gt(this,"emaPrice");gt(this,"id");gt(this,"metadata");gt(this,"vaa");gt(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 Q_({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})(Mp);function ex(e,t){return function(){return e.apply(t,arguments)}}const{toString:l7}=Object.prototype,{getPrototypeOf:Op}=Object,ll=(e=>t=>{const r=l7.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),An=e=>(e=e.toLowerCase(),t=>ll(t)===e),fl=e=>t=>typeof t===e,{isArray:Fo}=Array,za=fl("undefined");function f7(e){return e!==null&&!za(e)&&e.constructor!==null&&!za(e.constructor)&&qr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const tx=An("ArrayBuffer");function d7(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&tx(e.buffer),t}const h7=fl("string"),qr=fl("function"),rx=fl("number"),dl=e=>e!==null&&typeof e=="object",p7=e=>e===!0||e===!1,Qc=e=>{if(ll(e)!=="object")return!1;const t=Op(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},m7=An("Date"),g7=An("File"),v7=An("Blob"),y7=An("FileList"),b7=e=>dl(e)&&qr(e.pipe),w7=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||qr(e.append)&&((t=ll(e))==="formdata"||t==="object"&&qr(e.toString)&&e.toString()==="[object FormData]"))},_7=An("URLSearchParams"),[x7,S7,E7,C7]=["ReadableStream","Request","Response","Headers"].map(An),M7=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lc(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Fo(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 nx(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 Ps=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Rr)(),ix=e=>!za(e)&&e!==Ps;function Pd(){const{caseless:e}=ix(this)&&this||{},t={},r=(n,i)=>{const s=e&&nx(t,i)||i;Qc(t[s])&&Qc(n)?t[s]=Pd(t[s],n):Qc(n)?t[s]=Pd({},n):Fo(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&lc(arguments[n],r);return t}const A7=(e,t,r,{allOwnKeys:n}={})=>(lc(t,(i,s)=>{r&&qr(i)?e[s]=ex(i,r):e[s]=i},{allOwnKeys:n}),e),T7=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),O7=(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)},I7=(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&&Op(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},P7=(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},k7=e=>{if(!e)return null;if(Fo(e))return e;let t=e.length;if(!rx(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},j7=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Op(Uint8Array)),R7=(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])}},N7=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},D7=An("HTMLFormElement"),B7=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),wm=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),$7=An("RegExp"),sx=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};lc(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},L7=e=>{sx(e,(t,r)=>{if(qr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(qr(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+"'")})}})},F7=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Fo(e)?n(e):n(String(e).split(t)),r},U7=()=>{},z7=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,xf="abcdefghijklmnopqrstuvwxyz",_m="0123456789",ox={DIGIT:_m,ALPHA:xf,ALPHA_DIGIT:xf+xf.toUpperCase()+_m},V7=(e=16,t=ox.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function q7(e){return!!(e&&qr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const H7=e=>{const t=new Array(10),r=(n,i)=>{if(dl(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Fo(n)?[]:{};return lc(n,(o,a)=>{const c=r(o,i+1);!za(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},W7=An("AsyncFunction"),G7=e=>e&&(dl(e)||qr(e))&&qr(e.then)&&qr(e.catch),ax=((e,t)=>e?setImmediate:t?((r,n)=>(Ps.addEventListener("message",({source:i,data:s})=>{i===Ps&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Ps.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",qr(Ps.postMessage)),K7=typeof queueMicrotask<"u"?queueMicrotask.bind(Ps):typeof bn<"u"&&bn.nextTick||ax;var le={isArray:Fo,isArrayBuffer:tx,isBuffer:f7,isFormData:w7,isArrayBufferView:d7,isString:h7,isNumber:rx,isBoolean:p7,isObject:dl,isPlainObject:Qc,isReadableStream:x7,isRequest:S7,isResponse:E7,isHeaders:C7,isUndefined:za,isDate:m7,isFile:g7,isBlob:v7,isRegExp:$7,isFunction:qr,isStream:b7,isURLSearchParams:_7,isTypedArray:j7,isFileList:y7,forEach:lc,merge:Pd,extend:A7,trim:M7,stripBOM:T7,inherits:O7,toFlatObject:I7,kindOf:ll,kindOfTest:An,endsWith:P7,toArray:k7,forEachEntry:R7,matchAll:N7,isHTMLForm:D7,hasOwnProperty:wm,hasOwnProp:wm,reduceDescriptors:sx,freezeMethods:L7,toObjectSet:F7,toCamelCase:B7,noop:U7,toFiniteNumber:z7,findKey:nx,global:Ps,isContextDefined:ix,ALPHABET:ox,generateString:V7,isSpecCompliantForm:q7,toJSONObject:H7,isAsyncFn:W7,isThenable:G7,setImmediate:ax,asap:K7};function ht(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)}le.inherits(ht,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:le.toJSONObject(this.config),code:this.code,status:this.status}}});const cx=ht.prototype,ux={};["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=>{ux[e]={value:e}});Object.defineProperties(ht,ux);Object.defineProperty(cx,"isAxiosError",{value:!0});ht.from=(e,t,r,n,i,s)=>{const o=Object.create(cx);return le.toFlatObject(e,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),ht.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};var X7=null;function kd(e){return le.isPlainObject(e)||le.isArray(e)}function lx(e){return le.endsWith(e,"[]")?e.slice(0,-2):e}function xm(e,t,r){return e?e.concat(t).map(function(i,s){return i=lx(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function J7(e){return le.isArray(e)&&!e.some(kd)}const Y7=le.toFlatObject(le,{},null,function(t){return/^is[A-Z]/.test(t)});function hl(e,t,r){if(!le.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=le.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,T){return!le.isUndefined(T[w])});const n=r.metaTokens,i=r.visitor||l,s=r.dots,o=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&le.isSpecCompliantForm(t);if(!le.isFunction(i))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(le.isDate(b))return b.toISOString();if(!c&&le.isBlob(b))throw new ht("Blob is not supported. Use a Buffer instead.");return le.isArrayBuffer(b)||le.isTypedArray(b)?c&&typeof Blob=="function"?new Blob([b]):Od.from(b):b}function l(b,w,T){let P=b;if(b&&!T&&typeof b=="object"){if(le.endsWith(w,"{}"))w=n?w:w.slice(0,-2),b=JSON.stringify(b);else if(le.isArray(b)&&J7(b)||(le.isFileList(b)||le.endsWith(w,"[]"))&&(P=le.toArray(b)))return w=lx(w),P.forEach(function(N,z){!(le.isUndefined(N)||N===null)&&t.append(o===!0?xm([w],z,s):o===null?w:w+"[]",u(N))}),!1}return kd(b)?!0:(t.append(xm(T,w,s),u(b)),!1)}const f=[],h=Object.assign(Y7,{defaultVisitor:l,convertValue:u,isVisitable:kd});function y(b,w){if(!le.isUndefined(b)){if(f.indexOf(b)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(b),le.forEach(b,function(P,R){(!(le.isUndefined(P)||P===null)&&i.call(t,P,le.isString(R)?R.trim():R,w,h))===!0&&y(P,w?w.concat(R):[R])}),f.pop()}}if(!le.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Sm(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Ip(e,t){this._pairs=[],e&&hl(e,this,t)}const fx=Ip.prototype;fx.append=function(t,r){this._pairs.push([t,r])};fx.toString=function(t){const r=t?function(n){return t.call(this,n,Sm)}:Sm;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function Z7(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function dx(e,t,r){if(!t)return e;const n=r&&r.encode||Z7;le.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(i?s=i(t,r):s=le.isURLSearchParams(t)?t.toString():new Ip(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Q7{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){le.forEach(this.handlers,function(n){n!==null&&t(n)})}}var Em=Q7,hx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},eP=typeof URLSearchParams<"u"?URLSearchParams:Ip,tP=typeof FormData<"u"?FormData:null,rP=typeof Blob<"u"?Blob:null,nP={isBrowser:!0,classes:{URLSearchParams:eP,FormData:tP,Blob:rP},protocols:["http","https","file","blob","url","data"]};const Pp=typeof window<"u"&&typeof document<"u",jd=typeof navigator=="object"&&navigator||void 0,iP=Pp&&(!jd||["ReactNative","NativeScript","NS"].indexOf(jd.product)<0),sP=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),oP=Pp&&window.location.href||"http://localhost";var aP=Object.freeze({__proto__:null,hasBrowserEnv:Pp,hasStandardBrowserWebWorkerEnv:sP,hasStandardBrowserEnv:iP,navigator:jd,origin:oP}),Cr={...aP,...nP};function cP(e,t){return hl(e,new Cr.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Cr.isNode&&le.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function uP(e){return le.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function lP(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 px(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&&le.isArray(i)?i.length:o,c?(le.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a):((!i[o]||!le.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],s)&&le.isArray(i[o])&&(i[o]=lP(i[o])),!a)}if(le.isFormData(e)&&le.isFunction(e.entries)){const r={};return le.forEachEntry(e,(n,i)=>{t(uP(n),i,r,0)}),r}return null}function fP(e,t,r){if(le.isString(e))try{return(t||JSON.parse)(e),le.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const kp={transitional:hx,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,s=le.isObject(t);if(s&&le.isHTMLForm(t)&&(t=new FormData(t)),le.isFormData(t))return i?JSON.stringify(px(t)):t;if(le.isArrayBuffer(t)||le.isBuffer(t)||le.isStream(t)||le.isFile(t)||le.isBlob(t)||le.isReadableStream(t))return t;if(le.isArrayBufferView(t))return t.buffer;if(le.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 cP(t,this.formSerializer).toString();if((a=le.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return hl(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),fP(t)):t}],transformResponse:[function(t){const r=this.transitional||kp.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(le.isResponse(t)||le.isReadableStream(t))return t;if(t&&le.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"?ht.from(a,ht.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:Cr.classes.FormData,Blob:Cr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};le.forEach(["delete","get","head","post","put","patch"],e=>{kp.headers[e]={}});var jp=kp;const dP=le.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 hP=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]&&dP[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const Cm=Symbol("internals");function fa(e){return e&&String(e).trim().toLowerCase()}function eu(e){return e===!1||e==null?e:le.isArray(e)?e.map(eu):String(e)}function pP(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 mP=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Sf(e,t,r,n,i){if(le.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!le.isString(t)){if(le.isString(n))return t.indexOf(n)!==-1;if(le.isRegExp(n))return n.test(t)}}function gP(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function vP(e,t){const r=le.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 pl{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=fa(c);if(!l)throw new Error("header name must be a non-empty string");const f=le.findKey(i,l);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=eu(a))}const o=(a,c)=>le.forEach(a,(u,l)=>s(u,l,c));if(le.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(le.isString(t)&&(t=t.trim())&&!mP(t))o(hP(t),r);else if(le.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=fa(t),t){const n=le.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return pP(i);if(le.isFunction(r))return r.call(this,i,n);if(le.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=fa(t),t){const n=le.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Sf(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=fa(o),o){const a=le.findKey(n,o);a&&(!r||Sf(n,n[a],a,r))&&(delete n[a],i=!0)}}return le.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||Sf(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const r=this,n={};return le.forEach(this,(i,s)=>{const o=le.findKey(n,s);if(o){r[o]=eu(i),delete r[s];return}const a=t?gP(s):String(s).trim();a!==s&&delete r[s],r[a]=eu(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return le.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&le.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[Cm]=this[Cm]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=fa(o);n[a]||(vP(i,o),n[a]=!0)}return le.isArray(t)?t.forEach(s):s(t),this}}pl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);le.reduceDescriptors(pl.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});le.freezeMethods(pl);var wn=pl;function Ef(e,t){const r=this||jp,n=t||r,i=wn.from(n.headers);let s=n.data;return le.forEach(e,function(a){s=a.call(r,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function mx(e){return!!(e&&e.__CANCEL__)}function Uo(e,t,r){ht.call(this,e??"canceled",ht.ERR_CANCELED,t,r),this.name="CanceledError"}le.inherits(Uo,ht,{__CANCEL__:!0});function gx(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new ht("Request failed with status code "+r.status,[ht.ERR_BAD_REQUEST,ht.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function yP(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function bP(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 wP(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 Mu=(e,t,r=3)=>{let n=0;const i=bP(50,250);return wP(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)},Mm=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Am=e=>(...t)=>le.asap(()=>e(...t));var _P=Cr.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Cr.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Cr.origin),Cr.navigator&&/(msie|trident)/i.test(Cr.navigator.userAgent)):()=>!0,xP=Cr.hasStandardBrowserEnv?{write(e,t,r,n,i,s){const o=[e+"="+encodeURIComponent(t)];le.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),le.isString(n)&&o.push("path="+n),le.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 SP(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function EP(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function vx(e,t){return e&&!SP(t)?EP(e,t):t}const Tm=e=>e instanceof wn?{...e}:e;function Bs(e,t){t=t||{};const r={};function n(u,l,f,h){return le.isPlainObject(u)&&le.isPlainObject(l)?le.merge.call({caseless:h},u,l):le.isPlainObject(l)?le.merge({},l):le.isArray(l)?l.slice():l}function i(u,l,f,h){if(le.isUndefined(l)){if(!le.isUndefined(u))return n(void 0,u,f,h)}else return n(u,l,f,h)}function s(u,l){if(!le.isUndefined(l))return n(void 0,l)}function o(u,l){if(le.isUndefined(l)){if(!le.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(Tm(u),Tm(l),f,!0)};return le.forEach(Object.keys(Object.assign({},e,t)),function(l){const f=c[l]||i,h=f(e[l],t[l],l);le.isUndefined(h)&&f!==a||(r[l]=h)}),r}var yx=e=>{const t=Bs({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=wn.from(o),t.url=dx(vx(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(le.isFormData(r)){if(Cr.hasStandardBrowserEnv||Cr.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(Cr.hasStandardBrowserEnv&&(n&&le.isFunction(n)&&(n=n(t)),n||n!==!1&&_P(t.url))){const u=i&&s&&xP.read(s);u&&o.set(i,u)}return t};const CP=typeof XMLHttpRequest<"u";var MP=CP&&function(e){return new Promise(function(r,n){const i=yx(e);let s=i.data;const o=wn.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 T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function P(){if(!T)return;const N=wn.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),F={data:!a||a==="text"||a==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:N,config:e,request:T};gx(function(q){r(q),w()},function(q){n(q),w()},F),T=null}"onloadend"in T?T.onloadend=P:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.indexOf("file:")===0)||setTimeout(P)},T.onabort=function(){T&&(n(new ht("Request aborted",ht.ECONNABORTED,e,T)),T=null)},T.onerror=function(){n(new ht("Network Error",ht.ERR_NETWORK,e,T)),T=null},T.ontimeout=function(){let z=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const F=i.transitional||hx;i.timeoutErrorMessage&&(z=i.timeoutErrorMessage),n(new ht(z,F.clarifyTimeoutError?ht.ETIMEDOUT:ht.ECONNABORTED,e,T)),T=null},s===void 0&&o.setContentType(null),"setRequestHeader"in T&&le.forEach(o.toJSON(),function(z,F){T.setRequestHeader(F,z)}),le.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),a&&a!=="json"&&(T.responseType=i.responseType),u&&([h,b]=Mu(u,!0),T.addEventListener("progress",h)),c&&T.upload&&([f,y]=Mu(c),T.upload.addEventListener("progress",f),T.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=N=>{T&&(n(!N||N.type?new Uo(null,e,T):N),T.abort(),T=null)},i.cancelToken&&i.cancelToken.subscribe(l),i.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l)));const R=yP(i.url);if(R&&Cr.protocols.indexOf(R)===-1){n(new ht("Unsupported protocol "+R+":",ht.ERR_BAD_REQUEST,e));return}T.send(s||null)})};const AP=(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 ht?l:new Uo(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,s(new ht(`timeout ${t} of ms exceeded`,ht.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=()=>le.asap(a),c}};var TP=AP;const OP=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},IP=async function*(e,t){for await(const r of PP(e))yield*OP(r,t)},PP=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()}},Om=(e,t,r,n)=>{const i=IP(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})},ml=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",bx=ml&&typeof ReadableStream=="function",kP=ml&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),wx=(e,...t)=>{try{return!!e(...t)}catch{return!1}},jP=bx&&wx(()=>{let e=!1;const t=new Request(Cr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Im=64*1024,Rd=bx&&wx(()=>le.isReadableStream(new Response("").body)),Au={stream:Rd&&(e=>e.body)};ml&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Au[t]&&(Au[t]=le.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new ht(`Response type '${t}' is not supported`,ht.ERR_NOT_SUPPORT,n)})})})(new Response);const RP=async e=>{if(e==null)return 0;if(le.isBlob(e))return e.size;if(le.isSpecCompliantForm(e))return(await new Request(Cr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(le.isArrayBufferView(e)||le.isArrayBuffer(e))return e.byteLength;if(le.isURLSearchParams(e)&&(e=e+""),le.isString(e))return(await kP(e)).byteLength},NP=async(e,t)=>{const r=le.toFiniteNumber(e.getContentLength());return r??RP(t)};var DP=ml&&(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}=yx(e);u=u?(u+"").toLowerCase():"text";let y=TP([i,s&&s.toAbortSignal()],o),b;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let T;try{if(c&&jP&&r!=="get"&&r!=="head"&&(T=await NP(l,n))!==0){let F=new Request(t,{method:"POST",body:n,duplex:"half"}),W;if(le.isFormData(n)&&(W=F.headers.get("content-type"))&&l.setContentType(W),F.body){const[q,K]=Mm(T,Mu(Am(c)));n=Om(F.body,Im,q,K)}}le.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=Rd&&(u==="stream"||u==="response");if(Rd&&(a||N&&w)){const F={};["status","statusText","headers"].forEach(te=>{F[te]=R[te]});const W=le.toFiniteNumber(R.headers.get("content-length")),[q,K]=a&&Mm(W,Mu(Am(a),!0))||[];R=new Response(Om(R.body,Im,q,()=>{K&&K(),w&&w()}),F)}u=u||"text";let z=await Au[le.findKey(Au,u)||"text"](R,e);return!N&&w&&w(),await new Promise((F,W)=>{gx(F,W,{data:z,headers:wn.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 ht("Network Error",ht.ERR_NETWORK,e,b),{cause:P.cause||P}):ht.from(P,P&&P.code,e,b)}});const Nd={http:X7,xhr:MP,fetch:DP};le.forEach(Nd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Pm=e=>`- ${e}`,BP=e=>le.isFunction(e)||e===null||e===!1;var _x={getAdapter:e=>{e=le.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,!BP(r)&&(n=Nd[(o=String(r)).toLowerCase()],n===void 0))throw new ht(`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
|
-
`+s.map(Pm).join(`
|
|
37
|
-
`):" "+Pm(s[0]):"as no adapter specified";throw new ht("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:Nd};function Cf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Uo(null,e)}function km(e){return Cf(e),e.headers=wn.from(e.headers),e.data=Ef.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),_x.getAdapter(e.adapter||jp.adapter)(e).then(function(n){return Cf(e),n.data=Ef.call(e,e.transformResponse,n),n.headers=wn.from(n.headers),n},function(n){return mx(n)||(Cf(e),n&&n.response&&(n.response.data=Ef.call(e,e.transformResponse,n.response),n.response.headers=wn.from(n.response.headers))),Promise.reject(n)})}const xx="1.7.9",gl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{gl[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const jm={};gl.transitional=function(t,r,n){function i(s,o){return"[Axios v"+xx+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return(s,o,a)=>{if(t===!1)throw new ht(i(o," has been removed"+(r?" in "+r:"")),ht.ERR_DEPRECATED);return r&&!jm[o]&&(jm[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}};gl.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function $P(e,t,r){if(typeof e!="object")throw new ht("options must be an object",ht.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 ht("option "+s+" must be "+c,ht.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new ht("Unknown option "+s,ht.ERR_BAD_OPTION)}}var tu={assertOptions:$P,validators:gl};const Nn=tu.validators;class Tu{constructor(t){this.defaults=t,this.interceptors={request:new Em,response:new Em}}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=Bs(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&tu.assertOptions(n,{silentJSONParsing:Nn.transitional(Nn.boolean),forcedJSONParsing:Nn.transitional(Nn.boolean),clarifyTimeoutError:Nn.transitional(Nn.boolean)},!1),i!=null&&(le.isFunction(i)?r.paramsSerializer={serialize:i}:tu.assertOptions(i,{encode:Nn.function,serialize:Nn.function},!0)),tu.assertOptions(r,{baseUrl:Nn.spelling("baseURL"),withXsrfToken:Nn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&le.merge(s.common,s[r.method]);s&&le.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),r.headers=wn.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=[km.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(T){w.call(this,T);break}}try{l=km.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=Bs(this.defaults,t);const r=vx(t.baseURL,t.url);return dx(r,t.params,t.paramsSerializer)}}le.forEach(["delete","get","head","options"],function(t){Tu.prototype[t]=function(r,n){return this.request(Bs(n||{},{method:t,url:r,data:(n||{}).data}))}});le.forEach(["post","put","patch"],function(t){function r(n){return function(s,o,a){return this.request(Bs(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Tu.prototype[t]=r(),Tu.prototype[t+"Form"]=r(!0)});var ru=Tu;class Rp{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 Uo(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 Rp(function(i){t=i}),cancel:t}}}var LP=Rp;function FP(e){return function(r){return e.apply(null,r)}}function UP(e){return le.isObject(e)&&e.isAxiosError===!0}const Dd={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(Dd).forEach(([e,t])=>{Dd[t]=e});var zP=Dd;function Sx(e){const t=new ru(e),r=ex(ru.prototype.request,t);return le.extend(r,ru.prototype,t,{allOwnKeys:!0}),le.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return Sx(Bs(e,i))},r}const cr=Sx(jp);cr.Axios=ru;cr.CanceledError=Uo;cr.CancelToken=LP;cr.isCancel=mx;cr.VERSION=xx;cr.toFormData=hl;cr.AxiosError=ht;cr.Cancel=cr.CanceledError;cr.all=function(t){return Promise.all(t)};cr.spread=FP;cr.isAxiosError=UP;cr.mergeConfig=Bs;cr.AxiosHeaders=wn;cr.formToJSON=e=>px(le.isHTMLForm(e)?new FormData(e):e);cr.getAdapter=_x.getAdapter;cr.HttpStatusCode=zP;cr.default=cr;var Ex=cr,Np={exports:{}},Wr={},Cx={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})(Cx);var VP=Cx.exports,Mf={exports:{}},Af={exports:{}},Rm;function vl(){return Rm||(Rm=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}(Af)),Af.exports}var Nm;function qP(){return Nm||(Nm=1,function(e){var t=vl().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,M){E[O]=M.value},c=typeof Symbol=="function"?Symbol:{},u=c.iterator||"@@iterator",l=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function h(E,O,M){return Object.defineProperty(E,O,{value:M,enumerable:!0,configurable:!0,writable:!0}),E[O]}try{h({},"")}catch{h=function(M,g,v){return M[g]=v}}function y(E,O,M,g){var v=O&&O.prototype instanceof z?O:z,k=Object.create(v.prototype),ee=new x(g||[]);return a(k,"_invoke",{value:D(E,M,ee)}),k}function b(E,O,M){try{return{type:"normal",arg:E.call(O,M)}}catch(g){return{type:"throw",arg:g}}}i.wrap=y;var w="suspendedStart",T="suspendedYield",P="executing",R="completed",N={};function z(){}function F(){}function W(){}var q={};h(q,u,function(){return this});var K=Object.getPrototypeOf,te=K&&K(K(C([])));te&&te!==s&&o.call(te,u)&&(q=te);var se=W.prototype=z.prototype=Object.create(q);function H(E){["next","throw","return"].forEach(function(O){h(E,O,function(M){return this._invoke(O,M)})})}function L(E,O){function M(v,k,ee,ie){var ge=b(E[v],E,k);if(ge.type!=="throw"){var ve=ge.arg,Se=ve.value;return Se&&t(Se)=="object"&&o.call(Se,"__await")?O.resolve(Se.__await).then(function(xe){M("next",xe,ee,ie)},function(xe){M("throw",xe,ee,ie)}):O.resolve(Se).then(function(xe){ve.value=xe,ee(ve)},function(xe){return M("throw",xe,ee,ie)})}ie(ge.arg)}var g;a(this,"_invoke",{value:function(k,ee){function ie(){return new O(function(ge,ve){M(k,ee,ge,ve)})}return g=g?g.then(ie,ie):ie()}})}function D(E,O,M){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(M.method=v,M.arg=k;;){var ee=M.delegate;if(ee){var ie=p(ee,M);if(ie){if(ie===N)continue;return ie}}if(M.method==="next")M.sent=M._sent=M.arg;else if(M.method==="throw"){if(g===w)throw g=R,M.arg;M.dispatchException(M.arg)}else M.method==="return"&&M.abrupt("return",M.arg);g=P;var ge=b(E,O,M);if(ge.type==="normal"){if(g=M.done?R:T,ge.arg===N)continue;return{value:ge.arg,done:M.done}}ge.type==="throw"&&(g=R,M.method="throw",M.arg=ge.arg)}}}function p(E,O){var M=O.method,g=E.iterator[M];if(g===n)return O.delegate=null,M==="throw"&&E.iterator.return&&(O.method="return",O.arg=n,p(E,O),O.method==="throw")||M!=="return"&&(O.method="throw",O.arg=new TypeError("The iterator does not provide a '"+M+"' 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 C(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 M=-1,g=function v(){for(;++M<E.length;)if(o.call(E,M))return v.value=E[M],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 F.prototype=W,a(se,"constructor",{value:W,configurable:!0}),a(W,"constructor",{value:F,configurable:!0}),F.displayName=h(W,f,"GeneratorFunction"),i.isGeneratorFunction=function(E){var O=typeof E=="function"&&E.constructor;return!!O&&(O===F||(O.displayName||O.name)==="GeneratorFunction")},i.mark=function(E){return Object.setPrototypeOf?Object.setPrototypeOf(E,W):(E.__proto__=W,h(E,f,"GeneratorFunction")),E.prototype=Object.create(se),E},i.awrap=function(E){return{__await:E}},H(L.prototype),h(L.prototype,l,function(){return this}),i.AsyncIterator=L,i.async=function(E,O,M,g,v){v===void 0&&(v=Promise);var k=new L(y(E,O,M,g),v);return i.isGeneratorFunction(O)?k:k.next().then(function(ee){return ee.done?ee.value:k.next()})},H(se),h(se,f,"Generator"),h(se,u,function(){return this}),h(se,"toString",function(){return"[object Generator]"}),i.keys=function(E){var O=Object(E),M=[];for(var g in O)M.push(g);return M.reverse(),function v(){for(;M.length;){var k=M.pop();if(k in O)return v.value=k,v.done=!1,v}return v.done=!0,v}},i.values=C,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 M in this)M.charAt(0)==="t"&&o.call(this,M)&&!isNaN(+M.slice(1))&&(this[M]=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 M=this;function g(ve,Se){return ee.type="throw",ee.arg=O,M.next=ve,Se&&(M.method="next",M.arg=n),!!Se}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 ie=o.call(k,"catchLoc"),ge=o.call(k,"finallyLoc");if(ie&&ge){if(this.prev<k.catchLoc)return g(k.catchLoc,!0);if(this.prev<k.finallyLoc)return g(k.finallyLoc)}else if(ie){if(this.prev<k.catchLoc)return g(k.catchLoc,!0)}else{if(!ge)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return g(k.finallyLoc)}}}},abrupt:function(O,M){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<=M&&M<=k.finallyLoc&&(k=null);var ee=k?k.completion:{};return ee.type=O,ee.arg=M,k?(this.method="next",this.next=k.finallyLoc,N):this.complete(ee)},complete:function(O,M){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"&&M&&(this.next=M),N},finish:function(O){for(var M=this.tryEntries.length-1;M>=0;--M){var g=this.tryEntries[M];if(g.finallyLoc===O)return this.complete(g.completion,g.afterLoc),m(g),N}},catch:function(O){for(var M=this.tryEntries.length-1;M>=0;--M){var g=this.tryEntries[M];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,M,g){return this.delegate={iterator:C(O),resultName:M,nextLoc:g},this.method==="next"&&(this.arg=n),N}},i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Mf)),Mf.exports}var Tf,Dm;function HP(){if(Dm)return Tf;Dm=1;var e=qP()();Tf=e;try{regeneratorRuntime=e}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Tf}var Of={exports:{}},Bm;function WP(){return Bm||(Bm=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}(Of)),Of.exports}var If={exports:{}},Pf={exports:{}},kf={exports:{}},$m;function GP(){return $m||($m=1,function(e){var t=vl().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}(kf)),kf.exports}var Lm;function KP(){return Lm||(Lm=1,function(e){var t=vl().default,r=GP();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}(Pf)),Pf.exports}var Fm;function XP(){return Fm||(Fm=1,function(e){var t=KP();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}(If)),If.exports}var jf,Um;function JP(){if(Um)return jf;Um=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 jf=t=>!e.has(t&&t.code),jf}var fc=VP;Object.defineProperty(Wr,"__esModule",{value:!0});Wr.isNetworkError=Bp;Wr.isRetryableError=yl;Wr.isSafeRequestError=Tx;Wr.isIdempotentRequestError=$p;Wr.isNetworkOrIdempotentRequestError=Lp;Wr.exponentialDelay=Ox;Wr.default=zs;Wr.DEFAULT_OPTIONS=Wr.namespace=void 0;var Ou=fc(HP()),YP=fc(vl()),Mx=fc(WP()),ZP=fc(XP()),QP=fc(JP());function zm(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 Rf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zm(Object(r),!0).forEach(function(n){(0,ZP.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zm(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Dp="axios-retry";Wr.namespace=Dp;function Bp(e){var t=["ERR_CANCELED","ECONNABORTED"];return!e.response&&!!e.code&&!t.includes(e.code)&&(0,QP.default)(e)}var Ax=["get","head","options"],ek=Ax.concat(["put","delete"]);function yl(e){return e.code!=="ECONNABORTED"&&(!e.response||e.response.status>=500&&e.response.status<=599)}function Tx(e){return e.config?yl(e)&&Ax.indexOf(e.config.method)!==-1:!1}function $p(e){return e.config?yl(e)&&ek.indexOf(e.config.method)!==-1:!1}function Lp(e){return Bp(e)||$p(e)}function tk(){return 0}function Ox(){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 Ix={retries:3,retryCondition:Lp,retryDelay:tk,shouldResetTimeout:!1,onRetry:function(){}};Wr.DEFAULT_OPTIONS=Ix;function rk(e,t){return Rf(Rf(Rf({},Ix),t),e[Dp])}function Vm(e,t){var r=rk(e,t);return r.retryCount=r.retryCount||0,e[Dp]=r,r}function nk(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 ik(e,t){return Bd.apply(this,arguments)}function Bd(){return Bd=(0,Mx.default)(Ou.default.mark(function e(t,r){var n,i,s,o;return Ou.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,YP.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]])})),Bd.apply(this,arguments)}function zs(e,t){var r=e.interceptors.request.use(function(i){var s=Vm(i,t);return s.lastRequestTime=Date.now(),i}),n=e.interceptors.response.use(null,function(){var i=(0,Mx.default)(Ou.default.mark(function s(o){var a,c,u,l,f,h,y,b;return Ou.default.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(a=o.config,a){T.next=3;break}return T.abrupt("return",Promise.reject(o));case 3:return c=Vm(a,t),T.next=6,ik(c,o);case 6:if(!T.sent){T.next=21;break}if(c.retryCount+=1,u=c.retryDelay,l=c.shouldResetTimeout,f=c.onRetry,h=u(c.retryCount,o),nk(e,a),!(!l&&a.timeout&&c.lastRequestTime)){T.next=17;break}if(y=Date.now()-c.lastRequestTime,b=a.timeout-y-h,!(b<=0)){T.next=16;break}return T.abrupt("return",Promise.reject(o));case 16:a.timeout=b;case 17:return a.transformRequest=[function(P){return P}],T.next=20,f(c.retryCount,o,a);case 20:return T.abrupt("return",new Promise(function(P){return setTimeout(function(){return P(e(a))},h)}));case 21:return T.abrupt("return",Promise.reject(o));case 22:case"end":return T.stop()}},s)}));return function(s){return i.apply(this,arguments)}}());return{requestInterceptorId:r,responseInterceptorId:n}}zs.isNetworkError=Bp;zs.isSafeRequestError=Tx;zs.isIdempotentRequestError=$p;zs.isNetworkOrIdempotentRequestError=Lp;zs.exponentialDelay=Ox;zs.isRetryableError=yl;const Px=Wr.default;Np.exports=Px;Np.exports.default=Px;var sk=Np.exports,bl={},uo=null;typeof WebSocket<"u"?uo=WebSocket:typeof MozWebSocket<"u"?uo=MozWebSocket:typeof Rr<"u"?uo=Rr.WebSocket||Rr.MozWebSocket:typeof window<"u"?uo=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(uo=self.WebSocket||self.MozWebSocket);var ok=uo,ak=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(bl,"__esModule",{value:!0});bl.ResilientWebSocket=void 0;const ck=ak(ok),uk=3e4+3e3;class lk{constructor(t,r){gt(this,"endpoint");gt(this,"wsClient");gt(this,"wsUserClosed");gt(this,"wsFailedAttempts");gt(this,"pingTimeout");gt(this,"logger");gt(this,"onError");gt(this,"onMessage");gt(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 ck.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=fk(this.wsFailedAttempts);(r=this.logger)==null||r.error(`Connection closed unexpectedly or because of timeout. Reconnecting after ${i}ms.`),await qm(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()},uk)}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 qm(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}}bl.ResilientWebSocket=lk;async function qm(e){return new Promise(t=>setTimeout(t,e))}function fk(e){return 2**e*100}var To={};Object.defineProperty(To,"__esModule",{value:!0});To.removeLeading0xIfExists=To.makeWebsocketUrl=void 0;function dk(e){const t=new URL("ws",e),r=t.protocol==="https:";return t.protocol=r?"wss:":"ws:",t.toString()}To.makeWebsocketUrl=dk;function hk(e){return e.startsWith("0x")?e.substring(2):e}To.removeLeading0xIfExists=hk;var kx=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cl,"__esModule",{value:!0});cl.PriceServiceConnection=void 0;const Nf=Mp,pk=kx(Ex),Hm=kx(sk),mk=bl,Df=To;class gk{constructor(t,r){gt(this,"httpClient");gt(this,"priceFeedCallbacks");gt(this,"wsClient");gt(this,"wsEndpoint");gt(this,"logger");gt(this,"priceFeedRequestConfig");gt(this,"onWsError");var n,i,s;this.httpClient=pk.default.create({baseURL:t,timeout:(r==null?void 0:r.timeout)||5e3}),(0,Hm.default)(this.httpClient,{retries:(r==null?void 0:r.httpRetries)||3,retryDelay:Hm.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 bn<"u"&&typeof bn.exit=="function"?(this.logger.error("Halting the process due to the websocket error"),bn.exit(1)):this.logger.error("Cannot halt process. Please handle the websocket error.")},this.wsEndpoint=(0,Df.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=>Nf.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 Nf.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,Df.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,Df.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 mk.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=Nf.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()}}cl.PriceServiceConnection=gk;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseAccumulatorUpdateData=e.isAccumulatorUpdateData=e.Price=e.PriceFeed=e.PriceFeedMetadata=e.PriceServiceConnection=void 0;var t=cl;Object.defineProperty(e,"PriceServiceConnection",{enumerable:!0,get:function(){return t.PriceServiceConnection}});var r=Mp;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}})})(Cp);Object.defineProperty(al,"__esModule",{value:!0});al.SuiPriceServiceConnection=void 0;const vk=Cp,yk=uc;class bk extends vk.PriceServiceConnection{async getPriceFeedsUpdateData(t){return(await this.getLatestVaas(t)).map(n=>yk.Buffer.from(n,"base64"))}}al.SuiPriceServiceConnection=bk;var wl={};Object.defineProperty(wl,"__esModule",{value:!0});wl.SuiPythClient=void 0;const Oc=Sn,Ys=Qn,wk=uc,Bf=16*1024;class _k{constructor(t,r,n){gt(this,"provider");gt(this,"pythStateId");gt(this,"wormholeStateId");gt(this,"pythPackageId");gt(this,"wormholePackageId");gt(this,"priceTableInfo");gt(this,"priceFeedObjectIdCache",new Map);gt(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(Ys.bcs.vector(Ys.bcs.U8).serialize(Array.from(s),{maxSize:Bf}).toBytes()),r.object(Oc.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(Ys.bcs.vector(Ys.bcs.U8).serialize(Array.from(r[0]),{maxSize:Bf}).toBytes()),a[0],t.object(Oc.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(Oc.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(Ys.bcs.vector(Ys.bcs.U8).serialize(Array.from(r[0]),{maxSize:Bf}).toBytes()),s[0],t.object(Oc.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(wk.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)}}wl.SuiPythClient=_k;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PriceFeed=e.Price=e.SuiPythClient=e.SuiPriceServiceConnection=void 0;var t=al;Object.defineProperty(e,"SuiPriceServiceConnection",{enumerable:!0,get:function(){return t.SuiPriceServiceConnection}});var r=wl;Object.defineProperty(e,"SuiPythClient",{enumerable:!0,get:function(){return r.SuiPythClient}});var n=Cp;Object.defineProperty(e,"Price",{enumerable:!0,get:function(){return n.Price}}),Object.defineProperty(e,"PriceFeed",{enumerable:!0,get:function(){return n.PriceFeed}})})(Y_);var Wm=zE,$d=Sn,xk=po,Ic=Y_,Sk=Object.create,Fp=Object.defineProperty,Ek=Object.defineProperties,Ck=Object.getOwnPropertyDescriptor,Mk=Object.getOwnPropertyDescriptors,jx=Object.getOwnPropertyNames,Gm=Object.getOwnPropertySymbols,Ak=Object.getPrototypeOf,Rx=Object.prototype.hasOwnProperty,Tk=Object.prototype.propertyIsEnumerable,Km=(e,t,r)=>t in e?Fp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ok=(e,t)=>{for(var r in t||(t={}))Rx.call(t,r)&&Km(e,r,t[r]);if(Gm)for(var r of Gm(t))Tk.call(t,r)&&Km(e,r,t[r]);return e},Ik=(e,t)=>Ek(e,Mk(t)),Pk=(e=>typeof Ln<"u"?Ln:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Ln<"u"?Ln:t)[r]}):e)(function(e){if(typeof Ln<"u")return Ln.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),kk=(e,t)=>function(){return t||(0,e[jx(e)[0]])((t={exports:{}}).exports,t),t.exports},jk=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jx(t))!Rx.call(e,i)&&i!==r&&Fp(e,i,{get:()=>t[i],enumerable:!(n=Ck(t,i))||n.enumerable});return e},zo=(e,t,r)=>(r=e!=null?Sk(Ak(e)):{},jk(!e||!e.__esModule?Fp(r,"default",{value:e,enumerable:!0}):r,e)),Et=(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())}),Vo=kk({"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=Pk("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 C=0;d[0]==="-"&&(C++,this.negative=1),C<d.length&&(m===16?this._parseHex(d,C,x):(this._parseBase(d,m,C),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 C=0;C<this.length;C++)this.words[C]=0;var E,O,M=0;if(x==="be")for(C=d.length-1,E=0;C>=0;C-=3)O=d[C]|d[C-1]<<8|d[C-2]<<16,this.words[E]|=O<<M&67108863,this.words[E+1]=O>>>26-M&67108863,M+=24,M>=26&&(M-=26,E++);else if(x==="le")for(C=0,E=0;C<d.length;C+=3)O=d[C]|d[C+1]<<8|d[C+2]<<16,this.words[E]|=O<<M&67108863,this.words[E+1]=O>>>26-M&67108863,M+=24,M>=26&&(M-=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 C=0;C<this.length;C++)this.words[C]=0;var E=0,O=0,M;if(x==="be")for(C=d.length-1;C>=m;C-=2)M=u(d,m,C)<<E,this.words[O]|=M&67108863,E>=18?(E-=18,O+=1,this.words[O]|=M>>>26):E+=8;else{var g=d.length-m;for(C=g%2===0?m+1:m;C<d.length;C+=2)M=u(d,m,C)<<E,this.words[O]|=M&67108863,E>=18?(E-=18,O+=1,this.words[O]|=M>>>26):E+=8}this._strip()};function l(p,d,m,x){for(var C=0,E=0,O=Math.min(p.length,m),M=d;M<O;M++){var g=p.charCodeAt(M)-48;C*=x,g>=49?E=g-49+10:g>=17?E=g-17+10:E=g,i(g>=0&&E<x,"Invalid character"),C+=E}return C}o.prototype._parseBase=function(d,m,x){this.words=[0],this.length=1;for(var C=0,E=1;E<=67108863;E*=m)C++;C--,E=E/m|0;for(var O=d.length-x,M=O%C,g=Math.min(O,O-M)+x,v=0,k=x;k<g;k+=C)v=l(d,k,k+C,m),this.imuln(E),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(M!==0){var ee=1;for(v=l(d,k,d.length,m),k=0;k<M;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 C=0,E=0,O=0;O<this.length;O++){var M=this.words[O],g=((M<<C|E)&16777215).toString(16);E=M>>>24-C&16777215,C+=2,C>=26&&(C-=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 ie=ee.modrn(k).toString(d);ee=ee.idivn(k),ee.isZero()?x=ie+x:x=y[v-ie.length]+ie+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 T=function(d,m){return d.allocUnsafe?d.allocUnsafe(m):new d(m)};o.prototype.toArrayLike=function(d,m,x){this._strip();var C=this.byteLength(),E=x||Math.max(1,C);i(C<=E,"byte array longer than desired length"),i(E>0,"Requested array length <= 0");var O=T(d,E),M=m==="le"?"LE":"BE";return this["_toArrayLike"+M](O,C),O},o.prototype._toArrayLikeLE=function(d,m){for(var x=0,C=0,E=0,O=0;E<this.length;E++){var M=this.words[E]<<O|C;d[x++]=M&255,x<d.length&&(d[x++]=M>>8&255),x<d.length&&(d[x++]=M>>16&255),O===6?(x<d.length&&(d[x++]=M>>24&255),C=0,O=0):(C=M>>>24,O+=2)}if(x<d.length)for(d[x++]=C;x<d.length;)d[x++]=0},o.prototype._toArrayLikeBE=function(d,m){for(var x=d.length-1,C=0,E=0,O=0;E<this.length;E++){var M=this.words[E]<<O|C;d[x--]=M&255,x>=0&&(d[x--]=M>>8&255),x>=0&&(d[x--]=M>>16&255),O===6?(x>=0&&(d[x--]=M>>24&255),C=0,O=0):(C=M>>>24,O+=2)}if(x>=0)for(d[x--]=C;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,C=m%26;d[m]=p.words[x]>>>C&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 C=0;C<x.length;C++)this.words[C]=m.words[C]^x.words[C];if(this!==m)for(;C<m.length;C++)this.words[C]=m.words[C];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 C=0;C<m;C++)this.words[C]=~this.words[C]&67108863;return x>0&&(this.words[C]=~this.words[C]&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,C=d%26;return this._expand(x+1),m?this.words[x]=this.words[x]|1<<C:this.words[x]=this.words[x]&~(1<<C),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,C;this.length>d.length?(x=this,C=d):(x=d,C=this);for(var E=0,O=0;O<C.length;O++)m=(x.words[O]|0)+(C.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 C,E;x>0?(C=this,E=d):(C=d,E=this);for(var O=0,M=0;M<E.length;M++)m=(C.words[M]|0)-(E.words[M]|0)+O,O=m>>26,this.words[M]=m&67108863;for(;O!==0&&M<C.length;M++)m=(C.words[M]|0)+O,O=m>>26,this.words[M]=m&67108863;if(O===0&&M<C.length&&C!==this)for(;M<C.length;M++)this.words[M]=C.words[M];return this.length=Math.max(this.length,M),C!==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 C=p.words[0]|0,E=d.words[0]|0,O=C*E,M=O&67108863,g=O/67108864|0;m.words[0]=M;for(var v=1;v<x;v++){for(var k=g>>>26,ee=g&67108863,ie=Math.min(v,d.length-1),ge=Math.max(0,v-p.length+1);ge<=ie;ge++){var ve=v-ge|0;C=p.words[ve]|0,E=d.words[ge]|0,O=C*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 C=d.words,E=m.words,O=x.words,M=0,g,v,k,ee=C[0]|0,ie=ee&8191,ge=ee>>>13,ve=C[1]|0,Se=ve&8191,xe=ve>>>13,Xe=C[2]|0,Le=Xe&8191,ot=Xe>>>13,dt=C[3]|0,De=dt&8191,vt=dt>>>13,we=C[4]|0,me=we&8191,Ae=we>>>13,Ue=C[5]|0,Ne=Ue&8191,Te=Ue>>>13,Oe=C[6]|0,$e=Oe&8191,lt=Oe>>>13,pt=C[7]|0,He=pt&8191,kt=pt>>>13,xt=C[8]|0,Ye=xt&8191,At=xt>>>13,Nt=C[9]|0,rt=Nt&8191,St=Nt>>>13,Tt=E[0]|0,it=Tt&8191,jt=Tt>>>13,It=E[1]|0,nt=It&8191,bt=It>>>13,Ct=E[2]|0,Je=Ct&8191,mt=Ct>>>13,Pt=E[3]|0,st=Pt&8191,wt=Pt>>>13,Ft=E[4]|0,j=Ft&8191,S=Ft>>>13,A=E[5]|0,$=A&8191,X=A>>>13,Z=E[6]|0,re=Z&8191,Be=Z>>>13,et=E[7]|0,Re=et&8191,V=et>>>13,oe=E[8]|0,de=oe&8191,ke=oe>>>13,We=E[9]|0,je=We&8191,Fe=We>>>13;x.negative=d.negative^m.negative,x.length=19,g=Math.imul(ie,it),v=Math.imul(ie,jt),v=v+Math.imul(ge,it)|0,k=Math.imul(ge,jt);var at=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(at>>>26)|0,at&=67108863,g=Math.imul(Se,it),v=Math.imul(Se,jt),v=v+Math.imul(xe,it)|0,k=Math.imul(xe,jt),g=g+Math.imul(ie,nt)|0,v=v+Math.imul(ie,bt)|0,v=v+Math.imul(ge,nt)|0,k=k+Math.imul(ge,bt)|0;var Gt=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(Le,it),v=Math.imul(Le,jt),v=v+Math.imul(ot,it)|0,k=Math.imul(ot,jt),g=g+Math.imul(Se,nt)|0,v=v+Math.imul(Se,bt)|0,v=v+Math.imul(xe,nt)|0,k=k+Math.imul(xe,bt)|0,g=g+Math.imul(ie,Je)|0,v=v+Math.imul(ie,mt)|0,v=v+Math.imul(ge,Je)|0,k=k+Math.imul(ge,mt)|0;var Rt=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,g=Math.imul(De,it),v=Math.imul(De,jt),v=v+Math.imul(vt,it)|0,k=Math.imul(vt,jt),g=g+Math.imul(Le,nt)|0,v=v+Math.imul(Le,bt)|0,v=v+Math.imul(ot,nt)|0,k=k+Math.imul(ot,bt)|0,g=g+Math.imul(Se,Je)|0,v=v+Math.imul(Se,mt)|0,v=v+Math.imul(xe,Je)|0,k=k+Math.imul(xe,mt)|0,g=g+Math.imul(ie,st)|0,v=v+Math.imul(ie,wt)|0,v=v+Math.imul(ge,st)|0,k=k+Math.imul(ge,wt)|0;var Dt=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,g=Math.imul(me,it),v=Math.imul(me,jt),v=v+Math.imul(Ae,it)|0,k=Math.imul(Ae,jt),g=g+Math.imul(De,nt)|0,v=v+Math.imul(De,bt)|0,v=v+Math.imul(vt,nt)|0,k=k+Math.imul(vt,bt)|0,g=g+Math.imul(Le,Je)|0,v=v+Math.imul(Le,mt)|0,v=v+Math.imul(ot,Je)|0,k=k+Math.imul(ot,mt)|0,g=g+Math.imul(Se,st)|0,v=v+Math.imul(Se,wt)|0,v=v+Math.imul(xe,st)|0,k=k+Math.imul(xe,wt)|0,g=g+Math.imul(ie,j)|0,v=v+Math.imul(ie,S)|0,v=v+Math.imul(ge,j)|0,k=k+Math.imul(ge,S)|0;var Qt=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(Ne,it),v=Math.imul(Ne,jt),v=v+Math.imul(Te,it)|0,k=Math.imul(Te,jt),g=g+Math.imul(me,nt)|0,v=v+Math.imul(me,bt)|0,v=v+Math.imul(Ae,nt)|0,k=k+Math.imul(Ae,bt)|0,g=g+Math.imul(De,Je)|0,v=v+Math.imul(De,mt)|0,v=v+Math.imul(vt,Je)|0,k=k+Math.imul(vt,mt)|0,g=g+Math.imul(Le,st)|0,v=v+Math.imul(Le,wt)|0,v=v+Math.imul(ot,st)|0,k=k+Math.imul(ot,wt)|0,g=g+Math.imul(Se,j)|0,v=v+Math.imul(Se,S)|0,v=v+Math.imul(xe,j)|0,k=k+Math.imul(xe,S)|0,g=g+Math.imul(ie,$)|0,v=v+Math.imul(ie,X)|0,v=v+Math.imul(ge,$)|0,k=k+Math.imul(ge,X)|0;var gr=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(gr>>>26)|0,gr&=67108863,g=Math.imul($e,it),v=Math.imul($e,jt),v=v+Math.imul(lt,it)|0,k=Math.imul(lt,jt),g=g+Math.imul(Ne,nt)|0,v=v+Math.imul(Ne,bt)|0,v=v+Math.imul(Te,nt)|0,k=k+Math.imul(Te,bt)|0,g=g+Math.imul(me,Je)|0,v=v+Math.imul(me,mt)|0,v=v+Math.imul(Ae,Je)|0,k=k+Math.imul(Ae,mt)|0,g=g+Math.imul(De,st)|0,v=v+Math.imul(De,wt)|0,v=v+Math.imul(vt,st)|0,k=k+Math.imul(vt,wt)|0,g=g+Math.imul(Le,j)|0,v=v+Math.imul(Le,S)|0,v=v+Math.imul(ot,j)|0,k=k+Math.imul(ot,S)|0,g=g+Math.imul(Se,$)|0,v=v+Math.imul(Se,X)|0,v=v+Math.imul(xe,$)|0,k=k+Math.imul(xe,X)|0,g=g+Math.imul(ie,re)|0,v=v+Math.imul(ie,Be)|0,v=v+Math.imul(ge,re)|0,k=k+Math.imul(ge,Be)|0;var nr=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(nr>>>26)|0,nr&=67108863,g=Math.imul(He,it),v=Math.imul(He,jt),v=v+Math.imul(kt,it)|0,k=Math.imul(kt,jt),g=g+Math.imul($e,nt)|0,v=v+Math.imul($e,bt)|0,v=v+Math.imul(lt,nt)|0,k=k+Math.imul(lt,bt)|0,g=g+Math.imul(Ne,Je)|0,v=v+Math.imul(Ne,mt)|0,v=v+Math.imul(Te,Je)|0,k=k+Math.imul(Te,mt)|0,g=g+Math.imul(me,st)|0,v=v+Math.imul(me,wt)|0,v=v+Math.imul(Ae,st)|0,k=k+Math.imul(Ae,wt)|0,g=g+Math.imul(De,j)|0,v=v+Math.imul(De,S)|0,v=v+Math.imul(vt,j)|0,k=k+Math.imul(vt,S)|0,g=g+Math.imul(Le,$)|0,v=v+Math.imul(Le,X)|0,v=v+Math.imul(ot,$)|0,k=k+Math.imul(ot,X)|0,g=g+Math.imul(Se,re)|0,v=v+Math.imul(Se,Be)|0,v=v+Math.imul(xe,re)|0,k=k+Math.imul(xe,Be)|0,g=g+Math.imul(ie,Re)|0,v=v+Math.imul(ie,V)|0,v=v+Math.imul(ge,Re)|0,k=k+Math.imul(ge,V)|0;var Kt=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(Ye,it),v=Math.imul(Ye,jt),v=v+Math.imul(At,it)|0,k=Math.imul(At,jt),g=g+Math.imul(He,nt)|0,v=v+Math.imul(He,bt)|0,v=v+Math.imul(kt,nt)|0,k=k+Math.imul(kt,bt)|0,g=g+Math.imul($e,Je)|0,v=v+Math.imul($e,mt)|0,v=v+Math.imul(lt,Je)|0,k=k+Math.imul(lt,mt)|0,g=g+Math.imul(Ne,st)|0,v=v+Math.imul(Ne,wt)|0,v=v+Math.imul(Te,st)|0,k=k+Math.imul(Te,wt)|0,g=g+Math.imul(me,j)|0,v=v+Math.imul(me,S)|0,v=v+Math.imul(Ae,j)|0,k=k+Math.imul(Ae,S)|0,g=g+Math.imul(De,$)|0,v=v+Math.imul(De,X)|0,v=v+Math.imul(vt,$)|0,k=k+Math.imul(vt,X)|0,g=g+Math.imul(Le,re)|0,v=v+Math.imul(Le,Be)|0,v=v+Math.imul(ot,re)|0,k=k+Math.imul(ot,Be)|0,g=g+Math.imul(Se,Re)|0,v=v+Math.imul(Se,V)|0,v=v+Math.imul(xe,Re)|0,k=k+Math.imul(xe,V)|0,g=g+Math.imul(ie,de)|0,v=v+Math.imul(ie,ke)|0,v=v+Math.imul(ge,de)|0,k=k+Math.imul(ge,ke)|0;var mr=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(mr>>>26)|0,mr&=67108863,g=Math.imul(rt,it),v=Math.imul(rt,jt),v=v+Math.imul(St,it)|0,k=Math.imul(St,jt),g=g+Math.imul(Ye,nt)|0,v=v+Math.imul(Ye,bt)|0,v=v+Math.imul(At,nt)|0,k=k+Math.imul(At,bt)|0,g=g+Math.imul(He,Je)|0,v=v+Math.imul(He,mt)|0,v=v+Math.imul(kt,Je)|0,k=k+Math.imul(kt,mt)|0,g=g+Math.imul($e,st)|0,v=v+Math.imul($e,wt)|0,v=v+Math.imul(lt,st)|0,k=k+Math.imul(lt,wt)|0,g=g+Math.imul(Ne,j)|0,v=v+Math.imul(Ne,S)|0,v=v+Math.imul(Te,j)|0,k=k+Math.imul(Te,S)|0,g=g+Math.imul(me,$)|0,v=v+Math.imul(me,X)|0,v=v+Math.imul(Ae,$)|0,k=k+Math.imul(Ae,X)|0,g=g+Math.imul(De,re)|0,v=v+Math.imul(De,Be)|0,v=v+Math.imul(vt,re)|0,k=k+Math.imul(vt,Be)|0,g=g+Math.imul(Le,Re)|0,v=v+Math.imul(Le,V)|0,v=v+Math.imul(ot,Re)|0,k=k+Math.imul(ot,V)|0,g=g+Math.imul(Se,de)|0,v=v+Math.imul(Se,ke)|0,v=v+Math.imul(xe,de)|0,k=k+Math.imul(xe,ke)|0,g=g+Math.imul(ie,je)|0,v=v+Math.imul(ie,Fe)|0,v=v+Math.imul(ge,je)|0,k=k+Math.imul(ge,Fe)|0;var an=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(an>>>26)|0,an&=67108863,g=Math.imul(rt,nt),v=Math.imul(rt,bt),v=v+Math.imul(St,nt)|0,k=Math.imul(St,bt),g=g+Math.imul(Ye,Je)|0,v=v+Math.imul(Ye,mt)|0,v=v+Math.imul(At,Je)|0,k=k+Math.imul(At,mt)|0,g=g+Math.imul(He,st)|0,v=v+Math.imul(He,wt)|0,v=v+Math.imul(kt,st)|0,k=k+Math.imul(kt,wt)|0,g=g+Math.imul($e,j)|0,v=v+Math.imul($e,S)|0,v=v+Math.imul(lt,j)|0,k=k+Math.imul(lt,S)|0,g=g+Math.imul(Ne,$)|0,v=v+Math.imul(Ne,X)|0,v=v+Math.imul(Te,$)|0,k=k+Math.imul(Te,X)|0,g=g+Math.imul(me,re)|0,v=v+Math.imul(me,Be)|0,v=v+Math.imul(Ae,re)|0,k=k+Math.imul(Ae,Be)|0,g=g+Math.imul(De,Re)|0,v=v+Math.imul(De,V)|0,v=v+Math.imul(vt,Re)|0,k=k+Math.imul(vt,V)|0,g=g+Math.imul(Le,de)|0,v=v+Math.imul(Le,ke)|0,v=v+Math.imul(ot,de)|0,k=k+Math.imul(ot,ke)|0,g=g+Math.imul(Se,je)|0,v=v+Math.imul(Se,Fe)|0,v=v+Math.imul(xe,je)|0,k=k+Math.imul(xe,Fe)|0;var Dr=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(Dr>>>26)|0,Dr&=67108863,g=Math.imul(rt,Je),v=Math.imul(rt,mt),v=v+Math.imul(St,Je)|0,k=Math.imul(St,mt),g=g+Math.imul(Ye,st)|0,v=v+Math.imul(Ye,wt)|0,v=v+Math.imul(At,st)|0,k=k+Math.imul(At,wt)|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($e,$)|0,v=v+Math.imul($e,X)|0,v=v+Math.imul(lt,$)|0,k=k+Math.imul(lt,X)|0,g=g+Math.imul(Ne,re)|0,v=v+Math.imul(Ne,Be)|0,v=v+Math.imul(Te,re)|0,k=k+Math.imul(Te,Be)|0,g=g+Math.imul(me,Re)|0,v=v+Math.imul(me,V)|0,v=v+Math.imul(Ae,Re)|0,k=k+Math.imul(Ae,V)|0,g=g+Math.imul(De,de)|0,v=v+Math.imul(De,ke)|0,v=v+Math.imul(vt,de)|0,k=k+Math.imul(vt,ke)|0,g=g+Math.imul(Le,je)|0,v=v+Math.imul(Le,Fe)|0,v=v+Math.imul(ot,je)|0,k=k+Math.imul(ot,Fe)|0;var cn=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(cn>>>26)|0,cn&=67108863,g=Math.imul(rt,st),v=Math.imul(rt,wt),v=v+Math.imul(St,st)|0,k=Math.imul(St,wt),g=g+Math.imul(Ye,j)|0,v=v+Math.imul(Ye,S)|0,v=v+Math.imul(At,j)|0,k=k+Math.imul(At,S)|0,g=g+Math.imul(He,$)|0,v=v+Math.imul(He,X)|0,v=v+Math.imul(kt,$)|0,k=k+Math.imul(kt,X)|0,g=g+Math.imul($e,re)|0,v=v+Math.imul($e,Be)|0,v=v+Math.imul(lt,re)|0,k=k+Math.imul(lt,Be)|0,g=g+Math.imul(Ne,Re)|0,v=v+Math.imul(Ne,V)|0,v=v+Math.imul(Te,Re)|0,k=k+Math.imul(Te,V)|0,g=g+Math.imul(me,de)|0,v=v+Math.imul(me,ke)|0,v=v+Math.imul(Ae,de)|0,k=k+Math.imul(Ae,ke)|0,g=g+Math.imul(De,je)|0,v=v+Math.imul(De,Fe)|0,v=v+Math.imul(vt,je)|0,k=k+Math.imul(vt,Fe)|0;var ni=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(ni>>>26)|0,ni&=67108863,g=Math.imul(rt,j),v=Math.imul(rt,S),v=v+Math.imul(St,j)|0,k=Math.imul(St,S),g=g+Math.imul(Ye,$)|0,v=v+Math.imul(Ye,X)|0,v=v+Math.imul(At,$)|0,k=k+Math.imul(At,X)|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($e,Re)|0,v=v+Math.imul($e,V)|0,v=v+Math.imul(lt,Re)|0,k=k+Math.imul(lt,V)|0,g=g+Math.imul(Ne,de)|0,v=v+Math.imul(Ne,ke)|0,v=v+Math.imul(Te,de)|0,k=k+Math.imul(Te,ke)|0,g=g+Math.imul(me,je)|0,v=v+Math.imul(me,Fe)|0,v=v+Math.imul(Ae,je)|0,k=k+Math.imul(Ae,Fe)|0;var ii=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(ii>>>26)|0,ii&=67108863,g=Math.imul(rt,$),v=Math.imul(rt,X),v=v+Math.imul(St,$)|0,k=Math.imul(St,X),g=g+Math.imul(Ye,re)|0,v=v+Math.imul(Ye,Be)|0,v=v+Math.imul(At,re)|0,k=k+Math.imul(At,Be)|0,g=g+Math.imul(He,Re)|0,v=v+Math.imul(He,V)|0,v=v+Math.imul(kt,Re)|0,k=k+Math.imul(kt,V)|0,g=g+Math.imul($e,de)|0,v=v+Math.imul($e,ke)|0,v=v+Math.imul(lt,de)|0,k=k+Math.imul(lt,ke)|0,g=g+Math.imul(Ne,je)|0,v=v+Math.imul(Ne,Fe)|0,v=v+Math.imul(Te,je)|0,k=k+Math.imul(Te,Fe)|0;var un=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(un>>>26)|0,un&=67108863,g=Math.imul(rt,re),v=Math.imul(rt,Be),v=v+Math.imul(St,re)|0,k=Math.imul(St,Be),g=g+Math.imul(Ye,Re)|0,v=v+Math.imul(Ye,V)|0,v=v+Math.imul(At,Re)|0,k=k+Math.imul(At,V)|0,g=g+Math.imul(He,de)|0,v=v+Math.imul(He,ke)|0,v=v+Math.imul(kt,de)|0,k=k+Math.imul(kt,ke)|0,g=g+Math.imul($e,je)|0,v=v+Math.imul($e,Fe)|0,v=v+Math.imul(lt,je)|0,k=k+Math.imul(lt,Fe)|0;var si=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(si>>>26)|0,si&=67108863,g=Math.imul(rt,Re),v=Math.imul(rt,V),v=v+Math.imul(St,Re)|0,k=Math.imul(St,V),g=g+Math.imul(Ye,de)|0,v=v+Math.imul(Ye,ke)|0,v=v+Math.imul(At,de)|0,k=k+Math.imul(At,ke)|0,g=g+Math.imul(He,je)|0,v=v+Math.imul(He,Fe)|0,v=v+Math.imul(kt,je)|0,k=k+Math.imul(kt,Fe)|0;var oi=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(oi>>>26)|0,oi&=67108863,g=Math.imul(rt,de),v=Math.imul(rt,ke),v=v+Math.imul(St,de)|0,k=Math.imul(St,ke),g=g+Math.imul(Ye,je)|0,v=v+Math.imul(Ye,Fe)|0,v=v+Math.imul(At,je)|0,k=k+Math.imul(At,Fe)|0;var B=(M+g|0)+((v&8191)<<13)|0;M=(k+(v>>>13)|0)+(B>>>26)|0,B&=67108863,g=Math.imul(rt,je),v=Math.imul(rt,Fe),v=v+Math.imul(St,je)|0,k=Math.imul(St,Fe);var G=(M+g|0)+((v&8191)<<13)|0;return M=(k+(v>>>13)|0)+(G>>>26)|0,G&=67108863,O[0]=at,O[1]=Gt,O[2]=Rt,O[3]=Dt,O[4]=Qt,O[5]=gr,O[6]=nr,O[7]=Kt,O[8]=mr,O[9]=an,O[10]=Dr,O[11]=cn,O[12]=ni,O[13]=ii,O[14]=un,O[15]=si,O[16]=oi,O[17]=B,O[18]=G,M!==0&&(O[19]=M,x.length++),x};Math.imul||(N=R);function z(p,d,m){m.negative=d.negative^p.negative,m.length=p.length+d.length;for(var x=0,C=0,E=0;E<m.length-1;E++){var O=C;C=0;for(var M=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,ie=d.words[v]|0,ge=ee*ie,ve=ge&67108863;O=O+(ge/67108864|0)|0,ve=ve+M|0,M=ve&67108863,O=O+(ve>>>26)|0,C+=O>>>26,O&=67108863}m.words[E]=M,x=O,O=C}return x!==0?m.words[E]=x:m.length--,m._strip()}function F(p,d,m){return z(p,d,m)}o.prototype.mulTo=function(d,m){var x,C=this.length+d.length;return this.length===10&&d.length===10?x=N(this,d,m):C<63?x=R(this,d,m):C<1024?x=z(this,d,m):x=F(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),F(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,C=0;C<this.length;C++){var E=(this.words[C]|0)*d,O=(E&67108863)+(x&67108863);x>>=26,x+=E/67108864|0,x+=O>>>26,this.words[C]=O&67108863}return x!==0&&(this.words[C]=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,C=0;C<m.length&&m[C]===0;C++,x=x.sqr());if(++C<m.length)for(var E=x.sqr();C<m.length;C++,E=E.sqr())m[C]!==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,C=67108863>>>26-m<<26-m,E;if(m!==0){var O=0;for(E=0;E<this.length;E++){var M=this.words[E]&C,g=(this.words[E]|0)-M<<m;this.words[E]=g|O,O=M>>>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 C;m?C=(m-m%26)/26:C=0;var E=d%26,O=Math.min((d-E)/26,this.length),M=67108863^67108863>>>E<<E,g=x;if(C-=O,C=Math.max(0,C),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>=C);v--){var ee=this.words[v]|0;this.words[v]=k<<26-E|ee>>>E,k=ee&M}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,C=1<<m;if(this.length<=x)return!1;var E=this.words[x];return!!(E&C)},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 C=67108863^67108863>>>m<<m;this.words[this.length-1]&=C}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 C=d.length+x,E;this._expand(C);var O,M=0;for(E=0;E<d.length;E++){O=(this.words[E+x]|0)+M;var g=(d.words[E]|0)*m;O-=g&67108863,M=(O>>26)-(g/67108864|0),this.words[E+x]=O&67108863}for(;E<this.length-x;E++)O=(this.words[E+x]|0)+M,M=O>>26,this.words[E+x]=O&67108863;if(M===0)return this._strip();for(i(M===-1),M=0,E=0;E<this.length;E++)O=-(this.words[E]|0)+M,M=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,C=this.clone(),E=d,O=E.words[E.length-1]|0,M=this._countBits(O);x=26-M,x!==0&&(E=E.ushln(x),C.iushln(x),O=E.words[E.length-1]|0);var g=C.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=C.clone()._ishlnsubmul(E,1,g);ee.negative===0&&(C=ee,v&&(v.words[g]=1));for(var ie=g-1;ie>=0;ie--){var ge=(C.words[E.length+ie]|0)*67108864+(C.words[E.length+ie-1]|0);for(ge=Math.min(ge/O|0,67108863),C._ishlnsubmul(E,ge,ie);C.negative!==0;)ge--,C.negative=0,C._ishlnsubmul(E,1,ie),C.isZero()||(C.negative^=1);v&&(v.words[ie]=ge)}return v&&v._strip(),C._strip(),m!=="div"&&x!==0&&C.iushrn(x),{div:v||null,mod:C}},o.prototype.divmod=function(d,m,x){if(i(!d.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var C,E,O;return this.negative!==0&&d.negative===0?(O=this.neg().divmod(d,m),m!=="mod"&&(C=O.div.neg()),m!=="div"&&(E=O.mod.neg(),x&&E.negative!==0&&E.iadd(d)),{div:C,mod:E}):this.negative===0&&d.negative!==0?(O=this.divmod(d.neg(),m),m!=="mod"&&(C=O.div.neg()),{div:C,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,C=d.ushrn(1),E=d.andln(1),O=x.cmp(C);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,C=0,E=this.length-1;E>=0;E--)C=(x*C+(this.words[E]|0))%d;return m?-C:C},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,C=this.length-1;C>=0;C--){var E=(this.words[C]|0)+x*67108864;this.words[C]=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 C=new o(1),E=new o(0),O=new o(0),M=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,ie=1;!(m.words[0]&ie)&&ee<26;++ee,ie<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(C.isOdd()||E.isOdd())&&(C.iadd(v),E.isub(k)),C.iushrn(1),E.iushrn(1);for(var ge=0,ve=1;!(x.words[0]&ve)&&ge<26;++ge,ve<<=1);if(ge>0)for(x.iushrn(ge);ge-- >0;)(O.isOdd()||M.isOdd())&&(O.iadd(v),M.isub(k)),O.iushrn(1),M.iushrn(1);m.cmp(x)>=0?(m.isub(x),C.isub(O),E.isub(M)):(x.isub(m),O.isub(C),M.isub(E))}return{a:O,b:M,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 C=new o(1),E=new o(0),O=x.clone();m.cmpn(1)>0&&x.cmpn(1)>0;){for(var M=0,g=1;!(m.words[0]&g)&&M<26;++M,g<<=1);if(M>0)for(m.iushrn(M);M-- >0;)C.isOdd()&&C.iadd(O),C.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),C.isub(E)):(x.isub(m),E.isub(C))}var ee;return m.cmpn(1)===0?ee=C: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 C=0;m.isEven()&&x.isEven();C++)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(C)},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,C=1<<m;if(this.length<=x)return this._expand(x+1),this.words[x]|=C,this;for(var E=C,O=x;E!==0&&O<this.length;O++){var M=this.words[O]|0;M+=E,E=M>>>26,M&=67108863,this.words[O]=M}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 C=this.words[0]|0;x=C===d?0:C<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 C=this.words[x]|0,E=d.words[x]|0;if(C!==E){C<E?m=-1:C>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 L(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 W={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 C=x<this.n?-1:m.ucmp(this.p);return C===0?(m.words[0]=0,m.length=1):C>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 K(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(K,q),K.prototype.split=function(d,m){for(var x=4194303,C=Math.min(d.length,9),E=0;E<C;E++)m.words[E]=d.words[E];if(m.length=C,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 M=d.words[E]|0;d.words[E-10]=(M&x)<<4|O>>>22,O=M}O>>>=22,d.words[E-10]=O,O===0&&d.length>10?d.length-=10:d.length-=9},K.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 C=d.words[x]|0;m+=C*977,d.words[x]=m&67108863,m=C*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function te(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(te,q);function se(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(se,q);function H(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(H,q),H.prototype.imulK=function(d){for(var m=0,x=0;x<d.length;x++){var C=(d.words[x]|0)*19+m,E=C&67108863;C>>>=26,d.words[x]=E,m=C}return m!==0&&(d.words[d.length++]=m),d},o._prime=function(d){if(W[d])return W[d];var m;if(d==="k256")m=new K;else if(d==="p224")m=new te;else if(d==="p192")m=new se;else if(d==="p25519")m=new H;else throw new Error("Unknown prime "+d);return W[d]=m,m};function L(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}L.prototype._verify1=function(d){i(d.negative===0,"red works only with positives"),i(d.red,"red works only with red numbers")},L.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")},L.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(f(d,d.umod(this.m)._forceRed(this)),d)},L.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},L.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)},L.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},L.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)},L.prototype.isub=function(d,m){this._verify2(d,m);var x=d.isub(m);return x.cmpn(0)<0&&x.iadd(this.m),x},L.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},L.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},L.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},L.prototype.isqr=function(d){return this.imul(d,d.clone())},L.prototype.sqr=function(d){return this.mul(d,d)},L.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 C=this.m.subn(1),E=0;!C.isZero()&&C.andln(1)===0;)E++,C.iushrn(1);i(!C.isZero());var O=new o(1).toRed(this),M=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(M)!==0;)v.redIAdd(M);for(var k=this.pow(v,C),ee=this.pow(d,C.addn(1).iushrn(1)),ie=this.pow(d,C),ge=E;ie.cmp(O)!==0;){for(var ve=ie,Se=0;ve.cmp(O)!==0;Se++)ve=ve.redSqr();i(Se<ge);var xe=this.pow(k,new o(1).iushln(ge-Se-1));ee=ee.redMul(xe),k=xe.redSqr(),ie=ie.redMul(k),ge=Se}return ee},L.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},L.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,C=new Array(1<<x);C[0]=new o(1).toRed(this),C[1]=d;for(var E=2;E<C.length;E++)C[E]=this.mul(C[E-1],d);var O=C[0],M=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 ie=k>>ee&1;if(O!==C[0]&&(O=this.sqr(O)),ie===0&&M===0){g=0;continue}M<<=1,M|=ie,g++,!(g!==x&&(E!==0||ee!==0))&&(O=this.mul(O,C[M]),g=0,M=0)}v=26}return O},L.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},L.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},o.mont=function(d){return new D(d)};function D(p){L.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,L),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),C=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(C).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),C=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=x.isub(C).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)}}),go=9e15,ss=1e9,Ld="0123456789abcdef",Iu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Pu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Fd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-go,maxE:go,crypto:!1},Nx,gi,ct=!0,_l="[DecimalError] ",Ji=_l+"Invalid argument: ",Dx=_l+"Precision limit exceeded",Bx=_l+"crypto unavailable",$x="[object Decimal]",Ar=Math.floor,dr=Math.pow,Rk=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Nk=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Dk=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Lx=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,_n=1e7,Ze=7,Bk=9007199254740991,$k=Iu.length-1,Ud=Pu.length-1,ye={toStringTag:$x};ye.absoluteValue=ye.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ge(e)};ye.ceil=function(){return Ge(new this.constructor(this),this.e+1,2)};ye.clampedTo=ye.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(Ji+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};ye.comparedTo=ye.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};ye.cosine=ye.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=Lk(n,qx(n,r)),n.precision=e,n.rounding=t,Ge(gi==2||gi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};ye.cubeRoot=ye.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*dr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=_r(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=dr(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=Vt(u.plus(l).times(a),u.plus(c),o+2,1),_r(a.d).slice(0,o)===(r=_r(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ge(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")&&(Ge(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ct=!0,Ge(n,e,f.rounding,t)};ye.decimalPlaces=ye.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};ye.dividedBy=ye.div=function(e){return Vt(this,new this.constructor(e))};ye.dividedToIntegerBy=ye.divToInt=function(e){var t=this,r=t.constructor;return Ge(Vt(t,new r(e),0,1,1),r.precision,r.rounding)};ye.equals=ye.eq=function(e){return this.cmp(e)===0};ye.floor=function(){return Ge(new this.constructor(this),this.e+1,3)};ye.greaterThan=ye.gt=function(e){return this.cmp(e)>0};ye.greaterThanOrEqualTo=ye.gte=function(e){var t=this.cmp(e);return t==1||t===0};ye.hyperbolicCosine=ye.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/Sl(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Oo(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 Ge(s,o.precision=r,o.rounding=n,!0)};ye.hyperbolicSine=ye.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=Oo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Sl(5,e)),i=Oo(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,Ge(i,t,r,!0)};ye.hyperbolicTangent=ye.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,Vt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};ye.inverseCosine=ye.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()?vn(r,i,s):new r(0):new r(NaN):t.isZero()?vn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=vn(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))};ye.inverseHyperbolicCosine=ye.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)};ye.inverseHyperbolicSine=ye.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())};ye.inverseHyperbolicTangent=ye.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?Ge(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Vt(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)};ye.inverseSine=ye.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=vn(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)))};ye.inverseTangent=ye.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<=Ud)return o=vn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=Ud)return o=vn(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(ct=!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)),ct=!0,Ge(o,l.precision=f,l.rounding=h,!0)};ye.isFinite=function(){return!!this.d};ye.isInteger=ye.isInt=function(){return!!this.d&&Ar(this.e/Ze)>this.d.length-2};ye.isNaN=function(){return!this.s};ye.isNegative=ye.isNeg=function(){return this.s<0};ye.isPositive=ye.isPos=function(){return this.s>0};ye.isZero=function(){return!!this.d&&this.d[0]===0};ye.lessThan=ye.lt=function(e){return this.cmp(e)<0};ye.lessThanOrEqualTo=ye.lte=function(e){return this.cmp(e)<1};ye.logarithm=ye.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=zi(u,a),n=t?ku(l,a+10):zi(e,a),c=Vt(o,n,a,1),Va(c.d,i=f,h))do if(a+=10,o=zi(u,a),n=t?ku(l,a+10):zi(e,a),c=Vt(o,n,a,1),!s){+_r(c.d).slice(i+1,i+15)+1==1e14&&(c=Ge(c,f+1,0));break}while(Va(c.d,i+=10,h));return ct=!0,Ge(c,f,h)};ye.minus=ye.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?Ge(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]=_n-1;--u[i],u[n]+=_n}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=xl(u,r),ct?Ge(e,a,c):e):new b(c===3?-0:0)};ye.modulo=ye.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]?Ge(new n(r),n.precision,n.rounding):(ct=!1,n.modulo==9?(t=Vt(r,e.abs(),0,3,1),t.s*=e.s):t=Vt(r,e,0,n.modulo,1),t=t.times(e),ct=!0,r.minus(t))};ye.naturalExponential=ye.exp=function(){return zd(this)};ye.naturalLogarithm=ye.ln=function(){return zi(this)};ye.negated=ye.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Ge(e)};ye.plus=ye.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?Ge(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)/_n|0,u[i]%=_n;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=xl(u,n),ct?Ge(e,a,c):e};ye.precision=ye.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Ji+e);return r.d?(t=Fx(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};ye.round=function(){var e=this,t=e.constructor;return Ge(new t(e),e.e+1,t.rounding)};ye.sine=ye.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=Uk(n,qx(n,r)),n.precision=e,n.rounding=t,Ge(gi>2?r.neg():r,e,t,!0)):new n(NaN)};ye.squareRoot=ye.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=_r(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(Vt(o,s,r+2,1)).times(.5),_r(s.d).slice(0,r)===(t=_r(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Ge(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")&&(Ge(n,c+1,1),e=!n.times(n).eq(o));break}return ct=!0,Ge(n,c,l.rounding,e)};ye.tangent=ye.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=Vt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Ge(gi==2||gi==4?r.neg():r,e,t,!0)):new n(NaN)};ye.times=ye.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%_n|0,t=a/_n|0;s[i]=(s[i]+t)%_n|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=xl(s,r),ct?Ge(e,f.precision,f.rounding):e};ye.toBinary=function(e,t){return Up(this,2,e,t)};ye.toDecimalPlaces=ye.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Fr(e,0,ss),t===void 0?t=n.rounding:Fr(t,0,8),Ge(r,e+r.e+1,t))};ye.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Kn(n,!0):(Fr(e,0,ss),t===void 0?t=i.rounding:Fr(t,0,8),n=Ge(new i(n),e+1,t),r=Kn(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};ye.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=Kn(i):(Fr(e,0,ss),t===void 0?t=s.rounding:Fr(t,0,8),n=Ge(new s(i),e+i.e+1,t),r=Kn(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};ye.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=Fx(b)-y.e-1,o=s%Ze,t.d[0]=dr(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(Ji+a);e=a.gt(t)?s>0?t:u:a}for(ct=!1,a=new w(_r(b)),l=w.precision,w.precision=s=b.length*Ze*2;f=Vt(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=Vt(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=Vt(u,n,s,1).minus(y).abs().cmp(Vt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ct=!0,h};ye.toHexadecimal=ye.toHex=function(e,t){return Up(this,16,e,t)};ye.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:Fr(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=Vt(r,e,0,t,1).times(e),ct=!0,Ge(r)):(e.s=r.s,r=e),r};ye.toNumber=function(){return+this};ye.toOctal=function(e,t){return Up(this,8,e,t)};ye.toPower=ye.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(dr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Ge(a,n,s);if(t=Ar(e.e/Ze),t>=e.d.length-1&&(r=u<0?-u:u)<=Bk)return i=Ux(c,a,r,n),e.s<0?new c(1).div(i):Ge(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=dr(+a,u),t=r==0||!isFinite(r)?Ar(u*(Math.log("0."+_r(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=zd(e.times(zi(a,n+r)),n),i.d&&(i=Ge(i,n+5,1),Va(i.d,n,s)&&(t=n+10,i=Ge(zd(e.times(zi(a,t+r)),t),t+5,1),+_r(i.d).slice(n+1,n+15)+1==1e14&&(i=Ge(i,n+1,0)))),i.s=o,ct=!0,c.rounding=s,Ge(i,n,s))};ye.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Kn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Fr(e,1,ss),t===void 0?t=i.rounding:Fr(t,0,8),n=Ge(new i(n),e,t),r=Kn(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};ye.toSignificantDigits=ye.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Fr(e,1,ss),t===void 0?t=n.rounding:Fr(t,0,8)),Ge(new n(r),e,t)};ye.toString=function(){var e=this,t=e.constructor,r=Kn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};ye.truncated=ye.trunc=function(){return Ge(new this.constructor(this),this.e+1,1)};ye.valueOf=ye.toJSON=function(){var e=this,t=e.constructor,r=Kn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function _r(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+=$i(r)),s+=n;o=e[t],n=o+"",r=Ze-n.length,r&&(s+=$i(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Fr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Ji+e)}function Va(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=dr(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)==dr(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)==dr(10,t-3)-1,o}function nu(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]+=Ld.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 Lk(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Sl(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Oo(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 Vt=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,T,P,R,N,z,F,W,q,K,te,se,H,L,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=_n,y=Ze,l=Ar(n.e/y)-Ar(i.e/y)),H=m.length,te=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?(W=s=D.precision,o=D.rounding):a?W=s+(n.e-i.e)+1:W=s,W<0)R.push(1),b=!0;else{if(W=W/y+2|0,f=0,H==1){for(h=0,m=m[0],W++;(f<te||h)&&W--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<te}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),H=m.length,te=d.length),K=H,N=d.slice(0,H),z=N.length;z<H;)N[z++]=0;L=m.slice(),L.unshift(0),se=m[0],m[1]>=c/2&&++se;do h=0,u=t(m,N,H,z),u<0?(F=N[0],H!=z&&(F=F*c+(N[1]||0)),h=F/se|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),T=w.length,z=N.length,u=t(w,N,T,z),u==1&&(h--,r(w,H<T?L:m,T,c))):(h==0&&(u=h=1),w=m.slice()),T=w.length,T<z&&w.unshift(0),r(N,w,z,c),u==-1&&(z=N.length,u=t(m,N,H,z),u<1&&(h++,r(N,H<z?L:m,z,c))),z=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[z++]=d[K]||0:(N=[d[K]],z=1);while((K++<te||N[0]!==void 0)&&W--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,Nx=b;else{for(f=1,h=R[0];h>=10;h/=10)f++;P.e=f+l*y-1,Ge(P,a?s+P.e+1:s,o,b)}return P}}();function Ge(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/dr(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/dr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%dr(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/dr(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]=dr(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=dr(10,Ze-s),f[h]=o>0?(l/dr(10,i-o)%dr(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]==_n&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=_n)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 Kn(e,t,r){if(!e.isFinite())return Vx(e);var n,i=e.e,s=_r(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+$i(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+$i(-i-1)+s,r&&(n=r-o)>0&&(s+=$i(n))):i>=o?(s+=$i(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+$i(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=$i(n))),s}function xl(e,t){var r=e[0];for(t*=Ze;r>=10;r/=10)t++;return t}function ku(e,t,r){if(t>$k)throw ct=!0,r&&(e.precision=r),Error(Dx);return Ge(new e(Iu),t,1,!0)}function vn(e,t,r){if(t>Ud)throw Error(Dx);return Ge(new e(Pu),t,r,!0)}function Fx(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 $i(e){for(var t="";e--;)t+="0";return t}function Ux(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Ze+4);for(ct=!1;;){if(r%2&&(s=s.times(t),Jm(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),Jm(t.d,o)}return ct=!0,s}function Xm(e){return e.d[e.d.length-1]&1}function zx(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 zd(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(dr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Ge(s.times(e),c,1),r=r.times(++l),a=o.plus(Vt(s,r,c,1)),_r(a.d).slice(0,c)===_r(o.d).slice(0,c)){for(i=f;i--;)o=Ge(o.times(o),c,1);if(t==null)if(u<3&&Va(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Ge(o,h.precision=b,y,ct=!0);else return h.precision=b,o}o=a}}function zi(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,T=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!T||!T[0]||!w.e&&T[0]==1&&T.length==1)return new P(T&&!T[0]?-1/0:w.s!=1?NaN:T?0:w);if(t==null?(ct=!1,l=N):l=t,P.precision=l+=b,r=_r(T),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=_r(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=ku(P,l+2,N).times(s+""),w=zi(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Ge(w,N,R,ct=!0):w;for(f=w,c=o=w=Vt(w.minus(1),w.plus(1),l,1),h=Ge(w.times(w),l,1),i=3;;){if(o=Ge(o.times(h),l,1),u=c.plus(Vt(o,new P(i),l,1)),_r(u.d).slice(0,l)===_r(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(ku(P,l+2,N).times(s+""))),c=Vt(c,new P(y),l,1),t==null)if(Va(c.d,l-b,R,a))P.precision=l+=b,u=o=w=Vt(f.minus(1),f.plus(1),l,1),h=Ge(w.times(w),l,1),i=a=1;else return Ge(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 Vd(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),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 Fk(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Lx.test(t))return Vd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Nk.test(t))r=16,t=t.toLowerCase();else if(Rk.test(t))r=2;else if(Dk.test(t))r=8;else throw Error(Ji+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=Ux(n,new n(r),s,s*2)),u=nu(t,r,_n),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=xl(u,l),e.d=u,ct=!1,o&&(e=Vt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?dr(2,c):dc.pow(2,c))),ct=!0,e)}function Uk(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Oo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Sl(5,r)),t=Oo(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 Oo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Ze);for(ct=!1,c=r.times(r),a=new e(n);;){if(o=Vt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Vt(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 Sl(e,t){for(var r=e;--t;)r*=e;return r}function qx(e,t){var r,n=t.s<0,i=vn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return gi=n?4:1,t;if(r=t.divToInt(i),r.isZero())gi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return gi=Xm(r)?n?2:3:n?4:1,t;gi=Xm(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Up(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,b=r!==void 0;if(b?(Fr(r,1,ss),n===void 0?n=y.rounding:Fr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=Vx(e);else{for(l=Kn(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=nu(Kn(h),10,i),h.e=h.d.length),f=nu(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=Vt(e,h,r,n,0,i),f=e.d,s=e.e,u=Nx),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+=Ld.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=nu(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Ld.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 Jm(e,t){if(e.length>t)return e.length=t,!0}function zk(e){return new this(e).abs()}function Vk(e){return new this(e).acos()}function qk(e){return new this(e).acosh()}function Hk(e,t){return new this(e).plus(t)}function Wk(e){return new this(e).asin()}function Gk(e){return new this(e).asinh()}function Kk(e){return new this(e).atan()}function Xk(e){return new this(e).atanh()}function Jk(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=vn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?vn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=vn(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Vt(e,t,s,1)),t=vn(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Vt(e,t,s,1)),r}function Yk(e){return new this(e).cbrt()}function Zk(e){return Ge(e=new this(e),e.e+1,2)}function Qk(e,t,r){return new this(e).clamp(t,r)}function e9(e){if(!e||typeof e!="object")throw Error(_l+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,ss,"rounding",0,8,"toExpNeg",-go,0,"toExpPos",0,go,"maxE",0,go,"minE",-go,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Fd[r]),(n=e[r])!==void 0)if(Ar(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(Ji+r+": "+n);if(r="crypto",i&&(this[r]=Fd[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(Bx);else this[r]=!1;else throw Error(Ji+r+": "+n);return this}function t9(e){return new this(e).cos()}function r9(e){return new this(e).cosh()}function Hx(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,Ym(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 Vd(u,s.toString())}else if(c!=="string")throw Error(Ji+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),Lx.test(s)?Vd(u,s):Fk(u,s)}if(i.prototype=ye,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=e9,i.clone=Hx,i.isDecimal=Ym,i.abs=zk,i.acos=Vk,i.acosh=qk,i.add=Hk,i.asin=Wk,i.asinh=Gk,i.atan=Kk,i.atanh=Xk,i.atan2=Jk,i.cbrt=Yk,i.ceil=Zk,i.clamp=Qk,i.cos=t9,i.cosh=r9,i.div=n9,i.exp=i9,i.floor=s9,i.hypot=o9,i.ln=a9,i.log=c9,i.log10=l9,i.log2=u9,i.max=f9,i.min=d9,i.mod=h9,i.mul=p9,i.pow=m9,i.random=g9,i.round=v9,i.sign=y9,i.sin=b9,i.sinh=w9,i.sqrt=_9,i.sub=x9,i.sum=S9,i.tan=E9,i.tanh=C9,i.trunc=M9,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 n9(e,t){return new this(e).div(t)}function i9(e){return new this(e).exp()}function s9(e){return Ge(e=new this(e),e.e+1,3)}function o9(){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 Ym(e){return e instanceof dc||e&&e.toStringTag===$x||!1}function a9(e){return new this(e).ln()}function c9(e,t){return new this(e).log(t)}function u9(e){return new this(e).log(2)}function l9(e){return new this(e).log(10)}function f9(){return zx(this,arguments,"lt")}function d9(){return zx(this,arguments,"gt")}function h9(e,t){return new this(e).mod(t)}function p9(e,t){return new this(e).mul(t)}function m9(e,t){return new this(e).pow(t)}function g9(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Fr(e,1,ss),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(Bx);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Ze,n&&e&&(i=dr(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 v9(e){return Ge(e=new this(e),e.e+1,this.rounding)}function y9(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function b9(e){return new this(e).sin()}function w9(e){return new this(e).sinh()}function _9(e){return new this(e).sqrt()}function x9(e,t){return new this(e).sub(t)}function S9(){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,Ge(r,this.precision,this.rounding)}function E9(e){return new this(e).tan()}function C9(e){return new this(e).tanh()}function M9(e){return Ge(e=new this(e),e.e+1,1)}ye[Symbol.for("nodejs.util.inspect.custom")]=ye.toString;ye[Symbol.toStringTag]="Decimal";var dc=ye.constructor=Hx(Fd);Iu=new dc(Iu);Pu=new dc(Pu);var iu=dc,Vi=zo(Vo()),$f=zo(Vo()),A9=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 $f.default(e).mul(new $f.default(this.slippage)).div(new $f.default("1000000000000000000")).toString()}swap(e,t,r,n){return Et(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})})}},Zm="0x000000000000000000000000000000000000000000000000000000000000dee9",T9=class{constructor(e){if(e!==0)throw new Error("Aftermath only supported on mainnet")}getAccountCap(e,t){return Et(this,null,function*(){let r=50,n=null;for(;;){const i=e.getOwnedObjects({owner:t,cursor:n,limit:r,filter:{MoveModule:{package:Zm,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 Et(this,null,function*(){let n=yield this.getAccountCap(t,r);return n!==null?{accountCap:e.object(n),isCreate:!1}:{accountCap:e.moveCall({target:`${Zm}::clob_v2::create_account`,typeArguments:[],arguments:[]}),isCreate:!0}})}swap(e,t,r,n){return Et(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(Xn)],h=t.moveCall({target:`${e.publishedAt()}::deepbook::${a}`,typeArguments:[c,u],arguments:f});return l.isCreate&&t.transferObjects([l.accountCap],e.signer),h})}},O9=class{constructor(e){if(e!==0)throw new Error("Kriya amm only supported on mainnet")}swap(e,t,r,n){return Et(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})})}},I9=class{constructor(e){if(e!==0)throw new Error("Kriya clmm only supported on mainnet");this.version="0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78"}swap(e,t,r,n){return Et(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(Xn)];return t.moveCall({target:`${e.publishedAt()}::kriya_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},P9=class{constructor(e){if(e!==0)throw new Error("Flowx only supported on mainnet");this.container="0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511"}swap(e,t,r,n){return Et(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})})}},k9=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 Et(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(Xn)];return t.moveCall({target:`${e.publishedAt()}::flowx_clmm::${a}`,typeArguments:[c,u],arguments:l})})}},j9=class{constructor(e){if(e!==0)throw new Error("Turbos only supported on mainnet");this.versioned="0xf1cf0e81048df168ebeb1b8030fad24b3e0b53ae827c25053fff0779c1445b6f"}swap(e,t,r,n){return Et(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(Xn),t.object(this.versioned)];return t.moveCall({target:`${e.publishedAt()}::turbos::${a}`,typeArguments:[c,u,r.extendedDetails.turbosFeeType],arguments:l})})}},Qm=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(Xn)],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 Et(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(Xn)];return t.moveCall({target:`${e.publishedAt()}::cetus::${a}`,typeArguments:[c,u],arguments:l})})}};function eg(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 R9(e){return e.split("::")[0]}function Ns(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=Ns(r),u=Ik(Ok({},c),{type_arguments:i.map(l=>Ns(l).source_address)});return u.type_arguments=u.type_arguments.map(l=>xs.isSuiCoin(l)?l:Ns(l).source_address),u.source_address=eg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===Wx||r===B9?"0x2":$d.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=eg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function tg(e){return Ns(e).source_address}var N9="0x2::coin::Coin",D9=/^0x2::coin::Coin<(.+)>$/,Wx="0x2::sui::SUI",B9="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",xs=class Ni{static getCoinTypeArg(t){const r=t.type.match(D9);return r?r[1]:null}static isSUI(t){const r=Ni.getCoinTypeArg(t);return r?Ni.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`${N9}<${t}>`}static getCoinAssets(t,r){const n=[];return r.forEach(i=>{tg(i.coinAddress)===tg(t)&&n.push(i)}),n}static isSuiCoin(t){return Ns(t).full_address===Wx}static selectCoinObjectIdGreaterThanOrEqual(t,r,n=[]){const i=Ni.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=Ni.sortByBalance(t.filter(u=>!n.includes(u.coinObjectId))),s=Ni.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:Ni.sortByBalance(a),remainingCoins:Ni.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 rg(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";default:return"Unknown error"}}function Yi(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 $9(e,t){e=Yi(e),t=Yi(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 Gx(e,t){return e.moveCall({target:"0x2::coin::zero",typeArguments:[t]})}function Lf(e,t,r,n){const i=xs.getCoinAssets(n,t);if(r===BigInt(0)&&i.length===0)return{targetCoin:Gx(e,n),isMintZeroCoin:!0,targetCoinAmount:0};if(xs.calculateTotalBalance(i)<r)throw new AggregateError("Insufficient balance when build merge coin, coinType: "+n,"InsufficientBalance"+n);if(xs.isSuiCoin(n))return{targetCoin:e.splitCoins(e.gas,[e.pure.u64(r.toString())]),isMintZeroCoin:!0,targetCoinAmount:Number(r.toString())};let o=xs.sortByBalance(i);o.slice(0,3).reduce((f,h)=>f+h.balance,BigInt(0))<BigInt(r)&&(o=xs.sortByBalanceDes(i));let c=xs.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 L9(e,t=!0){return Et(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 F9(e){return!(!e.startsWith("0x")||e.length!==66)}var Zs=zo(Vo()),qi=zo(Vo()),hc=zo(Vo()),ks=new hc.default(0);new hc.default(1);var U9=new hc.default(2);U9.pow(new hc.default(128));var z9=new hc.default("18446744073709551615"),en=1e9;function V9(e,t,r){let n=ks;return t?n=e.mul(new qi.default(en-r*en)).div(new qi.default(en)):n=e.mul(new qi.default(en+r*en)).div(new qi.default(en)),Number(n.toString())}function q9(e,t,r){let n=ks;return t?n=e.mul(new qi.default(en-r*en)).div(new qi.default(en)):n=e.mul(new qi.default(en+r*en)).div(new qi.default(en)),n}function H9(e,t,r){return new iu(e).mul(iu.pow(2,-64)).pow(2).mul(iu.pow(10,t-r))}function W9(e,t,r,n){return Et(this,null,function*(){var i,s,o,a,c;const{from:u,target:l,amount:f,byAmountIn:h,pools:y}=t,b=Yi(u),w=Yi(l),T=new xk.Transaction,P=$9(b,w),R=n===0?"0x3a5aa90ffa33d09100d7b6941ea1c0ffe6ab66e77062ddd26320c1b073aabb10":"0x19dd42e05fa6c9988a60d30686ee3feb776672b5547e328d6dab16563da65293",N=P?b:w,z=P?w:b,F=[N,z];console.log("typeArguments",F,R);for(let M=0;M<y.length;M++){const g=[T.object(y[M]),T.pure.bool(P),T.pure.bool(h),T.pure.u64(f.toString())];T.moveCall({target:`${R}::fetcher_script::calculate_swap_result`,arguments:g,typeArguments:F})}if(!F9(r))throw new AggregateError("Aggregator package not set","InvalidWallet");L9(T);const W=yield e.devInspectTransactionBlock({transactionBlock:T,sender:r});if(W.error!=null)throw console.log("simulateRes.error",W.error),new AggregateError("Aggregator package not set","SimulateError");const q=(i=W.events)==null?void 0:i.filter(M=>M.type.includes("CalculatedSwapResultEvent"));if(q.length===0||q.length!==y.length)throw new AggregateError("Simulate event result error","simulateEventError");let K=h?ks:z9,te=0;for(let M=0;M<q.length;M+=1)if(!q[M].parsedJson.data.is_exceed)if(t.byAmountIn){const g=new Zs.BN(q[M].parsedJson.data.amount_out);g.gt(K)&&(te=M,K=g)}else{const g=new Zs.BN(q[M].parsedJson.data.amount_out);g.lt(K)&&(te=M,K=g)}const se=q[te].parsedJson.data;console.log("event",JSON.stringify(se,null,2));const H=se.step_results[0].current_sqrt_price,[L,D]=yield Promise.all([e.getCoinMetadata({coinType:N}).then(M=>M==null?void 0:M.decimals),e.getCoinMetadata({coinType:z}).then(M=>M==null?void 0:M.decimals)]);if(L==null||D==null)throw new AggregateError("Simulate event result error","CannotGetDecimals");const p=H9(H,L,D),d=Number(se.fee_rate)/1e6,m=new Zs.BN((s=se.amount_in)!=null?s:0),x=new Zs.BN((o=se.fee_amount)!=null?o:0),C=m.add(x),E={amountIn:C,amountOut:new Zs.BN((a=se.amount_out)!=null?a:0),routes:[{path:[{id:y[te],direction:P,provider:"CETUS",from:b,target:w,feeRate:d,amountIn:se.amount_in,amountOut:se.amount_out,extendedDetails:{afterSqrtPrice:se.after_sqrt_price}}],amountIn:C,amountOut:new Zs.BN((c=se.amount_out)!=null?c:0),initialPrice:p}],insufficientLiquidity:!1};return{isExceed:se.is_exceed,routeData:E}})}var G9=class{constructor(e){if(e!==0)throw new Error("Haedal only supported on mainnet")}swap(e,t,r,n){return Et(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})})}},K9=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 Et(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})})}},X9=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 Et(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})})}},J9=class{constructor(e){if(e!==0)throw new Error("Bluemove only supported on mainnet");this.dexInfo="0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"}swap(e,t,r,n){return Et(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})})}},Y9=class{constructor(e){this.deepbookV3Config=e===0?"0xe4099d0cda04f3aa80028fac91a9b3dbe50d08f2ff42aa2c29473926e34ca48c":"0xe19b5d072346cae83a037d4e3c8492068a74410a74e5830b3a68012db38296aa"}swap(e,t,r,n,i){return Et(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=Gx(t,e.deepbookv3DeepFeeType());const h=[t.object(this.deepbookV3Config),t.object(r.id),n,f,t.object(Xn)];return t.moveCall({target:`${e.publishedAtV2()}::deepbookv3::${c}`,typeArguments:[u,l],arguments:h})})}},Z9=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 Et(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(Xn)];return t.moveCall({target:`${e.publishedAtV2()}::scallop::${a}`,typeArguments:[c,u],arguments:l})})}},Q9=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 Et(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})})}},ej=class{constructor(e){if(e!==0)throw new Error("Bluefin only supported on mainnet");this.globalConfig="0x03db251ba509a8d5d8777b6338836082335d93eecbdd09a11e190a1cff51c352"}swap(e,t,r,n){return Et(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(Xn)];return t.moveCall({target:`${e.publishedAtV2()}::bluefin::${a}`,typeArguments:[c,u],arguments:l})})}},tj=class{constructor(e,t){if(e===1){this.connection=new Ic.SuiPriceServiceConnection("https://hermes-beta.pyth.network");const r="0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790",n="0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";this.pythClient=new Ic.SuiPythClient(t,n,r)}else{this.connection=new Ic.SuiPriceServiceConnection("https://hermes.pyth.network");const r="0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c",n="0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";this.pythClient=new Ic.SuiPythClient(t,n,r)}}swap(e,t,r,n){return Et(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(Xn)];return t.moveCall({target:`${e.publishedAtV2()}::haedalpmm::${a}`,typeArguments:[c,u],arguments:w})})}},Kx="CETUS",rj="DEEPBOOK",nj="KRIYA",ij="FLOWX",sj="FLOWXV3",oj="KRIYAV3",Xx="TURBOS",qd="AFTERMATH",aj="HAEDAL",cj="VOLO",uj="AFSUI",lj="BLUEMOVE",Jx="DEEPBOOKV3",Yx="SCALLOP",fj="SUILEND",dj="BLUEFIN",Zx="HAEDALPMM",hj="https://api-sui.cetus.zone/router_v2",pj=class{constructor(e,t,r,n){this.endpoint=e?gj(e):hj,this.client=r||new Wm.SuiClient({url:Wm.getFullnodeUrl("mainnet")}),this.signer=t||"",this.env=n||0,this.allCoins=new Map}getCoins(e,t=!0){return Et(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:Ns(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 Et(this,null,function*(){return vj(this.endpoint,e)})}expectInputSwap(e,t,r,n,i,s){return Et(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 Et(this,null,function*(){const i=[],s=[],o=[],a=new Qm(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:`${$d.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 Et(this,null,function*(){let t;try{t=yield W9(this.client,e,this.signer,this.env)}catch(r){return console.error("swapInPools error:",r),null}return t})}routerSwap(e){return Et(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 Vi.default(0)),u=t.reduce((y,b)=>y.add(b.amountOut),new Vi.default(0)),l=q9(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 Et(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,z)=>N.add(z.amountIn),new Vi.default(0)),y=t.reduce((N,z)=>N.add(z.amountOut),new Vi.default(0)),b=V9(r?y:h,r,n),T=Lf(i,l,BigInt((r?h:b).toString()),u);let P;if(c&&c>0){let N=yield this.getCoins(this.deepbookv3DeepFeeType());P=Lf(i,N,BigInt(c),this.deepbookv3DeepFeeType()).targetCoin}const R=yield this.routerSwap({routers:t,inputCoin:T.targetCoin,slippage:n,byAmountIn:r,txb:i,partner:s,deepbookv3DeepFee:P});if(o){let N=yield this.getCoins(f,a);const z=Lf(i,N,BigInt(0),f);i.mergeCoins(z.targetCoin,[R]),z.isMintZeroCoin&&this.transferOrDestoryCoin(i,z.targetCoin,f)}else this.transferOrDestoryCoin(i,R,f)})}publishedAt(){return this.env===0?"0x11451575c775a3e633437b827ecbc1eb51a5964b0302210b28f5b89880be21a2":"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:`${$d.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 Kx:return new Qm(this.env,t);case rj:return new T9(this.env);case Jx:return new Y9(this.env);case nj:return new O9(this.env);case oj:return new I9(this.env);case ij:return new P9(this.env);case sj:return new k9(this.env);case Xx:return new j9(this.env);case qd:return new A9(this.env);case aj:return new G9(this.env);case uj:return new K9(this.env);case cj:return new X9(this.env);case lj:return new J9(this.env);case Yx:return new Z9(this.env);case fj:return new Q9(this.env);case dj:return new ej(this.env);case Zx:return new tj(this.env,this.client);default:throw new Error(`Unsupported dex ${e}`)}}signAndExecuteTransaction(e,t){return Et(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t,options:{showEffects:!0,showEvents:!0,showInput:!0,showBalanceChanges:!0}})})}devInspectTransactionBlock(e){return Et(this,null,function*(){return yield this.client.devInspectTransactionBlock({transactionBlock:e,sender:this.signer})})}sendTransaction(e,t){return Et(this,null,function*(){return yield this.client.signAndExecuteTransaction({transaction:e,signer:t})})}getDeepbookV3Config(){return Et(this,null,function*(){const e=yield wj(this.endpoint);return e?e.data:null})}};function mj(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 Vi.default(e.amount_in.toString()),amountOut:new Vi.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===qd&&(h=i.extended_details.aftermath_pool_flatness===0?"v2":"v3");let y;return(i.provider===Xx||i.provider===qd||i.provider===Kx||i.provider===Jx||i.provider===Yx||i.provider===Zx)&&(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 Vi.default(n.amount_in.toString()),amountOut:new Vi.default(n.amount_out.toString()),initialPrice:new iu(n.initial_price.toString())})),totalDeepFee:t}}var Xn="0x0000000000000000000000000000000000000000000000000000000000000006";zo(Vo());function gj(e){return e.endsWith("/find_routes")?e.replace("/find_routes",""):e}function vj(e,t){return Et(this,null,function*(){let r;if(t.liquidityChanges&&t.liquidityChanges.length>0?r=yield bj(e,t):r=yield yj(e,t),!r)return null;if(!r.ok)return{amountIn:ks,amountOut:ks,routes:[],insufficientLiquidity:!1,error:{code:10001,msg:rg(10001)}};const n=yield r.json();if(n.data!=null)return mj(n.data);const i=n.msg==="liquidity is not enough";return{amountIn:ks,amountOut:ks,routes:[],insufficientLiquidity:i,error:{code:10003,msg:rg(10003)}}})}function yj(e,t){return Et(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=Yi(r),h=Yi(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=1000315",yield fetch(y)}catch(r){return console.error(r),null}})}function bj(e,t){return Et(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=Yi(r),y=Yi(n),b=`${e}/find_routes`,w=l==null?void 0:l.join(","),T={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(T)})}catch(P){return console.error("Error:",P),null}})}function wj(e){return Et(this,null,function*(){const t=`${e}/deepbookv3_config`;try{return(yield fetch(t)).json()}catch(r){return console.error("Error:",r),null}})}var Qx=(e=>(e[e.Mainnet=0]="Mainnet",e[e.Testnet=1]="Testnet",e))(Qx||{}),e4=pj,_j=Qx,ng=R9,Pa=Ns;/*!
|
|
33
|
+
*/(function(P){const N=r,F=A,L=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;P.Buffer=V,P.SlowBuffer=v,P.INSPECT_MAX_BYTES=50;const H=2147483647;P.kMaxLength=H;const{Uint8Array:q,ArrayBuffer:X,SharedArrayBuffer:re}=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 oe(j){if(j>H)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 $(j,S,M)}V.poolSize=8192;function $(j,S,M){if(typeof j=="string")return x(j,S);if(X.isView(j))return C(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 re<"u"&&(gt(j,re)||j&>(j.buffer,re)))return k(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=T(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 $(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?oe(j):S!==void 0?typeof M=="string"?oe(j).fill(S,M):oe(j).fill(S):oe(j)}V.alloc=function(j,S,M){return d(j,S,M)};function m(j){return p(j),oe(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=R(j,S)|0;let B=oe(M);const K=B.write(j,S);return K!==M&&(B=B.slice(0,K)),B}function E(j){const S=j.length<0?0:g(j.length)|0,M=oe(S);for(let B=0;B<S;B+=1)M[B]=j[B]&255;return M}function C(j){if(gt(j,q)){const S=new q(j);return k(S.buffer,S.byteOffset,S.byteLength)}return E(j)}function k(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 T(j){if(V.isBuffer(j)){const S=g(j.length)|0,M=oe(S);return M.length===0||j.copy(M,0,0,S),M}if(j.length!==void 0)return typeof j.length!="number"||It(j.length)?oe(0):E(j);if(j.type==="Buffer"&&Array.isArray(j.data))return E(j.data)}function g(j){if(j>=H)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H.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,ee=Math.min(B,K);Z<ee;++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 ee=S[B];if(gt(ee,q))Z+ee.length>K.length?(V.isBuffer(ee)||(ee=V.from(ee)),ee.copy(K,Z)):q.prototype.set.call(K,ee,Z);else if(V.isBuffer(ee))ee.copy(K,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=ee.length}return K};function R(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 Ot(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M*2;case"hex":return M>>>1;case"base64":return St(j).length;default:if(K)return B?-1:Ot(j).length;S=(""+S).toLowerCase(),K=!0}}V.byteLength=R;function se(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 qe(this,S,M);case"utf8":case"utf-8":return $e(this,S,M);case"ascii":return me(this,S,M);case"latin1":case"binary":return Te(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 ue(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)ue(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)ue(this,M,M+3),ue(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)ue(this,M,M+7),ue(this,M+1,M+6),ue(this,M+2,M+5),ue(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):se.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=P.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 ee=Z-K,Be=B-M;const tt=Math.min(ee,Be),Ne=this.slice(K,Z),z=S.slice(M,B);for(let ne=0;ne<tt;++ne)if(Ne[ne]!==z[ne]){ee=Ne[ne],Be=z[ne];break}return ee<Be?-1:Be<ee?1:0};function xe(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,It(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:be(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):be(j,[S],M,B,K);throw new TypeError("val must be string, number or Buffer")}function be(j,S,M,B,K){let Z=1,ee=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,ee/=2,Be/=2,M/=2}function tt(z,ne){return Z===1?z[ne]:z.readUInt16BE(ne*Z)}let Ne;if(K){let z=-1;for(Ne=M;Ne<ee;Ne++)if(tt(j,Ne)===tt(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>ee&&(M=ee-Be),Ne=M;Ne>=0;Ne--){let z=!0;for(let ne=0;ne<Be;ne++)if(tt(j,Ne+ne)!==tt(S,ne)){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 xe(this,S,M,B,!0)},V.prototype.lastIndexOf=function(S,M,B){return xe(this,S,M,B,!1)};function Ce(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 ee;for(ee=0;ee<B;++ee){const Be=parseInt(S.substr(ee*2,2),16);if(It(Be))return ee;j[M+ee]=Be}return ee}function Me(j,S,M,B){return Je(Ot(S,j.length-M),j,M,B)}function Ke(j,S,M,B){return Je(it(S),j,M,B)}function Ue(j,S,M,B){return Je(St(S),j,M,B)}function lt(j,S,M,B){return Je(yt(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 ee=!1;for(;;)switch(K){case"hex":return Ce(this,S,M,B);case"utf8":case"utf-8":return Me(this,S,M,B);case"ascii":case"latin1":case"binary":return Ke(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(ee)throw new TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),ee=!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 ee=null,Be=Z>239?4:Z>223?3:Z>191?2:1;if(K+Be<=M){let tt,Ne,z,ne;switch(Be){case 1:Z<128&&(ee=Z);break;case 2:tt=j[K+1],(tt&192)===128&&(ne=(Z&31)<<6|tt&63,ne>127&&(ee=ne));break;case 3:tt=j[K+1],Ne=j[K+2],(tt&192)===128&&(Ne&192)===128&&(ne=(Z&15)<<12|(tt&63)<<6|Ne&63,ne>2047&&(ne<55296||ne>57343)&&(ee=ne));break;case 4:tt=j[K+1],Ne=j[K+2],z=j[K+3],(tt&192)===128&&(Ne&192)===128&&(z&192)===128&&(ne=(Z&15)<<18|(tt&63)<<12|(Ne&63)<<6|z&63,ne>65535&&ne<1114112&&(ee=ne))}}ee===null?(ee=65533,Be=1):ee>65535&&(ee-=65536,B.push(ee>>>10&1023|55296),ee=56320|ee&1023),B.push(ee),K+=Be}return we(B)}const mt=4096;function we(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 me(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 Te(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 qe(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,ee=0;for(;++ee<M&&(Z*=256);)K+=this[S+ee]*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=bt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ct(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=bt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ct(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,ee=0;for(;++ee<M&&(Z*=256);)K+=this[S+ee]*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,ee=this[S+--K];for(;K>0&&(Z*=256);)ee+=this[S+--K]*Z;return Z*=128,ee>=Z&&(ee-=Math.pow(2,8*M)),ee},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=bt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ct(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=bt(function(S){S=S>>>0,xt(S,"offset");const M=this[S],B=this[S+7];(M===void 0||B===void 0)&&Ct(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,ee=0;for(this[M]=S&255;++ee<B&&(Z*=256);)this[M+ee]=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,ee=1;for(this[M+Z]=S&255;--Z>=0&&(ee*=256);)this[M+Z]=S/ee&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 Le(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 ee=Number(S>>BigInt(32)&BigInt(4294967295));return j[M++]=ee,ee=ee>>8,j[M++]=ee,ee=ee>>8,j[M++]=ee,ee=ee>>8,j[M++]=ee,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 ee=Number(S>>BigInt(32)&BigInt(4294967295));return j[M+3]=ee,ee=ee>>8,j[M+2]=ee,ee=ee>>8,j[M+1]=ee,ee=ee>>8,j[M]=ee,M+8}V.prototype.writeBigUInt64LE=bt(function(S,M=0){return Le(this,S,M,BigInt(0),BigInt("0xffffffffffffffff"))}),V.prototype.writeBigUInt64BE=bt(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 tt=Math.pow(2,8*B-1);Ie(this,S,M,B,tt-1,-tt)}let Z=0,ee=1,Be=0;for(this[M]=S&255;++Z<B&&(ee*=256);)S<0&&Be===0&&this[M+Z-1]!==0&&(Be=1),this[M+Z]=(S/ee>>0)-Be&255;return M+B},V.prototype.writeIntBE=function(S,M,B,K){if(S=+S,M=M>>>0,!K){const tt=Math.pow(2,8*B-1);Ie(this,S,M,B,tt-1,-tt)}let Z=B-1,ee=1,Be=0;for(this[M+Z]=S&255;--Z>=0&&(ee*=256);)S<0&&Be===0&&this[M+Z+1]!==0&&(Be=1),this[M+Z]=(S/ee>>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=bt(function(S,M=0){return Le(this,S,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),V.prototype.writeBigInt64BE=bt(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 ee=S.charCodeAt(0);(K==="utf8"&&ee<128||K==="latin1")&&(S=ee)}}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 ee=V.isBuffer(S)?S:V.from(S,K),Be=ee.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]=ee[Z%Be]}return this};const _t={};function Ze(j,S,M){_t[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}`}}}Ze("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ze("ERR_INVALID_ARG_TYPE",function(j,S){return`The "${j}" argument must be of type number. Received type ${typeof S}`},TypeError),Ze("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=Mt(String(M)):typeof M=="bigint"&&(K=String(M),(M>BigInt(2)**BigInt(32)||M<-(BigInt(2)**BigInt(32)))&&(K=Mt(K)),K+="n"),B+=` It must be ${S}. Received ${K}`,B},RangeError);function Mt(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 Rt(j,S,M){xt(S,"offset"),(j[S]===void 0||j[S+M]===void 0)&&Ct(S,j.length-(M+1))}function nt(j,S,M,B,K,Z){if(j>M||j<S){const ee=typeof S=="bigint"?"n":"";let Be;throw Z>3?S===0||S===BigInt(0)?Be=`>= 0${ee} and < 2${ee} ** ${(Z+1)*8}${ee}`:Be=`>= -(2${ee} ** ${(Z+1)*8-1}${ee}) and < 2 ** ${(Z+1)*8-1}${ee}`:Be=`>= ${S}${ee} and <= ${M}${ee}`,new _t.ERR_OUT_OF_RANGE("value",Be,j)}Rt(B,K,Z)}function xt(j,S){if(typeof j!="number")throw new _t.ERR_INVALID_ARG_TYPE(S,"number",j)}function Ct(j,S,M){throw Math.floor(j)!==j?(xt(j,M),new _t.ERR_OUT_OF_RANGE(M||"offset","an integer",j)):S<0?new _t.ERR_BUFFER_OUT_OF_BOUNDS:new _t.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 Ot(j,S){S=S||1/0;let M;const B=j.length;let K=null;const Z=[];for(let ee=0;ee<B;++ee){if(M=j.charCodeAt(ee),M>55295&&M<57344){if(!K){if(M>56319){(S-=3)>-1&&Z.push(239,191,189);continue}else if(ee+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 yt(j,S){let M,B,K;const Z=[];for(let ee=0;ee<j.length&&!((S-=2)<0);++ee)M=j.charCodeAt(ee),B=M>>8,K=M%256,Z.push(K),Z.push(B);return Z}function St(j){return N.toByteArray(jt(j))}function Je(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 It(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 bt(j){return typeof BigInt>"u"?Lt:j}function Lt(){throw new Error("BigInt not supported")}})(t);const I=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=I,e.isAscii=t.isAscii,e.isUtf8=t.isUtf8,e.kMaxLength=t.kMaxLength,e.kStringMaxLength=t.kStringMaxLength,e.resolveObjectURL=t.resolveObjectURL,e.transcode=t.transcode}(tf)),tf}Yh.exports;(function(e){(function(t,r){function n($,p){if(!$)throw new Error(p||"Assertion failed")}function i($,p){$.super_=p;var d=function(){};d.prototype=p.prototype,$.prototype=new d,$.prototype.constructor=$}function s($,p,d){if(s.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((p==="le"||p==="be")&&(d=p,p=10),this._init($||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=z_().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 E,C,k=0;if(m==="be")for(x=p.length-1,E=0;x>=0;x-=3)C=p[x]|p[x-1]<<8|p[x-2]<<16,this.words[E]|=C<<k&67108863,this.words[E+1]=C>>>26-k&67108863,k+=24,k>=26&&(k-=26,E++);else if(m==="le")for(x=0,E=0;x<p.length;x+=3)C=p[x]|p[x+1]<<8|p[x+2]<<16,this.words[E]|=C<<k&67108863,this.words[E+1]=C>>>26-k&67108863,k+=24,k>=26&&(k-=26,E++);return this._strip()};function a($,p){var 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 "+$)}function c($,p,d){var m=a($,d);return d-1>=p&&(m|=a($,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 E=0,C=0,k;if(m==="be")for(x=p.length-1;x>=d;x-=2)k=c(p,d,x)<<E,this.words[C]|=k&67108863,E>=18?(E-=18,C+=1,this.words[C]|=k>>>26):E+=8;else{var T=p.length-d;for(x=T%2===0?d+1:d;x<p.length;x+=2)k=c(p,d,x)<<E,this.words[C]|=k&67108863,E>=18?(E-=18,C+=1,this.words[C]|=k>>>26):E+=8}this._strip()};function u($,p,d,m){for(var x=0,E=0,C=Math.min($.length,d),k=p;k<C;k++){var T=$.charCodeAt(k)-48;x*=m,T>=49?E=T-49+10:T>=17?E=T-17+10:E=T,n(T>=0&&E<m,"Invalid character"),x+=E}return x}s.prototype._parseBase=function(p,d,m){this.words=[0],this.length=1;for(var x=0,E=1;E<=67108863;E*=d)x++;x--,E=E/d|0;for(var C=p.length-m,k=C%x,T=Math.min(C,C-k)+m,g=0,v=m;v<T;v+=x)g=u(p,v,v+x,d),this.imuln(E),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(k!==0){var R=1;for(g=u(p,v,p.length,d),v=0;v<k;v++)R*=d;this.imuln(R),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($,p){$.words=p.words,$.length=p.length,$.negative=p.negative,$.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],_=[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,E=0,C=0;C<this.length;C++){var k=this.words[C],T=((k<<x|E)&16777215).toString(16);E=k>>>24-x&16777215,x+=2,x>=26&&(x-=26,C--),E!==0||C!==this.length-1?m=h[6-T.length]+T+m:m=T+m}for(E!==0&&(m=E.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=_[p];m="";var R=this.clone();for(R.negative=0;!R.isZero();){var se=R.modrn(v).toString(p);R=R.idivn(v),R.isZero()?m=se+m:m=h[g-se.length]+se+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(),E=m||Math.max(1,x);n(x<=E,"byte array longer than desired length"),n(E>0,"Requested array length <= 0");var C=w(p,E),k=d==="le"?"LE":"BE";return this["_toArrayLike"+k](C,x),C},s.prototype._toArrayLikeLE=function(p,d){for(var m=0,x=0,E=0,C=0;E<this.length;E++){var k=this.words[E]<<C|x;p[m++]=k&255,m<p.length&&(p[m++]=k>>8&255),m<p.length&&(p[m++]=k>>16&255),C===6?(m<p.length&&(p[m++]=k>>24&255),x=0,C=0):(x=k>>>24,C+=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,E=0,C=0;E<this.length;E++){var k=this.words[E]<<C|x;p[m--]=k&255,m>=0&&(p[m--]=k>>8&255),m>=0&&(p[m--]=k>>16&255),C===6?(m>=0&&(p[m--]=k>>24&255),x=0,C=0):(x=k>>>24,C+=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($){for(var p=new Array($.bitLength()),d=0;d<p.length;d++){var m=d/26|0,x=d%26;p[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 E=0,C=0;C<x.length;C++)d=(m.words[C]|0)+(x.words[C]|0)+E,this.words[C]=d&67108863,E=d>>>26;for(;E!==0&&C<m.length;C++)d=(m.words[C]|0)+E,this.words[C]=d&67108863,E=d>>>26;if(this.length=m.length,E!==0)this.words[this.length]=E,this.length++;else if(m!==this)for(;C<m.length;C++)this.words[C]=m.words[C];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,E;m>0?(x=this,E=p):(x=p,E=this);for(var C=0,k=0;k<E.length;k++)d=(x.words[k]|0)-(E.words[k]|0)+C,C=d>>26,this.words[k]=d&67108863;for(;C!==0&&k<x.length;k++)d=(x.words[k]|0)+C,C=d>>26,this.words[k]=d&67108863;if(C===0&&k<x.length&&x!==this)for(;k<x.length;k++)this.words[k]=x.words[k];return this.length=Math.max(this.length,k),x!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function I($,p,d){d.negative=p.negative^$.negative;var m=$.length+p.length|0;d.length=m,m=m-1|0;var x=$.words[0]|0,E=p.words[0]|0,C=x*E,k=C&67108863,T=C/67108864|0;d.words[0]=k;for(var g=1;g<m;g++){for(var v=T>>>26,R=T&67108863,se=Math.min(g,p.length-1),ue=Math.max(0,g-$.length+1);ue<=se;ue++){var xe=g-ue|0;x=$.words[xe]|0,E=p.words[ue]|0,C=x*E+R,v+=C/67108864|0,R=C&67108863}d.words[g]=R|0,T=v|0}return T!==0?d.words[g]=T|0:d.length--,d._strip()}var P=function(p,d,m){var x=p.words,E=d.words,C=m.words,k=0,T,g,v,R=x[0]|0,se=R&8191,ue=R>>>13,xe=x[1]|0,be=xe&8191,Ce=xe>>>13,Me=x[2]|0,Ke=Me&8191,Ue=Me>>>13,lt=x[3]|0,ht=lt&8191,$e=lt>>>13,mt=x[4]|0,we=mt&8191,me=mt>>>13,Te=x[5]|0,qe=Te&8191,De=Te>>>13,Oe=x[6]|0,Ie=Oe&8191,Le=Oe>>>13,ft=x[7]|0,dt=ft&8191,He=ft>>>13,kt=x[8]|0,_t=kt&8191,Ze=kt>>>13,Mt=x[9]|0,Rt=Mt&8191,nt=Mt>>>13,xt=E[0]|0,Ct=xt&8191,st=xt>>>13,jt=E[1]|0,Ot=jt&8191,it=jt>>>13,yt=E[2]|0,St=yt&8191,Je=yt>>>13,gt=E[3]|0,It=gt&8191,ot=gt>>>13,bt=E[4]|0,Lt=bt&8191,j=bt>>>13,S=E[5]|0,M=S&8191,B=S>>>13,K=E[6]|0,Z=K&8191,ee=K>>>13,Be=E[7]|0,tt=Be&8191,Ne=Be>>>13,z=E[8]|0,ne=z&8191,he=z>>>13,Pe=E[9]|0,We=Pe&8191,Re=Pe>>>13;m.negative=p.negative^d.negative,m.length=19,T=Math.imul(se,Ct),g=Math.imul(se,st),g=g+Math.imul(ue,Ct)|0,v=Math.imul(ue,st);var Fe=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,T=Math.imul(be,Ct),g=Math.imul(be,st),g=g+Math.imul(Ce,Ct)|0,v=Math.imul(Ce,st),T=T+Math.imul(se,Ot)|0,g=g+Math.imul(se,it)|0,g=g+Math.imul(ue,Ot)|0,v=v+Math.imul(ue,it)|0;var at=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(at>>>26)|0,at&=67108863,T=Math.imul(Ke,Ct),g=Math.imul(Ke,st),g=g+Math.imul(Ue,Ct)|0,v=Math.imul(Ue,st),T=T+Math.imul(be,Ot)|0,g=g+Math.imul(be,it)|0,g=g+Math.imul(Ce,Ot)|0,v=v+Math.imul(Ce,it)|0,T=T+Math.imul(se,St)|0,g=g+Math.imul(se,Je)|0,g=g+Math.imul(ue,St)|0,v=v+Math.imul(ue,Je)|0;var Ht=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,T=Math.imul(ht,Ct),g=Math.imul(ht,st),g=g+Math.imul($e,Ct)|0,v=Math.imul($e,st),T=T+Math.imul(Ke,Ot)|0,g=g+Math.imul(Ke,it)|0,g=g+Math.imul(Ue,Ot)|0,v=v+Math.imul(Ue,it)|0,T=T+Math.imul(be,St)|0,g=g+Math.imul(be,Je)|0,g=g+Math.imul(Ce,St)|0,v=v+Math.imul(Ce,Je)|0,T=T+Math.imul(se,It)|0,g=g+Math.imul(se,ot)|0,g=g+Math.imul(ue,It)|0,v=v+Math.imul(ue,ot)|0;var Pt=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,T=Math.imul(we,Ct),g=Math.imul(we,st),g=g+Math.imul(me,Ct)|0,v=Math.imul(me,st),T=T+Math.imul(ht,Ot)|0,g=g+Math.imul(ht,it)|0,g=g+Math.imul($e,Ot)|0,v=v+Math.imul($e,it)|0,T=T+Math.imul(Ke,St)|0,g=g+Math.imul(Ke,Je)|0,g=g+Math.imul(Ue,St)|0,v=v+Math.imul(Ue,Je)|0,T=T+Math.imul(be,It)|0,g=g+Math.imul(be,ot)|0,g=g+Math.imul(Ce,It)|0,v=v+Math.imul(Ce,ot)|0,T=T+Math.imul(se,Lt)|0,g=g+Math.imul(se,j)|0,g=g+Math.imul(ue,Lt)|0,v=v+Math.imul(ue,j)|0;var Nt=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,T=Math.imul(qe,Ct),g=Math.imul(qe,st),g=g+Math.imul(De,Ct)|0,v=Math.imul(De,st),T=T+Math.imul(we,Ot)|0,g=g+Math.imul(we,it)|0,g=g+Math.imul(me,Ot)|0,v=v+Math.imul(me,it)|0,T=T+Math.imul(ht,St)|0,g=g+Math.imul(ht,Je)|0,g=g+Math.imul($e,St)|0,v=v+Math.imul($e,Je)|0,T=T+Math.imul(Ke,It)|0,g=g+Math.imul(Ke,ot)|0,g=g+Math.imul(Ue,It)|0,v=v+Math.imul(Ue,ot)|0,T=T+Math.imul(be,Lt)|0,g=g+Math.imul(be,j)|0,g=g+Math.imul(Ce,Lt)|0,v=v+Math.imul(Ce,j)|0,T=T+Math.imul(se,M)|0,g=g+Math.imul(se,B)|0,g=g+Math.imul(ue,M)|0,v=v+Math.imul(ue,B)|0;var Qt=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,T=Math.imul(Ie,Ct),g=Math.imul(Ie,st),g=g+Math.imul(Le,Ct)|0,v=Math.imul(Le,st),T=T+Math.imul(qe,Ot)|0,g=g+Math.imul(qe,it)|0,g=g+Math.imul(De,Ot)|0,v=v+Math.imul(De,it)|0,T=T+Math.imul(we,St)|0,g=g+Math.imul(we,Je)|0,g=g+Math.imul(me,St)|0,v=v+Math.imul(me,Je)|0,T=T+Math.imul(ht,It)|0,g=g+Math.imul(ht,ot)|0,g=g+Math.imul($e,It)|0,v=v+Math.imul($e,ot)|0,T=T+Math.imul(Ke,Lt)|0,g=g+Math.imul(Ke,j)|0,g=g+Math.imul(Ue,Lt)|0,v=v+Math.imul(Ue,j)|0,T=T+Math.imul(be,M)|0,g=g+Math.imul(be,B)|0,g=g+Math.imul(Ce,M)|0,v=v+Math.imul(Ce,B)|0,T=T+Math.imul(se,Z)|0,g=g+Math.imul(se,ee)|0,g=g+Math.imul(ue,Z)|0,v=v+Math.imul(ue,ee)|0;var gr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(gr>>>26)|0,gr&=67108863,T=Math.imul(dt,Ct),g=Math.imul(dt,st),g=g+Math.imul(He,Ct)|0,v=Math.imul(He,st),T=T+Math.imul(Ie,Ot)|0,g=g+Math.imul(Ie,it)|0,g=g+Math.imul(Le,Ot)|0,v=v+Math.imul(Le,it)|0,T=T+Math.imul(qe,St)|0,g=g+Math.imul(qe,Je)|0,g=g+Math.imul(De,St)|0,v=v+Math.imul(De,Je)|0,T=T+Math.imul(we,It)|0,g=g+Math.imul(we,ot)|0,g=g+Math.imul(me,It)|0,v=v+Math.imul(me,ot)|0,T=T+Math.imul(ht,Lt)|0,g=g+Math.imul(ht,j)|0,g=g+Math.imul($e,Lt)|0,v=v+Math.imul($e,j)|0,T=T+Math.imul(Ke,M)|0,g=g+Math.imul(Ke,B)|0,g=g+Math.imul(Ue,M)|0,v=v+Math.imul(Ue,B)|0,T=T+Math.imul(be,Z)|0,g=g+Math.imul(be,ee)|0,g=g+Math.imul(Ce,Z)|0,v=v+Math.imul(Ce,ee)|0,T=T+Math.imul(se,tt)|0,g=g+Math.imul(se,Ne)|0,g=g+Math.imul(ue,tt)|0,v=v+Math.imul(ue,Ne)|0;var nr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(nr>>>26)|0,nr&=67108863,T=Math.imul(_t,Ct),g=Math.imul(_t,st),g=g+Math.imul(Ze,Ct)|0,v=Math.imul(Ze,st),T=T+Math.imul(dt,Ot)|0,g=g+Math.imul(dt,it)|0,g=g+Math.imul(He,Ot)|0,v=v+Math.imul(He,it)|0,T=T+Math.imul(Ie,St)|0,g=g+Math.imul(Ie,Je)|0,g=g+Math.imul(Le,St)|0,v=v+Math.imul(Le,Je)|0,T=T+Math.imul(qe,It)|0,g=g+Math.imul(qe,ot)|0,g=g+Math.imul(De,It)|0,v=v+Math.imul(De,ot)|0,T=T+Math.imul(we,Lt)|0,g=g+Math.imul(we,j)|0,g=g+Math.imul(me,Lt)|0,v=v+Math.imul(me,j)|0,T=T+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,T=T+Math.imul(Ke,Z)|0,g=g+Math.imul(Ke,ee)|0,g=g+Math.imul(Ue,Z)|0,v=v+Math.imul(Ue,ee)|0,T=T+Math.imul(be,tt)|0,g=g+Math.imul(be,Ne)|0,g=g+Math.imul(Ce,tt)|0,v=v+Math.imul(Ce,Ne)|0,T=T+Math.imul(se,ne)|0,g=g+Math.imul(se,he)|0,g=g+Math.imul(ue,ne)|0,v=v+Math.imul(ue,he)|0;var Wt=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,T=Math.imul(Rt,Ct),g=Math.imul(Rt,st),g=g+Math.imul(nt,Ct)|0,v=Math.imul(nt,st),T=T+Math.imul(_t,Ot)|0,g=g+Math.imul(_t,it)|0,g=g+Math.imul(Ze,Ot)|0,v=v+Math.imul(Ze,it)|0,T=T+Math.imul(dt,St)|0,g=g+Math.imul(dt,Je)|0,g=g+Math.imul(He,St)|0,v=v+Math.imul(He,Je)|0,T=T+Math.imul(Ie,It)|0,g=g+Math.imul(Ie,ot)|0,g=g+Math.imul(Le,It)|0,v=v+Math.imul(Le,ot)|0,T=T+Math.imul(qe,Lt)|0,g=g+Math.imul(qe,j)|0,g=g+Math.imul(De,Lt)|0,v=v+Math.imul(De,j)|0,T=T+Math.imul(we,M)|0,g=g+Math.imul(we,B)|0,g=g+Math.imul(me,M)|0,v=v+Math.imul(me,B)|0,T=T+Math.imul(ht,Z)|0,g=g+Math.imul(ht,ee)|0,g=g+Math.imul($e,Z)|0,v=v+Math.imul($e,ee)|0,T=T+Math.imul(Ke,tt)|0,g=g+Math.imul(Ke,Ne)|0,g=g+Math.imul(Ue,tt)|0,v=v+Math.imul(Ue,Ne)|0,T=T+Math.imul(be,ne)|0,g=g+Math.imul(be,he)|0,g=g+Math.imul(Ce,ne)|0,v=v+Math.imul(Ce,he)|0,T=T+Math.imul(se,We)|0,g=g+Math.imul(se,Re)|0,g=g+Math.imul(ue,We)|0,v=v+Math.imul(ue,Re)|0;var mr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(mr>>>26)|0,mr&=67108863,T=Math.imul(Rt,Ot),g=Math.imul(Rt,it),g=g+Math.imul(nt,Ot)|0,v=Math.imul(nt,it),T=T+Math.imul(_t,St)|0,g=g+Math.imul(_t,Je)|0,g=g+Math.imul(Ze,St)|0,v=v+Math.imul(Ze,Je)|0,T=T+Math.imul(dt,It)|0,g=g+Math.imul(dt,ot)|0,g=g+Math.imul(He,It)|0,v=v+Math.imul(He,ot)|0,T=T+Math.imul(Ie,Lt)|0,g=g+Math.imul(Ie,j)|0,g=g+Math.imul(Le,Lt)|0,v=v+Math.imul(Le,j)|0,T=T+Math.imul(qe,M)|0,g=g+Math.imul(qe,B)|0,g=g+Math.imul(De,M)|0,v=v+Math.imul(De,B)|0,T=T+Math.imul(we,Z)|0,g=g+Math.imul(we,ee)|0,g=g+Math.imul(me,Z)|0,v=v+Math.imul(me,ee)|0,T=T+Math.imul(ht,tt)|0,g=g+Math.imul(ht,Ne)|0,g=g+Math.imul($e,tt)|0,v=v+Math.imul($e,Ne)|0,T=T+Math.imul(Ke,ne)|0,g=g+Math.imul(Ke,he)|0,g=g+Math.imul(Ue,ne)|0,v=v+Math.imul(Ue,he)|0,T=T+Math.imul(be,We)|0,g=g+Math.imul(be,Re)|0,g=g+Math.imul(Ce,We)|0,v=v+Math.imul(Ce,Re)|0;var on=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(on>>>26)|0,on&=67108863,T=Math.imul(Rt,St),g=Math.imul(Rt,Je),g=g+Math.imul(nt,St)|0,v=Math.imul(nt,Je),T=T+Math.imul(_t,It)|0,g=g+Math.imul(_t,ot)|0,g=g+Math.imul(Ze,It)|0,v=v+Math.imul(Ze,ot)|0,T=T+Math.imul(dt,Lt)|0,g=g+Math.imul(dt,j)|0,g=g+Math.imul(He,Lt)|0,v=v+Math.imul(He,j)|0,T=T+Math.imul(Ie,M)|0,g=g+Math.imul(Ie,B)|0,g=g+Math.imul(Le,M)|0,v=v+Math.imul(Le,B)|0,T=T+Math.imul(qe,Z)|0,g=g+Math.imul(qe,ee)|0,g=g+Math.imul(De,Z)|0,v=v+Math.imul(De,ee)|0,T=T+Math.imul(we,tt)|0,g=g+Math.imul(we,Ne)|0,g=g+Math.imul(me,tt)|0,v=v+Math.imul(me,Ne)|0,T=T+Math.imul(ht,ne)|0,g=g+Math.imul(ht,he)|0,g=g+Math.imul($e,ne)|0,v=v+Math.imul($e,he)|0,T=T+Math.imul(Ke,We)|0,g=g+Math.imul(Ke,Re)|0,g=g+Math.imul(Ue,We)|0,v=v+Math.imul(Ue,Re)|0;var Rr=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,T=Math.imul(Rt,It),g=Math.imul(Rt,ot),g=g+Math.imul(nt,It)|0,v=Math.imul(nt,ot),T=T+Math.imul(_t,Lt)|0,g=g+Math.imul(_t,j)|0,g=g+Math.imul(Ze,Lt)|0,v=v+Math.imul(Ze,j)|0,T=T+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,T=T+Math.imul(Ie,Z)|0,g=g+Math.imul(Ie,ee)|0,g=g+Math.imul(Le,Z)|0,v=v+Math.imul(Le,ee)|0,T=T+Math.imul(qe,tt)|0,g=g+Math.imul(qe,Ne)|0,g=g+Math.imul(De,tt)|0,v=v+Math.imul(De,Ne)|0,T=T+Math.imul(we,ne)|0,g=g+Math.imul(we,he)|0,g=g+Math.imul(me,ne)|0,v=v+Math.imul(me,he)|0,T=T+Math.imul(ht,We)|0,g=g+Math.imul(ht,Re)|0,g=g+Math.imul($e,We)|0,v=v+Math.imul($e,Re)|0;var an=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(an>>>26)|0,an&=67108863,T=Math.imul(Rt,Lt),g=Math.imul(Rt,j),g=g+Math.imul(nt,Lt)|0,v=Math.imul(nt,j),T=T+Math.imul(_t,M)|0,g=g+Math.imul(_t,B)|0,g=g+Math.imul(Ze,M)|0,v=v+Math.imul(Ze,B)|0,T=T+Math.imul(dt,Z)|0,g=g+Math.imul(dt,ee)|0,g=g+Math.imul(He,Z)|0,v=v+Math.imul(He,ee)|0,T=T+Math.imul(Ie,tt)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Le,tt)|0,v=v+Math.imul(Le,Ne)|0,T=T+Math.imul(qe,ne)|0,g=g+Math.imul(qe,he)|0,g=g+Math.imul(De,ne)|0,v=v+Math.imul(De,he)|0,T=T+Math.imul(we,We)|0,g=g+Math.imul(we,Re)|0,g=g+Math.imul(me,We)|0,v=v+Math.imul(me,Re)|0;var Qn=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,T=Math.imul(Rt,M),g=Math.imul(Rt,B),g=g+Math.imul(nt,M)|0,v=Math.imul(nt,B),T=T+Math.imul(_t,Z)|0,g=g+Math.imul(_t,ee)|0,g=g+Math.imul(Ze,Z)|0,v=v+Math.imul(Ze,ee)|0,T=T+Math.imul(dt,tt)|0,g=g+Math.imul(dt,Ne)|0,g=g+Math.imul(He,tt)|0,v=v+Math.imul(He,Ne)|0,T=T+Math.imul(Ie,ne)|0,g=g+Math.imul(Ie,he)|0,g=g+Math.imul(Le,ne)|0,v=v+Math.imul(Le,he)|0,T=T+Math.imul(qe,We)|0,g=g+Math.imul(qe,Re)|0,g=g+Math.imul(De,We)|0,v=v+Math.imul(De,Re)|0;var ei=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(ei>>>26)|0,ei&=67108863,T=Math.imul(Rt,Z),g=Math.imul(Rt,ee),g=g+Math.imul(nt,Z)|0,v=Math.imul(nt,ee),T=T+Math.imul(_t,tt)|0,g=g+Math.imul(_t,Ne)|0,g=g+Math.imul(Ze,tt)|0,v=v+Math.imul(Ze,Ne)|0,T=T+Math.imul(dt,ne)|0,g=g+Math.imul(dt,he)|0,g=g+Math.imul(He,ne)|0,v=v+Math.imul(He,he)|0,T=T+Math.imul(Ie,We)|0,g=g+Math.imul(Ie,Re)|0,g=g+Math.imul(Le,We)|0,v=v+Math.imul(Le,Re)|0;var cn=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(cn>>>26)|0,cn&=67108863,T=Math.imul(Rt,tt),g=Math.imul(Rt,Ne),g=g+Math.imul(nt,tt)|0,v=Math.imul(nt,Ne),T=T+Math.imul(_t,ne)|0,g=g+Math.imul(_t,he)|0,g=g+Math.imul(Ze,ne)|0,v=v+Math.imul(Ze,he)|0,T=T+Math.imul(dt,We)|0,g=g+Math.imul(dt,Re)|0,g=g+Math.imul(He,We)|0,v=v+Math.imul(He,Re)|0;var ti=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(ti>>>26)|0,ti&=67108863,T=Math.imul(Rt,ne),g=Math.imul(Rt,he),g=g+Math.imul(nt,ne)|0,v=Math.imul(nt,he),T=T+Math.imul(_t,We)|0,g=g+Math.imul(_t,Re)|0,g=g+Math.imul(Ze,We)|0,v=v+Math.imul(Ze,Re)|0;var ri=(k+T|0)+((g&8191)<<13)|0;k=(v+(g>>>13)|0)+(ri>>>26)|0,ri&=67108863,T=Math.imul(Rt,We),g=Math.imul(Rt,Re),g=g+Math.imul(nt,We)|0,v=Math.imul(nt,Re);var D=(k+T|0)+((g&8191)<<13)|0;return k=(v+(g>>>13)|0)+(D>>>26)|0,D&=67108863,C[0]=Fe,C[1]=at,C[2]=Ht,C[3]=Pt,C[4]=Nt,C[5]=Qt,C[6]=gr,C[7]=nr,C[8]=Wt,C[9]=mr,C[10]=on,C[11]=Rr,C[12]=an,C[13]=Qn,C[14]=ei,C[15]=cn,C[16]=ti,C[17]=ri,C[18]=D,k!==0&&(C[19]=k,m.length++),m};Math.imul||(P=I);function N($,p,d){d.negative=p.negative^$.negative,d.length=$.length+p.length;for(var m=0,x=0,E=0;E<d.length-1;E++){var C=x;x=0;for(var k=m&67108863,T=Math.min(E,p.length-1),g=Math.max(0,E-$.length+1);g<=T;g++){var v=E-g,R=$.words[v]|0,se=p.words[g]|0,ue=R*se,xe=ue&67108863;C=C+(ue/67108864|0)|0,xe=xe+k|0,k=xe&67108863,C=C+(xe>>>26)|0,x+=C>>>26,C&=67108863}d.words[E]=k,m=C,C=x}return m!==0?d.words[E]=m:d.length--,d._strip()}function F($,p,d){return N($,p,d)}s.prototype.mulTo=function(p,d){var m,x=this.length+p.length;return this.length===10&&p.length===10?m=P(this,p,d):x<63?m=I(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 E=(this.words[x]|0)*p,C=(E&67108863)+(m&67108863);m>>=26,m+=E/67108864|0,m+=C>>>26,this.words[x]=C&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 E=m.sqr();x<d.length;x++,E=E.sqr())d[x]!==0&&(m=m.mul(E));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,E;if(d!==0){var C=0;for(E=0;E<this.length;E++){var k=this.words[E]&x,T=(this.words[E]|0)-k<<d;this.words[E]=T|C,C=k>>>26-d}C&&(this.words[E]=C,this.length++)}if(m!==0){for(E=this.length-1;E>=0;E--)this.words[E+m]=this.words[E];for(E=0;E<m;E++)this.words[E]=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 E=p%26,C=Math.min((p-E)/26,this.length),k=67108863^67108863>>>E<<E,T=m;if(x-=C,x=Math.max(0,x),T){for(var g=0;g<C;g++)T.words[g]=this.words[g];T.length=C}if(C!==0)if(this.length>C)for(this.length-=C,g=0;g<this.length;g++)this.words[g]=this.words[g+C];else this.words[0]=0,this.length=1;var v=0;for(g=this.length-1;g>=0&&(v!==0||g>=x);g--){var R=this.words[g]|0;this.words[g]=v<<26-E|R>>>E,v=R&k}return T&&v!==0&&(T.words[T.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 E=this.words[m];return!!(E&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,E;this._expand(x);var C,k=0;for(E=0;E<p.length;E++){C=(this.words[E+m]|0)+k;var T=(p.words[E]|0)*d;C-=T&67108863,k=(C>>26)-(T/67108864|0),this.words[E+m]=C&67108863}for(;E<this.length-m;E++)C=(this.words[E+m]|0)+k,k=C>>26,this.words[E+m]=C&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,E=0;E<this.length;E++)C=-(this.words[E]|0)+k,k=C>>26,this.words[E]=C&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var m=this.length-p.length,x=this.clone(),E=p,C=E.words[E.length-1]|0,k=this._countBits(C);m=26-k,m!==0&&(E=E.ushln(m),x.iushln(m),C=E.words[E.length-1]|0);var T=x.length-E.length,g;if(d!=="mod"){g=new s(null),g.length=T+1,g.words=new Array(g.length);for(var v=0;v<g.length;v++)g.words[v]=0}var R=x.clone()._ishlnsubmul(E,1,T);R.negative===0&&(x=R,g&&(g.words[T]=1));for(var se=T-1;se>=0;se--){var ue=(x.words[E.length+se]|0)*67108864+(x.words[E.length+se-1]|0);for(ue=Math.min(ue/C|0,67108863),x._ishlnsubmul(E,ue,se);x.negative!==0;)ue--,x.negative=0,x._ishlnsubmul(E,1,se),x.isZero()||(x.negative^=1);g&&(g.words[se]=ue)}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,E,C;return this.negative!==0&&p.negative===0?(C=this.neg().divmod(p,d),d!=="mod"&&(x=C.div.neg()),d!=="div"&&(E=C.mod.neg(),m&&E.negative!==0&&E.iadd(p)),{div:x,mod:E}):this.negative===0&&p.negative!==0?(C=this.divmod(p.neg(),d),d!=="mod"&&(x=C.div.neg()),{div:x,mod:C.mod}):this.negative&p.negative?(C=this.neg().divmod(p.neg(),d),d!=="div"&&(E=C.mod.neg(),m&&E.negative!==0&&E.isub(p)),{div:C.div,mod:E}):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),E=p.andln(1),C=m.cmp(x);return C<0||E===1&&C===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,E=this.length-1;E>=0;E--)x=(m*x+(this.words[E]|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 E=(this.words[x]|0)+m*67108864;this.words[x]=E/p|0,m=E%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),E=new s(0),C=new s(0),k=new s(1),T=0;d.isEven()&&m.isEven();)d.iushrn(1),m.iushrn(1),++T;for(var g=m.clone(),v=d.clone();!d.isZero();){for(var R=0,se=1;!(d.words[0]&se)&&R<26;++R,se<<=1);if(R>0)for(d.iushrn(R);R-- >0;)(x.isOdd()||E.isOdd())&&(x.iadd(g),E.isub(v)),x.iushrn(1),E.iushrn(1);for(var ue=0,xe=1;!(m.words[0]&xe)&&ue<26;++ue,xe<<=1);if(ue>0)for(m.iushrn(ue);ue-- >0;)(C.isOdd()||k.isOdd())&&(C.iadd(g),k.isub(v)),C.iushrn(1),k.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(C),E.isub(k)):(m.isub(d),C.isub(x),k.isub(E))}return{a:C,b:k,gcd:m.iushln(T)}},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),E=new s(0),C=m.clone();d.cmpn(1)>0&&m.cmpn(1)>0;){for(var k=0,T=1;!(d.words[0]&T)&&k<26;++k,T<<=1);if(k>0)for(d.iushrn(k);k-- >0;)x.isOdd()&&x.iadd(C),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;)E.isOdd()&&E.iadd(C),E.iushrn(1);d.cmp(m)>=0?(d.isub(m),x.isub(E)):(m.isub(d),E.isub(x))}var R;return d.cmpn(1)===0?R=x:R=E,R.cmpn(0)<0&&R.iadd(p),R},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 E=d.cmp(m);if(E<0){var C=d;d=m,m=C}else if(E===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 E=x,C=m;E!==0&&C<this.length;C++){var k=this.words[C]|0;k+=E,E=k>>>26,k&=67108863,this.words[C]=k}return E!==0&&(this.words[C]=E,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,E=p.words[m]|0;if(x!==E){x<E?d=-1:x>E&&(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 oe(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 H($,p){this.name=$,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()}H.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},H.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},H.prototype.split=function(p,d){p.iushrn(this.n,0,d)},H.prototype.imulK=function(p){return p.imul(this.k)};function q(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(q,H),q.prototype.split=function(p,d){for(var m=4194303,x=Math.min(p.length,9),E=0;E<x;E++)d.words[E]=p.words[E];if(d.length=x,p.length<=9){p.words[0]=0,p.length=1;return}var C=p.words[9];for(d.words[d.length++]=C&m,E=10;E<p.length;E++){var k=p.words[E]|0;p.words[E-10]=(k&m)<<4|C>>>22,C=k}C>>>=22,p.words[E-10]=C,C===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(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(X,H);function re(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(re,H);function ae(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(ae,H),ae.prototype.imulK=function(p){for(var d=0,m=0;m<p.length;m++){var x=(p.words[m]|0)*19+d,E=x&67108863;x>>>=26,p.words[m]=E,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 re;else if(p==="p25519")d=new ae;else throw new Error("Unknown prime "+p);return L[p]=d,d};function oe($){if(typeof $=="string"){var p=s._prime($);this.m=p.p,this.prime=p}else n($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}oe.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},oe.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")},oe.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},oe.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},oe.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)},oe.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},oe.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)},oe.prototype.isub=function(p,d){this._verify2(p,d);var m=p.isub(d);return m.cmpn(0)<0&&m.iadd(this.m),m},oe.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},oe.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},oe.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},oe.prototype.isqr=function(p){return this.imul(p,p.clone())},oe.prototype.sqr=function(p){return this.mul(p,p)},oe.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),E=0;!x.isZero()&&x.andln(1)===0;)E++,x.iushrn(1);n(!x.isZero());var C=new s(1).toRed(this),k=C.redNeg(),T=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,T).cmp(k)!==0;)g.redIAdd(k);for(var v=this.pow(g,x),R=this.pow(p,x.addn(1).iushrn(1)),se=this.pow(p,x),ue=E;se.cmp(C)!==0;){for(var xe=se,be=0;xe.cmp(C)!==0;be++)xe=xe.redSqr();n(be<ue);var Ce=this.pow(v,new s(1).iushln(ue-be-1));R=R.redMul(Ce),v=Ce.redSqr(),se=se.redMul(v),ue=be}return R},oe.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},oe.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 E=2;E<x.length;E++)x[E]=this.mul(x[E-1],p);var C=x[0],k=0,T=0,g=d.bitLength()%26;for(g===0&&(g=26),E=d.length-1;E>=0;E--){for(var v=d.words[E],R=g-1;R>=0;R--){var se=v>>R&1;if(C!==x[0]&&(C=this.sqr(C)),se===0&&k===0){T=0;continue}k<<=1,k|=se,T++,!(T!==m&&(E!==0||R!==0))&&(C=this.mul(C,x[k]),T=0,k=0)}g=26}return C},oe.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},oe.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new V(p)};function V($){oe.call(this,$),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,oe),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),E=m.isub(x).iushrn(this.shift),C=E;return E.cmp(this.m)>=0?C=E.isub(this.m):E.cmpn(0)<0&&(C=E.iadd(this.m)),C._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),E=m.isub(x).iushrn(this.shift),C=E;return E.cmp(this.m)>=0?C=E.isub(this.m):E.cmpn(0)<0&&(C=E.iadd(this.m)),C._forceRed(this)},V.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(e,io)})(Yh);var ck=Yh.exports;const Yp=Qa(ck);/*!
|
|
39
34
|
* decimal.js v10.4.3
|
|
40
35
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
41
36
|
* https://github.com/MikeMcl/decimal.js
|
|
42
37
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
43
38
|
* MIT Licence
|
|
44
|
-
*/var vo=9e15,os=1e9,Hd="0123456789abcdef",ju="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Ru="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Wd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-vo,maxE:vo,crypto:!1},t4,vi,ut=!0,El="[DecimalError] ",Zi=El+"Invalid argument: ",r4=El+"Precision limit exceeded",n4=El+"crypto unavailable",i4="[object Decimal]",Tr=Math.floor,hr=Math.pow,xj=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Sj=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ej=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,s4=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,xn=1e7,Qe=7,Cj=9007199254740991,Mj=ju.length-1,Gd=Ru.length-1,be={toStringTag:i4};be.absoluteValue=be.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ke(e)};be.ceil=function(){return Ke(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(Zi+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())+Qe,n.rounding=1,r=Aj(n,l4(n,r)),n.precision=e,n.rounding=t,Ke(vi==2||vi==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(ut=!1,s=l.s*hr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=xr(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=hr(r,1/3),e=Tr((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),xr(a.d).slice(0,o)===(r=xr(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ke(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")&&(Ke(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ut=!0,Ke(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-Tr(this.e/Qe))*Qe,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 Ke(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 Ke(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/Ml(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Io(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 Ke(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=Io(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Ml(5,e)),i=Io(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,Ke(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()?yn(r,i,s):new r(0):new r(NaN):t.isZero()?yn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=yn(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,ut=!1,r=r.times(r).minus(1).sqrt().plus(r),ut=!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,ut=!1,r=r.times(r).plus(1).sqrt().plus(r),ut=!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?Ke(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=yn(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<=Gd)return o=yn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=Gd)return o=yn(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(ut=!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)),ut=!0,Ke(o,l.precision=f,l.rounding=h,!0)};be.isFinite=function(){return!!this.d};be.isInteger=be.isInt=function(){return!!this.d&&Tr(this.e/Qe)>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(ut=!1,a=f+y,o=Hi(u,a),n=t?Nu(l,a+10):Hi(e,a),c=qt(o,n,a,1),qa(c.d,i=f,h))do if(a+=10,o=Hi(u,a),n=t?Nu(l,a+10):Hi(e,a),c=qt(o,n,a,1),!s){+xr(c.d).slice(i+1,i+15)+1==1e14&&(c=Ke(c,f+1,0));break}while(qa(c.d,i+=10,h));return ut=!0,Ke(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 ut?Ke(e,a,c):e}if(r=Tr(e.e/Qe),l=Tr(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]=xn-1;--u[i],u[n]+=xn}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=Cl(u,r),ut?Ke(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]?Ke(new n(r),n.precision,n.rounding):(ut=!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),ut=!0,r.minus(t))};be.naturalExponential=be.exp=function(){return Kd(this)};be.naturalLogarithm=be.ln=function(){return Hi(this)};be.negated=be.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Ke(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)),ut?Ke(e,a,c):e;if(s=Tr(f.e/Qe),n=Tr(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)/xn|0,u[i]%=xn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Cl(u,n),ut?Ke(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(Zi+e);return r.d?(t=o4(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};be.round=function(){var e=this,t=e.constructor;return Ke(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())+Qe,n.rounding=1,r=Oj(n,l4(n,r)),n.precision=e,n.rounding=t,Ke(vi>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(ut=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=xr(a),(t.length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=Tr((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),xr(s.d).slice(0,r)===(t=xr(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Ke(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")&&(Ke(n,c+1,1),e=!n.times(n).eq(o));break}return ut=!0,Ke(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,Ke(vi==2||vi==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=Tr(l.e/Qe)+Tr(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%xn|0,t=a/xn|0;s[i]=(s[i]+t)%xn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Cl(s,r),ut?Ke(e,f.precision,f.rounding):e};be.toBinary=function(e,t){return zp(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,os),t===void 0?t=n.rounding:Ur(t,0,8),Ke(r,e+r.e+1,t))};be.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Jn(n,!0):(Ur(e,0,os),t===void 0?t=i.rounding:Ur(t,0,8),n=Ke(new i(n),e+1,t),r=Jn(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=Jn(i):(Ur(e,0,os),t===void 0?t=s.rounding:Ur(t,0,8),n=Ke(new s(i),e+i.e+1,t),r=Jn(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=o4(b)-y.e-1,o=s%Qe,t.d[0]=hr(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(Zi+a);e=a.gt(t)?s>0?t:u:a}for(ut=!1,a=new w(xr(b)),l=w.precision,w.precision=s=b.length*Qe*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,ut=!0,h};be.toHexadecimal=be.toHex=function(e,t){return zp(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]?(ut=!1,r=qt(r,e,0,t,1).times(e),ut=!0,Ke(r)):(e.s=r.s,r=e),r};be.toNumber=function(){return+this};be.toOctal=function(e,t){return zp(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(hr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Ke(a,n,s);if(t=Tr(e.e/Qe),t>=e.d.length-1&&(r=u<0?-u:u)<=Cj)return i=a4(c,a,r,n),e.s<0?new c(1).div(i):Ke(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=hr(+a,u),t=r==0||!isFinite(r)?Tr(u*(Math.log("0."+xr(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):(ut=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=Kd(e.times(Hi(a,n+r)),n),i.d&&(i=Ke(i,n+5,1),qa(i.d,n,s)&&(t=n+10,i=Ke(Kd(e.times(Hi(a,t+r)),t),t+5,1),+xr(i.d).slice(n+1,n+15)+1==1e14&&(i=Ke(i,n+1,0)))),i.s=o,ut=!0,c.rounding=s,Ke(i,n,s))};be.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Jn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Ur(e,1,os),t===void 0?t=i.rounding:Ur(t,0,8),n=Ke(new i(n),e,t),r=Jn(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,os),t===void 0?t=n.rounding:Ur(t,0,8)),Ke(new n(r),e,t)};be.toString=function(){var e=this,t=e.constructor,r=Jn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};be.truncated=be.trunc=function(){return Ke(new this.constructor(this),this.e+1,1)};be.valueOf=be.toJSON=function(){var e=this,t=e.constructor,r=Jn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function xr(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+=Li(r)),s+=n;o=e[t],n=o+"",r=Qe-n.length,r&&(s+=Li(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(Zi+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+=Qe,i=0):(i=Math.ceil((t+1)/Qe),t%=Qe),s=hr(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)==hr(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)==hr(10,t-3)-1,o}function su(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]+=Hd.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 Aj(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Ml(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Io(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,T,P,R,N,z,F,W,q,K,te,se,H,L,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=xn,y=Qe,l=Tr(n.e/y)-Tr(i.e/y)),H=m.length,te=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?(W=s=D.precision,o=D.rounding):a?W=s+(n.e-i.e)+1:W=s,W<0)R.push(1),b=!0;else{if(W=W/y+2|0,f=0,H==1){for(h=0,m=m[0],W++;(f<te||h)&&W--;f++)q=h*c+(d[f]||0),R[f]=q/m|0,h=q%m|0;b=h||f<te}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),H=m.length,te=d.length),K=H,N=d.slice(0,H),z=N.length;z<H;)N[z++]=0;L=m.slice(),L.unshift(0),se=m[0],m[1]>=c/2&&++se;do h=0,u=t(m,N,H,z),u<0?(F=N[0],H!=z&&(F=F*c+(N[1]||0)),h=F/se|0,h>1?(h>=c&&(h=c-1),w=e(m,h,c),T=w.length,z=N.length,u=t(w,N,T,z),u==1&&(h--,r(w,H<T?L:m,T,c))):(h==0&&(u=h=1),w=m.slice()),T=w.length,T<z&&w.unshift(0),r(N,w,z,c),u==-1&&(z=N.length,u=t(m,N,H,z),u<1&&(h++,r(N,H<z?L:m,z,c))),z=N.length):u===0&&(h++,N=[0]),R[f++]=h,u&&N[0]?N[z++]=d[K]||0:(N=[d[K]],z=1);while((K++<te||N[0]!==void 0)&&W--);b=N[0]!==void 0}R[0]||R.shift()}if(y==1)P.e=l,t4=b;else{for(f=1,h=R[0];h>=10;h/=10)f++;P.e=f+l*y-1,Ke(P,a?s+P.e+1:s,o,b)}return P}}();function Ke(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/hr(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/hr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%hr(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/hr(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]=hr(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=hr(10,Qe-s),f[h]=o>0?(l/hr(10,i-o)%hr(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]==xn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=xn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return ut&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function Jn(e,t,r){if(!e.isFinite())return u4(e);var n,i=e.e,s=xr(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+Li(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Li(-i-1)+s,r&&(n=r-o)>0&&(s+=Li(n))):i>=o?(s+=Li(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Li(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Li(n))),s}function Cl(e,t){var r=e[0];for(t*=Qe;r>=10;r/=10)t++;return t}function Nu(e,t,r){if(t>Mj)throw ut=!0,r&&(e.precision=r),Error(r4);return Ke(new e(ju),t,1,!0)}function yn(e,t,r){if(t>Gd)throw Error(r4);return Ke(new e(Ru),t,r,!0)}function o4(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 Li(e){for(var t="";e--;)t+="0";return t}function a4(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/Qe+4);for(ut=!1;;){if(r%2&&(s=s.times(t),sg(s.d,o)&&(i=!0)),r=Tr(r/2),r===0){r=s.d.length-1,i&&s.d[r]===0&&++s.d[r];break}t=t.times(t),sg(t.d,o)}return ut=!0,s}function ig(e){return e.d[e.d.length-1]&1}function c4(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 Kd(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?(ut=!1,c=b):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(hr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Ke(s.times(e),c,1),r=r.times(++l),a=o.plus(qt(s,r,c,1)),xr(a.d).slice(0,c)===xr(o.d).slice(0,c)){for(i=f;i--;)o=Ke(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 Ke(o,h.precision=b,y,ut=!0);else return h.precision=b,o}o=a}}function Hi(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,b=10,w=e,T=w.d,P=w.constructor,R=P.rounding,N=P.precision;if(w.s<0||!T||!T[0]||!w.e&&T[0]==1&&T.length==1)return new P(T&&!T[0]?-1/0:w.s!=1?NaN:T?0:w);if(t==null?(ut=!1,l=N):l=t,P.precision=l+=b,r=xr(T),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=xr(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=Nu(P,l+2,N).times(s+""),w=Hi(new P(n+"."+r.slice(1)),l-b).plus(u),P.precision=N,t==null?Ke(w,N,R,ut=!0):w;for(f=w,c=o=w=qt(w.minus(1),w.plus(1),l,1),h=Ke(w.times(w),l,1),i=3;;){if(o=Ke(o.times(h),l,1),u=c.plus(qt(o,new P(i),l,1)),xr(u.d).slice(0,l)===xr(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(Nu(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=Ke(w.times(w),l,1),i=a=1;else return Ke(c,P.precision=N,R,ut=!0);else return P.precision=N,c;c=u,i+=2}}function u4(e){return String(e.s*e.s/0)}function Xd(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),ut&&(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 Tj(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),s4.test(t))return Xd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Sj.test(t))r=16,t=t.toLowerCase();else if(xj.test(t))r=2;else if(Ej.test(t))r=8;else throw Error(Zi+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=a4(n,new n(r),s,s*2)),u=su(t,r,xn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Cl(u,l),e.d=u,ut=!1,o&&(e=qt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?hr(2,c):sn.pow(2,c))),ut=!0,e)}function Oj(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Io(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Ml(5,r)),t=Io(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 Io(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/Qe);for(ut=!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 ut=!0,o.d.length=l+1,o}function Ml(e,t){for(var r=e;--t;)r*=e;return r}function l4(e,t){var r,n=t.s<0,i=yn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return vi=n?4:1,t;if(r=t.divToInt(i),r.isZero())vi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return vi=ig(r)?n?2:3:n?4:1,t;vi=ig(r)?n?1:4:n?3:2}return t.minus(i).abs()}function zp(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,os),n===void 0?n=y.rounding:Ur(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=u4(e);else{for(l=Jn(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=su(Jn(h),10,i),h.e=h.d.length),f=su(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=t4),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+=Hd.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=su(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=Hd.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 sg(e,t){if(e.length>t)return e.length=t,!0}function Ij(e){return new this(e).abs()}function Pj(e){return new this(e).acos()}function kj(e){return new this(e).acosh()}function jj(e,t){return new this(e).plus(t)}function Rj(e){return new this(e).asin()}function Nj(e){return new this(e).asinh()}function Dj(e){return new this(e).atan()}function Bj(e){return new this(e).atanh()}function $j(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=yn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?yn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=yn(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=yn(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 Lj(e){return new this(e).cbrt()}function Fj(e){return Ke(e=new this(e),e.e+1,2)}function Uj(e,t,r){return new this(e).clamp(t,r)}function zj(e){if(!e||typeof e!="object")throw Error(El+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,os,"rounding",0,8,"toExpNeg",-vo,0,"toExpPos",0,vo,"maxE",0,vo,"minE",-vo,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=Wd[r]),(n=e[r])!==void 0)if(Tr(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(Zi+r+": "+n);if(r="crypto",i&&(this[r]=Wd[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(n4);else this[r]=!1;else throw Error(Zi+r+": "+n);return this}function Vj(e){return new this(e).cos()}function qj(e){return new this(e).cosh()}function f4(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,og(s)){u.s=s.s,ut?!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++;ut?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 Xd(u,s.toString())}else if(c!=="string")throw Error(Zi+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),s4.test(s)?Xd(u,s):Tj(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=zj,i.clone=f4,i.isDecimal=og,i.abs=Ij,i.acos=Pj,i.acosh=kj,i.add=jj,i.asin=Rj,i.asinh=Nj,i.atan=Dj,i.atanh=Bj,i.atan2=$j,i.cbrt=Lj,i.ceil=Fj,i.clamp=Uj,i.cos=Vj,i.cosh=qj,i.div=Hj,i.exp=Wj,i.floor=Gj,i.hypot=Kj,i.ln=Xj,i.log=Jj,i.log10=Zj,i.log2=Yj,i.max=Qj,i.min=eR,i.mod=tR,i.mul=rR,i.pow=nR,i.random=iR,i.round=sR,i.sign=oR,i.sin=aR,i.sinh=cR,i.sqrt=uR,i.sub=lR,i.sum=fR,i.tan=dR,i.tanh=hR,i.trunc=pR,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 Hj(e,t){return new this(e).div(t)}function Wj(e){return new this(e).exp()}function Gj(e){return Ke(e=new this(e),e.e+1,3)}function Kj(){var e,t,r=new this(0);for(ut=!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 ut=!0,new this(1/0);r=t}return ut=!0,r.sqrt()}function og(e){return e instanceof sn||e&&e.toStringTag===i4||!1}function Xj(e){return new this(e).ln()}function Jj(e,t){return new this(e).log(t)}function Yj(e){return new this(e).log(2)}function Zj(e){return new this(e).log(10)}function Qj(){return c4(this,arguments,"lt")}function eR(){return c4(this,arguments,"gt")}function tR(e,t){return new this(e).mod(t)}function rR(e,t){return new this(e).mul(t)}function nR(e,t){return new this(e).pow(t)}function iR(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Ur(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(n4);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=Qe,n&&e&&(i=hr(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 sR(e){return Ke(e=new this(e),e.e+1,this.rounding)}function oR(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function aR(e){return new this(e).sin()}function cR(e){return new this(e).sinh()}function uR(e){return new this(e).sqrt()}function lR(e,t){return new this(e).sub(t)}function fR(){var e=0,t=arguments,r=new this(t[e]);for(ut=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ut=!0,Ke(r,this.precision,this.rounding)}function dR(e){return new this(e).tan()}function hR(e){return new this(e).tanh()}function pR(e){return Ke(e=new this(e),e.e+1,1)}be[Symbol.for("nodejs.util.inspect.custom")]=be.toString;be[Symbol.toStringTag]="Decimal";var sn=be.constructor=f4(Wd);ju=new sn(ju);Ru=new sn(Ru);sn.config({precision:256,rounding:sn.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const rn=(e,t,r,n=sn.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Ve(e).equals(0))return"0";if(t!==void 0){const u=ds(e,t,n);if(!Ve(u).equals(0))return r?u:Po(u)}const i=Ve(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(Ve(o).gt(0))!a||Ve(o.length).gte(9)?c=ds(i,0,n):Ve(o.length).gte(4)?c=ds(i,2,n):c=ds(i,4,n);else{ds(i,6,n);const u=bR(a);if(u<6)c=ds(i,u+6,n);else{if(u>30)return"0";c=ds(i,9+(u-6),n)}}return r||Ve(o).lt(1)?c:Po(c)},mR=(e,t=2)=>{if(typeof e>"u"||e==="undefined"||e!==0&&!e)return"--";if(Ve(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=yR(e,t);return Number(r)>0?`+${r}%`:`${r}%`},d4=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=rn(e,t,!0,sn.ROUND_DOWN).toString();if(Ve(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Po(i).toString();return o.includes("e")&&(o=n?i:Po(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),"$--"}},gR=(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}`},Ve=e=>sn.isDecimal(e)?e:new sn(typeof e>"u"||e==="undefined"||!e?0:e);function vR(e,t){return t===void 0?"":Ve(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const ds=(e,t,r)=>Ve(e).toDP(t,r).toString(),yR=(e,t)=>{try{return Ve(e).toDP(t,sn.ROUND_DOWN).toString()}catch{return String(e)}},Po=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 bR(e){let t=0;if(e)for(;t<e.length;){if(Ve(e[t]).gt(0))return t+1;t++}return 0}function wR(e,t){const r=h4(Ve(t));return Number(Ve(e).mul(r))}function _R(e,t){const r=h4(Ve(t));return Number(Ve(e).div(r))}function h4(e){return Ve(10).pow(Ve(e).abs())}function Jd(e,t){const r=_R(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 gR(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 Al(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const $s=(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):"",Vp=(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(!Vp(e[i],t[i]))return!1;return!0};function ag(e){return!e||Object.keys(e).length===0}function p4(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const cg=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function SR(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=Ve(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=Pa(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===Sn.SUI_TYPE_ARG;let f=c.amount;l&&(f=r?f:Ve(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function ug(e,t){if(t){const r=e[Pa(t.coin_type).full_address];if(r)return Jd(Ve(r.amount).abs().toFixed(0),t.decimals)}}function zt(e){return`https://archive.cetus.zone/assets/terminal${e}`}const Pc=(e,t=10)=>e&&(e==null?void 0:e.length)>t&&Ve(t).gt(0)?`${e.slice(0,t)}...`:e,m4="0x2::sui::SUI",ER="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function g4(e){return Mr(e).full_address===m4}function lg(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 Mr(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={...Mr(r),type_arguments:i.map(l=>Mr(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>g4(l)?l:Mr(l).source_address),u.source_address=lg(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===m4||r===ER?"0x2":Sn.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=lg(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function CR(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const qp=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=Sn.normalizeSuiObjectId(n);return t&&(i=CR(i)),`${i}::${r.join("::")}`},MR=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}},AR=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}},Yd="tokenMap",v4="trustedTokenList",y4="collectTokenMap",b4="importTokenList";var w4={exports:{}};/*!
|
|
39
|
+
*/var ho=9e15,os=1e9,id="0123456789abcdef",bu="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",wu="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",sd={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ho,maxE:ho,crypto:!1},V_,mi,ut=!0,Yu="[DecimalError] ",Zi=Yu+"Invalid argument: ",q_=Yu+"Precision limit exceeded",G_=Yu+"crypto unavailable",H_="[object Decimal]",Ar=Math.floor,hr=Math.pow,uk=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,lk=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,fk=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,W_=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,wn=1e7,et=7,dk=9007199254740991,hk=bu.length-1,od=wu.length-1,ye={toStringTag:H_};ye.absoluteValue=ye.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ye(e)};ye.ceil=function(){return Ye(new this.constructor(this),this.e+1,2)};ye.clampedTo=ye.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(Zi+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};ye.comparedTo=ye.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};ye.cosine=ye.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())+et,n.rounding=1,r=pk(n,Z_(n,r)),n.precision=e,n.rounding=t,Ye(mi==2||mi==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};ye.cubeRoot=ye.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(ut=!1,s=l.s*hr(l.s*l,1/3),!s||Math.abs(s)==1/0?(r=_r(l.d),e=l.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=hr(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=Vt(u.plus(l).times(a),u.plus(c),o+2,1),_r(a.d).slice(0,o)===(r=_r(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!i&&r=="4999"){if(!i&&(Ye(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")&&(Ye(n,e+1,1),t=!n.times(n).times(n).eq(l));break}return ut=!0,Ye(n,e,f.rounding,t)};ye.decimalPlaces=ye.dp=function(){var e,t=this.d,r=NaN;if(t){if(e=t.length-1,r=(e-Ar(this.e/et))*et,e=t[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};ye.dividedBy=ye.div=function(e){return Vt(this,new this.constructor(e))};ye.dividedToIntegerBy=ye.divToInt=function(e){var t=this,r=t.constructor;return Ye(Vt(t,new r(e),0,1,1),r.precision,r.rounding)};ye.equals=ye.eq=function(e){return this.cmp(e)===0};ye.floor=function(){return Ye(new this.constructor(this),this.e+1,3)};ye.greaterThan=ye.gt=function(e){return this.cmp(e)>0};ye.greaterThanOrEqualTo=ye.gte=function(e){var t=this.cmp(e);return t==1||t===0};ye.hyperbolicCosine=ye.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/Zu(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=Eo(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 Ye(s,o.precision=r,o.rounding=n,!0)};ye.hyperbolicSine=ye.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=Eo(s,2,i,i,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,i=i.times(1/Zu(5,e)),i=Eo(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,Ye(i,t,r,!0)};ye.hyperbolicTangent=ye.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,Vt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)};ye.inverseCosine=ye.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()?yn(r,i,s):new r(0):new r(NaN):t.isZero()?yn(r,i+4,s).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=yn(r,i+4,s).times(.5),r.precision=i,r.rounding=s,e.minus(t))};ye.inverseHyperbolicCosine=ye.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,ut=!1,r=r.times(r).minus(1).sqrt().plus(r),ut=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)};ye.inverseHyperbolicSine=ye.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,ut=!1,r=r.times(r).plus(1).sqrt().plus(r),ut=!0,n.precision=e,n.rounding=t,r.ln())};ye.inverseHyperbolicTangent=ye.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?Ye(new s(i),e,t,!0):(s.precision=r=n-i.e,i=Vt(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)};ye.inverseSine=ye.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=yn(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)))};ye.inverseTangent=ye.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<=od)return o=yn(l,f+4,h).times(.25),o.s=u.s,o}else{if(!u.s)return new l(NaN);if(f+4<=od)return o=yn(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/et+2|0),e=r;e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(ut=!1,t=Math.ceil(a/et),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)),ut=!0,Ye(o,l.precision=f,l.rounding=h,!0)};ye.isFinite=function(){return!!this.d};ye.isInteger=ye.isInt=function(){return!!this.d&&Ar(this.e/et)>this.d.length-2};ye.isNaN=function(){return!this.s};ye.isNegative=ye.isNeg=function(){return this.s<0};ye.isPositive=ye.isPos=function(){return this.s>0};ye.isZero=function(){return!!this.d&&this.d[0]===0};ye.lessThan=ye.lt=function(e){return this.cmp(e)<0};ye.lessThanOrEqualTo=ye.lte=function(e){return this.cmp(e)<1};ye.logarithm=ye.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(ut=!1,a=f+y,o=Vi(u,a),n=t?_u(l,a+10):Vi(e,a),c=Vt(o,n,a,1),La(c.d,i=f,h))do if(a+=10,o=Vi(u,a),n=t?_u(l,a+10):Vi(e,a),c=Vt(o,n,a,1),!s){+_r(c.d).slice(i+1,i+15)+1==1e14&&(c=Ye(c,f+1,0));break}while(La(c.d,i+=10,h));return ut=!0,Ye(c,f,h)};ye.minus=ye.sub=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,_=y.constructor;if(e=new _(e),!y.d||!e.d)return!y.s||!e.s?e=new _(NaN):y.d?e.s=-e.s:e=new _(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=_.precision,c=_.rounding,!u[0]||!h[0]){if(h[0])e.s=-e.s;else if(u[0])e=new _(y);else return new _(c===3?-0:0);return ut?Ye(e,a,c):e}if(r=Ar(e.e/et),l=Ar(y.e/et),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/et),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]=wn-1;--u[i],u[n]+=wn}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=Ju(u,r),ut?Ye(e,a,c):e):new _(c===3?-0:0)};ye.modulo=ye.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]?Ye(new n(r),n.precision,n.rounding):(ut=!1,n.modulo==9?(t=Vt(r,e.abs(),0,3,1),t.s*=e.s):t=Vt(r,e,0,n.modulo,1),t=t.times(e),ut=!0,r.minus(t))};ye.naturalExponential=ye.exp=function(){return ad(this)};ye.naturalLogarithm=ye.ln=function(){return Vi(this)};ye.negated=ye.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Ye(e)};ye.plus=ye.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)),ut?Ye(e,a,c):e;if(s=Ar(f.e/et),n=Ar(e.e/et),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/et),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)/wn|0,u[i]%=wn;for(t&&(u.unshift(t),++n),o=u.length;u[--o]==0;)u.pop();return e.d=u,e.e=Ju(u,n),ut?Ye(e,a,c):e};ye.precision=ye.sd=function(e){var t,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Zi+e);return r.d?(t=K_(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t};ye.round=function(){var e=this,t=e.constructor;return Ye(new t(e),e.e+1,t.rounding)};ye.sine=ye.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())+et,n.rounding=1,r=gk(n,Z_(n,r)),n.precision=e,n.rounding=t,Ye(mi>2?r.neg():r,e,t,!0)):new n(NaN)};ye.squareRoot=ye.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(ut=!1,u=Math.sqrt(+o),u==0||u==1/0?(t=_r(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(Vt(o,s,r+2,1)).times(.5),_r(s.d).slice(0,r)===(t=_r(n.d)).slice(0,r))if(t=t.slice(r-3,r+1),t=="9999"||!i&&t=="4999"){if(!i&&(Ye(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")&&(Ye(n,c+1,1),e=!n.times(n).eq(o));break}return ut=!0,Ye(n,c,l.rounding,e)};ye.tangent=ye.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=Vt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Ye(mi==2||mi==4?r.neg():r,e,t,!0)):new n(NaN)};ye.times=ye.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/et)+Ar(e.e/et),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%wn|0,t=a/wn|0;s[i]=(s[i]+t)%wn|0}for(;!s[--o];)s.pop();return t?++r:s.shift(),e.d=s,e.e=Ju(s,r),ut?Ye(e,f.precision,f.rounding):e};ye.toBinary=function(e,t){return Jh(this,2,e,t)};ye.toDecimalPlaces=ye.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Lr(e,0,os),t===void 0?t=n.rounding:Lr(t,0,8),Ye(r,e+r.e+1,t))};ye.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Wn(n,!0):(Lr(e,0,os),t===void 0?t=i.rounding:Lr(t,0,8),n=Ye(new i(n),e+1,t),r=Wn(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};ye.toFixed=function(e,t){var r,n,i=this,s=i.constructor;return e===void 0?r=Wn(i):(Lr(e,0,os),t===void 0?t=s.rounding:Lr(t,0,8),n=Ye(new s(i),e+i.e+1,t),r=Wn(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r};ye.toFraction=function(e){var t,r,n,i,s,o,a,c,u,l,f,h,y=this,_=y.d,w=y.constructor;if(!_)return new w(y);if(u=r=new w(1),n=c=new w(0),t=new w(n),s=t.e=K_(_)-y.e-1,o=s%et,t.d[0]=hr(10,o<0?et+o:o),e==null)e=s>0?t:u;else{if(a=new w(e),!a.isInt()||a.lt(u))throw Error(Zi+a);e=a.gt(t)?s>0?t:u:a}for(ut=!1,a=new w(_r(_)),l=w.precision,w.precision=s=_.length*et*2;f=Vt(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=Vt(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=Vt(u,n,s,1).minus(y).abs().cmp(Vt(c,r,s,1).minus(y).abs())<1?[u,n]:[c,r],w.precision=l,ut=!0,h};ye.toHexadecimal=ye.toHex=function(e,t){return Jh(this,16,e,t)};ye.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:Lr(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]?(ut=!1,r=Vt(r,e,0,t,1).times(e),ut=!0,Ye(r)):(e.s=r.s,r=e),r};ye.toNumber=function(){return+this};ye.toOctal=function(e,t){return Jh(this,8,e,t)};ye.toPower=ye.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(hr(+a,u));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return Ye(a,n,s);if(t=Ar(e.e/et),t>=e.d.length-1&&(r=u<0?-u:u)<=dk)return i=X_(c,a,r,n),e.s<0?new c(1).div(i):Ye(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=hr(+a,u),t=r==0||!isFinite(r)?Ar(u*(Math.log("0."+_r(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):(ut=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),i=ad(e.times(Vi(a,n+r)),n),i.d&&(i=Ye(i,n+5,1),La(i.d,n,s)&&(t=n+10,i=Ye(ad(e.times(Vi(a,t+r)),t),t+5,1),+_r(i.d).slice(n+1,n+15)+1==1e14&&(i=Ye(i,n+1,0)))),i.s=o,ut=!0,c.rounding=s,Ye(i,n,s))};ye.toPrecision=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=Wn(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Lr(e,1,os),t===void 0?t=i.rounding:Lr(t,0,8),n=Ye(new i(n),e,t),r=Wn(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};ye.toSignificantDigits=ye.toSD=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Lr(e,1,os),t===void 0?t=n.rounding:Lr(t,0,8)),Ye(new n(r),e,t)};ye.toString=function(){var e=this,t=e.constructor,r=Wn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};ye.truncated=ye.trunc=function(){return Ye(new this.constructor(this),this.e+1,1)};ye.valueOf=ye.toJSON=function(){var e=this,t=e.constructor,r=Wn(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};function _r(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=et-n.length,r&&(s+=Ui(r)),s+=n;o=e[t],n=o+"",r=et-n.length,r&&(s+=Ui(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function Lr(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Zi+e)}function La(e,t,r,n){var i,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=et,i=0):(i=Math.ceil((t+1)/et),t%=et),s=hr(10,et-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)==hr(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)==hr(10,t-3)-1,o}function Vc(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]+=id.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 pk(e,t){var r,n,i;if(t.isZero())return t;n=t.d.length,n<32?(r=Math.ceil(n/3),i=(1/Zu(4,r)).toString()):(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Eo(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 Vt=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,_,w,A,I,P,N,F,L,H,q,X,re,ae,oe,V,$=n.constructor,p=n.s==i.s?1:-1,d=n.d,m=i.d;if(!d||!d[0]||!m||!m[0])return new $(!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=wn,y=et,l=Ar(n.e/y)-Ar(i.e/y)),oe=m.length,re=d.length,I=new $(p),P=I.d=[],f=0;m[f]==(d[f]||0);f++);if(m[f]>(d[f]||0)&&l--,s==null?(H=s=$.precision,o=$.rounding):a?H=s+(n.e-i.e)+1:H=s,H<0)P.push(1),_=!0;else{if(H=H/y+2|0,f=0,oe==1){for(h=0,m=m[0],H++;(f<re||h)&&H--;f++)q=h*c+(d[f]||0),P[f]=q/m|0,h=q%m|0;_=h||f<re}else{for(h=c/(m[0]+1)|0,h>1&&(m=e(m,h,c),d=e(d,h,c),oe=m.length,re=d.length),X=oe,N=d.slice(0,oe),F=N.length;F<oe;)N[F++]=0;V=m.slice(),V.unshift(0),ae=m[0],m[1]>=c/2&&++ae;do h=0,u=t(m,N,oe,F),u<0?(L=N[0],oe!=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,oe<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,oe,F),u<1&&(h++,r(N,oe<F?V:m,F,c))),F=N.length):u===0&&(h++,N=[0]),P[f++]=h,u&&N[0]?N[F++]=d[X]||0:(N=[d[X]],F=1);while((X++<re||N[0]!==void 0)&&H--);_=N[0]!==void 0}P[0]||P.shift()}if(y==1)I.e=l,V_=_;else{for(f=1,h=P[0];h>=10;h/=10)f++;I.e=f+l*y-1,Ye(I,a?s+I.e+1:s,o,_)}return I}}();function Ye(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+=et,o=t,l=f[h=0],c=l/hr(10,i-o-1)%10|0;else if(h=Math.ceil((s+1)/et),a=f.length,h>=a)if(n){for(;a++<=h;)f.push(0);l=c=0,i=1,s%=et,o=s-et+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;s%=et,o=s-et+i,c=o<0?0:l/hr(10,i-o-1)%10|0}if(n=n||t<0||f[h+1]!==void 0||(o<0?l:l%hr(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/hr(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]=hr(10,(et-t%et)%et),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=hr(10,et-s),f[h]=o>0?(l/hr(10,i-o)%hr(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]==wn&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=wn)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return ut&&(e.e>y.maxE?(e.d=null,e.e=NaN):e.e<y.minE&&(e.e=0,e.d=[0])),e}function Wn(e,t,r){if(!e.isFinite())return J_(e);var n,i=e.e,s=_r(e.d),o=s.length;return t?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+Ui(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+Ui(-i-1)+s,r&&(n=r-o)>0&&(s+=Ui(n))):i>=o?(s+=Ui(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+Ui(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=Ui(n))),s}function Ju(e,t){var r=e[0];for(t*=et;r>=10;r/=10)t++;return t}function _u(e,t,r){if(t>hk)throw ut=!0,r&&(e.precision=r),Error(q_);return Ye(new e(bu),t,1,!0)}function yn(e,t,r){if(t>od)throw Error(q_);return Ye(new e(wu),t,r,!0)}function K_(e){var t=e.length-1,r=t*et+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 Ui(e){for(var t="";e--;)t+="0";return t}function X_(e,t,r,n){var i,s=new e(1),o=Math.ceil(n/et+4);for(ut=!1;;){if(r%2&&(s=s.times(t),Zp(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),Zp(t.d,o)}return ut=!0,s}function Jp(e){return e.d[e.d.length-1]&1}function Y_(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 ad(e,t){var r,n,i,s,o,a,c,u=0,l=0,f=0,h=e.constructor,y=h.rounding,_=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?(ut=!1,c=_):c=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(n=Math.log(hr(2,f))/Math.LN10*2+5|0,c+=n,r=s=o=new h(1),h.precision=c;;){if(s=Ye(s.times(e),c,1),r=r.times(++l),a=o.plus(Vt(s,r,c,1)),_r(a.d).slice(0,c)===_r(o.d).slice(0,c)){for(i=f;i--;)o=Ye(o.times(o),c,1);if(t==null)if(u<3&&La(o.d,c-n,y,u))h.precision=c+=10,r=s=a=new h(1),l=0,u++;else return Ye(o,h.precision=_,y,ut=!0);else return h.precision=_,o}o=a}}function Vi(e,t){var r,n,i,s,o,a,c,u,l,f,h,y=1,_=10,w=e,A=w.d,I=w.constructor,P=I.rounding,N=I.precision;if(w.s<0||!A||!A[0]||!w.e&&A[0]==1&&A.length==1)return new I(A&&!A[0]?-1/0:w.s!=1?NaN:A?0:w);if(t==null?(ut=!1,l=N):l=t,I.precision=l+=_,r=_r(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=_r(w.d),n=r.charAt(0),y++;s=w.e,n>1?(w=new I("0."+r),s++):w=new I(n+"."+r.slice(1))}else return u=_u(I,l+2,N).times(s+""),w=Vi(new I(n+"."+r.slice(1)),l-_).plus(u),I.precision=N,t==null?Ye(w,N,P,ut=!0):w;for(f=w,c=o=w=Vt(w.minus(1),w.plus(1),l,1),h=Ye(w.times(w),l,1),i=3;;){if(o=Ye(o.times(h),l,1),u=c.plus(Vt(o,new I(i),l,1)),_r(u.d).slice(0,l)===_r(c.d).slice(0,l))if(c=c.times(2),s!==0&&(c=c.plus(_u(I,l+2,N).times(s+""))),c=Vt(c,new I(y),l,1),t==null)if(La(c.d,l-_,P,a))I.precision=l+=_,u=o=w=Vt(f.minus(1),f.plus(1),l,1),h=Ye(w.times(w),l,1),i=a=1;else return Ye(c,I.precision=N,P,ut=!0);else return I.precision=N,c;c=u,i+=2}}function J_(e){return String(e.s*e.s/0)}function cd(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)%et,r<0&&(n+=et),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=et;n<i;)e.d.push(+t.slice(n,n+=et));t=t.slice(n),n=et-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),ut&&(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 mk(e,t){var r,n,i,s,o,a,c,u,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),W_.test(t))return cd(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(lk.test(t))r=16,t=t.toLowerCase();else if(uk.test(t))r=2;else if(fk.test(t))r=8;else throw Error(Zi+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=X_(n,new n(r),s,s*2)),u=Vc(t,r,wn),l=u.length-1,s=l;u[s]===0;--s)u.pop();return s<0?new n(e.s*0):(e.e=Ju(u,l),e.d=u,ut=!1,o&&(e=Vt(e,i,a*4)),c&&(e=e.times(Math.abs(c)<54?hr(2,c):rn.pow(2,c))),ut=!0,e)}function gk(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Eo(e,2,t,t);r=1.4*Math.sqrt(n),r=r>16?16:r|0,t=t.times(1/Zu(5,r)),t=Eo(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 Eo(e,t,r,n,i){var s,o,a,c,u=e.precision,l=Math.ceil(u/et);for(ut=!1,c=r.times(r),a=new e(n);;){if(o=Vt(a.times(c),new e(t++*t++),u,1),a=i?n.plus(o):n.minus(o),n=Vt(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 ut=!0,o.d.length=l+1,o}function Zu(e,t){for(var r=e;--t;)r*=e;return r}function Z_(e,t){var r,n=t.s<0,i=yn(e,e.precision,1),s=i.times(.5);if(t=t.abs(),t.lte(s))return mi=n?4:1,t;if(r=t.divToInt(i),r.isZero())mi=n?3:2;else{if(t=t.minus(r.times(i)),t.lte(s))return mi=Jp(r)?n?2:3:n?4:1,t;mi=Jp(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Jh(e,t,r,n){var i,s,o,a,c,u,l,f,h,y=e.constructor,_=r!==void 0;if(_?(Lr(r,1,os),n===void 0?n=y.rounding:Lr(n,0,8)):(r=y.precision,n=y.rounding),!e.isFinite())l=J_(e);else{for(l=Wn(e),o=l.indexOf("."),_?(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=Vc(Wn(h),10,i),h.e=h.d.length),f=Vc(l,10,i),s=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=_?"0p+0":"0";else{if(o<0?s--:(e=new y(e),e.d=f,e.e=s,e=Vt(e,h,r,n,0,i),f=e.d,s=e.e,u=V_),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+=id.charAt(f[o]);if(_){if(c>1)if(t==16||t==8){for(o=t==16?4:3,--c;c%o;c++)l+="0";for(f=Vc(l,i,t),c=f.length;!f[c-1];--c);for(o=1,l="1.";o<c;o++)l+=id.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 Zp(e,t){if(e.length>t)return e.length=t,!0}function vk(e){return new this(e).abs()}function yk(e){return new this(e).acos()}function bk(e){return new this(e).acosh()}function wk(e,t){return new this(e).plus(t)}function _k(e){return new this(e).asin()}function xk(e){return new this(e).asinh()}function Sk(e){return new this(e).atan()}function Ek(e){return new this(e).atanh()}function Mk(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=yn(this,s,1).times(t.s>0?.25:.75),r.s=e.s):!t.d||e.isZero()?(r=t.s<0?yn(this,n,i):new this(0),r.s=e.s):!e.d||t.isZero()?(r=yn(this,s,1).times(.5),r.s=e.s):t.s<0?(this.precision=s,this.rounding=1,r=this.atan(Vt(e,t,s,1)),t=yn(this,s,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Vt(e,t,s,1)),r}function Ck(e){return new this(e).cbrt()}function Ak(e){return Ye(e=new this(e),e.e+1,2)}function Tk(e,t,r){return new this(e).clamp(t,r)}function Ok(e){if(!e||typeof e!="object")throw Error(Yu+"Object expected");var t,r,n,i=e.defaults===!0,s=["precision",1,os,"rounding",0,8,"toExpNeg",-ho,0,"toExpPos",0,ho,"maxE",0,ho,"minE",-ho,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(r=s[t],i&&(this[r]=sd[r]),(n=e[r])!==void 0)if(Ar(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(Zi+r+": "+n);if(r="crypto",i&&(this[r]=sd[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(G_);else this[r]=!1;else throw Error(Zi+r+": "+n);return this}function Ik(e){return new this(e).cos()}function kk(e){return new this(e).cosh()}function Q_(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,Qp(s)){u.s=s.s,ut?!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++;ut?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 cd(u,s.toString())}else if(c!=="string")throw Error(Zi+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),u.s=-1):(a===43&&(s=s.slice(1)),u.s=1),W_.test(s)?cd(u,s):mk(u,s)}if(i.prototype=ye,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=Ok,i.clone=Q_,i.isDecimal=Qp,i.abs=vk,i.acos=yk,i.acosh=bk,i.add=wk,i.asin=_k,i.asinh=xk,i.atan=Sk,i.atanh=Ek,i.atan2=Mk,i.cbrt=Ck,i.ceil=Ak,i.clamp=Tk,i.cos=Ik,i.cosh=kk,i.div=jk,i.exp=Pk,i.floor=Rk,i.hypot=Nk,i.ln=Dk,i.log=$k,i.log10=Lk,i.log2=Bk,i.max=Uk,i.min=Fk,i.mod=zk,i.mul=Vk,i.pow=qk,i.random=Gk,i.round=Hk,i.sign=Wk,i.sin=Kk,i.sinh=Xk,i.sqrt=Yk,i.sub=Jk,i.sum=Zk,i.tan=Qk,i.tanh=ej,i.trunc=tj,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 jk(e,t){return new this(e).div(t)}function Pk(e){return new this(e).exp()}function Rk(e){return Ye(e=new this(e),e.e+1,3)}function Nk(){var e,t,r=new this(0);for(ut=!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 ut=!0,new this(1/0);r=t}return ut=!0,r.sqrt()}function Qp(e){return e instanceof rn||e&&e.toStringTag===H_||!1}function Dk(e){return new this(e).ln()}function $k(e,t){return new this(e).log(t)}function Bk(e){return new this(e).log(2)}function Lk(e){return new this(e).log(10)}function Uk(){return Y_(this,arguments,"lt")}function Fk(){return Y_(this,arguments,"gt")}function zk(e,t){return new this(e).mod(t)}function Vk(e,t){return new this(e).mul(t)}function qk(e,t){return new this(e).pow(t)}function Gk(e){var t,r,n,i,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:Lr(e,1,os),n=Math.ceil(e/et),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(G_);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=et,n&&e&&(i=hr(10,et-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-=et)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<et&&(r-=et-n)}return o.e=r,o.d=a,o}function Hk(e){return Ye(e=new this(e),e.e+1,this.rounding)}function Wk(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function Kk(e){return new this(e).sin()}function Xk(e){return new this(e).sinh()}function Yk(e){return new this(e).sqrt()}function Jk(e,t){return new this(e).sub(t)}function Zk(){var e=0,t=arguments,r=new this(t[e]);for(ut=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return ut=!0,Ye(r,this.precision,this.rounding)}function Qk(e){return new this(e).tan()}function ej(e){return new this(e).tanh()}function tj(e){return Ye(e=new this(e),e.e+1,1)}ye[Symbol.for("nodejs.util.inspect.custom")]=ye.toString;ye[Symbol.toStringTag]="Decimal";var rn=ye.constructor=Q_(sd);bu=new rn(bu);wu=new rn(wu);rn.config({precision:256,rounding:rn.ROUND_DOWN,toExpNeg:-256,toExpPos:256});const en=(e,t,r,n=rn.ROUND_HALF_DOWN)=>{if(e==="∞")return"∞";if(e!=="0"&&!e||Ve(e).equals(0))return"0";if(t!==void 0){const u=fs(e,t,n);if(!Ve(u).equals(0))return r?u:Mo(u)}const i=Ve(e).toString(),s=i.split("."),o=s[0],a=s[1];let c;if(Ve(o).gt(0))!a||Ve(o.length).gte(9)?c=fs(i,0,n):Ve(o.length).gte(4)?c=fs(i,2,n):c=fs(i,4,n);else{fs(i,6,n);const u=oj(a);if(u<6)c=fs(i,u+6,n);else{if(u>30)return"0";c=fs(i,9+(u-6),n)}}return r||Ve(o).lt(1)?c:Mo(c)},rj=(e,t=2)=>{if(typeof e>"u"||e==="undefined"||e!==0&&!e)return"--";if(Ve(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=sj(e,t);return Number(r)>0?`+${r}%`:`${r}%`},e4=(e,t,r,n)=>{try{if(e===void 0||e==="--")return"$--";const i=en(e,t,!0,rn.ROUND_DOWN).toString();if(Ve(i).equals(0))return"$0";const s=i.startsWith("-");let o=n?i:Mo(i).toString();return o.includes("e")&&(o=n?i:Mo(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"$--"}},nj=(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 _=0;_<f;_+=1){const w=u[_]||"0";h+=w}o=c+h+y}else{let _="0";for(let w=0;w<f;w+=1)h=(c[c.length-w-1]||"0")+h;c.length>f&&(_=c.substr(0,c.length-f)),o=`${_}.${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}`},Ve=e=>rn.isDecimal(e)?e:new rn(typeof e>"u"||e==="undefined"||!e?0:e);function ij(e,t){return t===void 0?"":Ve(e==null?void 0:e.toString()).div(Math.pow(10,t)).toString()}const fs=(e,t,r)=>Ve(e).toDP(t,r).toString(),sj=(e,t)=>{try{return Ve(e).toDP(t,rn.ROUND_DOWN).toString()}catch{return String(e)}},Mo=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 oj(e){let t=0;if(e)for(;t<e.length;){if(Ve(e[t]).gt(0))return t+1;t++}return 0}function aj(e,t){const r=t4(Ve(t));return Number(Ve(e).mul(r))}function cj(e,t){const r=t4(Ve(t));return Number(Ve(e).div(r))}function t4(e){return Ve(10).pow(Ve(e).abs())}function ud(e,t){const r=cj(e,t);return uj(r.toString(),Number(t))}function uj(e,t=9){if(e===void 0)return"";const r=e.toLowerCase();if(r.includes("e")){if(r.includes("+"))return nj(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 Qu(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}const Ps=(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):"",Zh=(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(!Zh(e[i],t[i]))return!1;return!0};function em(e){return!e||Object.keys(e).length===0}function r4(e){var t;return!!(((t=e.split("::"))==null?void 0:t.length)===3&&e.startsWith("0x"))}const tm=async e=>new Promise(t=>{setTimeout(()=>{t(1)},e)});function lj(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=Ve(i.computationCost).add(i.storageCost).sub(i.storageRebate).mul(-1).toFixed(0)),n&&n.forEach(c=>{const u=Ta(c.coinType).full_address;if(c.owner.AddressOwner===t){const l=u===qd;let f=c.amount;l&&(f=r?f:Ve(f).sub(o).toFixed(0));const h={coinType:u,amount:f};s[u]=h}}),s}function rm(e,t){if(t){const r=e[Ta(t.coin_type).full_address];if(r)return ud(Ve(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&&Ve(t).gt(0)?`${e.slice(0,t)}...`:e,n4="0x2::sui::SUI",fj="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";function i4(e){return Mr(e).full_address===n4}function nm(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 Mr(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={...Mr(r),type_arguments:i.map(l=>Mr(l).source_address)};return u.type_arguments=u.type_arguments.map(l=>i4(l)?l:Mr(l).source_address),u.source_address=nm(u.full_address,u.type_arguments),u}const s=r.split("::"),a={full_address:r,address:r===n4||r===fj?"0x2":hi(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=nm(a.full_address,a.type_arguments),a}catch{return{full_address:e,address:"",module:"",name:"",type_arguments:[],source_address:e}}}function dj(e){return e.startsWith("0x")?`${e.slice(2)}`:e}const Qh=(e,t=!0)=>{const r=e.split("::"),n=r.shift();let i=hi(n);return t&&(i=dj(i)),`${i}::${r.join("::")}`},hj=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}},pj=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}},ld="tokenMap",s4="trustedTokenList",o4="collectTokenMap",a4="importTokenList";var c4={exports:{}};/*!
|
|
45
40
|
localForage -- Offline Storage, Improved
|
|
46
41
|
Version 1.10.0
|
|
47
42
|
https://localforage.github.io/localForage
|
|
48
43
|
(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 Ln=="function"&&Ln;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 Ln=="function"&&Ln,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 T=s.document.createElement("script");T.onreadystatechange=function(){b(),T.onreadystatechange=null,T.parentNode.removeChild(T),T=null},s.document.documentElement.appendChild(T)}:a=function(){setTimeout(b,0)};var h,y=[];function b(){h=!0;for(var T,P,R=y.length;R;){for(P=y,y=[],T=-1;++T<R;)P[T]();R=y.length}h=!1}n.exports=w;function w(T){y.push(T)===1&&!h&&a()}}).call(this,typeof Rr<"u"?Rr: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(F){if(typeof F!="function")throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,F!==o&&w(this,F)}f.prototype.catch=function(F){return this.then(null,F)},f.prototype.then=function(F,W){if(typeof F!="function"&&this.state===u||typeof W!="function"&&this.state===c)return this;var q=new this.constructor(o);if(this.state!==l){var K=this.state===u?F:W;y(q,K,this.outcome)}else this.queue.push(new h(q,F,W));return q};function h(F,W,q){this.promise=F,typeof W=="function"&&(this.onFulfilled=W,this.callFulfilled=this.otherCallFulfilled),typeof q=="function"&&(this.onRejected=q,this.callRejected=this.otherCallRejected)}h.prototype.callFulfilled=function(F){a.resolve(this.promise,F)},h.prototype.otherCallFulfilled=function(F){y(this.promise,this.onFulfilled,F)},h.prototype.callRejected=function(F){a.reject(this.promise,F)},h.prototype.otherCallRejected=function(F){y(this.promise,this.onRejected,F)};function y(F,W,q){s(function(){var K;try{K=W(q)}catch(te){return a.reject(F,te)}K===F?a.reject(F,new TypeError("Cannot resolve promise with itself")):a.resolve(F,K)})}a.resolve=function(F,W){var q=T(b,W);if(q.status==="error")return a.reject(F,q.value);var K=q.value;if(K)w(F,K);else{F.state=u,F.outcome=W;for(var te=-1,se=F.queue.length;++te<se;)F.queue[te].callFulfilled(W)}return F},a.reject=function(F,W){F.state=c,F.outcome=W;for(var q=-1,K=F.queue.length;++q<K;)F.queue[q].callRejected(W);return F};function b(F){var W=F&&F.then;if(F&&(typeof F=="object"||typeof F=="function")&&typeof W=="function")return function(){W.apply(F,arguments)}}function w(F,W){var q=!1;function K(L){q||(q=!0,a.reject(F,L))}function te(L){q||(q=!0,a.resolve(F,L))}function se(){W(te,K)}var H=T(se);H.status==="error"&&K(H.value)}function T(F,W){var q={};try{q.value=F(W),q.status="success"}catch(K){q.status="error",q.value=K}return q}f.resolve=P;function P(F){return F instanceof this?F:a.resolve(new this(o),F)}f.reject=R;function R(F){var W=new this(o);return a.reject(W,F)}f.all=N;function N(F){var W=this;if(Object.prototype.toString.call(F)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=F.length,K=!1;if(!q)return this.resolve([]);for(var te=new Array(q),se=0,H=-1,L=new this(o);++H<q;)D(F[H],H);return L;function D(p,d){W.resolve(p).then(m,function(x){K||(K=!0,a.reject(L,x))});function m(x){te[d]=x,++se===q&&!K&&(K=!0,a.resolve(L,te))}}}f.race=z;function z(F){var W=this;if(Object.prototype.toString.call(F)!=="[object Array]")return this.reject(new TypeError("must be an array"));var q=F.length,K=!1;if(!q)return this.resolve([]);for(var te=-1,se=new this(o);++te<q;)H(F[te]);return se;function H(L){W.resolve(L).then(function(D){K||(K=!0,a.resolve(se,D))},function(D){K||(K=!0,a.reject(se,D))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof Rr<"u"?Rr: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(B){return typeof B}:function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B};function o(B,G){if(!(B instanceof G))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 B=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),G=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!B||G)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(B,G){B=B||[],G=G||{};try{return new Blob(B,G)}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<B.length;Q+=1)Y.append(B[Q]);return Y.getBlob(G.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h(B,G){G&&B.then(function(U){G(null,U)},function(U){G(U)})}function y(B,G,U){typeof G=="function"&&B.then(G),typeof U=="function"&&B.catch(U)}function b(B){return typeof B!="string"&&(console.warn(B+" used as a key, but it is not a string."),B=String(B)),B}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var T="local-forage-detect-blob-support",P=void 0,R={},N=Object.prototype.toString,z="readonly",F="readwrite";function W(B){for(var G=B.length,U=new ArrayBuffer(G),Y=new Uint8Array(U),Q=0;Q<G;Q++)Y[Q]=B.charCodeAt(Q);return U}function q(B){return new f(function(G){var U=B.transaction(T,F),Y=l([""]);U.objectStore(T).put(Y,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),G(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),J=navigator.userAgent.match(/Edge\//);G(J||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function K(B){return typeof P=="boolean"?f.resolve(P):q(B).then(function(G){return P=G,P})}function te(B){var G=R[B.name],U={};U.promise=new f(function(Y,Q){U.resolve=Y,U.reject=Q}),G.deferredOperations.push(U),G.dbReady?G.dbReady=G.dbReady.then(function(){return U.promise}):G.dbReady=U.promise}function se(B){var G=R[B.name],U=G.deferredOperations.pop();if(U)return U.resolve(),U.promise}function H(B,G){var U=R[B.name],Y=U.deferredOperations.pop();if(Y)return Y.reject(G),Y.promise}function L(B,G){return new f(function(U,Y){if(R[B.name]=R[B.name]||g(),B.db)if(G)te(B),B.db.close();else return U(B.db);var Q=[B.name];G&&Q.push(B.version);var J=c.open.apply(c,Q);G&&(J.onupgradeneeded=function(he){var _e=J.result;try{_e.createObjectStore(B.storeName),he.oldVersion<=1&&_e.createObjectStore(T)}catch(Ee){if(Ee.name==="ConstraintError")console.warn('The database "'+B.name+'" has been upgraded from version '+he.oldVersion+" to version "+he.newVersion+', but the storage "'+B.storeName+'" already exists.');else throw Ee}}),J.onerror=function(he){he.preventDefault(),Y(J.error)},J.onsuccess=function(){var he=J.result;he.onversionchange=function(_e){_e.target.close()},U(he),se(B)}})}function D(B){return L(B,!1)}function p(B){return L(B,!0)}function d(B,G){if(!B.db)return!0;var U=!B.db.objectStoreNames.contains(B.storeName),Y=B.version<B.db.version,Q=B.version>B.db.version;if(Y&&(B.version!==G&&console.warn('The database "'+B.name+`" can't be downgraded from version `+B.db.version+" to version "+B.version+"."),B.version=B.db.version),Q||U){if(U){var J=B.db.version+1;J>B.version&&(B.version=J)}return!0}return!1}function m(B){return new f(function(G,U){var Y=new FileReader;Y.onerror=U,Y.onloadend=function(Q){var J=btoa(Q.target.result||"");G({__local_forage_encoded_blob:!0,data:J,type:B.type})},Y.readAsBinaryString(B)})}function x(B){var G=W(atob(B.data));return l([G],{type:B.type})}function C(B){return B&&B.__local_forage_encoded_blob}function E(B){var G=this,U=G._initReady().then(function(){var Y=R[G._dbInfo.name];if(Y&&Y.dbReady)return Y.dbReady});return y(U,B,B),U}function O(B){te(B);for(var G=R[B.name],U=G.forages,Y=0;Y<U.length;Y++){var Q=U[Y];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return B.db=null,D(B).then(function(J){return B.db=J,d(B)?p(B):J}).then(function(J){B.db=G.db=J;for(var he=0;he<U.length;he++)U[he]._dbInfo.db=J}).catch(function(J){throw H(B,J),J})}function M(B,G,U,Y){Y===void 0&&(Y=1);try{var Q=B.db.transaction(B.storeName,G);U(null,Q)}catch(J){if(Y>0&&(!B.db||J.name==="InvalidStateError"||J.name==="NotFoundError"))return f.resolve().then(function(){if(!B.db||J.name==="NotFoundError"&&!B.db.objectStoreNames.contains(B.storeName)&&B.version<=B.db.version)return B.db&&(B.version=B.db.version+1),p(B)}).then(function(){return O(B).then(function(){M(B,G,U,Y-1)})}).catch(U);U(J)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v(B){var G=this,U={db:null};if(B)for(var Y in B)U[Y]=B[Y];var Q=R[U.name];Q||(Q=g(),R[U.name]=Q),Q.forages.push(G),G._initReady||(G._initReady=G.ready,G.ready=E);var J=[];function he(){return f.resolve()}for(var _e=0;_e<Q.forages.length;_e++){var Ee=Q.forages[_e];Ee!==G&&J.push(Ee._initReady().catch(he))}var Ce=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,G._defaultConfig.version)?p(U):Me}).then(function(Me){U.db=Q.db=Me,G._dbInfo=U;for(var ze=0;ze<Ce.length;ze++){var yt=Ce[ze];yt!==G&&(yt._dbInfo.db=U.db,yt._dbInfo.version=U.version)}})}function k(B,G){var U=this;B=b(B);var Y=new f(function(Q,J){U.ready().then(function(){M(U._dbInfo,z,function(he,_e){if(he)return J(he);try{var Ee=_e.objectStore(U._dbInfo.storeName),Ce=Ee.get(B);Ce.onsuccess=function(){var Me=Ce.result;Me===void 0&&(Me=null),C(Me)&&(Me=x(Me)),Q(Me)},Ce.onerror=function(){J(Ce.error)}}catch(Me){J(Me)}})}).catch(J)});return h(Y,G),Y}function ee(B,G){var U=this,Y=new f(function(Q,J){U.ready().then(function(){M(U._dbInfo,z,function(he,_e){if(he)return J(he);try{var Ee=_e.objectStore(U._dbInfo.storeName),Ce=Ee.openCursor(),Me=1;Ce.onsuccess=function(){var ze=Ce.result;if(ze){var yt=ze.value;C(yt)&&(yt=x(yt));var Bt=B(yt,ze.key,Me++);Bt!==void 0?Q(Bt):ze.continue()}else Q()},Ce.onerror=function(){J(Ce.error)}}catch(ze){J(ze)}})}).catch(J)});return h(Y,G),Y}function ie(B,G,U){var Y=this;B=b(B);var Q=new f(function(J,he){var _e;Y.ready().then(function(){return _e=Y._dbInfo,N.call(G)==="[object Blob]"?K(_e.db).then(function(Ee){return Ee?G:m(G)}):G}).then(function(Ee){M(Y._dbInfo,F,function(Ce,Me){if(Ce)return he(Ce);try{var ze=Me.objectStore(Y._dbInfo.storeName);Ee===null&&(Ee=void 0);var yt=ze.put(Ee,B);Me.oncomplete=function(){Ee===void 0&&(Ee=null),J(Ee)},Me.onabort=Me.onerror=function(){var Bt=yt.error?yt.error:yt.transaction.error;he(Bt)}}catch(Bt){he(Bt)}})}).catch(he)});return h(Q,U),Q}function ge(B,G){var U=this;B=b(B);var Y=new f(function(Q,J){U.ready().then(function(){M(U._dbInfo,F,function(he,_e){if(he)return J(he);try{var Ee=_e.objectStore(U._dbInfo.storeName),Ce=Ee.delete(B);_e.oncomplete=function(){Q()},_e.onerror=function(){J(Ce.error)},_e.onabort=function(){var Me=Ce.error?Ce.error:Ce.transaction.error;J(Me)}}catch(Me){J(Me)}})}).catch(J)});return h(Y,G),Y}function ve(B){var G=this,U=new f(function(Y,Q){G.ready().then(function(){M(G._dbInfo,F,function(J,he){if(J)return Q(J);try{var _e=he.objectStore(G._dbInfo.storeName),Ee=_e.clear();he.oncomplete=function(){Y()},he.onabort=he.onerror=function(){var Ce=Ee.error?Ee.error:Ee.transaction.error;Q(Ce)}}catch(Ce){Q(Ce)}})}).catch(Q)});return h(U,B),U}function Se(B){var G=this,U=new f(function(Y,Q){G.ready().then(function(){M(G._dbInfo,z,function(J,he){if(J)return Q(J);try{var _e=he.objectStore(G._dbInfo.storeName),Ee=_e.count();Ee.onsuccess=function(){Y(Ee.result)},Ee.onerror=function(){Q(Ee.error)}}catch(Ce){Q(Ce)}})}).catch(Q)});return h(U,B),U}function xe(B,G){var U=this,Y=new f(function(Q,J){if(B<0){Q(null);return}U.ready().then(function(){M(U._dbInfo,z,function(he,_e){if(he)return J(he);try{var Ee=_e.objectStore(U._dbInfo.storeName),Ce=!1,Me=Ee.openKeyCursor();Me.onsuccess=function(){var ze=Me.result;if(!ze){Q(null);return}B===0||Ce?Q(ze.key):(Ce=!0,ze.advance(B))},Me.onerror=function(){J(Me.error)}}catch(ze){J(ze)}})}).catch(J)});return h(Y,G),Y}function Xe(B){var G=this,U=new f(function(Y,Q){G.ready().then(function(){M(G._dbInfo,z,function(J,he){if(J)return Q(J);try{var _e=he.objectStore(G._dbInfo.storeName),Ee=_e.openKeyCursor(),Ce=[];Ee.onsuccess=function(){var Me=Ee.result;if(!Me){Y(Ce);return}Ce.push(Me.key),Me.continue()},Ee.onerror=function(){Q(Ee.error)}}catch(Me){Q(Me)}})}).catch(Q)});return h(U,B),U}function Le(B,G){G=w.apply(this,arguments);var U=this.config();B=typeof B!="function"&&B||{},B.name||(B.name=B.name||U.name,B.storeName=B.storeName||U.storeName);var Y=this,Q;if(!B.name)Q=f.reject("Invalid arguments");else{var J=B.name===U.name&&Y._dbInfo.db,he=J?f.resolve(Y._dbInfo.db):D(B).then(function(_e){var Ee=R[B.name],Ce=Ee.forages;Ee.db=_e;for(var Me=0;Me<Ce.length;Me++)Ce[Me]._dbInfo.db=_e;return _e});B.storeName?Q=he.then(function(_e){if(_e.objectStoreNames.contains(B.storeName)){var Ee=_e.version+1;te(B);var Ce=R[B.name],Me=Ce.forages;_e.close();for(var ze=0;ze<Me.length;ze++){var yt=Me[ze];yt._dbInfo.db=null,yt._dbInfo.version=Ee}var Bt=new f(function(Ut,or){var ir=c.open(B.name,Ee);ir.onerror=function(Jr){var ta=ir.result;ta.close(),or(Jr)},ir.onupgradeneeded=function(){var Jr=ir.result;Jr.deleteObjectStore(B.storeName)},ir.onsuccess=function(){var Jr=ir.result;Jr.close(),Ut(Jr)}});return Bt.then(function(Ut){Ce.db=Ut;for(var or=0;or<Me.length;or++){var ir=Me[or];ir._dbInfo.db=Ut,se(ir._dbInfo)}}).catch(function(Ut){throw(H(B,Ut)||f.resolve()).catch(function(){}),Ut})}}):Q=he.then(function(_e){te(B);var Ee=R[B.name],Ce=Ee.forages;_e.close();for(var Me=0;Me<Ce.length;Me++){var ze=Ce[Me];ze._dbInfo.db=null}var yt=new f(function(Bt,Ut){var or=c.deleteDatabase(B.name);or.onerror=function(){var ir=or.result;ir&&ir.close(),Ut(or.error)},or.onblocked=function(){console.warn('dropInstance blocked for database "'+B.name+'" until all open connections are closed')},or.onsuccess=function(){var ir=or.result;ir&&ir.close(),Bt(ir)}});return yt.then(function(Bt){Ee.db=Bt;for(var Ut=0;Ut<Ce.length;Ut++){var or=Ce[Ut];se(or._dbInfo)}}).catch(function(Bt){throw(H(B,Bt)||f.resolve()).catch(function(){}),Bt})})}return h(Q,G),Q}var ot={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:ee,getItem:k,setItem:ie,removeItem:ge,clear:ve,length:Se,key:xe,keys:Xe,dropInstance:Le};function dt(){return typeof openDatabase=="function"}var De="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vt="~~local_forage_type~",we=/^~~local_forage_type~([^~]+)~/,me="__lfsc__:",Ae=me.length,Ue="arbf",Ne="blob",Te="si08",Oe="ui08",$e="uic8",lt="si16",pt="si32",He="ur16",kt="ui32",xt="fl32",Ye="fl64",At=Ae+Ue.length,Nt=Object.prototype.toString;function rt(B){var G=B.length*.75,U=B.length,Y,Q=0,J,he,_e,Ee;B[B.length-1]==="="&&(G--,B[B.length-2]==="="&&G--);var Ce=new ArrayBuffer(G),Me=new Uint8Array(Ce);for(Y=0;Y<U;Y+=4)J=De.indexOf(B[Y]),he=De.indexOf(B[Y+1]),_e=De.indexOf(B[Y+2]),Ee=De.indexOf(B[Y+3]),Me[Q++]=J<<2|he>>4,Me[Q++]=(he&15)<<4|_e>>2,Me[Q++]=(_e&3)<<6|Ee&63;return Ce}function St(B){var G=new Uint8Array(B),U="",Y;for(Y=0;Y<G.length;Y+=3)U+=De[G[Y]>>2],U+=De[(G[Y]&3)<<4|G[Y+1]>>4],U+=De[(G[Y+1]&15)<<2|G[Y+2]>>6],U+=De[G[Y+2]&63];return G.length%3===2?U=U.substring(0,U.length-1)+"=":G.length%3===1&&(U=U.substring(0,U.length-2)+"=="),U}function Tt(B,G){var U="";if(B&&(U=Nt.call(B)),B&&(U==="[object ArrayBuffer]"||B.buffer&&Nt.call(B.buffer)==="[object ArrayBuffer]")){var Y,Q=me;B instanceof ArrayBuffer?(Y=B,Q+=Ue):(Y=B.buffer,U==="[object Int8Array]"?Q+=Te:U==="[object Uint8Array]"?Q+=Oe:U==="[object Uint8ClampedArray]"?Q+=$e:U==="[object Int16Array]"?Q+=lt:U==="[object Uint16Array]"?Q+=He:U==="[object Int32Array]"?Q+=pt:U==="[object Uint32Array]"?Q+=kt:U==="[object Float32Array]"?Q+=xt:U==="[object Float64Array]"?Q+=Ye:G(new Error("Failed to get type for BinaryArray"))),G(Q+St(Y))}else if(U==="[object Blob]"){var J=new FileReader;J.onload=function(){var he=vt+B.type+"~"+St(this.result);G(me+Ne+he)},J.readAsArrayBuffer(B)}else try{G(JSON.stringify(B))}catch(he){console.error("Couldn't convert value into a JSON string: ",B),G(null,he)}}function it(B){if(B.substring(0,Ae)!==me)return JSON.parse(B);var G=B.substring(At),U=B.substring(Ae,At),Y;if(U===Ne&&we.test(G)){var Q=G.match(we);Y=Q[1],G=G.substring(Q[0].length)}var J=rt(G);switch(U){case Ue:return J;case Ne:return l([J],{type:Y});case Te:return new Int8Array(J);case Oe:return new Uint8Array(J);case $e:return new Uint8ClampedArray(J);case lt:return new Int16Array(J);case He:return new Uint16Array(J);case pt:return new Int32Array(J);case kt:return new Uint32Array(J);case xt:return new Float32Array(J);case Ye:return new Float64Array(J);default:throw new Error("Unkown type: "+U)}}var jt={serialize:Tt,deserialize:it,stringToBuffer:rt,bufferToString:St};function It(B,G,U,Y){B.executeSql("CREATE TABLE IF NOT EXISTS "+G.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,Y)}function nt(B){var G=this,U={db:null};if(B)for(var Y in B)U[Y]=typeof B[Y]!="string"?B[Y].toString():B[Y];var Q=new f(function(J,he){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(_e){return he(_e)}U.db.transaction(function(_e){It(_e,U,function(){G._dbInfo=U,J()},function(Ee,Ce){he(Ce)})},he)});return U.serializer=jt,Q}function bt(B,G,U,Y,Q,J){B.executeSql(U,Y,Q,function(he,_e){_e.code===_e.SYNTAX_ERR?he.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[G.storeName],function(Ee,Ce){Ce.rows.length?J(Ee,_e):It(Ee,G,function(){Ee.executeSql(U,Y,Q,J)},J)},J):J(he,_e)},J)}function Ct(B,G){var U=this;B=b(B);var Y=new f(function(Q,J){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(_e){bt(_e,he,"SELECT * FROM "+he.storeName+" WHERE key = ? LIMIT 1",[B],function(Ee,Ce){var Me=Ce.rows.length?Ce.rows.item(0).value:null;Me&&(Me=he.serializer.deserialize(Me)),Q(Me)},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function Je(B,G){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(_e){bt(_e,he,"SELECT * FROM "+he.storeName,[],function(Ee,Ce){for(var Me=Ce.rows,ze=Me.length,yt=0;yt<ze;yt++){var Bt=Me.item(yt),Ut=Bt.value;if(Ut&&(Ut=he.serializer.deserialize(Ut)),Ut=B(Ut,Bt.key,yt+1),Ut!==void 0){Q(Ut);return}}Q()},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function mt(B,G,U,Y){var Q=this;B=b(B);var J=new f(function(he,_e){Q.ready().then(function(){G===void 0&&(G=null);var Ee=G,Ce=Q._dbInfo;Ce.serializer.serialize(G,function(Me,ze){ze?_e(ze):Ce.db.transaction(function(yt){bt(yt,Ce,"INSERT OR REPLACE INTO "+Ce.storeName+" (key, value) VALUES (?, ?)",[B,Me],function(){he(Ee)},function(Bt,Ut){_e(Ut)})},function(yt){if(yt.code===yt.QUOTA_ERR){if(Y>0){he(mt.apply(Q,[B,Ee,U,Y-1]));return}_e(yt)}})})}).catch(_e)});return h(J,U),J}function Pt(B,G,U){return mt.apply(this,[B,G,U,1])}function st(B,G){var U=this;B=b(B);var Y=new f(function(Q,J){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(_e){bt(_e,he,"DELETE FROM "+he.storeName+" WHERE key = ?",[B],function(){Q()},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function wt(B){var G=this,U=new f(function(Y,Q){G.ready().then(function(){var J=G._dbInfo;J.db.transaction(function(he){bt(he,J,"DELETE FROM "+J.storeName,[],function(){Y()},function(_e,Ee){Q(Ee)})})}).catch(Q)});return h(U,B),U}function Ft(B){var G=this,U=new f(function(Y,Q){G.ready().then(function(){var J=G._dbInfo;J.db.transaction(function(he){bt(he,J,"SELECT COUNT(key) as c FROM "+J.storeName,[],function(_e,Ee){var Ce=Ee.rows.item(0).c;Y(Ce)},function(_e,Ee){Q(Ee)})})}).catch(Q)});return h(U,B),U}function j(B,G){var U=this,Y=new f(function(Q,J){U.ready().then(function(){var he=U._dbInfo;he.db.transaction(function(_e){bt(_e,he,"SELECT key FROM "+he.storeName+" WHERE id = ? LIMIT 1",[B+1],function(Ee,Ce){var Me=Ce.rows.length?Ce.rows.item(0).key:null;Q(Me)},function(Ee,Ce){J(Ce)})})}).catch(J)});return h(Y,G),Y}function S(B){var G=this,U=new f(function(Y,Q){G.ready().then(function(){var J=G._dbInfo;J.db.transaction(function(he){bt(he,J,"SELECT key FROM "+J.storeName,[],function(_e,Ee){for(var Ce=[],Me=0;Me<Ee.rows.length;Me++)Ce.push(Ee.rows.item(Me).key);Y(Ce)},function(_e,Ee){Q(Ee)})})}).catch(Q)});return h(U,B),U}function A(B){return new f(function(G,U){B.transaction(function(Y){Y.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,J){for(var he=[],_e=0;_e<J.rows.length;_e++)he.push(J.rows.item(_e).name);G({db:B,storeNames:he})},function(Q,J){U(J)})},function(Y){U(Y)})})}function $(B,G){G=w.apply(this,arguments);var U=this.config();B=typeof B!="function"&&B||{},B.name||(B.name=B.name||U.name,B.storeName=B.storeName||U.storeName);var Y=this,Q;return B.name?Q=new f(function(J){var he;B.name===U.name?he=Y._dbInfo.db:he=openDatabase(B.name,"","",0),B.storeName?J({db:he,storeNames:[B.storeName]}):J(A(he))}).then(function(J){return new f(function(he,_e){J.db.transaction(function(Ee){function Ce(Bt){return new f(function(Ut,or){Ee.executeSql("DROP TABLE IF EXISTS "+Bt,[],function(){Ut()},function(ir,Jr){or(Jr)})})}for(var Me=[],ze=0,yt=J.storeNames.length;ze<yt;ze++)Me.push(Ce(J.storeNames[ze]));f.all(Me).then(function(){he()}).catch(function(Bt){_e(Bt)})},function(Ee){_e(Ee)})})}):Q=f.reject("Invalid arguments"),h(Q,G),Q}var X={_driver:"webSQLStorage",_initStorage:nt,_support:dt(),iterate:Je,getItem:Ct,setItem:Pt,removeItem:st,clear:wt,length:Ft,key:j,keys:S,dropInstance:$};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function re(B,G){var U=B.name+"/";return B.storeName!==G.storeName&&(U+=B.storeName+"/"),U}function Be(){var B="_localforage_support_test";try{return localStorage.setItem(B,!0),localStorage.removeItem(B),!1}catch{return!0}}function et(){return!Be()||localStorage.length>0}function Re(B){var G=this,U={};if(B)for(var Y in B)U[Y]=B[Y];return U.keyPrefix=re(B,G._defaultConfig),et()?(G._dbInfo=U,U.serializer=jt,f.resolve()):f.reject()}function V(B){var G=this,U=G.ready().then(function(){for(var Y=G._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var J=localStorage.key(Q);J.indexOf(Y)===0&&localStorage.removeItem(J)}});return h(U,B),U}function oe(B,G){var U=this;B=b(B);var Y=U.ready().then(function(){var Q=U._dbInfo,J=localStorage.getItem(Q.keyPrefix+B);return J&&(J=Q.serializer.deserialize(J)),J});return h(Y,G),Y}function de(B,G){var U=this,Y=U.ready().then(function(){for(var Q=U._dbInfo,J=Q.keyPrefix,he=J.length,_e=localStorage.length,Ee=1,Ce=0;Ce<_e;Ce++){var Me=localStorage.key(Ce);if(Me.indexOf(J)===0){var ze=localStorage.getItem(Me);if(ze&&(ze=Q.serializer.deserialize(ze)),ze=B(ze,Me.substring(he),Ee++),ze!==void 0)return ze}}});return h(Y,G),Y}function ke(B,G){var U=this,Y=U.ready().then(function(){var Q=U._dbInfo,J;try{J=localStorage.key(B)}catch{J=null}return J&&(J=J.substring(Q.keyPrefix.length)),J});return h(Y,G),Y}function We(B){var G=this,U=G.ready().then(function(){for(var Y=G._dbInfo,Q=localStorage.length,J=[],he=0;he<Q;he++){var _e=localStorage.key(he);_e.indexOf(Y.keyPrefix)===0&&J.push(_e.substring(Y.keyPrefix.length))}return J});return h(U,B),U}function je(B){var G=this,U=G.keys().then(function(Y){return Y.length});return h(U,B),U}function Fe(B,G){var U=this;B=b(B);var Y=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+B)});return h(Y,G),Y}function at(B,G,U){var Y=this;B=b(B);var Q=Y.ready().then(function(){G===void 0&&(G=null);var J=G;return new f(function(he,_e){var Ee=Y._dbInfo;Ee.serializer.serialize(G,function(Ce,Me){if(Me)_e(Me);else try{localStorage.setItem(Ee.keyPrefix+B,Ce),he(J)}catch(ze){(ze.name==="QuotaExceededError"||ze.name==="NS_ERROR_DOM_QUOTA_REACHED")&&_e(ze),_e(ze)}})})});return h(Q,U),Q}function Gt(B,G){if(G=w.apply(this,arguments),B=typeof B!="function"&&B||{},!B.name){var U=this.config();B.name=B.name||U.name,B.storeName=B.storeName||U.storeName}var Y=this,Q;return B.name?Q=new f(function(J){B.storeName?J(re(B,Y._defaultConfig)):J(B.name+"/")}).then(function(J){for(var he=localStorage.length-1;he>=0;he--){var _e=localStorage.key(he);_e.indexOf(J)===0&&localStorage.removeItem(_e)}}):Q=f.reject("Invalid arguments"),h(Q,G),Q}var Rt={_driver:"localStorageWrapper",_initStorage:Re,_support:Z(),iterate:de,getItem:oe,setItem:at,removeItem:Fe,clear:V,length:je,key:ke,keys:We,dropInstance:Gt},Dt=function(G,U){return G===U||typeof G=="number"&&typeof U=="number"&&isNaN(G)&&isNaN(U)},Qt=function(G,U){for(var Y=G.length,Q=0;Q<Y;){if(Dt(G[Q],U))return!0;Q++}return!1},gr=Array.isArray||function(B){return Object.prototype.toString.call(B)==="[object Array]"},nr={},Kt={},mr={INDEXEDDB:ot,WEBSQL:X,LOCALSTORAGE:Rt},an=[mr.INDEXEDDB._driver,mr.WEBSQL._driver,mr.LOCALSTORAGE._driver],Dr=["dropInstance"],cn=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Dr),ni={description:"",driver:an.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ii(B,G){B[G]=function(){var U=arguments;return B.ready().then(function(){return B[G].apply(B,U)})}}function un(){for(var B=1;B<arguments.length;B++){var G=arguments[B];if(G)for(var U in G)G.hasOwnProperty(U)&&(gr(G[U])?arguments[0][U]=G[U].slice():arguments[0][U]=G[U])}return arguments[0]}var si=function(){function B(G){o(this,B);for(var U in mr)if(mr.hasOwnProperty(U)){var Y=mr[U],Q=Y._driver;this[U]=Q,nr[Q]||this.defineDriver(Y)}this._defaultConfig=un({},ni),this._config=un({},this._defaultConfig,G),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return B.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},B.prototype.defineDriver=function(U,Y,Q){var J=new f(function(he,_e){try{var Ee=U._driver,Ce=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){_e(Ce);return}for(var Me=cn.concat("_initStorage"),ze=0,yt=Me.length;ze<yt;ze++){var Bt=Me[ze],Ut=!Qt(Dr,Bt);if((Ut||U[Bt])&&typeof U[Bt]!="function"){_e(Ce);return}}var or=function(){for(var ta=function(rS){return function(){var nS=new Error("Method "+rS+" is not implemented by the current driver"),B0=f.reject(nS);return h(B0,arguments[arguments.length-1]),B0}},rf=0,tS=Dr.length;rf<tS;rf++){var nf=Dr[rf];U[nf]||(U[nf]=ta(nf))}};or();var ir=function(ta){nr[Ee]&&console.info("Redefining LocalForage driver: "+Ee),nr[Ee]=U,Kt[Ee]=ta,he()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(ir,_e):ir(!!U._support):ir(!0)}catch(Jr){_e(Jr)}});return y(J,Y,Q),J},B.prototype.driver=function(){return this._driver||null},B.prototype.getDriver=function(U,Y,Q){var J=nr[U]?f.resolve(nr[U]):f.reject(new Error("Driver not found."));return y(J,Y,Q),J},B.prototype.getSerializer=function(U){var Y=f.resolve(jt);return y(Y,U),Y},B.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},B.prototype.setDriver=function(U,Y,Q){var J=this;gr(U)||(U=[U]);var he=this._getSupportedDrivers(U);function _e(){J._config.driver=J.driver()}function Ee(ze){return J._extend(ze),_e(),J._ready=J._initStorage(J._config),J._ready}function Ce(ze){return function(){var yt=0;function Bt(){for(;yt<ze.length;){var Ut=ze[yt];return yt++,J._dbInfo=null,J._ready=null,J.getDriver(Ut).then(Ee).catch(Bt)}_e();var or=new Error("No available storage method found.");return J._driverSet=f.reject(or),J._driverSet}return Bt()}}var Me=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Me.then(function(){var ze=he[0];return J._dbInfo=null,J._ready=null,J.getDriver(ze).then(function(yt){J._driver=yt._driver,_e(),J._wrapLibraryMethodsWithReady(),J._initDriver=Ce(he)})}).catch(function(){_e();var ze=new Error("No available storage method found.");return J._driverSet=f.reject(ze),J._driverSet}),y(this._driverSet,Y,Q),this._driverSet},B.prototype.supports=function(U){return!!Kt[U]},B.prototype._extend=function(U){un(this,U)},B.prototype._getSupportedDrivers=function(U){for(var Y=[],Q=0,J=U.length;Q<J;Q++){var he=U[Q];this.supports(he)&&Y.push(he)}return Y},B.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,Y=cn.length;U<Y;U++)ii(this,cn[U])},B.prototype.createInstance=function(U){return new B(U)},B}(),oi=new si;n.exports=oi},{3:3}]},{},[4])(4)})})(w4);var TR=w4.exports;const wa=nc(TR);wa.config({name:"CetusSite",storeName:"tokens"});class wi{static async setItem(t,r){try{await wa.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await wa.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await wa.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await wa.clear()}catch(t){console.error("Failed to clear storage",t)}}}const Tl=[{name:"SuiVision",link:"https://suivision.xyz",img:zt("/images/logo_suivision@2x.png"),isCustom:!1},{name:"Suiscan",link:"https://suiscan.xyz/mainnet",img:zt("/images/logo_suiscan@2x.png"),isCustom:!1}],Du=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],OR=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],IR="mainnet",PR={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"}},Bu=PR[IR],kR=zt("/images/birdeye-logo.png"),jR=zt("/images/img-logo@2x.png"),RR=zt("/images/logo_CoinGecko@2x.png"),NR=zt("/images/logo_pyth.png");var ka=(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))(ka||{});const _4={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},DR={pyth:NR,coingecko:RR,birdeye:kR,Cetus:jR},yr={CETUS:zt("/images/aggregator-source/cetus.png"),KRIYA:zt("/images/aggregator-source/kriya.png"),FLOWX:zt("/images/aggregator-source/flowx.png"),AFTERMATH:zt("/images/aggregator-source/aftermath.png"),TURBOS:zt("/images/aggregator-source/turbos.png"),HAEDAL:zt("/images/aggregator-source/haedal.png"),VOLO:zt("/images/aggregator-source/volo.png"),AFSUI:zt("/images/aggregator-source/aftermath.png"),BLUEMOVE:zt("/images/aggregator-source/bluemove.png"),KRIYAV3:zt("/images/aggregator-source/kriya.png"),FLOWXV3:zt("/images/aggregator-source/flowx.png"),DEEPBOOKV3:zt("/images/aggregator-source/deepbook.png"),SCALLOP:zt("/images/aggregator-source/scallop.png"),SUILEND:zt("/images/aggregator-source/suilend.png"),BLUEFIN:zt("/images/aggregator-source/bluefin.png"),HAEDALPMM:zt("/images/aggregator-source/haedal.png")},x4={CETUS:{name:"Cetus",id:"CETUS",logo:yr.CETUS,type:"dex",sort:100},DEEPBOOKV3:{name:"DeepBook V3",id:"DEEPBOOKV3",logo:yr.DEEPBOOKV3,type:"dex",sort:99},KRIYA:{name:"Kriya V2",id:"KRIYA",logo:yr.KRIYA,type:"dex",sort:98},KRIYAV3:{name:"Kriya V3",id:"KRIYAV3",logo:yr.KRIYA,type:"dex",sort:97},FLOWX:{name:"FlowX V2",id:"FLOWX",logo:yr.FLOWX,type:"dex",sort:96},FLOWXV3:{name:"FlowX V3",id:"FLOWXV3",logo:yr.FLOWX,type:"dex",sort:95},AFTERMATH:{name:"Aftermath",id:"AFTERMATH",logo:yr.AFTERMATH,type:"dex",sort:94},TURBOS:{name:"Turbos",id:"TURBOS",logo:yr.TURBOS,type:"dex",sort:93},HAEDAL:{name:"Haedal LSD",id:"HAEDAL",logo:yr.HAEDAL,type:"other",sort:92},HAEDALPMM:{name:"Haedal HMM",id:"HAEDALPMM",logo:yr.HAEDALPMM,type:"other",sort:92},VOLO:{name:"Volo",id:"VOLO",logo:yr.VOLO,type:"other",sort:91},AFSUI:{name:"Aftermath LSD",id:"AFSUI",logo:yr.AFTERMATH,type:"other",sort:90},BLUEMOVE:{name:"BlueMove",id:"BLUEMOVE",logo:yr.BLUEMOVE,type:"dex",sort:80},BLUEFIN:{name:"Bluefin",id:"BLUEFIN",logo:yr.BLUEFIN,sort:79,type:"dex"},SCALLOP:{name:"Scallop",id:"SCALLOP",logo:yr.SCALLOP,type:"other",sort:70},SUILEND:{name:"SpringSui",id:"SUILEND",logo:yr.SUILEND,type:"other",sort:60}},fg=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},BR=e=>e?fg(e):fg,$R=e=>e;function LR(e,t=$R){const r=ae.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return ae.useDebugValue(r),r}const dg=e=>{const t=BR(e),r=n=>LR(t,n);return Object.assign(r,t),r},Ai=e=>e?dg(e):dg;function FR(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 Zd=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Zd(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Zd(n)(r)}}}},UR=(e,t)=>(r,n,i)=>{let s={storage:FR(()=>localStorage),partialize:w=>w,version:0,merge:(w,T)=>({...T,...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,T)=>{f(w,T),l()};const h=e((...w)=>{r(...w),l()},n,i);i.getInitialState=()=>h;let y;const b=()=>{var w,T;if(!u)return;o=!1,a.forEach(R=>{var N;return R((N=n())!=null?N:h)});const P=((T=s.onRehydrateStorage)==null?void 0:T.call(s,(w=n())!=null?w:h))||void 0;return Zd(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(z=>[!0,z]):[!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[z,F]=R;if(y=s.merge(F,(N=n())!=null?N:h),r(y,!0),z)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},zR=UR,VR=(e,t)=>({currentExplorer:Tl[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:Du,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:Du[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(ka),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}))}}),Xr=Ai(zR(VR,{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}}}));function qo(){const{currentExplorer:e}=Xr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${HR(n)}/${r}`:s=`${i}/${qR(n)}/${r}`,s}}}const qR=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"}},HR=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 S4(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 E4={exports:{}};/*!
|
|
44
|
+
*/(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 $n=="function"&&$n;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(_){var w=n[u][1][_];return o(w||_)},y,y.exports,r,n,i,s)}return i[u].exports}for(var a=typeof $n=="function"&&$n,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(_),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=_,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(){_(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},s.document.documentElement.appendChild(A)}:a=function(){setTimeout(_,0)};var h,y=[];function _(){h=!0;for(var A,I,P=y.length;P;){for(I=y,y=[],A=-1;++A<P;)I[A]();P=y.length}h=!1}n.exports=w;function w(A){y.push(A)===1&&!h&&a()}}).call(this,typeof io<"u"?io: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,H){if(typeof L!="function"&&this.state===u||typeof H!="function"&&this.state===c)return this;var q=new this.constructor(o);if(this.state!==l){var X=this.state===u?L:H;y(q,X,this.outcome)}else this.queue.push(new h(q,L,H));return q};function h(L,H,q){this.promise=L,typeof H=="function"&&(this.onFulfilled=H,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,H,q){s(function(){var X;try{X=H(q)}catch(re){return a.reject(L,re)}X===L?a.reject(L,new TypeError("Cannot resolve promise with itself")):a.resolve(L,X)})}a.resolve=function(L,H){var q=A(_,H);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=H;for(var re=-1,ae=L.queue.length;++re<ae;)L.queue[re].callFulfilled(H)}return L},a.reject=function(L,H){L.state=c,L.outcome=H;for(var q=-1,X=L.queue.length;++q<X;)L.queue[q].callRejected(H);return L};function _(L){var H=L&&L.then;if(L&&(typeof L=="object"||typeof L=="function")&&typeof H=="function")return function(){H.apply(L,arguments)}}function w(L,H){var q=!1;function X(V){q||(q=!0,a.reject(L,V))}function re(V){q||(q=!0,a.resolve(L,V))}function ae(){H(re,X)}var oe=A(ae);oe.status==="error"&&X(oe.value)}function A(L,H){var q={};try{q.value=L(H),q.status="success"}catch(X){q.status="error",q.value=X}return q}f.resolve=I;function I(L){return L instanceof this?L:a.resolve(new this(o),L)}f.reject=P;function P(L){var H=new this(o);return a.reject(H,L)}f.all=N;function N(L){var H=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 re=new Array(q),ae=0,oe=-1,V=new this(o);++oe<q;)$(L[oe],oe);return V;function $(p,d){H.resolve(p).then(m,function(x){X||(X=!0,a.reject(V,x))});function m(x){re[d]=x,++ae===q&&!X&&(X=!0,a.resolve(V,re))}}}f.race=F;function F(L){var H=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 re=-1,ae=new this(o);++re<q;)oe(L[re]);return ae;function oe(V){H.resolve(V).then(function($){X||(X=!0,a.resolve(ae,$))},function($){X||(X=!0,a.reject(ae,$))})}}},{1:1}],3:[function(r,n,i){(function(s){typeof s.Promise!="function"&&(s.Promise=r(2))}).call(this,typeof io<"u"?io: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(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D};function o(D,W){if(!(D instanceof W))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 D=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),W=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!D||W)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function l(D,W){D=D||[],W=W||{};try{return new Blob(D,W)}catch(Y){if(Y.name!=="TypeError")throw Y;for(var U=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,J=new U,Q=0;Q<D.length;Q+=1)J.append(D[Q]);return J.getBlob(W.type)}}typeof Promise>"u"&&r(3);var f=Promise;function h(D,W){W&&D.then(function(U){W(null,U)},function(U){W(U)})}function y(D,W,U){typeof W=="function"&&D.then(W),typeof U=="function"&&D.catch(U)}function _(D){return typeof D!="string"&&(console.warn(D+" used as a key, but it is not a string."),D=String(D)),D}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",I=void 0,P={},N=Object.prototype.toString,F="readonly",L="readwrite";function H(D){for(var W=D.length,U=new ArrayBuffer(W),J=new Uint8Array(U),Q=0;Q<W;Q++)J[Q]=D.charCodeAt(Q);return U}function q(D){return new f(function(W){var U=D.transaction(A,L),J=l([""]);U.objectStore(A).put(J,"key"),U.onabort=function(Q){Q.preventDefault(),Q.stopPropagation(),W(!1)},U.oncomplete=function(){var Q=navigator.userAgent.match(/Chrome\/(\d+)/),Y=navigator.userAgent.match(/Edge\//);W(Y||!Q||parseInt(Q[1],10)>=43)}}).catch(function(){return!1})}function X(D){return typeof I=="boolean"?f.resolve(I):q(D).then(function(W){return I=W,I})}function re(D){var W=P[D.name],U={};U.promise=new f(function(J,Q){U.resolve=J,U.reject=Q}),W.deferredOperations.push(U),W.dbReady?W.dbReady=W.dbReady.then(function(){return U.promise}):W.dbReady=U.promise}function ae(D){var W=P[D.name],U=W.deferredOperations.pop();if(U)return U.resolve(),U.promise}function oe(D,W){var U=P[D.name],J=U.deferredOperations.pop();if(J)return J.reject(W),J.promise}function V(D,W){return new f(function(U,J){if(P[D.name]=P[D.name]||g(),D.db)if(W)re(D),D.db.close();else return U(D.db);var Q=[D.name];W&&Q.push(D.version);var Y=c.open.apply(c,Q);W&&(Y.onupgradeneeded=function(pe){var _e=Y.result;try{_e.createObjectStore(D.storeName),pe.oldVersion<=1&&_e.createObjectStore(A)}catch(Se){if(Se.name==="ConstraintError")console.warn('The database "'+D.name+'" has been upgraded from version '+pe.oldVersion+" to version "+pe.newVersion+', but the storage "'+D.storeName+'" already exists.');else throw Se}}),Y.onerror=function(pe){pe.preventDefault(),J(Y.error)},Y.onsuccess=function(){var pe=Y.result;pe.onversionchange=function(_e){_e.target.close()},U(pe),ae(D)}})}function $(D){return V(D,!1)}function p(D){return V(D,!0)}function d(D,W){if(!D.db)return!0;var U=!D.db.objectStoreNames.contains(D.storeName),J=D.version<D.db.version,Q=D.version>D.db.version;if(J&&(D.version!==W&&console.warn('The database "'+D.name+`" can't be downgraded from version `+D.db.version+" to version "+D.version+"."),D.version=D.db.version),Q||U){if(U){var Y=D.db.version+1;Y>D.version&&(D.version=Y)}return!0}return!1}function m(D){return new f(function(W,U){var J=new FileReader;J.onerror=U,J.onloadend=function(Q){var Y=btoa(Q.target.result||"");W({__local_forage_encoded_blob:!0,data:Y,type:D.type})},J.readAsBinaryString(D)})}function x(D){var W=H(atob(D.data));return l([W],{type:D.type})}function E(D){return D&&D.__local_forage_encoded_blob}function C(D){var W=this,U=W._initReady().then(function(){var J=P[W._dbInfo.name];if(J&&J.dbReady)return J.dbReady});return y(U,D,D),U}function k(D){re(D);for(var W=P[D.name],U=W.forages,J=0;J<U.length;J++){var Q=U[J];Q._dbInfo.db&&(Q._dbInfo.db.close(),Q._dbInfo.db=null)}return D.db=null,$(D).then(function(Y){return D.db=Y,d(D)?p(D):Y}).then(function(Y){D.db=W.db=Y;for(var pe=0;pe<U.length;pe++)U[pe]._dbInfo.db=Y}).catch(function(Y){throw oe(D,Y),Y})}function T(D,W,U,J){J===void 0&&(J=1);try{var Q=D.db.transaction(D.storeName,W);U(null,Q)}catch(Y){if(J>0&&(!D.db||Y.name==="InvalidStateError"||Y.name==="NotFoundError"))return f.resolve().then(function(){if(!D.db||Y.name==="NotFoundError"&&!D.db.objectStoreNames.contains(D.storeName)&&D.version<=D.db.version)return D.db&&(D.version=D.db.version+1),p(D)}).then(function(){return k(D).then(function(){T(D,W,U,J-1)})}).catch(U);U(Y)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function v(D){var W=this,U={db:null};if(D)for(var J in D)U[J]=D[J];var Q=P[U.name];Q||(Q=g(),P[U.name]=Q),Q.forages.push(W),W._initReady||(W._initReady=W.ready,W.ready=C);var Y=[];function pe(){return f.resolve()}for(var _e=0;_e<Q.forages.length;_e++){var Se=Q.forages[_e];Se!==W&&Y.push(Se._initReady().catch(pe))}var Ee=Q.forages.slice(0);return f.all(Y).then(function(){return U.db=Q.db,$(U)}).then(function(Ae){return U.db=Ae,d(U,W._defaultConfig.version)?p(U):Ae}).then(function(Ae){U.db=Q.db=Ae,W._dbInfo=U;for(var ze=0;ze<Ee.length;ze++){var vt=Ee[ze];vt!==W&&(vt._dbInfo.db=U.db,vt._dbInfo.version=U.version)}})}function R(D,W){var U=this;D=_(D);var J=new f(function(Q,Y){U.ready().then(function(){T(U._dbInfo,F,function(pe,_e){if(pe)return Y(pe);try{var Se=_e.objectStore(U._dbInfo.storeName),Ee=Se.get(D);Ee.onsuccess=function(){var Ae=Ee.result;Ae===void 0&&(Ae=null),E(Ae)&&(Ae=x(Ae)),Q(Ae)},Ee.onerror=function(){Y(Ee.error)}}catch(Ae){Y(Ae)}})}).catch(Y)});return h(J,W),J}function se(D,W){var U=this,J=new f(function(Q,Y){U.ready().then(function(){T(U._dbInfo,F,function(pe,_e){if(pe)return Y(pe);try{var Se=_e.objectStore(U._dbInfo.storeName),Ee=Se.openCursor(),Ae=1;Ee.onsuccess=function(){var ze=Ee.result;if(ze){var vt=ze.value;E(vt)&&(vt=x(vt));var Dt=D(vt,ze.key,Ae++);Dt!==void 0?Q(Dt):ze.continue()}else Q()},Ee.onerror=function(){Y(Ee.error)}}catch(ze){Y(ze)}})}).catch(Y)});return h(J,W),J}function ue(D,W,U){var J=this;D=_(D);var Q=new f(function(Y,pe){var _e;J.ready().then(function(){return _e=J._dbInfo,N.call(W)==="[object Blob]"?X(_e.db).then(function(Se){return Se?W:m(W)}):W}).then(function(Se){T(J._dbInfo,L,function(Ee,Ae){if(Ee)return pe(Ee);try{var ze=Ae.objectStore(J._dbInfo.storeName);Se===null&&(Se=void 0);var vt=ze.put(Se,D);Ae.oncomplete=function(){Se===void 0&&(Se=null),Y(Se)},Ae.onabort=Ae.onerror=function(){var Dt=vt.error?vt.error:vt.transaction.error;pe(Dt)}}catch(Dt){pe(Dt)}})}).catch(pe)});return h(Q,U),Q}function xe(D,W){var U=this;D=_(D);var J=new f(function(Q,Y){U.ready().then(function(){T(U._dbInfo,L,function(pe,_e){if(pe)return Y(pe);try{var Se=_e.objectStore(U._dbInfo.storeName),Ee=Se.delete(D);_e.oncomplete=function(){Q()},_e.onerror=function(){Y(Ee.error)},_e.onabort=function(){var Ae=Ee.error?Ee.error:Ee.transaction.error;Y(Ae)}}catch(Ae){Y(Ae)}})}).catch(Y)});return h(J,W),J}function be(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){T(W._dbInfo,L,function(Y,pe){if(Y)return Q(Y);try{var _e=pe.objectStore(W._dbInfo.storeName),Se=_e.clear();pe.oncomplete=function(){J()},pe.onabort=pe.onerror=function(){var Ee=Se.error?Se.error:Se.transaction.error;Q(Ee)}}catch(Ee){Q(Ee)}})}).catch(Q)});return h(U,D),U}function Ce(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){T(W._dbInfo,F,function(Y,pe){if(Y)return Q(Y);try{var _e=pe.objectStore(W._dbInfo.storeName),Se=_e.count();Se.onsuccess=function(){J(Se.result)},Se.onerror=function(){Q(Se.error)}}catch(Ee){Q(Ee)}})}).catch(Q)});return h(U,D),U}function Me(D,W){var U=this,J=new f(function(Q,Y){if(D<0){Q(null);return}U.ready().then(function(){T(U._dbInfo,F,function(pe,_e){if(pe)return Y(pe);try{var Se=_e.objectStore(U._dbInfo.storeName),Ee=!1,Ae=Se.openKeyCursor();Ae.onsuccess=function(){var ze=Ae.result;if(!ze){Q(null);return}D===0||Ee?Q(ze.key):(Ee=!0,ze.advance(D))},Ae.onerror=function(){Y(Ae.error)}}catch(ze){Y(ze)}})}).catch(Y)});return h(J,W),J}function Ke(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){T(W._dbInfo,F,function(Y,pe){if(Y)return Q(Y);try{var _e=pe.objectStore(W._dbInfo.storeName),Se=_e.openKeyCursor(),Ee=[];Se.onsuccess=function(){var Ae=Se.result;if(!Ae){J(Ee);return}Ee.push(Ae.key),Ae.continue()},Se.onerror=function(){Q(Se.error)}}catch(Ae){Q(Ae)}})}).catch(Q)});return h(U,D),U}function Ue(D,W){W=w.apply(this,arguments);var U=this.config();D=typeof D!="function"&&D||{},D.name||(D.name=D.name||U.name,D.storeName=D.storeName||U.storeName);var J=this,Q;if(!D.name)Q=f.reject("Invalid arguments");else{var Y=D.name===U.name&&J._dbInfo.db,pe=Y?f.resolve(J._dbInfo.db):$(D).then(function(_e){var Se=P[D.name],Ee=Se.forages;Se.db=_e;for(var Ae=0;Ae<Ee.length;Ae++)Ee[Ae]._dbInfo.db=_e;return _e});D.storeName?Q=pe.then(function(_e){if(_e.objectStoreNames.contains(D.storeName)){var Se=_e.version+1;re(D);var Ee=P[D.name],Ae=Ee.forages;_e.close();for(var ze=0;ze<Ae.length;ze++){var vt=Ae[ze];vt._dbInfo.db=null,vt._dbInfo.version=Se}var Dt=new f(function(Ut,or){var ir=c.open(D.name,Se);ir.onerror=function(Kr){var Yo=ir.result;Yo.close(),or(Kr)},ir.onupgradeneeded=function(){var Kr=ir.result;Kr.deleteObjectStore(D.storeName)},ir.onsuccess=function(){var Kr=ir.result;Kr.close(),Ut(Kr)}});return Dt.then(function(Ut){Ee.db=Ut;for(var or=0;or<Ae.length;or++){var ir=Ae[or];ir._dbInfo.db=Ut,ae(ir._dbInfo)}}).catch(function(Ut){throw(oe(D,Ut)||f.resolve()).catch(function(){}),Ut})}}):Q=pe.then(function(_e){re(D);var Se=P[D.name],Ee=Se.forages;_e.close();for(var Ae=0;Ae<Ee.length;Ae++){var ze=Ee[Ae];ze._dbInfo.db=null}var vt=new f(function(Dt,Ut){var or=c.deleteDatabase(D.name);or.onerror=function(){var ir=or.result;ir&&ir.close(),Ut(or.error)},or.onblocked=function(){console.warn('dropInstance blocked for database "'+D.name+'" until all open connections are closed')},or.onsuccess=function(){var ir=or.result;ir&&ir.close(),Dt(ir)}});return vt.then(function(Dt){Se.db=Dt;for(var Ut=0;Ut<Ee.length;Ut++){var or=Ee[Ut];ae(or._dbInfo)}}).catch(function(Dt){throw(oe(D,Dt)||f.resolve()).catch(function(){}),Dt})})}return h(Q,W),Q}var lt={_driver:"asyncStorage",_initStorage:v,_support:u(),iterate:se,getItem:R,setItem:ue,removeItem:xe,clear:be,length:Ce,key:Me,keys:Ke,dropInstance:Ue};function ht(){return typeof openDatabase=="function"}var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt="~~local_forage_type~",we=/^~~local_forage_type~([^~]+)~/,me="__lfsc__:",Te=me.length,qe="arbf",De="blob",Oe="si08",Ie="ui08",Le="uic8",ft="si16",dt="si32",He="ur16",kt="ui32",_t="fl32",Ze="fl64",Mt=Te+qe.length,Rt=Object.prototype.toString;function nt(D){var W=D.length*.75,U=D.length,J,Q=0,Y,pe,_e,Se;D[D.length-1]==="="&&(W--,D[D.length-2]==="="&&W--);var Ee=new ArrayBuffer(W),Ae=new Uint8Array(Ee);for(J=0;J<U;J+=4)Y=$e.indexOf(D[J]),pe=$e.indexOf(D[J+1]),_e=$e.indexOf(D[J+2]),Se=$e.indexOf(D[J+3]),Ae[Q++]=Y<<2|pe>>4,Ae[Q++]=(pe&15)<<4|_e>>2,Ae[Q++]=(_e&3)<<6|Se&63;return Ee}function xt(D){var W=new Uint8Array(D),U="",J;for(J=0;J<W.length;J+=3)U+=$e[W[J]>>2],U+=$e[(W[J]&3)<<4|W[J+1]>>4],U+=$e[(W[J+1]&15)<<2|W[J+2]>>6],U+=$e[W[J+2]&63];return W.length%3===2?U=U.substring(0,U.length-1)+"=":W.length%3===1&&(U=U.substring(0,U.length-2)+"=="),U}function Ct(D,W){var U="";if(D&&(U=Rt.call(D)),D&&(U==="[object ArrayBuffer]"||D.buffer&&Rt.call(D.buffer)==="[object ArrayBuffer]")){var J,Q=me;D instanceof ArrayBuffer?(J=D,Q+=qe):(J=D.buffer,U==="[object Int8Array]"?Q+=Oe:U==="[object Uint8Array]"?Q+=Ie:U==="[object Uint8ClampedArray]"?Q+=Le:U==="[object Int16Array]"?Q+=ft:U==="[object Uint16Array]"?Q+=He:U==="[object Int32Array]"?Q+=dt:U==="[object Uint32Array]"?Q+=kt:U==="[object Float32Array]"?Q+=_t:U==="[object Float64Array]"?Q+=Ze:W(new Error("Failed to get type for BinaryArray"))),W(Q+xt(J))}else if(U==="[object Blob]"){var Y=new FileReader;Y.onload=function(){var pe=mt+D.type+"~"+xt(this.result);W(me+De+pe)},Y.readAsArrayBuffer(D)}else try{W(JSON.stringify(D))}catch(pe){console.error("Couldn't convert value into a JSON string: ",D),W(null,pe)}}function st(D){if(D.substring(0,Te)!==me)return JSON.parse(D);var W=D.substring(Mt),U=D.substring(Te,Mt),J;if(U===De&&we.test(W)){var Q=W.match(we);J=Q[1],W=W.substring(Q[0].length)}var Y=nt(W);switch(U){case qe:return Y;case De:return l([Y],{type:J});case Oe:return new Int8Array(Y);case Ie:return new Uint8Array(Y);case Le:return new Uint8ClampedArray(Y);case ft:return new Int16Array(Y);case He:return new Uint16Array(Y);case dt:return new Int32Array(Y);case kt:return new Uint32Array(Y);case _t:return new Float32Array(Y);case Ze:return new Float64Array(Y);default:throw new Error("Unkown type: "+U)}}var jt={serialize:Ct,deserialize:st,stringToBuffer:nt,bufferToString:xt};function Ot(D,W,U,J){D.executeSql("CREATE TABLE IF NOT EXISTS "+W.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],U,J)}function it(D){var W=this,U={db:null};if(D)for(var J in D)U[J]=typeof D[J]!="string"?D[J].toString():D[J];var Q=new f(function(Y,pe){try{U.db=openDatabase(U.name,String(U.version),U.description,U.size)}catch(_e){return pe(_e)}U.db.transaction(function(_e){Ot(_e,U,function(){W._dbInfo=U,Y()},function(Se,Ee){pe(Ee)})},pe)});return U.serializer=jt,Q}function yt(D,W,U,J,Q,Y){D.executeSql(U,J,Q,function(pe,_e){_e.code===_e.SYNTAX_ERR?pe.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[W.storeName],function(Se,Ee){Ee.rows.length?Y(Se,_e):Ot(Se,W,function(){Se.executeSql(U,J,Q,Y)},Y)},Y):Y(pe,_e)},Y)}function St(D,W){var U=this;D=_(D);var J=new f(function(Q,Y){U.ready().then(function(){var pe=U._dbInfo;pe.db.transaction(function(_e){yt(_e,pe,"SELECT * FROM "+pe.storeName+" WHERE key = ? LIMIT 1",[D],function(Se,Ee){var Ae=Ee.rows.length?Ee.rows.item(0).value:null;Ae&&(Ae=pe.serializer.deserialize(Ae)),Q(Ae)},function(Se,Ee){Y(Ee)})})}).catch(Y)});return h(J,W),J}function Je(D,W){var U=this,J=new f(function(Q,Y){U.ready().then(function(){var pe=U._dbInfo;pe.db.transaction(function(_e){yt(_e,pe,"SELECT * FROM "+pe.storeName,[],function(Se,Ee){for(var Ae=Ee.rows,ze=Ae.length,vt=0;vt<ze;vt++){var Dt=Ae.item(vt),Ut=Dt.value;if(Ut&&(Ut=pe.serializer.deserialize(Ut)),Ut=D(Ut,Dt.key,vt+1),Ut!==void 0){Q(Ut);return}}Q()},function(Se,Ee){Y(Ee)})})}).catch(Y)});return h(J,W),J}function gt(D,W,U,J){var Q=this;D=_(D);var Y=new f(function(pe,_e){Q.ready().then(function(){W===void 0&&(W=null);var Se=W,Ee=Q._dbInfo;Ee.serializer.serialize(W,function(Ae,ze){ze?_e(ze):Ee.db.transaction(function(vt){yt(vt,Ee,"INSERT OR REPLACE INTO "+Ee.storeName+" (key, value) VALUES (?, ?)",[D,Ae],function(){pe(Se)},function(Dt,Ut){_e(Ut)})},function(vt){if(vt.code===vt.QUOTA_ERR){if(J>0){pe(gt.apply(Q,[D,Se,U,J-1]));return}_e(vt)}})})}).catch(_e)});return h(Y,U),Y}function It(D,W,U){return gt.apply(this,[D,W,U,1])}function ot(D,W){var U=this;D=_(D);var J=new f(function(Q,Y){U.ready().then(function(){var pe=U._dbInfo;pe.db.transaction(function(_e){yt(_e,pe,"DELETE FROM "+pe.storeName+" WHERE key = ?",[D],function(){Q()},function(Se,Ee){Y(Ee)})})}).catch(Y)});return h(J,W),J}function bt(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){var Y=W._dbInfo;Y.db.transaction(function(pe){yt(pe,Y,"DELETE FROM "+Y.storeName,[],function(){J()},function(_e,Se){Q(Se)})})}).catch(Q)});return h(U,D),U}function Lt(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){var Y=W._dbInfo;Y.db.transaction(function(pe){yt(pe,Y,"SELECT COUNT(key) as c FROM "+Y.storeName,[],function(_e,Se){var Ee=Se.rows.item(0).c;J(Ee)},function(_e,Se){Q(Se)})})}).catch(Q)});return h(U,D),U}function j(D,W){var U=this,J=new f(function(Q,Y){U.ready().then(function(){var pe=U._dbInfo;pe.db.transaction(function(_e){yt(_e,pe,"SELECT key FROM "+pe.storeName+" WHERE id = ? LIMIT 1",[D+1],function(Se,Ee){var Ae=Ee.rows.length?Ee.rows.item(0).key:null;Q(Ae)},function(Se,Ee){Y(Ee)})})}).catch(Y)});return h(J,W),J}function S(D){var W=this,U=new f(function(J,Q){W.ready().then(function(){var Y=W._dbInfo;Y.db.transaction(function(pe){yt(pe,Y,"SELECT key FROM "+Y.storeName,[],function(_e,Se){for(var Ee=[],Ae=0;Ae<Se.rows.length;Ae++)Ee.push(Se.rows.item(Ae).key);J(Ee)},function(_e,Se){Q(Se)})})}).catch(Q)});return h(U,D),U}function M(D){return new f(function(W,U){D.transaction(function(J){J.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(Q,Y){for(var pe=[],_e=0;_e<Y.rows.length;_e++)pe.push(Y.rows.item(_e).name);W({db:D,storeNames:pe})},function(Q,Y){U(Y)})},function(J){U(J)})})}function B(D,W){W=w.apply(this,arguments);var U=this.config();D=typeof D!="function"&&D||{},D.name||(D.name=D.name||U.name,D.storeName=D.storeName||U.storeName);var J=this,Q;return D.name?Q=new f(function(Y){var pe;D.name===U.name?pe=J._dbInfo.db:pe=openDatabase(D.name,"","",0),D.storeName?Y({db:pe,storeNames:[D.storeName]}):Y(M(pe))}).then(function(Y){return new f(function(pe,_e){Y.db.transaction(function(Se){function Ee(Dt){return new f(function(Ut,or){Se.executeSql("DROP TABLE IF EXISTS "+Dt,[],function(){Ut()},function(ir,Kr){or(Kr)})})}for(var Ae=[],ze=0,vt=Y.storeNames.length;ze<vt;ze++)Ae.push(Ee(Y.storeNames[ze]));f.all(Ae).then(function(){pe()}).catch(function(Dt){_e(Dt)})},function(Se){_e(Se)})})}):Q=f.reject("Invalid arguments"),h(Q,W),Q}var K={_driver:"webSQLStorage",_initStorage:it,_support:ht(),iterate:Je,getItem:St,setItem:It,removeItem:ot,clear:bt,length:Lt,key:j,keys:S,dropInstance:B};function Z(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function ee(D,W){var U=D.name+"/";return D.storeName!==W.storeName&&(U+=D.storeName+"/"),U}function Be(){var D="_localforage_support_test";try{return localStorage.setItem(D,!0),localStorage.removeItem(D),!1}catch{return!0}}function tt(){return!Be()||localStorage.length>0}function Ne(D){var W=this,U={};if(D)for(var J in D)U[J]=D[J];return U.keyPrefix=ee(D,W._defaultConfig),tt()?(W._dbInfo=U,U.serializer=jt,f.resolve()):f.reject()}function z(D){var W=this,U=W.ready().then(function(){for(var J=W._dbInfo.keyPrefix,Q=localStorage.length-1;Q>=0;Q--){var Y=localStorage.key(Q);Y.indexOf(J)===0&&localStorage.removeItem(Y)}});return h(U,D),U}function ne(D,W){var U=this;D=_(D);var J=U.ready().then(function(){var Q=U._dbInfo,Y=localStorage.getItem(Q.keyPrefix+D);return Y&&(Y=Q.serializer.deserialize(Y)),Y});return h(J,W),J}function he(D,W){var U=this,J=U.ready().then(function(){for(var Q=U._dbInfo,Y=Q.keyPrefix,pe=Y.length,_e=localStorage.length,Se=1,Ee=0;Ee<_e;Ee++){var Ae=localStorage.key(Ee);if(Ae.indexOf(Y)===0){var ze=localStorage.getItem(Ae);if(ze&&(ze=Q.serializer.deserialize(ze)),ze=D(ze,Ae.substring(pe),Se++),ze!==void 0)return ze}}});return h(J,W),J}function Pe(D,W){var U=this,J=U.ready().then(function(){var Q=U._dbInfo,Y;try{Y=localStorage.key(D)}catch{Y=null}return Y&&(Y=Y.substring(Q.keyPrefix.length)),Y});return h(J,W),J}function We(D){var W=this,U=W.ready().then(function(){for(var J=W._dbInfo,Q=localStorage.length,Y=[],pe=0;pe<Q;pe++){var _e=localStorage.key(pe);_e.indexOf(J.keyPrefix)===0&&Y.push(_e.substring(J.keyPrefix.length))}return Y});return h(U,D),U}function Re(D){var W=this,U=W.keys().then(function(J){return J.length});return h(U,D),U}function Fe(D,W){var U=this;D=_(D);var J=U.ready().then(function(){var Q=U._dbInfo;localStorage.removeItem(Q.keyPrefix+D)});return h(J,W),J}function at(D,W,U){var J=this;D=_(D);var Q=J.ready().then(function(){W===void 0&&(W=null);var Y=W;return new f(function(pe,_e){var Se=J._dbInfo;Se.serializer.serialize(W,function(Ee,Ae){if(Ae)_e(Ae);else try{localStorage.setItem(Se.keyPrefix+D,Ee),pe(Y)}catch(ze){(ze.name==="QuotaExceededError"||ze.name==="NS_ERROR_DOM_QUOTA_REACHED")&&_e(ze),_e(ze)}})})});return h(Q,U),Q}function Ht(D,W){if(W=w.apply(this,arguments),D=typeof D!="function"&&D||{},!D.name){var U=this.config();D.name=D.name||U.name,D.storeName=D.storeName||U.storeName}var J=this,Q;return D.name?Q=new f(function(Y){D.storeName?Y(ee(D,J._defaultConfig)):Y(D.name+"/")}).then(function(Y){for(var pe=localStorage.length-1;pe>=0;pe--){var _e=localStorage.key(pe);_e.indexOf(Y)===0&&localStorage.removeItem(_e)}}):Q=f.reject("Invalid arguments"),h(Q,W),Q}var Pt={_driver:"localStorageWrapper",_initStorage:Ne,_support:Z(),iterate:he,getItem:ne,setItem:at,removeItem:Fe,clear:z,length:Re,key:Pe,keys:We,dropInstance:Ht},Nt=function(W,U){return W===U||typeof W=="number"&&typeof U=="number"&&isNaN(W)&&isNaN(U)},Qt=function(W,U){for(var J=W.length,Q=0;Q<J;){if(Nt(W[Q],U))return!0;Q++}return!1},gr=Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"},nr={},Wt={},mr={INDEXEDDB:lt,WEBSQL:K,LOCALSTORAGE:Pt},on=[mr.INDEXEDDB._driver,mr.WEBSQL._driver,mr.LOCALSTORAGE._driver],Rr=["dropInstance"],an=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Rr),Qn={description:"",driver:on.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ei(D,W){D[W]=function(){var U=arguments;return D.ready().then(function(){return D[W].apply(D,U)})}}function cn(){for(var D=1;D<arguments.length;D++){var W=arguments[D];if(W)for(var U in W)W.hasOwnProperty(U)&&(gr(W[U])?arguments[0][U]=W[U].slice():arguments[0][U]=W[U])}return arguments[0]}var ti=function(){function D(W){o(this,D);for(var U in mr)if(mr.hasOwnProperty(U)){var J=mr[U],Q=J._driver;this[U]=Q,nr[Q]||this.defineDriver(J)}this._defaultConfig=cn({},Qn),this._config=cn({},this._defaultConfig,W),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return D.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 J in U){if(J==="storeName"&&(U[J]=U[J].replace(/\W/g,"_")),J==="version"&&typeof U[J]!="number")return new Error("Database version must be a number.");this._config[J]=U[J]}return"driver"in U&&U.driver?this.setDriver(this._config.driver):!0}else return typeof U=="string"?this._config[U]:this._config},D.prototype.defineDriver=function(U,J,Q){var Y=new f(function(pe,_e){try{var Se=U._driver,Ee=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!U._driver){_e(Ee);return}for(var Ae=an.concat("_initStorage"),ze=0,vt=Ae.length;ze<vt;ze++){var Dt=Ae[ze],Ut=!Qt(Rr,Dt);if((Ut||U[Dt])&&typeof U[Dt]!="function"){_e(Ee);return}}var or=function(){for(var Yo=function(g3){return function(){var v3=new Error("Method "+g3+" is not implemented by the current driver"),Z0=f.reject(v3);return h(Z0,arguments[arguments.length-1]),Z0}},Nl=0,m3=Rr.length;Nl<m3;Nl++){var Dl=Rr[Nl];U[Dl]||(U[Dl]=Yo(Dl))}};or();var ir=function(Yo){nr[Se]&&console.info("Redefining LocalForage driver: "+Se),nr[Se]=U,Wt[Se]=Yo,pe()};"_support"in U?U._support&&typeof U._support=="function"?U._support().then(ir,_e):ir(!!U._support):ir(!0)}catch(Kr){_e(Kr)}});return y(Y,J,Q),Y},D.prototype.driver=function(){return this._driver||null},D.prototype.getDriver=function(U,J,Q){var Y=nr[U]?f.resolve(nr[U]):f.reject(new Error("Driver not found."));return y(Y,J,Q),Y},D.prototype.getSerializer=function(U){var J=f.resolve(jt);return y(J,U),J},D.prototype.ready=function(U){var J=this,Q=J._driverSet.then(function(){return J._ready===null&&(J._ready=J._initDriver()),J._ready});return y(Q,U,U),Q},D.prototype.setDriver=function(U,J,Q){var Y=this;gr(U)||(U=[U]);var pe=this._getSupportedDrivers(U);function _e(){Y._config.driver=Y.driver()}function Se(ze){return Y._extend(ze),_e(),Y._ready=Y._initStorage(Y._config),Y._ready}function Ee(ze){return function(){var vt=0;function Dt(){for(;vt<ze.length;){var Ut=ze[vt];return vt++,Y._dbInfo=null,Y._ready=null,Y.getDriver(Ut).then(Se).catch(Dt)}_e();var or=new Error("No available storage method found.");return Y._driverSet=f.reject(or),Y._driverSet}return Dt()}}var Ae=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=Ae.then(function(){var ze=pe[0];return Y._dbInfo=null,Y._ready=null,Y.getDriver(ze).then(function(vt){Y._driver=vt._driver,_e(),Y._wrapLibraryMethodsWithReady(),Y._initDriver=Ee(pe)})}).catch(function(){_e();var ze=new Error("No available storage method found.");return Y._driverSet=f.reject(ze),Y._driverSet}),y(this._driverSet,J,Q),this._driverSet},D.prototype.supports=function(U){return!!Wt[U]},D.prototype._extend=function(U){cn(this,U)},D.prototype._getSupportedDrivers=function(U){for(var J=[],Q=0,Y=U.length;Q<Y;Q++){var pe=U[Q];this.supports(pe)&&J.push(pe)}return J},D.prototype._wrapLibraryMethodsWithReady=function(){for(var U=0,J=an.length;U<J;U++)ei(this,an[U])},D.prototype.createInstance=function(U){return new D(U)},D}(),ri=new ti;n.exports=ri},{3:3}]},{},[4])(4)})})(c4);var mj=c4.exports;const ga=Qa(mj);ga.config({name:"CetusSite",storeName:"tokens"});class yi{static async setItem(t,r){try{await ga.setItem(t,r)}catch(n){console.error(`Failed to set item with key "${t}"`,n)}}static async getItem(t){try{return await ga.getItem(t)}catch(r){return console.error(`Failed to get item with key "${t}"`,r),null}}static async removeItem(t){try{await ga.removeItem(t)}catch(r){console.error(`Failed to remove item with key "${t}"`,r)}}static async clear(){try{await ga.clear()}catch(t){console.error("Failed to clear storage",t)}}}const el=[{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}],xu=[{name:"Sui Fullnode",link:"https://fullnode.mainnet.sui.io",isCustom:!1},{name:"Custom RPC URL",link:"",isCustom:!0}],gj=[{display:"0.1",value:"0.001"},{display:"0.5",value:"0.005"},{display:"1",value:"0.01"}],vj="mainnet",yj={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"}},Su=yj[vj],bj=Ft("/images/birdeye-logo.png"),wj=Ft("/images/img-logo@2x.png"),_j=Ft("/images/logo_CoinGecko@2x.png"),xj=Ft("/images/logo_pyth.png");var Oa=(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))(Oa||{});const u4={pyth:"Pyth Network",coingecko:"CoinGecko",birdeye:"Birdeye",Cetus:"Cetus"},Sj={pyth:xj,coingecko:_j,birdeye:bj,Cetus:wj},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")},l4={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}},im=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},Ej=e=>e?im(e):im,Mj=e=>e;function Cj(e,t=Mj){const r=ie.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return ie.useDebugValue(r),r}const sm=e=>{const t=Ej(e),r=n=>Cj(t,n);return Object.assign(r,t),r},Ti=e=>e?sm(e):sm;function Aj(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 fd=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return fd(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return fd(n)(r)}}}},Tj=(e,t)=>(r,n,i)=>{let s={storage:Aj(()=>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 _=()=>{var w,A;if(!u)return;o=!1,a.forEach(P=>{var N;return P((N=n())!=null?N:h)});const I=((A=s.onRehydrateStorage)==null?void 0:A.call(s,(w=n())!=null?w:h))||void 0;return fd(u.getItem.bind(u))(s.name).then(P=>{if(P)if(typeof P.version=="number"&&P.version!==s.version){if(s.migrate){const N=s.migrate(P.state,P.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,P.state];return[!1,void 0]}).then(P=>{var N;const[F,L]=P;if(y=s.merge(L,(N=n())!=null?N:h),r(y,!0),F)return l()}).then(()=>{I==null||I(y,void 0),y=n(),o=!0,c.forEach(P=>P(y))}).catch(P=>{I==null||I(void 0,P)})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(u=w.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>_(),hasHydrated:()=>o,onHydrate:w=>(a.add(w),()=>{a.delete(w)}),onFinishHydration:w=>(c.add(w),()=>{c.delete(w)})},s.skipHydration||_(),y||h},Oj=Tj,Ij=(e,t)=>({currentExplorer:el[0].link,setCurrentExplorer:r=>{e(()=>({currentExplorer:r}))},rpcList:xu,setRpcList:r=>{e(()=>({rpcList:[...r]}))},currentRpc:xu[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(Oa),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}))}}),Wr=Ti(Oj(Ij,{name:"useGlobalStore",partialize:e=>{const{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}=e;return{currentExplorer:t,currentRpc:r,slippage:n,customRpc:i,providers:s,mevProtect:o}}}));function $o(){const{currentExplorer:e}=Wr();return{getExplorerUrl:(r,n="account",i=e)=>{let s;return i.includes("suivision")?s=`${i}/${jj(n)}/${r}`:s=`${i}/${kj(n)}/${r}`,s}}}const kj=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"}},jj=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 f4(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 b.jsx("span",{style:{display:"inline",whiteSpace:"normal",textAlign:"start"},children:c.map((u,l)=>{const f=r.includes(u);return b.jsx("span",{style:{lineHeight:"20px",fontSize:s,color:f?i:o,cursor:"pointer",whiteSpace:"inherit"},onClick:()=>n(u),children:u},l)})})}var d4={exports:{}};/*!
|
|
50
45
|
Copyright (c) 2018 Jed Watson.
|
|
51
46
|
Licensed under the MIT License (MIT), see
|
|
52
47
|
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})()})(E4);var WR=E4.exports;const Jt=nc(WR);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 GR(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ol(...e){return t=>e.forEach(r=>GR(r,t))}function Zt(...e){return I.useCallback(Ol(...e),e)}function Ho(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,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,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,KR(i,...t)]}function KR(...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 xi=I.forwardRef((e,t)=>{const{children:r,...n}=e,i=I.Children.toArray(r),s=i.find(XR);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(Qd,{...n,ref:t,children:I.isValidElement(o)?I.cloneElement(o,void 0,a):null})}return _.jsx(Qd,{...n,ref:t,children:r})});xi.displayName="Slot";var Qd=I.forwardRef((e,t)=>{const{children:r,...n}=e;if(I.isValidElement(r)){const i=YR(r);return I.cloneElement(r,{...JR(n,r.props),ref:t?Ol(t,i):i})}return I.Children.count(r)>1?I.Children.only(null):null});Qd.displayName="SlotClone";var Wo=({children:e})=>_.jsx(_.Fragment,{children:e});function XR(e){return I.isValidElement(e)&&e.type===Wo}function JR(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 YR(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 ZR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Wt=ZR.reduce((e,t)=>{const r=I.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?xi: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 C4(e,t){e&&jv.flushSync(()=>e.dispatchEvent(t))}function pr(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 QR(e,t=globalThis==null?void 0:globalThis.document){const r=pr(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 eN="DismissableLayer",eh="dismissableLayer.update",tN="dismissableLayer.pointerDownOutside",rN="dismissableLayer.focusOutside",hg,M4=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hp=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=I.useContext(M4),[l,f]=I.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=I.useState({}),b=Zt(t,q=>f(q)),w=Array.from(u.layers),[T]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),P=w.indexOf(T),R=l?w.indexOf(l):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,z=R>=P,F=sN(q=>{const K=q.target,te=[...u.branches].some(se=>se.contains(K));!z||te||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),W=oN(q=>{const K=q.target;[...u.branches].some(se=>se.contains(K))||(s==null||s(q),o==null||o(q),q.defaultPrevented||a==null||a())},h);return QR(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&&(hg=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),pg(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=hg)}},[l,h,r,u]),I.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),pg())},[l,u]),I.useEffect(()=>{const q=()=>y({});return document.addEventListener(eh,q),()=>document.removeEventListener(eh,q)},[]),_.jsx(Wt.div,{...c,ref:b,style:{pointerEvents:N?z?"auto":"none":void 0,...e.style},onFocusCapture:tt(e.onFocusCapture,W.onFocusCapture),onBlurCapture:tt(e.onBlurCapture,W.onBlurCapture),onPointerDownCapture:tt(e.onPointerDownCapture,F.onPointerDownCapture)})});Hp.displayName=eN;var nN="DismissableLayerBranch",iN=I.forwardRef((e,t)=>{const r=I.useContext(M4),n=I.useRef(null),i=Zt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),_.jsx(Wt.div,{...e,ref:i})});iN.displayName=nN;function sN(e,t=globalThis==null?void 0:globalThis.document){const r=pr(e),n=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){A4(tN,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 oN(e,t=globalThis==null?void 0:globalThis.document){const r=pr(e),n=I.useRef(!1);return I.useEffect(()=>{const i=s=>{s.target&&!n.current&&A4(rN,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 pg(){const e=new CustomEvent(eh);document.dispatchEvent(e)}function A4(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?C4(i,s):i.dispatchEvent(s)}var Qi=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},aN=I["useId".toString()]||(()=>{}),cN=0;function Ha(e){const[t,r]=I.useState(aN());return Qi(()=>{e||r(n=>n??String(cN++))},[e]),e||(t?`radix-${t}`:"")}const uN=["top","right","bottom","left"],es=Math.min,Vr=Math.max,$u=Math.round,kc=Math.floor,Hn=e=>({x:e,y:e}),lN={left:"right",right:"left",bottom:"top",top:"bottom"},fN={start:"end",end:"start"};function th(e,t,r){return Vr(e,es(t,r))}function Si(e,t){return typeof e=="function"?e(t):e}function Ei(e){return e.split("-")[0]}function Go(e){return e.split("-")[1]}function Wp(e){return e==="x"?"y":"x"}function Gp(e){return e==="y"?"height":"width"}function ts(e){return["top","bottom"].includes(Ei(e))?"y":"x"}function Kp(e){return Wp(ts(e))}function dN(e,t,r){r===void 0&&(r=!1);const n=Go(e),i=Kp(e),s=Gp(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Lu(o)),[o,Lu(o)]}function hN(e){const t=Lu(e);return[rh(e),t,rh(t)]}function rh(e){return e.replace(/start|end/g,t=>fN[t])}function pN(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 mN(e,t,r,n){const i=Go(e);let s=pN(Ei(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(rh)))),s}function Lu(e){return e.replace(/left|right|bottom|top/g,t=>lN[t])}function gN(e){return{top:0,right:0,bottom:0,left:0,...e}}function T4(e){return typeof e!="number"?gN(e):{top:e,right:e,bottom:e,left:e}}function Fu(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 mg(e,t,r){let{reference:n,floating:i}=e;const s=ts(t),o=Kp(t),a=Gp(o),c=Ei(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(Go(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const vN=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}=mg(u,n,c),h=n,y={},b=0;for(let w=0;w<a.length;w++){const{name:T,fn:P}=a[w],{x:R,y:N,data:z,reset:F}=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,[T]:{...y[T],...z}},F&&b<=50&&(b++,typeof F=="object"&&(F.placement&&(h=F.placement),F.rects&&(u=F.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):F.rects),{x:l,y:f}=mg(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function Wa(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}=Si(t,e),b=T4(y),T=a[h?f==="floating"?"reference":"floating":f],P=Fu(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(T)))==null||r?T:T.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)),z=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},F=Fu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:R,offsetParent:N,strategy:c}):R);return{top:(P.top-F.top+b.top)/z.y,bottom:(F.bottom-P.bottom+b.bottom)/z.y,left:(P.left-F.left+b.left)/z.x,right:(F.right-P.right+b.right)/z.x}}const yN=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}=Si(e,t)||{};if(u==null)return{};const f=T4(l),h={x:r,y:n},y=Kp(i),b=Gp(y),w=await o.getDimensions(u),T=y==="y",P=T?"top":"left",R=T?"bottom":"right",N=T?"clientHeight":"clientWidth",z=s.reference[b]+s.reference[y]-h[y]-s.floating[b],F=h[y]-s.reference[y],W=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let q=W?W[N]:0;(!q||!await(o.isElement==null?void 0:o.isElement(W)))&&(q=a.floating[N]||s.floating[b]);const K=z/2-F/2,te=q/2-w[b]/2-1,se=es(f[P],te),H=es(f[R],te),L=se,D=q-w[b]-H,p=q/2-w[b]/2+K,d=th(L,p,D),m=!c.arrow&&Go(i)!=null&&p!==d&&s.reference[b]/2-(p<L?se:H)-w[b]/2<0,x=m?p<L?p-L:p-D:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),bN=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,...T}=Si(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const P=Ei(i),R=ts(a),N=Ei(a)===a,z=await(c.isRTL==null?void 0:c.isRTL(u.floating)),F=h||(N||!w?[Lu(a)]:hN(a)),W=b!=="none";!h&&W&&F.push(...mN(a,w,b,z));const q=[a,...F],K=await Wa(t,T),te=[];let se=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&te.push(K[P]),f){const p=dN(i,o,z);te.push(K[p[0]],K[p[1]])}if(se=[...se,{placement:i,overflows:te}],!te.every(p=>p<=0)){var H,L;const p=(((H=s.flip)==null?void 0:H.index)||0)+1,d=q[p];if(d)return{data:{index:p,overflows:se},reset:{placement:d}};let m=(L=se.filter(x=>x.overflows[0]<=0).sort((x,C)=>x.overflows[1]-C.overflows[1])[0])==null?void 0:L.placement;if(!m)switch(y){case"bestFit":{var D;const x=(D=se.filter(C=>{if(W){const E=ts(C.placement);return E===R||E==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(E=>E>0).reduce((E,O)=>E+O,0)]).sort((C,E)=>C[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 gg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vg(e){return uN.some(t=>e[t]>=0)}const wN=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Si(e,t);switch(n){case"referenceHidden":{const s=await Wa(t,{...i,elementContext:"reference"}),o=gg(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:vg(o)}}}case"escaped":{const s=await Wa(t,{...i,altBoundary:!0}),o=gg(s,r.floating);return{data:{escapedOffsets:o,escaped:vg(o)}}}default:return{}}}}};async function _N(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Ei(r),a=Go(r),c=ts(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Si(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 xN=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 _N(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}}}}},SN=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:T=>{let{x:P,y:R}=T;return{x:P,y:R}}},...c}=Si(e,t),u={x:r,y:n},l=await Wa(t,c),f=ts(Ei(i)),h=Wp(f);let y=u[h],b=u[f];if(s){const T=h==="y"?"top":"left",P=h==="y"?"bottom":"right",R=y+l[T],N=y-l[P];y=th(R,y,N)}if(o){const T=f==="y"?"top":"left",P=f==="y"?"bottom":"right",R=b+l[T],N=b-l[P];b=th(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}}}}}},EN=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}=Si(e,t),l={x:r,y:n},f=ts(i),h=Wp(f);let y=l[h],b=l[f];const w=Si(a,t),T=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const N=h==="y"?"height":"width",z=s.reference[h]-s.floating[N]+T.mainAxis,F=s.reference[h]+s.reference[N]-T.mainAxis;y<z?y=z:y>F&&(y=F)}if(u){var P,R;const N=h==="y"?"width":"height",z=["top","left"].includes(Ei(i)),F=s.reference[f]-s.floating[N]+(z&&((P=o.offset)==null?void 0:P[f])||0)+(z?0:T.crossAxis),W=s.reference[f]+s.reference[N]+(z?0:((R=o.offset)==null?void 0:R[f])||0)-(z?T.crossAxis:0);b<F?b=F:b>W&&(b=W)}return{[h]:y,[f]:b}}}},CN=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}=Si(e,t),l=await Wa(t,u),f=Ei(i),h=Go(i),y=ts(i)==="y",{width:b,height:w}=s.floating;let T,P;f==="top"||f==="bottom"?(T=f,P=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(P=f,T=h==="end"?"top":"bottom");const R=w-l.top-l.bottom,N=b-l.left-l.right,z=es(w-l[T],R),F=es(b-l[P],N),W=!t.middlewareData.shift;let q=z,K=F;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(K=N),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(q=R),W&&!h){const se=Vr(l.left,0),H=Vr(l.right,0),L=Vr(l.top,0),D=Vr(l.bottom,0);y?K=b-2*(se!==0||H!==0?se+H:Vr(l.left,l.right)):q=w-2*(L!==0||D!==0?L+D:Vr(l.top,l.bottom))}await c({...t,availableWidth:K,availableHeight:q});const te=await o.getDimensions(a.floating);return b!==te.width||w!==te.height?{reset:{rects:!0}}:{}}}};function Il(){return typeof window<"u"}function Ko(e){return O4(e)?(e.nodeName||"").toLowerCase():"#document"}function Hr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ei(e){var t;return(t=(O4(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function O4(e){return Il()?e instanceof Node||e instanceof Hr(e).Node:!1}function En(e){return Il()?e instanceof Element||e instanceof Hr(e).Element:!1}function Yn(e){return Il()?e instanceof HTMLElement||e instanceof Hr(e).HTMLElement:!1}function yg(e){return!Il()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hr(e).ShadowRoot}function pc(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=Cn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function MN(e){return["table","td","th"].includes(Ko(e))}function Pl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Xp(e){const t=Jp(),r=En(e)?Cn(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 AN(e){let t=rs(e);for(;Yn(t)&&!ko(t);){if(Xp(t))return t;if(Pl(t))return null;t=rs(t)}return null}function Jp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ko(e){return["html","body","#document"].includes(Ko(e))}function Cn(e){return Hr(e).getComputedStyle(e)}function kl(e){return En(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rs(e){if(Ko(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yg(e)&&e.host||ei(e);return yg(t)?t.host:t}function I4(e){const t=rs(e);return ko(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yn(t)&&pc(t)?t:I4(t)}function Ga(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=I4(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Hr(i);if(s){const a=nh(o);return t.concat(o,o.visualViewport||[],pc(i)?i:[],a&&r?Ga(a):[])}return t.concat(i,Ga(i,[],r))}function nh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function P4(e){const t=Cn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Yn(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=$u(r)!==s||$u(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function Yp(e){return En(e)?e:e.contextElement}function So(e){const t=Yp(e);if(!Yn(t))return Hn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=P4(t);let o=(s?$u(r.width):r.width)/n,a=(s?$u(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const TN=Hn(0);function k4(e){const t=Hr(e);return!Jp()||!t.visualViewport?TN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ON(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Hr(e)?!1:t}function Ls(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=Yp(e);let o=Hn(1);t&&(n?En(n)&&(o=So(n)):o=So(e));const a=ON(s,r,n)?k4(s):Hn(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=Hr(s),y=n&&En(n)?Hr(n):n;let b=h,w=nh(b);for(;w&&n&&y!==b;){const T=So(w),P=w.getBoundingClientRect(),R=Cn(w),N=P.left+(w.clientLeft+parseFloat(R.paddingLeft))*T.x,z=P.top+(w.clientTop+parseFloat(R.paddingTop))*T.y;c*=T.x,u*=T.y,l*=T.x,f*=T.y,c+=N,u+=z,b=Hr(w),w=nh(b)}}return Fu({width:l,height:f,x:c,y:u})}function Zp(e,t){const r=kl(e).scrollLeft;return t?t.left+r:Ls(ei(e)).left+r}function j4(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:Zp(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function IN(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=ei(n),a=t?Pl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Hn(1);const l=Hn(0),f=Yn(n);if((f||!f&&!s)&&((Ko(n)!=="body"||pc(o))&&(c=kl(n)),Yn(n))){const y=Ls(n);u=So(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?j4(o,c,!0):Hn(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 PN(e){return Array.from(e.getClientRects())}function kN(e){const t=ei(e),r=kl(e),n=e.ownerDocument.body,i=Vr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Vr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+Zp(e);const a=-r.scrollTop;return Cn(n).direction==="rtl"&&(o+=Vr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function jN(e,t){const r=Hr(e),n=ei(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=Jp();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function RN(e,t){const r=Ls(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=Yn(e)?So(e):Hn(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 bg(e,t,r){let n;if(t==="viewport")n=jN(e,r);else if(t==="document")n=kN(ei(e));else if(En(t))n=RN(t,r);else{const i=k4(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Fu(n)}function R4(e,t){const r=rs(e);return r===t||!En(r)||ko(r)?!1:Cn(r).position==="fixed"||R4(r,t)}function NN(e,t){const r=t.get(e);if(r)return r;let n=Ga(e,[],!1).filter(a=>En(a)&&Ko(a)!=="body"),i=null;const s=Cn(e).position==="fixed";let o=s?rs(e):e;for(;En(o)&&!ko(o);){const a=Cn(o),c=Xp(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||pc(o)&&!c&&R4(e,o))?n=n.filter(l=>l!==o):i=a,o=rs(o)}return t.set(e,n),n}function DN(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?Pl(t)?[]:NN(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=bg(t,l,i);return u.top=Vr(f.top,u.top),u.right=es(f.right,u.right),u.bottom=es(f.bottom,u.bottom),u.left=Vr(f.left,u.left),u},bg(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function BN(e){const{width:t,height:r}=P4(e);return{width:t,height:r}}function $N(e,t,r){const n=Yn(t),i=ei(t),s=r==="fixed",o=Ls(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Hn(0);if(n||!n&&!s)if((Ko(t)!=="body"||pc(i))&&(a=kl(t)),n){const h=Ls(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=Zp(i));const u=i&&!n&&!s?j4(i,a):Hn(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 Ff(e){return Cn(e).position==="static"}function wg(e,t){if(!Yn(e)||Cn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ei(e)===r&&(r=r.ownerDocument.body),r}function N4(e,t){const r=Hr(e);if(Pl(e))return r;if(!Yn(e)){let i=rs(e);for(;i&&!ko(i);){if(En(i)&&!Ff(i))return i;i=rs(i)}return r}let n=wg(e,t);for(;n&&MN(n)&&Ff(n);)n=wg(n,t);return n&&ko(n)&&Ff(n)&&!Xp(n)?r:n||AN(e)||r}const LN=async function(e){const t=this.getOffsetParent||N4,r=this.getDimensions,n=await r(e.floating);return{reference:$N(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function FN(e){return Cn(e).direction==="rtl"}const UN={convertOffsetParentRelativeRectToViewportRelativeRect:IN,getDocumentElement:ei,getClippingRect:DN,getOffsetParent:N4,getElementRects:LN,getClientRects:PN,getDimensions:BN,getScale:So,isElement:En,isRTL:FN};function zN(e,t){let r=null,n;const i=ei(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=kc(l),b=kc(i.clientWidth-(u+f)),w=kc(i.clientHeight-(l+h)),T=kc(u),R={rootMargin:-y+"px "+-b+"px "+-w+"px "+-T+"px",threshold:Vr(0,es(1,c))||1};let N=!0;function z(F){const W=F[0].intersectionRatio;if(W!==c){if(!N)return o();W?o(!1,W):n=setTimeout(()=>{o(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(z,{...R,root:i.ownerDocument})}catch{r=new IntersectionObserver(z,R)}r.observe(e)}return o(!0),s}function VN(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=Yp(e),l=i||s?[...u?Ga(u):[],...Ga(t)]:[];l.forEach(P=>{i&&P.addEventListener("scroll",r,{passive:!0}),s&&P.addEventListener("resize",r)});const f=u&&a?zN(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?Ls(e):null;c&&T();function T(){const P=Ls(e);w&&(P.x!==w.x||P.y!==w.y||P.width!==w.width||P.height!==w.height)&&r(),w=P,b=requestAnimationFrame(T)}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 qN=xN,HN=SN,WN=bN,GN=CN,KN=wN,_g=yN,XN=EN,JN=(e,t,r)=>{const n=new Map,i={platform:UN,...r},s={...i.platform,_c:n};return vN(e,t,{...i,platform:s})};var ou=typeof document<"u"?ae.useLayoutEffect:ae.useEffect;function Uu(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(!Uu(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)&&!Uu(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function D4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xg(e,t){const r=D4(e);return Math.round(t*r)/r}function Uf(e){const t=I.useRef(e);return ou(()=>{t.current=e}),t}function YN(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);Uu(h,n)||y(n);const[b,w]=I.useState(null),[T,P]=I.useState(null),R=I.useCallback(C=>{C!==W.current&&(W.current=C,w(C))},[]),N=I.useCallback(C=>{C!==q.current&&(q.current=C,P(C))},[]),z=s||b,F=o||T,W=I.useRef(null),q=I.useRef(null),K=I.useRef(l),te=c!=null,se=Uf(c),H=Uf(i),L=Uf(u),D=I.useCallback(()=>{if(!W.current||!q.current)return;const C={placement:t,strategy:r,middleware:h};H.current&&(C.platform=H.current),JN(W.current,q.current,C).then(E=>{const O={...E,isPositioned:L.current!==!1};p.current&&!Uu(K.current,O)&&(K.current=O,jv.flushSync(()=>{f(O)}))})},[h,t,r,H,L]);ou(()=>{u===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,f(C=>({...C,isPositioned:!1})))},[u]);const p=I.useRef(!1);ou(()=>(p.current=!0,()=>{p.current=!1}),[]),ou(()=>{if(z&&(W.current=z),F&&(q.current=F),z&&F){if(se.current)return se.current(z,F,D);D()}},[z,F,D,se,te]);const d=I.useMemo(()=>({reference:W,floating:q,setReference:R,setFloating:N}),[R,N]),m=I.useMemo(()=>({reference:z,floating:F}),[z,F]),x=I.useMemo(()=>{const C={position:r,left:0,top:0};if(!m.floating)return C;const E=xg(m.floating,l.x),O=xg(m.floating,l.y);return a?{...C,transform:"translate("+E+"px, "+O+"px)",...D4(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 ZN=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?_g({element:n.current,padding:i}).fn(r):{}:n?_g({element:n,padding:i}).fn(r):{}}}},QN=(e,t)=>({...qN(e),options:[e,t]}),eD=(e,t)=>({...HN(e),options:[e,t]}),tD=(e,t)=>({...XN(e),options:[e,t]}),rD=(e,t)=>({...WN(e),options:[e,t]}),nD=(e,t)=>({...GN(e),options:[e,t]}),iD=(e,t)=>({...KN(e),options:[e,t]}),sD=(e,t)=>({...ZN(e),options:[e,t]});var oD="Arrow",B4=I.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...s}=e;return _.jsx(Wt.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"})})});B4.displayName=oD;var aD=B4;function cD(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,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,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,uD(i,...t)]}function uD(...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 Qp(e){const[t,r]=I.useState(void 0);return Qi(()=>{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 e0="Popper",[$4,jl]=cD(e0),[lD,L4]=$4(e0),F4=e=>{const{__scopePopper:t,children:r}=e,[n,i]=I.useState(null);return _.jsx(lD,{scope:t,anchor:n,onAnchorChange:i,children:r})};F4.displayName=e0;var U4="PopperAnchor",z4=I.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=L4(U4,r),o=I.useRef(null),a=Zt(t,o);return I.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:_.jsx(Wt.div,{...i,ref:a})});z4.displayName=U4;var t0="PopperContent",[fD,dD]=$4(t0),V4=I.forwardRef((e,t)=>{var ge,ve,Se,xe,Xe,Le;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,T=L4(t0,r),[P,R]=I.useState(null),N=Zt(t,ot=>R(ot)),[z,F]=I.useState(null),W=Qp(z),q=(W==null?void 0:W.width)??0,K=(W==null?void 0:W.height)??0,te=n+(s!=="center"?"-"+s:""),se=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},H=Array.isArray(u)?u:[u],L=H.length>0,D={padding:se,boundary:H.filter(pD),altBoundary:L},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:C}=YN({strategy:"fixed",placement:te,whileElementsMounted:(...ot)=>VN(...ot,{animationFrame:y==="always"}),elements:{reference:T.anchor},middleware:[QN({mainAxis:i+K,alignmentAxis:o}),c&&eD({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?tD():void 0,...D}),c&&rD({...D}),nD({...D,apply:({elements:ot,rects:dt,availableWidth:De,availableHeight:vt})=>{const{width:we,height:me}=dt.reference,Ae=ot.floating.style;Ae.setProperty("--radix-popper-available-width",`${De}px`),Ae.setProperty("--radix-popper-available-height",`${vt}px`),Ae.setProperty("--radix-popper-anchor-width",`${we}px`),Ae.setProperty("--radix-popper-anchor-height",`${me}px`)}}),z&&sD({element:z,padding:a}),mD({arrowWidth:q,arrowHeight:K}),h&&iD({strategy:"referenceHidden",...D})]}),[E,O]=W4(m),M=pr(b);Qi(()=>{x&&(M==null||M())},[x,M]);const g=(ge=C.arrow)==null?void 0:ge.x,v=(ve=C.arrow)==null?void 0:ve.y,k=((Se=C.arrow)==null?void 0:Se.centerOffset)!==0,[ee,ie]=I.useState();return Qi(()=>{P&&ie(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":[(xe=C.transformOrigin)==null?void 0:xe.x,(Xe=C.transformOrigin)==null?void 0:Xe.y].join(" "),...((Le=C.hide)==null?void 0:Le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:_.jsx(fD,{scope:r,placedSide:E,onArrowChange:F,arrowX:g,arrowY:v,shouldHideArrow:k,children:_.jsx(Wt.div,{"data-side":E,"data-align":O,...w,ref:N,style:{...w.style,animation:x?void 0:"none"}})})})});V4.displayName=t0;var q4="PopperArrow",hD={top:"bottom",right:"left",bottom:"top",left:"right"},H4=I.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=dD(q4,n),o=hD[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(aD,{...i,ref:r,style:{...i.style,display:"block"}})})});H4.displayName=q4;function pD(e){return e!==null}var mD=e=>({name:"transformOrigin",options:e,fn(t){var T,P,R;const{placement:r,rects:n,middlewareData:i}=t,o=((T=i.arrow)==null?void 0:T.centerOffset)!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,l]=W4(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 W4(e){const[t,r="center"]=e.split("-");return[t,r]}var G4=F4,K4=z4,X4=V4,J4=H4,gD="Portal",Y4=I.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=I.useState(!1);Qi(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Yu.createPortal(_.jsx(Wt.div,{...n,ref:t}),o):null});Y4.displayName=gD;function vD(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var Tn=e=>{const{present:t,children:r}=e,n=yD(t),i=typeof r=="function"?r({present:n.isPresent}):I.Children.only(r),s=Zt(n.ref,bD(i));return typeof r=="function"||n.isPresent?I.cloneElement(i,{ref:s}):null};Tn.displayName="Presence";function yD(e){const[t,r]=I.useState(),n=I.useRef({}),i=I.useRef(e),s=I.useRef("none"),o=e?"mounted":"unmounted",[a,c]=vD(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const u=jc(n.current);s.current=a==="mounted"?u:"none"},[a]),Qi(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=jc(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]),Qi(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=jc(n.current).includes(y.animationName);if(y.target===t&&w&&(c("ANIMATION_END"),!i.current)){const T=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=T)})}},h=y=>{y.target===t&&(s.current=jc(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 jc(e){return(e==null?void 0:e.animationName)||"none"}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)}function mc({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=wD({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=pr(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 wD({defaultProp:e,onChange:t}){const r=I.useState(e),[n]=r,i=I.useRef(n),s=pr(t);return I.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var _D="VisuallyHidden",Z4=I.forwardRef((e,t)=>_.jsx(Wt.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}}));Z4.displayName=_D;var xD=Z4,[Rl,MK]=Ho("Tooltip",[jl]),r0=jl(),Q4="TooltipProvider",SD=700,Sg="tooltip.open",[ED,e6]=Rl(Q4),t6=e=>{const{__scopeTooltip:t,delayDuration:r=SD,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(ED,{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})};t6.displayName=Q4;var r6="Tooltip",[AK,Nl]=Rl(r6),ih="TooltipTrigger",CD=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=Nl(ih,r),s=e6(ih,r),o=r0(r),a=I.useRef(null),c=Zt(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(K4,{asChild:!0,...o,children:_.jsx(Wt.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)})})});CD.displayName=ih;var MD="TooltipPortal",[TK,AD]=Rl(MD,{forceMount:void 0}),jo="TooltipContent",TD=I.forwardRef((e,t)=>{const r=AD(jo,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=Nl(jo,e.__scopeTooltip);return _.jsx(Tn,{present:n||o.open,children:o.disableHoverableContent?_.jsx(n6,{side:i,...s,ref:t}):_.jsx(OD,{side:i,...s,ref:t})})}),OD=I.forwardRef((e,t)=>{const r=Nl(jo,e.__scopeTooltip),n=e6(jo,e.__scopeTooltip),i=I.useRef(null),s=Zt(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 T=b.currentTarget,P={x:b.clientX,y:b.clientY},R=jD(P,T.getBoundingClientRect()),N=RD(P,R),z=ND(w.getBoundingClientRect()),F=BD([...N,...z]);a(F),f(!0)},[f]);return I.useEffect(()=>()=>h(),[h]),I.useEffect(()=>{if(c&&l){const b=T=>y(T,l),w=T=>y(T,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 T=w.target,P={x:w.clientX,y:w.clientY},R=(c==null?void 0:c.contains(T))||(l==null?void 0:l.contains(T)),N=!DD(P,o);R?h():N&&(h(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,l,o,u,h]),_.jsx(n6,{...e,ref:s})}),[ID,PD]=Rl(r6,{isInside:!1}),n6=I.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=Nl(jo,r),u=r0(r),{onClose:l}=c;return I.useEffect(()=>(document.addEventListener(Sg,l),()=>document.removeEventListener(Sg,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(Hp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:_.jsxs(X4,{"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(Wo,{children:n}),_.jsx(ID,{scope:r,isInside:!0,children:_.jsx(xD,{id:c.contentId,role:"tooltip",children:i||n})})]})})});TD.displayName=jo;var i6="TooltipArrow",kD=I.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=r0(r);return PD(i6,r).isInside?null:_.jsx(J4,{...i,...n,ref:t})});kD.displayName=i6;function jD(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 RD(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 ND(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 DD(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 BD(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),$D(t)}function $D(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 LD=t6,s6=I.createContext(void 0),FD=e=>{const{dir:t,children:r}=e;return _.jsx(s6.Provider,{value:t,children:r})};function n0(e){const t=I.useContext(s6);return e||t||"ltr"}const UD=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],zD=["sky","mint","lime","yellow","amber"],VD=["gold","bronze"],qD=[...UD,...zD,...VD],HD="gray",WD=["mauve","slate","sage","olive","sand"],GD=[HD,...WD];function KD(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 XD=["inherit","light","dark"],JD=[...qD,"gray"],YD=[...GD,"auto"],ZD=["solid","translucent"],QD=["none","small","medium","large","full"],eB=["90%","95%","100%","105%","110%"],kr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:XD,default:"inherit"},accentColor:{type:"enum",values:JD,default:"indigo"},grayColor:{type:"enum",values:YD,default:"auto"},panelBackground:{type:"enum",values:ZD,default:"translucent"},radius:{type:"enum",values:QD,default:"medium"},scaling:{type:"enum",values:eB,default:"100%"}};function o6(e){return e==="gray"?"gray":KD(e)}const Qs=()=>{},zu=I.createContext(void 0);function tB(){const e=I.useContext(zu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const Dl=I.forwardRef((e,t)=>I.useContext(zu)===void 0?I.createElement(LD,null,I.createElement(FD,{dir:"ltr"},I.createElement(a6,{...e,ref:t}))):I.createElement(i0,{...e,ref:t}));Dl.displayName="Theme";const a6=I.forwardRef((e,t)=>{const{appearance:r=kr.appearance.default,accentColor:n=kr.accentColor.default,grayColor:i=kr.grayColor.default,panelBackground:s=kr.panelBackground.default,radius:o=kr.radius.default,scaling:a=kr.scaling.default,hasBackground:c=kr.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[T,P]=I.useState(s);I.useEffect(()=>P(s),[s]);const[R,N]=I.useState(o);I.useEffect(()=>N(o),[o]);const[z,F]=I.useState(a);I.useEffect(()=>F(a),[a]);const W=I.memo(({appearance:K})=>I.createElement("script",{dangerouslySetInnerHTML:{__html:`!(function(){try{var d=document.documentElement,c=d.classList;c.remove('light','dark');d.style.colorScheme='${K}';c.add('${K}');}catch(e){}})();`}}),()=>!0);W.displayName="ExplicitRootAppearanceScript",I.useEffect(()=>rB(r),[r]);const q=b==="auto"?o6(h):b;return I.createElement(I.Fragment,null,l!=="inherit"&&I.createElement(W,{appearance:l}),c&&I.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
48
|
+
*/(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})()})(d4);var Pj=d4.exports;const Xt=Qa(Pj);function rt(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 Rj(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function tl(...e){return t=>e.forEach(r=>Rj(r,t))}function Jt(...e){return O.useCallback(tl(...e),e)}function Bo(e,t=[]){let r=[];function n(s,o){const a=O.createContext(o),c=r.length;r=[...r,o];const u=f=>{var I;const{scope:h,children:y,..._}=f,w=((I=h==null?void 0:h[e])==null?void 0:I[c])||a,A=O.useMemo(()=>_,Object.values(_));return b.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,_=O.useContext(y);if(_)return _;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=>O.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return O.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,Nj(i,...t)]}function Nj(...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 O.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var xi=O.forwardRef((e,t)=>{const{children:r,...n}=e,i=O.Children.toArray(r),s=i.find(Dj);if(s){const o=s.props.children,a=i.map(c=>c===s?O.Children.count(o)>1?O.Children.only(null):O.isValidElement(o)?o.props.children:null:c);return b.jsx(dd,{...n,ref:t,children:O.isValidElement(o)?O.cloneElement(o,void 0,a):null})}return b.jsx(dd,{...n,ref:t,children:r})});xi.displayName="Slot";var dd=O.forwardRef((e,t)=>{const{children:r,...n}=e;if(O.isValidElement(r)){const i=Bj(r);return O.cloneElement(r,{...$j(n,r.props),ref:t?tl(t,i):i})}return O.Children.count(r)>1?O.Children.only(null):null});dd.displayName="SlotClone";var Lo=({children:e})=>b.jsx(b.Fragment,{children:e});function Dj(e){return O.isValidElement(e)&&e.type===Lo}function $j(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 Bj(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 Lj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Gt=Lj.reduce((e,t)=>{const r=O.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?xi:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(a,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function h4(e,t){e&&Ug.flushSync(()=>e.dispatchEvent(t))}function pr(e){const t=O.useRef(e);return O.useEffect(()=>{t.current=e}),O.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function Uj(e,t=globalThis==null?void 0:globalThis.document){const r=pr(e);O.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 Fj="DismissableLayer",hd="dismissableLayer.update",zj="dismissableLayer.pointerDownOutside",Vj="dismissableLayer.focusOutside",om,p4=O.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),e0=O.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...c}=e,u=O.useContext(p4),[l,f]=O.useState(null),h=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=O.useState({}),_=Jt(t,q=>f(q)),w=Array.from(u.layers),[A]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),I=w.indexOf(A),P=l?w.indexOf(l):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,F=P>=I,L=Hj(q=>{const X=q.target,re=[...u.branches].some(ae=>ae.contains(X));!F||re||(i==null||i(q),o==null||o(q),q.defaultPrevented||a==null||a())},h),H=Wj(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 Uj(q=>{P===u.layers.size-1&&(n==null||n(q),!q.defaultPrevented&&a&&(q.preventDefault(),a()))},h),O.useEffect(()=>{if(l)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(om=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(l)),u.layers.add(l),am(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=om)}},[l,h,r,u]),O.useEffect(()=>()=>{l&&(u.layers.delete(l),u.layersWithOutsidePointerEventsDisabled.delete(l),am())},[l,u]),O.useEffect(()=>{const q=()=>y({});return document.addEventListener(hd,q),()=>document.removeEventListener(hd,q)},[]),b.jsx(Gt.div,{...c,ref:_,style:{pointerEvents:N?F?"auto":"none":void 0,...e.style},onFocusCapture:rt(e.onFocusCapture,H.onFocusCapture),onBlurCapture:rt(e.onBlurCapture,H.onBlurCapture),onPointerDownCapture:rt(e.onPointerDownCapture,L.onPointerDownCapture)})});e0.displayName=Fj;var qj="DismissableLayerBranch",Gj=O.forwardRef((e,t)=>{const r=O.useContext(p4),n=O.useRef(null),i=Jt(t,n);return O.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),b.jsx(Gt.div,{...e,ref:i})});Gj.displayName=qj;function Hj(e,t=globalThis==null?void 0:globalThis.document){const r=pr(e),n=O.useRef(!1),i=O.useRef(()=>{});return O.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let c=function(){m4(zj,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 Wj(e,t=globalThis==null?void 0:globalThis.document){const r=pr(e),n=O.useRef(!1);return O.useEffect(()=>{const i=s=>{s.target&&!n.current&&m4(Vj,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 am(){const e=new CustomEvent(hd);document.dispatchEvent(e)}function m4(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?h4(i,s):i.dispatchEvent(s)}var Qi=globalThis!=null&&globalThis.document?O.useLayoutEffect:()=>{},Kj=O["useId".toString()]||(()=>{}),Xj=0;function Ua(e){const[t,r]=O.useState(Kj());return Qi(()=>{e||r(n=>n??String(Xj++))},[e]),e||(t?`radix-${t}`:"")}const Yj=["top","right","bottom","left"],es=Math.min,Fr=Math.max,Eu=Math.round,_c=Math.floor,Vn=e=>({x:e,y:e}),Jj={left:"right",right:"left",bottom:"top",top:"bottom"},Zj={start:"end",end:"start"};function pd(e,t,r){return Fr(e,es(t,r))}function Si(e,t){return typeof e=="function"?e(t):e}function Ei(e){return e.split("-")[0]}function Uo(e){return e.split("-")[1]}function t0(e){return e==="x"?"y":"x"}function r0(e){return e==="y"?"height":"width"}function ts(e){return["top","bottom"].includes(Ei(e))?"y":"x"}function n0(e){return t0(ts(e))}function Qj(e,t,r){r===void 0&&(r=!1);const n=Uo(e),i=n0(e),s=r0(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Mu(o)),[o,Mu(o)]}function eP(e){const t=Mu(e);return[md(e),t,md(t)]}function md(e){return e.replace(/start|end/g,t=>Zj[t])}function tP(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 rP(e,t,r,n){const i=Uo(e);let s=tP(Ei(e),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(md)))),s}function Mu(e){return e.replace(/left|right|bottom|top/g,t=>Jj[t])}function nP(e){return{top:0,right:0,bottom:0,left:0,...e}}function g4(e){return typeof e!="number"?nP(e):{top:e,right:e,bottom:e,left:e}}function Cu(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 cm(e,t,r){let{reference:n,floating:i}=e;const s=ts(t),o=n0(t),a=r0(o),c=Ei(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(Uo(t)){case"start":y[o]-=h*(r&&u?-1:1);break;case"end":y[o]+=h*(r&&u?-1:1);break}return y}const iP=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}=cm(u,n,c),h=n,y={},_=0;for(let w=0;w<a.length;w++){const{name:A,fn:I}=a[w],{x:P,y:N,data:F,reset:L}=await I({x:l,y:f,initialPlacement:n,placement:h,strategy:i,middlewareData:y,rects:u,platform:o,elements:{reference:e,floating:t}});l=P??l,f=N??f,y={...y,[A]:{...y[A],...F}},L&&_<=50&&(_++,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}=cm(u,h,c)),w=-1)}return{x:l,y:f,placement:h,strategy:i,middlewareData:y}};async function Fa(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}=Si(t,e),_=g4(y),A=a[h?f==="floating"?"reference":"floating":f],I=Cu(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})),P=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=Cu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:P,offsetParent:N,strategy:c}):P);return{top:(I.top-L.top+_.top)/F.y,bottom:(L.bottom-I.bottom+_.bottom)/F.y,left:(I.left-L.left+_.left)/F.x,right:(L.right-I.right+_.right)/F.x}}const sP=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}=Si(e,t)||{};if(u==null)return{};const f=g4(l),h={x:r,y:n},y=n0(i),_=r0(y),w=await o.getDimensions(u),A=y==="y",I=A?"top":"left",P=A?"bottom":"right",N=A?"clientHeight":"clientWidth",F=s.reference[_]+s.reference[y]-h[y]-s.floating[_],L=h[y]-s.reference[y],H=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let q=H?H[N]:0;(!q||!await(o.isElement==null?void 0:o.isElement(H)))&&(q=a.floating[N]||s.floating[_]);const X=F/2-L/2,re=q/2-w[_]/2-1,ae=es(f[I],re),oe=es(f[P],re),V=ae,$=q-w[_]-oe,p=q/2-w[_]/2+X,d=pd(V,p,$),m=!c.arrow&&Uo(i)!=null&&p!==d&&s.reference[_]/2-(p<V?ae:oe)-w[_]/2<0,x=m?p<V?p-V:p-$:0;return{[y]:h[y]+x,data:{[y]:d,centerOffset:p-d-x,...m&&{alignmentOffset:x}},reset:m}}}),oP=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:_="none",flipAlignment:w=!0,...A}=Si(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const I=Ei(i),P=ts(a),N=Ei(a)===a,F=await(c.isRTL==null?void 0:c.isRTL(u.floating)),L=h||(N||!w?[Mu(a)]:eP(a)),H=_!=="none";!h&&H&&L.push(...rP(a,w,_,F));const q=[a,...L],X=await Fa(t,A),re=[];let ae=((n=s.flip)==null?void 0:n.overflows)||[];if(l&&re.push(X[I]),f){const p=Qj(i,o,F);re.push(X[p[0]],X[p[1]])}if(ae=[...ae,{placement:i,overflows:re}],!re.every(p=>p<=0)){var oe,V;const p=(((oe=s.flip)==null?void 0:oe.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,E)=>x.overflows[1]-E.overflows[1])[0])==null?void 0:V.placement;if(!m)switch(y){case"bestFit":{var $;const x=($=ae.filter(E=>{if(H){const C=ts(E.placement);return C===P||C==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(C=>C>0).reduce((C,k)=>C+k,0)]).sort((E,C)=>E[1]-C[1])[0])==null?void 0:$[0];x&&(m=x);break}case"initialPlacement":m=a;break}if(i!==m)return{reset:{placement:m}}}return{}}}};function um(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function lm(e){return Yj.some(t=>e[t]>=0)}const aP=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...i}=Si(e,t);switch(n){case"referenceHidden":{const s=await Fa(t,{...i,elementContext:"reference"}),o=um(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:lm(o)}}}case"escaped":{const s=await Fa(t,{...i,altBoundary:!0}),o=um(s,r.floating);return{data:{escapedOffsets:o,escaped:lm(o)}}}default:return{}}}}};async function cP(e,t){const{placement:r,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Ei(r),a=Uo(r),c=ts(r)==="y",u=["left","top"].includes(o)?-1:1,l=s&&c?-1:1,f=Si(t,e);let{mainAxis:h,crossAxis:y,alignmentAxis:_}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof _=="number"&&(y=a==="end"?_*-1:_),c?{x:y*l,y:h*u}:{x:h*u,y:y*l}}const uP=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 cP(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}}}}},lP=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:I,y:P}=A;return{x:I,y:P}}},...c}=Si(e,t),u={x:r,y:n},l=await Fa(t,c),f=ts(Ei(i)),h=t0(f);let y=u[h],_=u[f];if(s){const A=h==="y"?"top":"left",I=h==="y"?"bottom":"right",P=y+l[A],N=y-l[I];y=pd(P,y,N)}if(o){const A=f==="y"?"top":"left",I=f==="y"?"bottom":"right",P=_+l[A],N=_-l[I];_=pd(P,_,N)}const w=a.fn({...t,[h]:y,[f]:_});return{...w,data:{x:w.x-r,y:w.y-n,enabled:{[h]:s,[f]:o}}}}}},fP=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}=Si(e,t),l={x:r,y:n},f=ts(i),h=t0(f);let y=l[h],_=l[f];const w=Si(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 I,P;const N=h==="y"?"width":"height",F=["top","left"].includes(Ei(i)),L=s.reference[f]-s.floating[N]+(F&&((I=o.offset)==null?void 0:I[f])||0)+(F?0:A.crossAxis),H=s.reference[f]+s.reference[N]+(F?0:((P=o.offset)==null?void 0:P[f])||0)-(F?A.crossAxis:0);_<L?_=L:_>H&&(_=H)}return{[h]:y,[f]:_}}}},dP=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}=Si(e,t),l=await Fa(t,u),f=Ei(i),h=Uo(i),y=ts(i)==="y",{width:_,height:w}=s.floating;let A,I;f==="top"||f==="bottom"?(A=f,I=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(I=f,A=h==="end"?"top":"bottom");const P=w-l.top-l.bottom,N=_-l.left-l.right,F=es(w-l[A],P),L=es(_-l[I],N),H=!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=P),H&&!h){const ae=Fr(l.left,0),oe=Fr(l.right,0),V=Fr(l.top,0),$=Fr(l.bottom,0);y?X=_-2*(ae!==0||oe!==0?ae+oe:Fr(l.left,l.right)):q=w-2*(V!==0||$!==0?V+$:Fr(l.top,l.bottom))}await c({...t,availableWidth:X,availableHeight:q});const re=await o.getDimensions(a.floating);return _!==re.width||w!==re.height?{reset:{rects:!0}}:{}}}};function rl(){return typeof window<"u"}function Fo(e){return v4(e)?(e.nodeName||"").toLowerCase():"#document"}function Vr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yn(e){var t;return(t=(v4(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function v4(e){return rl()?e instanceof Node||e instanceof Vr(e).Node:!1}function Sn(e){return rl()?e instanceof Element||e instanceof Vr(e).Element:!1}function Kn(e){return rl()?e instanceof HTMLElement||e instanceof Vr(e).HTMLElement:!1}function fm(e){return!rl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Vr(e).ShadowRoot}function oc(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=En(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function hP(e){return["table","td","th"].includes(Fo(e))}function nl(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function i0(e){const t=s0(),r=Sn(e)?En(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 pP(e){let t=rs(e);for(;Kn(t)&&!Co(t);){if(i0(t))return t;if(nl(t))return null;t=rs(t)}return null}function s0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Co(e){return["html","body","#document"].includes(Fo(e))}function En(e){return Vr(e).getComputedStyle(e)}function il(e){return Sn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rs(e){if(Fo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fm(e)&&e.host||Yn(e);return fm(t)?t.host:t}function y4(e){const t=rs(e);return Co(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kn(t)&&oc(t)?t:y4(t)}function za(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=y4(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),o=Vr(i);if(s){const a=gd(o);return t.concat(o,o.visualViewport||[],oc(i)?i:[],a&&r?za(a):[])}return t.concat(i,za(i,[],r))}function gd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function b4(e){const t=En(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Kn(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,a=Eu(r)!==s||Eu(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function o0(e){return Sn(e)?e:e.contextElement}function bo(e){const t=o0(e);if(!Kn(t))return Vn(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:s}=b4(t);let o=(s?Eu(r.width):r.width)/n,a=(s?Eu(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const mP=Vn(0);function w4(e){const t=Vr(e);return!s0()||!t.visualViewport?mP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gP(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Vr(e)?!1:t}function Rs(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=o0(e);let o=Vn(1);t&&(n?Sn(n)&&(o=bo(n)):o=bo(e));const a=gP(s,r,n)?w4(s):Vn(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=Vr(s),y=n&&Sn(n)?Vr(n):n;let _=h,w=gd(_);for(;w&&n&&y!==_;){const A=bo(w),I=w.getBoundingClientRect(),P=En(w),N=I.left+(w.clientLeft+parseFloat(P.paddingLeft))*A.x,F=I.top+(w.clientTop+parseFloat(P.paddingTop))*A.y;c*=A.x,u*=A.y,l*=A.x,f*=A.y,c+=N,u+=F,_=Vr(w),w=gd(_)}}return Cu({width:l,height:f,x:c,y:u})}function a0(e,t){const r=il(e).scrollLeft;return t?t.left+r:Rs(Yn(e)).left+r}function _4(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-(r?0:a0(e,n)),s=n.top+t.scrollTop;return{x:i,y:s}}function vP(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const s=i==="fixed",o=Yn(n),a=t?nl(t.floating):!1;if(n===o||a&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Vn(1);const l=Vn(0),f=Kn(n);if((f||!f&&!s)&&((Fo(n)!=="body"||oc(o))&&(c=il(n)),Kn(n))){const y=Rs(n);u=bo(n),l.x=y.x+n.clientLeft,l.y=y.y+n.clientTop}const h=o&&!f&&!s?_4(o,c,!0):Vn(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 yP(e){return Array.from(e.getClientRects())}function bP(e){const t=Yn(e),r=il(e),n=e.ownerDocument.body,i=Fr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Fr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+a0(e);const a=-r.scrollTop;return En(n).direction==="rtl"&&(o+=Fr(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function wP(e,t){const r=Vr(e),n=Yn(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=s0();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:a,y:c}}function _P(e,t){const r=Rs(e,!0,t==="fixed"),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=Kn(e)?bo(e):Vn(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 dm(e,t,r){let n;if(t==="viewport")n=wP(e,r);else if(t==="document")n=bP(Yn(e));else if(Sn(t))n=_P(t,r);else{const i=w4(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Cu(n)}function x4(e,t){const r=rs(e);return r===t||!Sn(r)||Co(r)?!1:En(r).position==="fixed"||x4(r,t)}function xP(e,t){const r=t.get(e);if(r)return r;let n=za(e,[],!1).filter(a=>Sn(a)&&Fo(a)!=="body"),i=null;const s=En(e).position==="fixed";let o=s?rs(e):e;for(;Sn(o)&&!Co(o);){const a=En(o),c=i0(o);!c&&a.position==="fixed"&&(i=null),(s?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||oc(o)&&!c&&x4(e,o))?n=n.filter(l=>l!==o):i=a,o=rs(o)}return t.set(e,n),n}function SP(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[...r==="clippingAncestors"?nl(t)?[]:xP(t,this._c):[].concat(r),n],a=o[0],c=o.reduce((u,l)=>{const f=dm(t,l,i);return u.top=Fr(f.top,u.top),u.right=es(f.right,u.right),u.bottom=es(f.bottom,u.bottom),u.left=Fr(f.left,u.left),u},dm(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function EP(e){const{width:t,height:r}=b4(e);return{width:t,height:r}}function MP(e,t,r){const n=Kn(t),i=Yn(t),s=r==="fixed",o=Rs(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Vn(0);if(n||!n&&!s)if((Fo(t)!=="body"||oc(i))&&(a=il(t)),n){const h=Rs(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=a0(i));const u=i&&!n&&!s?_4(i,a):Vn(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 rf(e){return En(e).position==="static"}function hm(e,t){if(!Kn(e)||En(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Yn(e)===r&&(r=r.ownerDocument.body),r}function S4(e,t){const r=Vr(e);if(nl(e))return r;if(!Kn(e)){let i=rs(e);for(;i&&!Co(i);){if(Sn(i)&&!rf(i))return i;i=rs(i)}return r}let n=hm(e,t);for(;n&&hP(n)&&rf(n);)n=hm(n,t);return n&&Co(n)&&rf(n)&&!i0(n)?r:n||pP(e)||r}const CP=async function(e){const t=this.getOffsetParent||S4,r=this.getDimensions,n=await r(e.floating);return{reference:MP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function AP(e){return En(e).direction==="rtl"}const TP={convertOffsetParentRelativeRectToViewportRelativeRect:vP,getDocumentElement:Yn,getClippingRect:SP,getOffsetParent:S4,getElementRects:CP,getClientRects:yP,getDimensions:EP,getScale:bo,isElement:Sn,isRTL:AP};function OP(e,t){let r=null,n;const i=Yn(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=_c(l),_=_c(i.clientWidth-(u+f)),w=_c(i.clientHeight-(l+h)),A=_c(u),P={rootMargin:-y+"px "+-_+"px "+-w+"px "+-A+"px",threshold:Fr(0,es(1,c))||1};let N=!0;function F(L){const H=L[0].intersectionRatio;if(H!==c){if(!N)return o();H?o(!1,H):n=setTimeout(()=>{o(!1,1e-7)},1e3)}N=!1}try{r=new IntersectionObserver(F,{...P,root:i.ownerDocument})}catch{r=new IntersectionObserver(F,P)}r.observe(e)}return o(!0),s}function IP(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=o0(e),l=i||s?[...u?za(u):[],...za(t)]:[];l.forEach(I=>{i&&I.addEventListener("scroll",r,{passive:!0}),s&&I.addEventListener("resize",r)});const f=u&&a?OP(u,r):null;let h=-1,y=null;o&&(y=new ResizeObserver(I=>{let[P]=I;P&&P.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 _,w=c?Rs(e):null;c&&A();function A(){const I=Rs(e);w&&(I.x!==w.x||I.y!==w.y||I.width!==w.width||I.height!==w.height)&&r(),w=I,_=requestAnimationFrame(A)}return r(),()=>{var I;l.forEach(P=>{i&&P.removeEventListener("scroll",r),s&&P.removeEventListener("resize",r)}),f==null||f(),(I=y)==null||I.disconnect(),y=null,c&&cancelAnimationFrame(_)}}const kP=uP,jP=lP,PP=oP,RP=dP,NP=aP,pm=sP,DP=fP,$P=(e,t,r)=>{const n=new Map,i={platform:TP,...r},s={...i.platform,_c:n};return iP(e,t,{...i,platform:s})};var qc=typeof document<"u"?ie.useLayoutEffect:ie.useEffect;function Au(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(!Au(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)&&!Au(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function E4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function mm(e,t){const r=E4(e);return Math.round(t*r)/r}function nf(e){const t=O.useRef(e);return qc(()=>{t.current=e}),t}function BP(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]=O.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,y]=O.useState(n);Au(h,n)||y(n);const[_,w]=O.useState(null),[A,I]=O.useState(null),P=O.useCallback(E=>{E!==H.current&&(H.current=E,w(E))},[]),N=O.useCallback(E=>{E!==q.current&&(q.current=E,I(E))},[]),F=s||_,L=o||A,H=O.useRef(null),q=O.useRef(null),X=O.useRef(l),re=c!=null,ae=nf(c),oe=nf(i),V=nf(u),$=O.useCallback(()=>{if(!H.current||!q.current)return;const E={placement:t,strategy:r,middleware:h};oe.current&&(E.platform=oe.current),$P(H.current,q.current,E).then(C=>{const k={...C,isPositioned:V.current!==!1};p.current&&!Au(X.current,k)&&(X.current=k,Ug.flushSync(()=>{f(k)}))})},[h,t,r,oe,V]);qc(()=>{u===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,f(E=>({...E,isPositioned:!1})))},[u]);const p=O.useRef(!1);qc(()=>(p.current=!0,()=>{p.current=!1}),[]),qc(()=>{if(F&&(H.current=F),L&&(q.current=L),F&&L){if(ae.current)return ae.current(F,L,$);$()}},[F,L,$,ae,re]);const d=O.useMemo(()=>({reference:H,floating:q,setReference:P,setFloating:N}),[P,N]),m=O.useMemo(()=>({reference:F,floating:L}),[F,L]),x=O.useMemo(()=>{const E={position:r,left:0,top:0};if(!m.floating)return E;const C=mm(m.floating,l.x),k=mm(m.floating,l.y);return a?{...E,transform:"translate("+C+"px, "+k+"px)",...E4(m.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:C,top:k}},[r,a,m.floating,l.x,l.y]);return O.useMemo(()=>({...l,update:$,refs:d,elements:m,floatingStyles:x}),[l,$,d,m,x])}const LP=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?pm({element:n.current,padding:i}).fn(r):{}:n?pm({element:n,padding:i}).fn(r):{}}}},UP=(e,t)=>({...kP(e),options:[e,t]}),FP=(e,t)=>({...jP(e),options:[e,t]}),zP=(e,t)=>({...DP(e),options:[e,t]}),VP=(e,t)=>({...PP(e),options:[e,t]}),qP=(e,t)=>({...RP(e),options:[e,t]}),GP=(e,t)=>({...NP(e),options:[e,t]}),HP=(e,t)=>({...LP(e),options:[e,t]});var WP="Arrow",M4=O.forwardRef((e,t)=>{const{children:r,width:n=10,height:i=5,...s}=e;return b.jsx(Gt.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:b.jsx("polygon",{points:"0,0 30,0 15,10"})})});M4.displayName=WP;var KP=M4;function XP(e,t=[]){let r=[];function n(s,o){const a=O.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,..._}=f,w=(h==null?void 0:h[e][c])||a,A=O.useMemo(()=>_,Object.values(_));return b.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,_=O.useContext(y);if(_)return _;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=>O.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return O.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,YP(i,...t)]}function YP(...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 O.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function c0(e){const[t,r]=O.useState(void 0);return Qi(()=>{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 u0="Popper",[C4,sl]=XP(u0),[JP,A4]=C4(u0),T4=e=>{const{__scopePopper:t,children:r}=e,[n,i]=O.useState(null);return b.jsx(JP,{scope:t,anchor:n,onAnchorChange:i,children:r})};T4.displayName=u0;var O4="PopperAnchor",I4=O.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...i}=e,s=A4(O4,r),o=O.useRef(null),a=Jt(t,o);return O.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:b.jsx(Gt.div,{...i,ref:a})});I4.displayName=O4;var l0="PopperContent",[ZP,QP]=C4(l0),k4=O.forwardRef((e,t)=>{var xe,be,Ce,Me,Ke,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:_,...w}=e,A=A4(l0,r),[I,P]=O.useState(null),N=Jt(t,lt=>P(lt)),[F,L]=O.useState(null),H=c0(F),q=(H==null?void 0:H.width)??0,X=(H==null?void 0:H.height)??0,re=n+(s!=="center"?"-"+s:""),ae=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},oe=Array.isArray(u)?u:[u],V=oe.length>0,$={padding:ae,boundary:oe.filter(tR),altBoundary:V},{refs:p,floatingStyles:d,placement:m,isPositioned:x,middlewareData:E}=BP({strategy:"fixed",placement:re,whileElementsMounted:(...lt)=>IP(...lt,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[UP({mainAxis:i+X,alignmentAxis:o}),c&&FP({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?zP():void 0,...$}),c&&VP({...$}),qP({...$,apply:({elements:lt,rects:ht,availableWidth:$e,availableHeight:mt})=>{const{width:we,height:me}=ht.reference,Te=lt.floating.style;Te.setProperty("--radix-popper-available-width",`${$e}px`),Te.setProperty("--radix-popper-available-height",`${mt}px`),Te.setProperty("--radix-popper-anchor-width",`${we}px`),Te.setProperty("--radix-popper-anchor-height",`${me}px`)}}),F&&HP({element:F,padding:a}),rR({arrowWidth:q,arrowHeight:X}),h&&GP({strategy:"referenceHidden",...$})]}),[C,k]=R4(m),T=pr(_);Qi(()=>{x&&(T==null||T())},[x,T]);const g=(xe=E.arrow)==null?void 0:xe.x,v=(be=E.arrow)==null?void 0:be.y,R=((Ce=E.arrow)==null?void 0:Ce.centerOffset)!==0,[se,ue]=O.useState();return Qi(()=>{I&&ue(window.getComputedStyle(I).zIndex)},[I]),b.jsx("div",{ref:p.setFloating,"data-radix-popper-content-wrapper":"",style:{...d,transform:x?d.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(Me=E.transformOrigin)==null?void 0:Me.x,(Ke=E.transformOrigin)==null?void 0:Ke.y].join(" "),...((Ue=E.hide)==null?void 0:Ue.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:b.jsx(ZP,{scope:r,placedSide:C,onArrowChange:L,arrowX:g,arrowY:v,shouldHideArrow:R,children:b.jsx(Gt.div,{"data-side":C,"data-align":k,...w,ref:N,style:{...w.style,animation:x?void 0:"none"}})})})});k4.displayName=l0;var j4="PopperArrow",eR={top:"bottom",right:"left",bottom:"top",left:"right"},P4=O.forwardRef(function(t,r){const{__scopePopper:n,...i}=t,s=QP(j4,n),o=eR[s.placedSide];return b.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:b.jsx(KP,{...i,ref:r,style:{...i.style,display:"block"}})})});P4.displayName=j4;function tR(e){return e!==null}var rR=e=>({name:"transformOrigin",options:e,fn(t){var A,I,P;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]=R4(r),f={start:"0%",center:"50%",end:"100%"}[l],h=(((I=i.arrow)==null?void 0:I.x)??0)+a/2,y=(((P=i.arrow)==null?void 0:P.y)??0)+c/2;let _="",w="";return u==="bottom"?(_=o?f:`${h}px`,w=`${-c}px`):u==="top"?(_=o?f:`${h}px`,w=`${n.floating.height+c}px`):u==="right"?(_=`${-c}px`,w=o?f:`${y}px`):u==="left"&&(_=`${n.floating.width+c}px`,w=o?f:`${y}px`),{data:{x:_,y:w}}}});function R4(e){const[t,r="center"]=e.split("-");return[t,r]}var N4=T4,D4=I4,$4=k4,B4=P4,nR="Portal",L4=O.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[i,s]=O.useState(!1);Qi(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Uu.createPortal(b.jsx(Gt.div,{...n,ref:t}),o):null});L4.displayName=nR;function iR(e,t){return O.useReducer((r,n)=>t[r][n]??r,e)}var Mn=e=>{const{present:t,children:r}=e,n=sR(t),i=typeof r=="function"?r({present:n.isPresent}):O.Children.only(r),s=Jt(n.ref,oR(i));return typeof r=="function"||n.isPresent?O.cloneElement(i,{ref:s}):null};Mn.displayName="Presence";function sR(e){const[t,r]=O.useState(),n=O.useRef({}),i=O.useRef(e),s=O.useRef("none"),o=e?"mounted":"unmounted",[a,c]=iR(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return O.useEffect(()=>{const u=xc(n.current);s.current=a==="mounted"?u:"none"},[a]),Qi(()=>{const u=n.current,l=i.current;if(l!==e){const h=s.current,y=xc(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]),Qi(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=y=>{const w=xc(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=xc(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:O.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function xc(e){return(e==null?void 0:e.animationName)||"none"}function oR(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 ac({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,i]=aR({defaultProp:t,onChange:r}),s=e!==void 0,o=s?e:n,a=pr(r),c=O.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 aR({defaultProp:e,onChange:t}){const r=O.useState(e),[n]=r,i=O.useRef(n),s=pr(t);return O.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}var cR="VisuallyHidden",U4=O.forwardRef((e,t)=>b.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}}));U4.displayName=cR;var uR=U4,[ol,XW]=Bo("Tooltip",[sl]),f0=sl(),F4="TooltipProvider",lR=700,gm="tooltip.open",[fR,z4]=ol(F4),V4=e=>{const{__scopeTooltip:t,delayDuration:r=lR,skipDelayDuration:n=300,disableHoverableContent:i=!1,children:s}=e,[o,a]=O.useState(!0),c=O.useRef(!1),u=O.useRef(0);return O.useEffect(()=>{const l=u.current;return()=>window.clearTimeout(l)},[]),b.jsx(fR,{scope:t,isOpenDelayed:o,delayDuration:r,onOpen:O.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:O.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:O.useCallback(l=>{c.current=l},[]),disableHoverableContent:i,children:s})};V4.displayName=F4;var q4="Tooltip",[YW,al]=ol(q4),vd="TooltipTrigger",dR=O.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=al(vd,r),s=z4(vd,r),o=f0(r),a=O.useRef(null),c=Jt(t,a,i.onTriggerChange),u=O.useRef(!1),l=O.useRef(!1),f=O.useCallback(()=>u.current=!1,[]);return O.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),b.jsx(D4,{asChild:!0,...o,children:b.jsx(Gt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...n,ref:c,onPointerMove:rt(e.onPointerMove,h=>{h.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:rt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:rt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:rt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:rt(e.onBlur,i.onClose),onClick:rt(e.onClick,i.onClose)})})});dR.displayName=vd;var hR="TooltipPortal",[JW,pR]=ol(hR,{forceMount:void 0}),Ao="TooltipContent",mR=O.forwardRef((e,t)=>{const r=pR(Ao,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=al(Ao,e.__scopeTooltip);return b.jsx(Mn,{present:n||o.open,children:o.disableHoverableContent?b.jsx(G4,{side:i,...s,ref:t}):b.jsx(gR,{side:i,...s,ref:t})})}),gR=O.forwardRef((e,t)=>{const r=al(Ao,e.__scopeTooltip),n=z4(Ao,e.__scopeTooltip),i=O.useRef(null),s=Jt(t,i),[o,a]=O.useState(null),{trigger:c,onClose:u}=r,l=i.current,{onPointerInTransitChange:f}=n,h=O.useCallback(()=>{a(null),f(!1)},[f]),y=O.useCallback((_,w)=>{const A=_.currentTarget,I={x:_.clientX,y:_.clientY},P=wR(I,A.getBoundingClientRect()),N=_R(I,P),F=xR(w.getBoundingClientRect()),L=ER([...N,...F]);a(L),f(!0)},[f]);return O.useEffect(()=>()=>h(),[h]),O.useEffect(()=>{if(c&&l){const _=A=>y(A,l),w=A=>y(A,c);return c.addEventListener("pointerleave",_),l.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",_),l.removeEventListener("pointerleave",w)}}},[c,l,y,h]),O.useEffect(()=>{if(o){const _=w=>{const A=w.target,I={x:w.clientX,y:w.clientY},P=(c==null?void 0:c.contains(A))||(l==null?void 0:l.contains(A)),N=!SR(I,o);P?h():N&&(h(),u())};return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[c,l,o,u,h]),b.jsx(G4,{...e,ref:s})}),[vR,yR]=ol(q4,{isInside:!1}),G4=O.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,c=al(Ao,r),u=f0(r),{onClose:l}=c;return O.useEffect(()=>(document.addEventListener(gm,l),()=>document.removeEventListener(gm,l)),[l]),O.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]),b.jsx(e0,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:l,children:b.jsxs($4,{"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:[b.jsx(Lo,{children:n}),b.jsx(vR,{scope:r,isInside:!0,children:b.jsx(uR,{id:c.contentId,role:"tooltip",children:i||n})})]})})});mR.displayName=Ao;var H4="TooltipArrow",bR=O.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,i=f0(r);return yR(H4,r).isInside?null:b.jsx(B4,{...i,...n,ref:t})});bR.displayName=H4;function wR(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 _R(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 xR(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 SR(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 ER(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),MR(t)}function MR(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 CR=V4,W4=O.createContext(void 0),AR=e=>{const{dir:t,children:r}=e;return b.jsx(W4.Provider,{value:t,children:r})};function d0(e){const t=O.useContext(W4);return e||t||"ltr"}const TR=["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange"],OR=["sky","mint","lime","yellow","amber"],IR=["gold","bronze"],kR=[...TR,...OR,...IR],jR="gray",PR=["mauve","slate","sage","olive","sand"],RR=[jR,...PR];function NR(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 DR=["inherit","light","dark"],$R=[...kR,"gray"],BR=[...RR,"auto"],LR=["solid","translucent"],UR=["none","small","medium","large","full"],FR=["90%","95%","100%","105%","110%"],kr={hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:DR,default:"inherit"},accentColor:{type:"enum",values:$R,default:"indigo"},grayColor:{type:"enum",values:BR,default:"auto"},panelBackground:{type:"enum",values:LR,default:"translucent"},radius:{type:"enum",values:UR,default:"medium"},scaling:{type:"enum",values:FR,default:"100%"}};function K4(e){return e==="gray"?"gray":NR(e)}const Ws=()=>{},Tu=O.createContext(void 0);function zR(){const e=O.useContext(Tu);if(e===void 0)throw new Error("`useThemeContext` must be used within a `Theme`");return e}const cl=O.forwardRef((e,t)=>O.useContext(Tu)===void 0?O.createElement(CR,null,O.createElement(AR,{dir:"ltr"},O.createElement(X4,{...e,ref:t}))):O.createElement(h0,{...e,ref:t}));cl.displayName="Theme";const X4=O.forwardRef((e,t)=>{const{appearance:r=kr.appearance.default,accentColor:n=kr.accentColor.default,grayColor:i=kr.grayColor.default,panelBackground:s=kr.panelBackground.default,radius:o=kr.radius.default,scaling:a=kr.scaling.default,hasBackground:c=kr.hasBackground.default,...u}=e,[l,f]=O.useState(r);O.useEffect(()=>f(r),[r]);const[h,y]=O.useState(n);O.useEffect(()=>y(n),[n]);const[_,w]=O.useState(i);O.useEffect(()=>w(i),[i]);const[A,I]=O.useState(s);O.useEffect(()=>I(s),[s]);const[P,N]=O.useState(o);O.useEffect(()=>N(o),[o]);const[F,L]=O.useState(a);O.useEffect(()=>L(a),[a]);const H=O.memo(({appearance:X})=>O.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);H.displayName="ExplicitRootAppearanceScript",O.useEffect(()=>VR(r),[r]);const q=_==="auto"?K4(h):_;return O.createElement(O.Fragment,null,l!=="inherit"&&O.createElement(H,{appearance:l}),c&&O.createElement("style",{dangerouslySetInnerHTML:{__html:`
|
|
54
49
|
:root, .light, .light-theme { --color-page-background: white; }
|
|
55
50
|
.dark, .dark-theme { --color-page-background: var(--${q}-1); }
|
|
56
51
|
body { background-color: var(--color-page-background); }
|
|
57
|
-
`}}),I.createElement(i0,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:b,panelBackground:T,radius:R,scaling:z,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:P,onRadiusChange:N,onScalingChange:F}))});a6.displayName="ThemeRoot";const i0=I.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=I.useContext(zu),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:kr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:kr.accentColor.default,grayColor:b=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:kr.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:kr.panelBackground.default,radius:T=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:kr.radius.default,scaling:P=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:kr.scaling.default,onAppearanceChange:R=Qs,onAccentColorChange:N=Qs,onGrayColorChange:z=Qs,onPanelBackgroundChange:F=Qs,onRadiusChange:W=Qs,onScalingChange:q=Qs,...K}=e,te=u?xi:"div",se=b==="auto"?o6(y):b,H=e.appearance!==void 0&&e.appearance!=="inherit",L=e.grayColor!==void 0,D=!l&&(f===!0||f!==!1&&(H||L));return I.createElement(zu.Provider,{value:I.useMemo(()=>({appearance:h,accentColor:y,grayColor:b,resolvedGrayColor:se,panelBackground:w,radius:T,scaling:P,onAppearanceChange:R,onAccentColorChange:N,onGrayColorChange:z,onPanelBackgroundChange:F,onRadiusChange:W,onScalingChange:q}),[h,y,b,se,w,T,P,R,N,z,F,W,q])},I.createElement(te,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":se,"data-has-background":D?"true":"false","data-panel-background":w,"data-radius":T,"data-scaling":P,ref:t,...K,className:Jt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},K.className)}))});i0.displayName="ThemeImpl";function rB(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 gc={type:"enum",values:kr.accentColor.values,default:void 0},Bl={type:"boolean",default:void 0};function _t(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 hs=["0","1","2","3","4","5","6","7","8","9"],nB={p:{type:"enum",values:hs,default:void 0,responsive:!0},px:{type:"enum",values:hs,default:void 0,responsive:!0},py:{type:"enum",values:hs,default:void 0,responsive:!0},pt:{type:"enum",values:hs,default:void 0,responsive:!0},pr:{type:"enum",values:hs,default:void 0,responsive:!0},pb:{type:"enum",values:hs,default:void 0,responsive:!0},pl:{type:"enum",values:hs,default:void 0,responsive:!0}};function iB(e){const{p:t=wr.p.default,px:r=wr.px.default,py:n=wr.py.default,pt:i=wr.pt.default,pr:s=wr.pr.default,pb:o=wr.pb.default,pl:a=wr.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function sB(e){return[_t(e.p,"rt-r-p"),_t(e.px,"rt-r-px"),_t(e.py,"rt-r-py"),_t(e.pt,"rt-r-pt"),_t(e.pr,"rt-r-pr"),_t(e.pb,"rt-r-pb"),_t(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const oB=["static","relative","absolute","fixed","sticky"],da=["auto","0","50%","100%"],Eg=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],aB=["0","1"],cB=["0","1"],wr={...nB,position:{type:"enum",values:oB,default:void 0,responsive:!0},inset:{type:"enum",values:da,default:void 0,responsive:!0},top:{type:"enum",values:da,default:void 0,responsive:!0},right:{type:"enum",values:da,default:void 0,responsive:!0},bottom:{type:"enum",values:da,default:void 0,responsive:!0},left:{type:"enum",values:da,default:void 0,responsive:!0},width:{type:"enum",values:Eg,default:void 0,responsive:!0},height:{type:"enum",values:Eg,default:void 0,responsive:!0},shrink:{type:"enum",values:aB,default:void 0,responsive:!0},grow:{type:"enum",values:cB,default:void 0,responsive:!0}};function uB(e){const{rest:t,...r}=iB(e),{position:n=wr.position.default,width:i=wr.width.default,height:s=wr.height.default,inset:o=wr.inset.default,top:a=wr.top.default,bottom:c=wr.bottom.default,left:u=wr.left.default,right:l=wr.right.default,shrink:f=wr.shrink.default,grow:h=wr.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 lB(e){return[sB(e),_t(e.position,"rt-r-position"),_t(e.shrink,"rt-r-fs"),_t(e.grow,"rt-r-fg"),_t(e.width,"rt-r-w"),_t(e.height,"rt-r-h"),_t(e.inset,"rt-r-inset"),_t(e.top,"rt-r-top"),_t(e.bottom,"rt-r-bottom"),_t(e.left,"rt-r-left"),_t(e.right,"rt-r-right")].filter(Boolean).join(" ")}const ps=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],ms={m:{type:"enum",values:ps,default:void 0,responsive:!0},mx:{type:"enum",values:ps,default:void 0,responsive:!0},my:{type:"enum",values:ps,default:void 0,responsive:!0},mt:{type:"enum",values:ps,default:void 0,responsive:!0},mr:{type:"enum",values:ps,default:void 0,responsive:!0},mb:{type:"enum",values:ps,default:void 0,responsive:!0},ml:{type:"enum",values:ps,default:void 0,responsive:!0}};function Xo(e){const{m:t=ms.m.default,mx:r=ms.mx.default,my:n=ms.my.default,mt:i=ms.mt.default,mr:s=ms.mr.default,mb:o=ms.mb.default,ml:a=ms.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function Jo(e){return[_t(e.m,"rt-r-m"),_t(e.mx,"rt-r-mx"),_t(e.my,"rt-r-my"),_t(e.mt,"rt-r-mt"),_t(e.mr,"rt-r-mr"),_t(e.mb,"rt-r-mb"),_t(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const s0={type:"enum",values:kr.radius.values,default:void 0},fB=["none","inline-flex","flex"],dB=["row","column","row-reverse","column-reverse"],hB=["start","center","end","baseline","stretch"],pB=["start","center","end","between"],mB=["nowrap","wrap","wrap-reverse"],gB=["0","1","2","3","4","5","6","7","8","9"],eo={display:{type:"enum",values:fB,default:"flex",responsive:!0},direction:{type:"enum",values:dB,default:void 0,responsive:!0},align:{type:"enum",values:hB,default:void 0,responsive:!0},justify:{type:"enum",values:pB,default:"start",responsive:!0},wrap:{type:"enum",values:mB,default:void 0,responsive:!0},gap:{type:"enum",values:gB,default:void 0,responsive:!0}},c6=I.forwardRef((e,t)=>{const{rest:r,...n}=Xo(e),{rest:i,...s}=uB(r),{className:o,asChild:a,display:c=eo.display.default,direction:u=eo.direction.default,align:l=eo.align.default,justify:f=eo.justify.default,wrap:h=eo.wrap.default,gap:y=eo.gap.default,...b}=i,w=a?xi:"div";return I.createElement(w,{...b,ref:t,className:Jt("rt-Flex",o,_t(c,"rt-r-display"),_t(u,"rt-r-fd"),_t(l,"rt-r-ai"),_t(f,"rt-r-jc",{between:"space-between"}),_t(h,"rt-r-fw"),_t(y,"rt-r-gap"),lB(s),Jo(n))})});c6.displayName="Flex";function u6(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 o0="Checkbox",[vB,OK]=Ho(o0),[yB,bB]=vB(o0),l6=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=Zt(t,z=>y(z)),w=I.useRef(!1),T=h?l||!!h.closest("form"):!0,[P=!1,R]=mc({prop:i,defaultProp:s,onChange:u}),N=I.useRef(P);return I.useEffect(()=>{const z=h==null?void 0:h.form;if(z){const F=()=>R(N.current);return z.addEventListener("reset",F),()=>z.removeEventListener("reset",F)}},[h,R]),_.jsxs(yB,{scope:r,state:P,disabled:a,children:[_.jsx(Wt.button,{type:"button",role:"checkbox","aria-checked":Ki(P)?"mixed":P,"aria-required":o,"data-state":h6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:tt(e.onKeyDown,z=>{z.key==="Enter"&&z.preventDefault()}),onClick:tt(e.onClick,z=>{R(F=>Ki(F)?!0:!F),T&&(w.current=z.isPropagationStopped(),w.current||z.stopPropagation())})}),T&&_.jsx(wB,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:Ki(s)?!1:s})]})});l6.displayName=o0;var f6="CheckboxIndicator",d6=I.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=bB(f6,r);return _.jsx(Tn,{present:n||Ki(s.state)||s.state===!0,children:_.jsx(Wt.span,{"data-state":h6(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});d6.displayName=f6;var wB=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=I.useRef(null),a=u6(r),c=Qp(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=Ki(r),y.call(l,Ki(r)?!1:r),l.dispatchEvent(b)}},[a,r,n]);const u=I.useRef(Ki(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 Ki(e){return e==="indeterminate"}function h6(e){return Ki(e)?"indeterminate":e?"checked":"unchecked"}var _B=l6,xB=d6;const SB=["1","2","3"],EB=["classic","surface","soft"],Rc={size:{type:"enum",values:SB,default:"2",responsive:!0},variant:{type:"enum",values:EB,default:"surface"},color:gc,highContrast:Bl},$l=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"})));$l.displayName="ThickCheckIcon";const CB=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"})));CB.displayName="ChevronDownIcon";const p6=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"})));p6.displayName="ThickChevronRightIcon";const MB=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"})));MB.displayName="InfoCircledIcon";const Ll=I.forwardRef((e,t)=>{const{rest:r,...n}=Xo(e),{className:i,style:s,size:o=Rc.size.default,variant:a=Rc.variant.default,color:c=Rc.color.default,highContrast:u=Rc.highContrast.default,...l}=r;return I.createElement("span",{className:Jt("rt-CheckboxRoot",i,_t(o,"rt-r-size"),Jo(n)),style:s},I.createElement(_B,{"data-accent-color":c,...l,ref:t,className:Jt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},I.createElement(xB,{className:"rt-CheckboxIndicator"},I.createElement($l,{className:"rt-CheckboxIndicatorIcon"}))))});Ll.displayName="Checkbox";function AB(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,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,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,TB(i,...t)]}function TB(...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 m6(e){const t=e+"CollectionProvider",[r,n]=AB(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,T=ae.useRef(null),P=ae.useRef(new Map).current;return _.jsx(i,{scope:b,itemMap:P,collectionRef:T,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=ae.forwardRef((y,b)=>{const{scope:w,children:T}=y,P=s(a,w),R=Zt(b,P.collectionRef);return _.jsx(xi,{ref:R,children:T})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=ae.forwardRef((y,b)=>{const{scope:w,children:T,...P}=y,R=ae.useRef(null),N=Zt(b,R),z=s(u,w);return ae.useEffect(()=>(z.itemMap.set(R,{ref:R,...P}),()=>void z.itemMap.delete(R))),_.jsx(xi,{[l]:"",ref:N,children:T})});f.displayName=u;function h(y){const b=s(e+"CollectionConsumer",y);return ae.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const P=Array.from(T.querySelectorAll(`[${l}]`));return Array.from(b.itemMap.values()).sort((z,F)=>P.indexOf(z.ref.current)-P.indexOf(F.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,n]}function OB(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,T=I.useMemo(()=>b,Object.values(b));return _.jsx(w.Provider,{value:T,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,IB(i,...t)]}function IB(...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 zf="rovingFocusGroup.onEntryFocus",PB={bubbles:!1,cancelable:!0},Fl="RovingFocusGroup",[sh,g6,kB]=m6(Fl),[jB,v6]=OB(Fl,[kB]),[RB,NB]=jB(Fl),y6=I.forwardRef((e,t)=>_.jsx(sh.Provider,{scope:e.__scopeRovingFocusGroup,children:_.jsx(sh.Slot,{scope:e.__scopeRovingFocusGroup,children:_.jsx(DB,{...e,ref:t})})}));y6.displayName=Fl;var DB=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=Zt(t,h),b=n0(s),[w=null,T]=mc({prop:o,defaultProp:a,onChange:c}),[P,R]=I.useState(!1),N=pr(u),z=g6(r),F=I.useRef(!1),[W,q]=I.useState(0);return I.useEffect(()=>{const K=h.current;if(K)return K.addEventListener(zf,N),()=>K.removeEventListener(zf,N)},[N]),_.jsx(RB,{scope:r,orientation:n,dir:b,loop:i,currentTabStopId:w,onItemFocus:I.useCallback(K=>T(K),[T]),onItemShiftTab:I.useCallback(()=>R(!0),[]),onFocusableItemAdd:I.useCallback(()=>q(K=>K+1),[]),onFocusableItemRemove:I.useCallback(()=>q(K=>K-1),[]),children:_.jsx(Wt.div,{tabIndex:P||W===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:tt(e.onMouseDown,()=>{F.current=!0}),onFocus:tt(e.onFocus,K=>{const te=!F.current;if(K.target===K.currentTarget&&te&&!P){const se=new CustomEvent(zf,PB);if(K.currentTarget.dispatchEvent(se),!se.defaultPrevented){const H=z().filter(m=>m.focusable),L=H.find(m=>m.active),D=H.find(m=>m.id===w),d=[L,D,...H].filter(Boolean).map(m=>m.ref.current);_6(d,l)}}F.current=!1}),onBlur:tt(e.onBlur,()=>R(!1))})})}),b6="RovingFocusGroupItem",w6=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=Ha(),c=s||a,u=NB(b6,r),l=u.currentTabStopId===c,f=g6(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return I.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),_.jsx(sh.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:_.jsx(Wt.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=LB(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?FB(P,R+1):P.slice(R+1)}setTimeout(()=>_6(P))}})})})});w6.displayName=b6;var BB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $B(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function LB(e,t,r){const n=$B(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return BB[n]}function _6(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function FB(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var UB=y6,zB=w6;function VB(e,[t,r]){return Math.min(r,Math.max(t,e))}var Vf=0;function qB(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Cg()),document.body.insertAdjacentElement("beforeend",e[1]??Cg()),Vf++,()=>{Vf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Vf--}},[])}function Cg(){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 qf="focusScope.autoFocusOnMount",Hf="focusScope.autoFocusOnUnmount",Mg={bubbles:!1,cancelable:!0},HB="FocusScope",x6=I.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=I.useState(null),u=pr(i),l=pr(s),f=I.useRef(null),h=Zt(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 z=N.target;a.contains(z)?f.current=z:Di(f.current,{select:!0})},T=function(N){if(y.paused||!a)return;const z=N.relatedTarget;z!==null&&(a.contains(z)||Di(f.current,{select:!0}))},P=function(N){if(document.activeElement===document.body)for(const F of N)F.removedNodes.length>0&&Di(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",T);const R=new MutationObserver(P);return a&&R.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",T),R.disconnect()}}},[n,a,y.paused]),I.useEffect(()=>{if(a){Tg.add(y);const w=document.activeElement;if(!a.contains(w)){const P=new CustomEvent(qf,Mg);a.addEventListener(qf,u),a.dispatchEvent(P),P.defaultPrevented||(WB(YB(S6(a)),{select:!0}),document.activeElement===w&&Di(a))}return()=>{a.removeEventListener(qf,u),setTimeout(()=>{const P=new CustomEvent(Hf,Mg);a.addEventListener(Hf,l),a.dispatchEvent(P),P.defaultPrevented||Di(w??document.body,{select:!0}),a.removeEventListener(Hf,l),Tg.remove(y)},0)}}},[a,u,l,y]);const b=I.useCallback(w=>{if(!r&&!n||y.paused)return;const T=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,P=document.activeElement;if(T&&P){const R=w.currentTarget,[N,z]=GB(R);N&&z?!w.shiftKey&&P===z?(w.preventDefault(),r&&Di(N,{select:!0})):w.shiftKey&&P===N&&(w.preventDefault(),r&&Di(z,{select:!0})):P===R&&w.preventDefault()}},[r,n,y.paused]);return _.jsx(Wt.div,{tabIndex:-1,...o,ref:h,onKeyDown:b})});x6.displayName=HB;function WB(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Di(n,{select:t}),document.activeElement!==r)return}function GB(e){const t=S6(e),r=Ag(t,e),n=Ag(t.reverse(),e);return[r,n]}function S6(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 Ag(e,t){for(const r of e)if(!KB(r,{upTo:t}))return r}function KB(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 XB(e){return e instanceof HTMLInputElement&&"select"in e}function Di(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&XB(e)&&t&&e.select()}}var Tg=JB();function JB(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Og(e,t),e.unshift(t)},remove(t){var r;e=Og(e,t),(r=e[0])==null||r.resume()}}}function Og(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function YB(e){return e.filter(t=>t.tagName!=="A")}var ZB=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},to=new WeakMap,Nc=new WeakMap,Dc={},Wf=0,E6=function(e){return e&&(e.host||E6(e.parentNode))},QB=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})},e$=function(e,t,r,n){var i=QB(t,Array.isArray(e)?e:[e]);Dc[r]||(Dc[r]=new WeakMap);var s=Dc[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=(to.get(h)||0)+1,T=(s.get(h)||0)+1;to.set(h,w),s.set(h,T),o.push(h),w===1&&b&&Nc.set(h,!0),T===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(),Wf++,function(){o.forEach(function(f){var h=to.get(f)-1,y=s.get(f)-1;to.set(f,h),s.set(f,y),h||(Nc.has(f)||f.removeAttribute(n),Nc.delete(f)),y||f.removeAttribute(r)}),Wf--,Wf||(to=new WeakMap,to=new WeakMap,Nc=new WeakMap,Dc={})}},t$=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||ZB(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),e$(n,i,r,"aria-hidden")):function(){return null}},Un=function(){return Un=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},Un.apply(this,arguments)};function C6(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 r$(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))}var au="right-scroll-bar-position",cu="width-before-scroll-bar",n$="with-scroll-bars-hidden",i$="--removed-body-scroll-bar-size";function Gf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function s$(e,t){var r=ae.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 o$=typeof window<"u"?I.useLayoutEffect:I.useEffect,Ig=new WeakMap;function a$(e,t){var r=s$(t||null,function(n){return e.forEach(function(i){return Gf(i,n)})});return o$(function(){var n=Ig.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||Gf(a,null)}),s.forEach(function(a){i.has(a)||Gf(a,o)})}Ig.set(r,e)},[e]),r}function c$(e){return e}function u$(e,t){t===void 0&&(t=c$);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 l$(e){e===void 0&&(e={});var t=u$(null);return t.options=Un({async:!0,ssr:!1},e),t}var M6=function(e){var t=e.sideCar,r=C6(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,Un({},r))};M6.isSideCarExport=!0;function f$(e,t){return e.useMedium(t),M6}var A6=l$(),Kf=function(){},Ul=I.forwardRef(function(e,t){var r=I.useRef(null),n=I.useState({onScrollCapture:Kf,onWheelCapture:Kf,onTouchMoveCapture:Kf}),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,T=e.as,P=T===void 0?"div":T,R=e.gapMode,N=C6(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),z=h,F=a$([r,t]),W=Un(Un({},N),i);return I.createElement(I.Fragment,null,l&&I.createElement(z,{sideCar:A6,removeScrollBar:u,shards:f,noIsolation:y,inert:b,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:R}),o?I.cloneElement(I.Children.only(a),Un(Un({},W),{ref:F})):I.createElement(P,Un({},W,{className:c,ref:F}),a))});Ul.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ul.classNames={fullWidth:cu,zeroRight:au};var Pg,d$=function(){if(Pg)return Pg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function h$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=d$();return t&&e.setAttribute("nonce",t),e}function p$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function m$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var g$=function(){var e=0,t=null;return{add:function(r){e==0&&(t=h$())&&(p$(t,r),m$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},v$=function(){var e=g$();return function(t,r){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},T6=function(){var e=v$(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},y$={left:0,top:0,right:0,gap:0},Xf=function(e){return parseInt(e||"",10)||0},b$=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[Xf(r),Xf(n),Xf(i)]},w$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return y$;var t=b$(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])}},_$=T6(),Eo="data-scroll-locked",x$=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(
|
|
52
|
+
`}}),O.createElement(h0,{...u,ref:t,isRoot:!0,hasBackground:c,appearance:l,accentColor:h,grayColor:_,panelBackground:A,radius:P,scaling:F,onAppearanceChange:f,onAccentColorChange:y,onGrayColorChange:w,onPanelBackgroundChange:I,onRadiusChange:N,onScalingChange:L}))});X4.displayName="ThemeRoot";const h0=O.forwardRef((e,t)=>{var r,n,i,s,o,a;const c=O.useContext(Tu),{asChild:u,isRoot:l,hasBackground:f,appearance:h=(r=c==null?void 0:c.appearance)!==null&&r!==void 0?r:kr.appearance.default,accentColor:y=(n=c==null?void 0:c.accentColor)!==null&&n!==void 0?n:kr.accentColor.default,grayColor:_=(i=c==null?void 0:c.resolvedGrayColor)!==null&&i!==void 0?i:kr.grayColor.default,panelBackground:w=(s=c==null?void 0:c.panelBackground)!==null&&s!==void 0?s:kr.panelBackground.default,radius:A=(o=c==null?void 0:c.radius)!==null&&o!==void 0?o:kr.radius.default,scaling:I=(a=c==null?void 0:c.scaling)!==null&&a!==void 0?a:kr.scaling.default,onAppearanceChange:P=Ws,onAccentColorChange:N=Ws,onGrayColorChange:F=Ws,onPanelBackgroundChange:L=Ws,onRadiusChange:H=Ws,onScalingChange:q=Ws,...X}=e,re=u?xi:"div",ae=_==="auto"?K4(y):_,oe=e.appearance!==void 0&&e.appearance!=="inherit",V=e.grayColor!==void 0,$=!l&&(f===!0||f!==!1&&(oe||V));return O.createElement(Tu.Provider,{value:O.useMemo(()=>({appearance:h,accentColor:y,grayColor:_,resolvedGrayColor:ae,panelBackground:w,radius:A,scaling:I,onAppearanceChange:P,onAccentColorChange:N,onGrayColorChange:F,onPanelBackgroundChange:L,onRadiusChange:H,onScalingChange:q}),[h,y,_,ae,w,A,I,P,N,F,L,H,q])},O.createElement(re,{"data-is-root-theme":l?"true":"false","data-accent-color":y,"data-gray-color":ae,"data-has-background":$?"true":"false","data-panel-background":w,"data-radius":A,"data-scaling":I,ref:t,...X,className:Xt("radix-themes",{light:!l&&h==="light",dark:!l&&h==="dark"},X.className)}))});h0.displayName="ThemeImpl";function VR(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 cc={type:"enum",values:kr.accentColor.values,default:void 0},ul={type:"boolean",default:void 0};function wt(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 _=(i=r==null?void 0:r[y])!==null&&i!==void 0?i:y,w=c==="initial"?`${h}${f}${_}`:`${c}:${h}${f}${_}`;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 ds=["0","1","2","3","4","5","6","7","8","9"],qR={p:{type:"enum",values:ds,default:void 0,responsive:!0},px:{type:"enum",values:ds,default:void 0,responsive:!0},py:{type:"enum",values:ds,default:void 0,responsive:!0},pt:{type:"enum",values:ds,default:void 0,responsive:!0},pr:{type:"enum",values:ds,default:void 0,responsive:!0},pb:{type:"enum",values:ds,default:void 0,responsive:!0},pl:{type:"enum",values:ds,default:void 0,responsive:!0}};function GR(e){const{p:t=br.p.default,px:r=br.px.default,py:n=br.py.default,pt:i=br.pt.default,pr:s=br.pr.default,pb:o=br.pb.default,pl:a=br.pl.default,...c}=e;return{p:t,px:r,py:n,pt:i,pr:s,pb:o,pl:a,rest:c}}function HR(e){return[wt(e.p,"rt-r-p"),wt(e.px,"rt-r-px"),wt(e.py,"rt-r-py"),wt(e.pt,"rt-r-pt"),wt(e.pr,"rt-r-pr"),wt(e.pb,"rt-r-pb"),wt(e.pl,"rt-r-pl")].filter(Boolean).join(" ")}const WR=["static","relative","absolute","fixed","sticky"],oa=["auto","0","50%","100%"],vm=["auto","min-content","max-content","100%","0","1","2","3","4","5","6","7","8","9"],KR=["0","1"],XR=["0","1"],br={...qR,position:{type:"enum",values:WR,default:void 0,responsive:!0},inset:{type:"enum",values:oa,default:void 0,responsive:!0},top:{type:"enum",values:oa,default:void 0,responsive:!0},right:{type:"enum",values:oa,default:void 0,responsive:!0},bottom:{type:"enum",values:oa,default:void 0,responsive:!0},left:{type:"enum",values:oa,default:void 0,responsive:!0},width:{type:"enum",values:vm,default:void 0,responsive:!0},height:{type:"enum",values:vm,default:void 0,responsive:!0},shrink:{type:"enum",values:KR,default:void 0,responsive:!0},grow:{type:"enum",values:XR,default:void 0,responsive:!0}};function YR(e){const{rest:t,...r}=GR(e),{position:n=br.position.default,width:i=br.width.default,height:s=br.height.default,inset:o=br.inset.default,top:a=br.top.default,bottom:c=br.bottom.default,left:u=br.left.default,right:l=br.right.default,shrink:f=br.shrink.default,grow:h=br.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 JR(e){return[HR(e),wt(e.position,"rt-r-position"),wt(e.shrink,"rt-r-fs"),wt(e.grow,"rt-r-fg"),wt(e.width,"rt-r-w"),wt(e.height,"rt-r-h"),wt(e.inset,"rt-r-inset"),wt(e.top,"rt-r-top"),wt(e.bottom,"rt-r-bottom"),wt(e.left,"rt-r-left"),wt(e.right,"rt-r-right")].filter(Boolean).join(" ")}const hs=["auto","0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],ps={m:{type:"enum",values:hs,default:void 0,responsive:!0},mx:{type:"enum",values:hs,default:void 0,responsive:!0},my:{type:"enum",values:hs,default:void 0,responsive:!0},mt:{type:"enum",values:hs,default:void 0,responsive:!0},mr:{type:"enum",values:hs,default:void 0,responsive:!0},mb:{type:"enum",values:hs,default:void 0,responsive:!0},ml:{type:"enum",values:hs,default:void 0,responsive:!0}};function zo(e){const{m:t=ps.m.default,mx:r=ps.mx.default,my:n=ps.my.default,mt:i=ps.mt.default,mr:s=ps.mr.default,mb:o=ps.mb.default,ml:a=ps.ml.default,...c}=e;return{m:t,mx:r,my:n,mt:i,mr:s,mb:o,ml:a,rest:c}}function Vo(e){return[wt(e.m,"rt-r-m"),wt(e.mx,"rt-r-mx"),wt(e.my,"rt-r-my"),wt(e.mt,"rt-r-mt"),wt(e.mr,"rt-r-mr"),wt(e.mb,"rt-r-mb"),wt(e.ml,"rt-r-ml")].filter(Boolean).join(" ")}const p0={type:"enum",values:kr.radius.values,default:void 0},ZR=["none","inline-flex","flex"],QR=["row","column","row-reverse","column-reverse"],eN=["start","center","end","baseline","stretch"],tN=["start","center","end","between"],rN=["nowrap","wrap","wrap-reverse"],nN=["0","1","2","3","4","5","6","7","8","9"],Ks={display:{type:"enum",values:ZR,default:"flex",responsive:!0},direction:{type:"enum",values:QR,default:void 0,responsive:!0},align:{type:"enum",values:eN,default:void 0,responsive:!0},justify:{type:"enum",values:tN,default:"start",responsive:!0},wrap:{type:"enum",values:rN,default:void 0,responsive:!0},gap:{type:"enum",values:nN,default:void 0,responsive:!0}},Y4=O.forwardRef((e,t)=>{const{rest:r,...n}=zo(e),{rest:i,...s}=YR(r),{className:o,asChild:a,display:c=Ks.display.default,direction:u=Ks.direction.default,align:l=Ks.align.default,justify:f=Ks.justify.default,wrap:h=Ks.wrap.default,gap:y=Ks.gap.default,..._}=i,w=a?xi:"div";return O.createElement(w,{..._,ref:t,className:Xt("rt-Flex",o,wt(c,"rt-r-display"),wt(u,"rt-r-fd"),wt(l,"rt-r-ai"),wt(f,"rt-r-jc",{between:"space-between"}),wt(h,"rt-r-fw"),wt(y,"rt-r-gap"),JR(s),Vo(n))})});Y4.displayName="Flex";function J4(e){const t=O.useRef({value:e,previous:e});return O.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var m0="Checkbox",[iN,ZW]=Bo(m0),[sN,oN]=iN(m0),Z4=O.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]=O.useState(null),_=Jt(t,F=>y(F)),w=O.useRef(!1),A=h?l||!!h.closest("form"):!0,[I=!1,P]=ac({prop:i,defaultProp:s,onChange:u}),N=O.useRef(I);return O.useEffect(()=>{const F=h==null?void 0:h.form;if(F){const L=()=>P(N.current);return F.addEventListener("reset",L),()=>F.removeEventListener("reset",L)}},[h,P]),b.jsxs(sN,{scope:r,state:I,disabled:a,children:[b.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":Hi(I)?"mixed":I,"aria-required":o,"data-state":tx(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:_,onKeyDown:rt(e.onKeyDown,F=>{F.key==="Enter"&&F.preventDefault()}),onClick:rt(e.onClick,F=>{P(L=>Hi(L)?!0:!L),A&&(w.current=F.isPropagationStopped(),w.current||F.stopPropagation())})}),A&&b.jsx(aN,{control:h,bubbles:!w.current,name:n,value:c,checked:I,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"},defaultChecked:Hi(s)?!1:s})]})});Z4.displayName=m0;var Q4="CheckboxIndicator",ex=O.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...i}=e,s=oN(Q4,r);return b.jsx(Mn,{present:n||Hi(s.state)||s.state===!0,children:b.jsx(Gt.span,{"data-state":tx(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});ex.displayName=Q4;var aN=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:i,...s}=e,o=O.useRef(null),a=J4(r),c=c0(t);O.useEffect(()=>{const l=o.current,f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==r&&y){const _=new Event("click",{bubbles:n});l.indeterminate=Hi(r),y.call(l,Hi(r)?!1:r),l.dispatchEvent(_)}},[a,r,n]);const u=O.useRef(Hi(r)?!1:r);return b.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 Hi(e){return e==="indeterminate"}function tx(e){return Hi(e)?"indeterminate":e?"checked":"unchecked"}var cN=Z4,uN=ex;const lN=["1","2","3"],fN=["classic","surface","soft"],Sc={size:{type:"enum",values:lN,default:"2",responsive:!0},variant:{type:"enum",values:fN,default:"surface"},color:cc,highContrast:ul},ll=O.forwardRef(({color:e="currentColor",...t},r)=>O.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},O.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"})));ll.displayName="ThickCheckIcon";const dN=O.forwardRef(({color:e="currentColor",...t},r)=>O.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},O.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"})));dN.displayName="ChevronDownIcon";const rx=O.forwardRef(({color:e="currentColor",...t},r)=>O.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:e,xmlns:"http://www.w3.org/2000/svg",...t,ref:r},O.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"})));rx.displayName="ThickChevronRightIcon";const hN=O.forwardRef(({color:e="currentColor",...t},r)=>O.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,ref:r},O.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"})));hN.displayName="InfoCircledIcon";const fl=O.forwardRef((e,t)=>{const{rest:r,...n}=zo(e),{className:i,style:s,size:o=Sc.size.default,variant:a=Sc.variant.default,color:c=Sc.color.default,highContrast:u=Sc.highContrast.default,...l}=r;return O.createElement("span",{className:Xt("rt-CheckboxRoot",i,wt(o,"rt-r-size"),Vo(n)),style:s},O.createElement(cN,{"data-accent-color":c,...l,ref:t,className:Xt("rt-reset","rt-CheckboxButton",`rt-variant-${a}`,{"rt-high-contrast":u})},O.createElement(uN,{className:"rt-CheckboxIndicator"},O.createElement(ll,{className:"rt-CheckboxIndicatorIcon"}))))});fl.displayName="Checkbox";function pN(e,t=[]){let r=[];function n(s,o){const a=O.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,..._}=f,w=(h==null?void 0:h[e][c])||a,A=O.useMemo(()=>_,Object.values(_));return b.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,_=O.useContext(y);if(_)return _;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=>O.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return O.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,mN(i,...t)]}function mN(...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 O.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function nx(e){const t=e+"CollectionProvider",[r,n]=pN(t),[i,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:_,children:w}=y,A=ie.useRef(null),I=ie.useRef(new Map).current;return b.jsx(i,{scope:_,itemMap:I,collectionRef:A,children:w})};o.displayName=t;const a=e+"CollectionSlot",c=ie.forwardRef((y,_)=>{const{scope:w,children:A}=y,I=s(a,w),P=Jt(_,I.collectionRef);return b.jsx(xi,{ref:P,children:A})});c.displayName=a;const u=e+"CollectionItemSlot",l="data-radix-collection-item",f=ie.forwardRef((y,_)=>{const{scope:w,children:A,...I}=y,P=ie.useRef(null),N=Jt(_,P),F=s(u,w);return ie.useEffect(()=>(F.itemMap.set(P,{ref:P,...I}),()=>void F.itemMap.delete(P))),b.jsx(xi,{[l]:"",ref:N,children:A})});f.displayName=u;function h(y){const _=s(e+"CollectionConsumer",y);return ie.useCallback(()=>{const A=_.collectionRef.current;if(!A)return[];const I=Array.from(A.querySelectorAll(`[${l}]`));return Array.from(_.itemMap.values()).sort((F,L)=>I.indexOf(F.ref.current)-I.indexOf(L.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,n]}function gN(e,t=[]){let r=[];function n(s,o){const a=O.createContext(o),c=r.length;r=[...r,o];function u(f){const{scope:h,children:y,..._}=f,w=(h==null?void 0:h[e][c])||a,A=O.useMemo(()=>_,Object.values(_));return b.jsx(w.Provider,{value:A,children:y})}function l(f,h){const y=(h==null?void 0:h[e][c])||a,_=O.useContext(y);if(_)return _;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=>O.createContext(o));return function(a){const c=(a==null?void 0:a[e])||s;return O.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[n,vN(i,...t)]}function vN(...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 O.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var sf="rovingFocusGroup.onEntryFocus",yN={bubbles:!1,cancelable:!0},dl="RovingFocusGroup",[yd,ix,bN]=nx(dl),[wN,sx]=gN(dl,[bN]),[_N,xN]=wN(dl),ox=O.forwardRef((e,t)=>b.jsx(yd.Provider,{scope:e.__scopeRovingFocusGroup,children:b.jsx(yd.Slot,{scope:e.__scopeRovingFocusGroup,children:b.jsx(SN,{...e,ref:t})})}));ox.displayName=dl;var SN=O.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=O.useRef(null),y=Jt(t,h),_=d0(s),[w=null,A]=ac({prop:o,defaultProp:a,onChange:c}),[I,P]=O.useState(!1),N=pr(u),F=ix(r),L=O.useRef(!1),[H,q]=O.useState(0);return O.useEffect(()=>{const X=h.current;if(X)return X.addEventListener(sf,N),()=>X.removeEventListener(sf,N)},[N]),b.jsx(_N,{scope:r,orientation:n,dir:_,loop:i,currentTabStopId:w,onItemFocus:O.useCallback(X=>A(X),[A]),onItemShiftTab:O.useCallback(()=>P(!0),[]),onFocusableItemAdd:O.useCallback(()=>q(X=>X+1),[]),onFocusableItemRemove:O.useCallback(()=>q(X=>X-1),[]),children:b.jsx(Gt.div,{tabIndex:I||H===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:rt(e.onMouseDown,()=>{L.current=!0}),onFocus:rt(e.onFocus,X=>{const re=!L.current;if(X.target===X.currentTarget&&re&&!I){const ae=new CustomEvent(sf,yN);if(X.currentTarget.dispatchEvent(ae),!ae.defaultPrevented){const oe=F().filter(m=>m.focusable),V=oe.find(m=>m.active),$=oe.find(m=>m.id===w),d=[V,$,...oe].filter(Boolean).map(m=>m.ref.current);ux(d,l)}}L.current=!1}),onBlur:rt(e.onBlur,()=>P(!1))})})}),ax="RovingFocusGroupItem",cx=O.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=e,a=Ua(),c=s||a,u=xN(ax,r),l=u.currentTabStopId===c,f=ix(r),{onFocusableItemAdd:h,onFocusableItemRemove:y}=u;return O.useEffect(()=>{if(n)return h(),()=>y()},[n,h,y]),b.jsx(yd.ItemSlot,{scope:r,id:c,focusable:n,active:i,children:b.jsx(Gt.span,{tabIndex:l?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:rt(e.onMouseDown,_=>{n?u.onItemFocus(c):_.preventDefault()}),onFocus:rt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:rt(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){u.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const w=CN(_,u.orientation,u.dir);if(w!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let I=f().filter(P=>P.focusable).map(P=>P.ref.current);if(w==="last")I.reverse();else if(w==="prev"||w==="next"){w==="prev"&&I.reverse();const P=I.indexOf(_.currentTarget);I=u.loop?AN(I,P+1):I.slice(P+1)}setTimeout(()=>ux(I))}})})})});cx.displayName=ax;var EN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function MN(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function CN(e,t,r){const n=MN(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return EN[n]}function ux(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function AN(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var TN=ox,ON=cx;function IN(e,[t,r]){return Math.min(r,Math.max(t,e))}var of=0;function kN(){O.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ym()),document.body.insertAdjacentElement("beforeend",e[1]??ym()),of++,()=>{of===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),of--}},[])}function ym(){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 af="focusScope.autoFocusOnMount",cf="focusScope.autoFocusOnUnmount",bm={bubbles:!1,cancelable:!0},jN="FocusScope",lx=O.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,c]=O.useState(null),u=pr(i),l=pr(s),f=O.useRef(null),h=Jt(t,w=>c(w)),y=O.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O.useEffect(()=>{if(n){let w=function(N){if(y.paused||!a)return;const F=N.target;a.contains(F)?f.current=F:$i(f.current,{select:!0})},A=function(N){if(y.paused||!a)return;const F=N.relatedTarget;F!==null&&(a.contains(F)||$i(f.current,{select:!0}))},I=function(N){if(document.activeElement===document.body)for(const L of N)L.removedNodes.length>0&&$i(a)};document.addEventListener("focusin",w),document.addEventListener("focusout",A);const P=new MutationObserver(I);return a&&P.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",A),P.disconnect()}}},[n,a,y.paused]),O.useEffect(()=>{if(a){_m.add(y);const w=document.activeElement;if(!a.contains(w)){const I=new CustomEvent(af,bm);a.addEventListener(af,u),a.dispatchEvent(I),I.defaultPrevented||(PN(BN(fx(a)),{select:!0}),document.activeElement===w&&$i(a))}return()=>{a.removeEventListener(af,u),setTimeout(()=>{const I=new CustomEvent(cf,bm);a.addEventListener(cf,l),a.dispatchEvent(I),I.defaultPrevented||$i(w??document.body,{select:!0}),a.removeEventListener(cf,l),_m.remove(y)},0)}}},[a,u,l,y]);const _=O.useCallback(w=>{if(!r&&!n||y.paused)return;const A=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,I=document.activeElement;if(A&&I){const P=w.currentTarget,[N,F]=RN(P);N&&F?!w.shiftKey&&I===F?(w.preventDefault(),r&&$i(N,{select:!0})):w.shiftKey&&I===N&&(w.preventDefault(),r&&$i(F,{select:!0})):I===P&&w.preventDefault()}},[r,n,y.paused]);return b.jsx(Gt.div,{tabIndex:-1,...o,ref:h,onKeyDown:_})});lx.displayName=jN;function PN(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if($i(n,{select:t}),document.activeElement!==r)return}function RN(e){const t=fx(e),r=wm(t,e),n=wm(t.reverse(),e);return[r,n]}function fx(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 wm(e,t){for(const r of e)if(!NN(r,{upTo:t}))return r}function NN(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 DN(e){return e instanceof HTMLInputElement&&"select"in e}function $i(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&DN(e)&&t&&e.select()}}var _m=$N();function $N(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=xm(e,t),e.unshift(t)},remove(t){var r;e=xm(e,t),(r=e[0])==null||r.resume()}}}function xm(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function BN(e){return e.filter(t=>t.tagName!=="A")}var LN=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Xs=new WeakMap,Ec=new WeakMap,Mc={},uf=0,dx=function(e){return e&&(e.host||dx(e.parentNode))},UN=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=dx(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})},FN=function(e,t,r,n){var i=UN(t,Array.isArray(e)?e:[e]);Mc[r]||(Mc[r]=new WeakMap);var s=Mc[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),_=y!==null&&y!=="false",w=(Xs.get(h)||0)+1,A=(s.get(h)||0)+1;Xs.set(h,w),s.set(h,A),o.push(h),w===1&&_&&Ec.set(h,!0),A===1&&h.setAttribute(r,"true"),_||h.setAttribute(n,"true")}catch(I){console.error("aria-hidden: cannot operate on ",h,I)}})};return l(t),a.clear(),uf++,function(){o.forEach(function(f){var h=Xs.get(f)-1,y=s.get(f)-1;Xs.set(f,h),s.set(f,y),h||(Ec.has(f)||f.removeAttribute(n),Ec.delete(f)),y||f.removeAttribute(r)}),uf--,uf||(Xs=new WeakMap,Xs=new WeakMap,Ec=new WeakMap,Mc={})}},zN=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||LN(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),FN(n,i,r,"aria-hidden")):function(){return null}},Ln=function(){return Ln=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},Ln.apply(this,arguments)};function hx(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 VN(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))}var Gc="right-scroll-bar-position",Hc="width-before-scroll-bar",qN="with-scroll-bars-hidden",GN="--removed-body-scroll-bar-size";function lf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function HN(e,t){var r=ie.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 WN=typeof window<"u"?O.useLayoutEffect:O.useEffect,Sm=new WeakMap;function KN(e,t){var r=HN(t||null,function(n){return e.forEach(function(i){return lf(i,n)})});return WN(function(){var n=Sm.get(r);if(n){var i=new Set(n),s=new Set(e),o=r.current;i.forEach(function(a){s.has(a)||lf(a,null)}),s.forEach(function(a){i.has(a)||lf(a,o)})}Sm.set(r,e)},[e]),r}function XN(e){return e}function YN(e,t){t===void 0&&(t=XN);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 JN(e){e===void 0&&(e={});var t=YN(null);return t.options=Ln({async:!0,ssr:!1},e),t}var px=function(e){var t=e.sideCar,r=hx(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 O.createElement(n,Ln({},r))};px.isSideCarExport=!0;function ZN(e,t){return e.useMedium(t),px}var mx=JN(),ff=function(){},hl=O.forwardRef(function(e,t){var r=O.useRef(null),n=O.useState({onScrollCapture:ff,onWheelCapture:ff,onTouchMoveCapture:ff}),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,_=e.inert,w=e.allowPinchZoom,A=e.as,I=A===void 0?"div":A,P=e.gapMode,N=hx(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=h,L=KN([r,t]),H=Ln(Ln({},N),i);return O.createElement(O.Fragment,null,l&&O.createElement(F,{sideCar:mx,removeScrollBar:u,shards:f,noIsolation:y,inert:_,setCallbacks:s,allowPinchZoom:!!w,lockRef:r,gapMode:P}),o?O.cloneElement(O.Children.only(a),Ln(Ln({},H),{ref:L})):O.createElement(I,Ln({},H,{className:c,ref:L}),a))});hl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hl.classNames={fullWidth:Hc,zeroRight:Gc};var Em,QN=function(){if(Em)return Em;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function eD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=QN();return t&&e.setAttribute("nonce",t),e}function tD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function rD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var nD=function(){var e=0,t=null;return{add:function(r){e==0&&(t=eD())&&(tD(t,r),rD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iD=function(){var e=nD();return function(t,r){O.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},gx=function(){var e=iD(),t=function(r){var n=r.styles,i=r.dynamic;return e(n,i),null};return t},sD={left:0,top:0,right:0,gap:0},df=function(e){return parseInt(e||"",10)||0},oD=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[df(r),df(n),df(i)]},aD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return sD;var t=oD(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])}},cD=gx(),wo="data-scroll-locked",uD=function(e,t,r,n){var i=e.left,s=e.top,o=e.right,a=e.gap;return r===void 0&&(r="margin"),`
|
|
53
|
+
.`.concat(qN,` {
|
|
59
54
|
overflow: hidden `).concat(n,`;
|
|
60
55
|
padding-right: `).concat(a,"px ").concat(n,`;
|
|
61
56
|
}
|
|
62
|
-
body[`).concat(
|
|
57
|
+
body[`).concat(wo,`] {
|
|
63
58
|
overflow: hidden `).concat(n,`;
|
|
64
59
|
overscroll-behavior: contain;
|
|
65
60
|
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
@@ -72,29 +67,34 @@ body { background-color: var(--color-page-background); }
|
|
|
72
67
|
`),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
73
68
|
}
|
|
74
69
|
|
|
75
|
-
.`).concat(
|
|
70
|
+
.`).concat(Gc,` {
|
|
76
71
|
right: `).concat(a,"px ").concat(n,`;
|
|
77
72
|
}
|
|
78
73
|
|
|
79
|
-
.`).concat(
|
|
74
|
+
.`).concat(Hc,` {
|
|
80
75
|
margin-right: `).concat(a,"px ").concat(n,`;
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
.`).concat(
|
|
78
|
+
.`).concat(Gc," .").concat(Gc,` {
|
|
84
79
|
right: 0 `).concat(n,`;
|
|
85
80
|
}
|
|
86
81
|
|
|
87
|
-
.`).concat(
|
|
82
|
+
.`).concat(Hc," .").concat(Hc,` {
|
|
88
83
|
margin-right: 0 `).concat(n,`;
|
|
89
84
|
}
|
|
90
85
|
|
|
91
|
-
body[`).concat(
|
|
92
|
-
`).concat(
|
|
86
|
+
body[`).concat(wo,`] {
|
|
87
|
+
`).concat(GN,": ").concat(a,`px;
|
|
93
88
|
}
|
|
94
|
-
`)},
|
|
89
|
+
`)},Mm=function(){var e=parseInt(document.body.getAttribute(wo)||"0",10);return isFinite(e)?e:0},lD=function(){O.useEffect(function(){return document.body.setAttribute(wo,(Mm()+1).toString()),function(){var e=Mm()-1;e<=0?document.body.removeAttribute(wo):document.body.setAttribute(wo,e.toString())}},[])},fD=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;lD();var s=O.useMemo(function(){return aD(i)},[i]);return O.createElement(cD,{styles:uD(s,!t,i,r?"":"!important")})},bd=!1;if(typeof window<"u")try{var Cc=Object.defineProperty({},"passive",{get:function(){return bd=!0,!0}});window.addEventListener("test",Cc,Cc),window.removeEventListener("test",Cc,Cc)}catch{bd=!1}var Ys=bd?{passive:!1}:!1,dD=function(e){return e.tagName==="TEXTAREA"},vx=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!dD(e)&&r[t]==="visible")},hD=function(e){return vx(e,"overflowY")},pD=function(e){return vx(e,"overflowX")},Cm=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=yx(e,n);if(i){var s=bx(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},mD=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},gD=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},yx=function(e,t){return e==="v"?hD(t):pD(t)},bx=function(e,t){return e==="v"?mD(t):gD(t)},vD=function(e,t){return e==="h"&&t==="rtl"?-1:1},yD=function(e,t,r,n,i){var s=vD(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=bx(e,a),_=y[0],w=y[1],A=y[2],I=w-A-s*_;(_||I)&&yx(e,a)&&(f+=I,h+=_),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},Ac=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Am=function(e){return[e.deltaX,e.deltaY]},Tm=function(e){return e&&"current"in e?e.current:e},bD=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wD=function(e){return`
|
|
95
90
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
96
91
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
97
|
-
`)},R$=0,no=[];function N$(e){var t=I.useRef([]),r=I.useRef([0,0]),n=I.useRef(),i=I.useState(R$++)[0],s=I.useState(T6)[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=r$([e.lockRef.current],(e.shards||[]).map(Ng),!0).filter(Boolean);return w.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(w,T){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var P=$c(w),R=r.current,N="deltaX"in w?w.deltaX:R[0]-P[0],z="deltaY"in w?w.deltaY:R[1]-P[1],F,W=w.target,q=Math.abs(N)>Math.abs(z)?"h":"v";if("touches"in w&&q==="h"&&W.type==="range")return!1;var K=jg(q,W);if(!K)return!0;if(K?F=q:(F=q==="v"?"h":"v",K=jg(q,W)),!K)return!1;if(!n.current&&"changedTouches"in w&&(N||z)&&(n.current=F),!F)return!0;var te=n.current||F;return P$(te,T,w,te==="h"?N:z,!0)},[]),c=I.useCallback(function(w){var T=w;if(!(!no.length||no[no.length-1]!==s)){var P="deltaY"in T?Rg(T):$c(T),R=t.current.filter(function(F){return F.name===T.type&&(F.target===T.target||T.target===F.shadowParent)&&k$(F.delta,P)})[0];if(R&&R.should){T.cancelable&&T.preventDefault();return}if(!R){var N=(o.current.shards||[]).map(Ng).filter(Boolean).filter(function(F){return F.contains(T.target)}),z=N.length>0?a(T,N[0]):!o.current.noIsolation;z&&T.cancelable&&T.preventDefault()}}},[]),u=I.useCallback(function(w,T,P,R){var N={name:w,delta:T,target:P,should:R,shadowParent:D$(P)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(z){return z!==N})},1)},[]),l=I.useCallback(function(w){r.current=$c(w),n.current=void 0},[]),f=I.useCallback(function(w){u(w.type,Rg(w),w.target,a(w,e.lockRef.current))},[]),h=I.useCallback(function(w){u(w.type,$c(w),w.target,a(w,e.lockRef.current))},[]);I.useEffect(function(){return no.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,ro),document.addEventListener("touchmove",c,ro),document.addEventListener("touchstart",l,ro),function(){no=no.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,ro),document.removeEventListener("touchmove",c,ro),document.removeEventListener("touchstart",l,ro)}},[]);var y=e.removeScrollBar,b=e.inert;return I.createElement(I.Fragment,null,b?I.createElement(s,{styles:j$(i)}):null,y?I.createElement(E$,{gapMode:e.gapMode}):null)}function D$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const B$=f$(A6,N$);var k6=I.forwardRef(function(e,t){return I.createElement(Ul,Un({},e,{ref:t,sideCar:B$}))});k6.classNames=Ul.classNames;const $$=k6;function L$(e,t){return I.useReducer((r,n)=>t[r][n]??r,e)}var a0="ScrollArea",[j6,IK]=Ho(a0),[F$,on]=j6(a0),R6=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,T]=I.useState(null),[P,R]=I.useState(0),[N,z]=I.useState(0),[F,W]=I.useState(!1),[q,K]=I.useState(!1),te=Zt(t,H=>c(H)),se=n0(i);return _.jsx(F$,{scope:r,type:n,dir:se,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:h,scrollbarX:y,onScrollbarXChange:b,scrollbarXEnabled:F,onScrollbarXEnabledChange:W,scrollbarY:w,onScrollbarYChange:T,scrollbarYEnabled:q,onScrollbarYEnabledChange:K,onCornerWidthChange:R,onCornerHeightChange:z,children:_.jsx(Wt.div,{dir:se,...o,ref:te,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});R6.displayName=a0;var N6="ScrollAreaViewport",D6=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=on(N6,r),a=I.useRef(null),c=Zt(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(Wt.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})})]})});D6.displayName=N6;var ti="ScrollAreaScrollbar",B6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=on(ti,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(U$,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(z$,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx($6,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(c0,{...n,ref:t}):null});B6.displayName=ti;var U$=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=on(ti,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(Tn,{present:r||s,children:_.jsx($6,{"data-state":s?"visible":"hidden",...n,ref:t})})}),z$=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=on(ti,e.__scopeScrollArea),s=e.orientation==="horizontal",o=Vl(()=>c("SCROLL_END"),100),[a,c]=L$("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(Tn,{present:r||a!=="hidden",children:_.jsx(c0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),$6=I.forwardRef((e,t)=>{const r=on(ti,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=I.useState(!1),a=e.orientation==="horizontal",c=Vl(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return Ro(r.viewport,c),Ro(r.content,c),_.jsx(Tn,{present:n||s,children:_.jsx(c0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),c0=I.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=on(ti,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=V6(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 K$(h,o.current,a,y)}return r==="horizontal"?_.jsx(V$,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=Dg(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(q$,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=Dg(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}),V$=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=on(ti,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Zt(t,c,s.onScrollbarXChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(F6,{"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":zl(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),H6(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:qu(o.paddingLeft),paddingEnd:qu(o.paddingRight)}})}})}),q$=I.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=on(ti,e.__scopeScrollArea),[o,a]=I.useState(),c=I.useRef(null),u=Zt(t,c,s.onScrollbarYChange);return I.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(F6,{"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":zl(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),H6(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:qu(o.paddingTop),paddingEnd:qu(o.paddingBottom)}})}})}),[H$,L6]=j6(ti),F6=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=on(ti,r),[b,w]=I.useState(null),T=Zt(t,te=>w(te)),P=I.useRef(null),R=I.useRef(""),N=y.viewport,z=n.content-n.viewport,F=pr(l),W=pr(c),q=Vl(f,10);function K(te){if(P.current){const se=te.clientX-P.current.left,H=te.clientY-P.current.top;u({x:se,y:H})}}return I.useEffect(()=>{const te=se=>{const H=se.target;(b==null?void 0:b.contains(H))&&F(se,z)};return document.addEventListener("wheel",te,{passive:!1}),()=>document.removeEventListener("wheel",te,{passive:!1})},[N,b,z,F]),I.useEffect(W,[n,W]),Ro(b,q),Ro(y.content,q),_.jsx(H$,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:pr(s),onThumbPointerUp:pr(o),onThumbPositionChange:W,onThumbPointerDown:pr(a),children:_.jsx(Wt.div,{...h,ref:T,style:{position:"absolute",...h.style},onPointerDown:tt(e.onPointerDown,te=>{te.button===0&&(te.target.setPointerCapture(te.pointerId),P.current=b.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),K(te))}),onPointerMove:tt(e.onPointerMove,K),onPointerUp:tt(e.onPointerUp,te=>{const se=te.target;se.hasPointerCapture(te.pointerId)&&se.releasePointerCapture(te.pointerId),document.body.style.webkitUserSelect=R.current,y.viewport&&(y.viewport.style.scrollBehavior=""),P.current=null})})})}),Vu="ScrollAreaThumb",U6=I.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=L6(Vu,e.__scopeScrollArea);return _.jsx(Tn,{present:r||i.hasThumb,children:_.jsx(W$,{ref:t,...n})})}),W$=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=on(Vu,r),o=L6(Vu,r),{onThumbPositionChange:a}=o,c=Zt(t,f=>o.onThumbChange(f)),u=I.useRef(),l=Vl(()=>{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=X$(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,l,a]),_.jsx(Wt.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)})});U6.displayName=Vu;var u0="ScrollAreaCorner",z6=I.forwardRef((e,t)=>{const r=on(u0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(G$,{...e,ref:t}):null});z6.displayName=u0;var G$=I.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=on(u0,r),[s,o]=I.useState(0),[a,c]=I.useState(0),u=!!(s&&a);return Ro(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),Ro(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?_.jsx(Wt.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 qu(e){return e?parseInt(e,10):0}function V6(e,t){const r=e/t;return isNaN(r)?0:r}function zl(e){const t=V6(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function K$(e,t,r,n="ltr"){const i=zl(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 q6([c,u],f)(e)}function Dg(e,t,r="ltr"){const n=zl(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=VB(e,c);return q6([0,o],[0,a])(u)}function q6(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 H6(e,t){return e>0&&e<t}var X$=(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 Vl(e,t){const r=pr(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 Ro(e,t){const r=pr(t);Qi(()=>{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 J$=R6,Y$=D6,Bg=B6,$g=U6,Z$=z6,l0="Switch",[Q$,PK]=Ho(l0),[eL,tL]=Q$(l0),W6=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=Zt(t,N=>y(N)),w=I.useRef(!1),T=h?l||!!h.closest("form"):!0,[P=!1,R]=mc({prop:i,defaultProp:s,onChange:u});return _.jsxs(eL,{scope:r,checked:P,disabled:a,children:[_.jsx(Wt.button,{type:"button",role:"switch","aria-checked":P,"aria-required":o,"data-state":X6(P),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onClick:tt(e.onClick,N=>{R(z=>!z),T&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),T&&_.jsx(rL,{control:h,bubbles:!w.current,name:n,value:c,checked:P,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});W6.displayName=l0;var G6="SwitchThumb",K6=I.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=tL(G6,r);return _.jsx(Wt.span,{"data-state":X6(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});K6.displayName=G6;var rL=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=I.useRef(null),o=u6(r),a=Qp(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 X6(e){return e?"checked":"unchecked"}var nL=W6,iL=K6;const sL=["1","2","3"],oL=["classic","surface","soft"],ha={size:{type:"enum",values:sL,default:"2",responsive:!0},variant:{type:"enum",values:oL,default:"surface"},color:gc,highContrast:Bl,radius:s0},J6=I.forwardRef((e,t)=>{const{rest:r,...n}=Xo(e),{className:i,style:s,size:o=ha.size.default,variant:a=ha.variant.default,color:c=ha.color.default,highContrast:u=ha.highContrast.default,radius:l=ha.radius.default,...f}=r;return I.createElement("span",{"data-radius":l,className:Jt("rt-SwitchRoot",i,_t(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Jo(n)),style:s},I.createElement(nL,{"data-accent-color":c,...f,ref:t,className:Jt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},I.createElement(iL,{className:Jt("rt-SwitchThumb",{"rt-high-contrast":u})})))});J6.displayName="Switch";var ah=["Enter"," "],aL=["ArrowDown","PageUp","Home"],Y6=["ArrowUp","PageDown","End"],cL=[...aL,...Y6],uL={ltr:[...ah,"ArrowRight"],rtl:[...ah,"ArrowLeft"]},lL={ltr:["ArrowLeft"],rtl:["ArrowRight"]},vc="Menu",[Ka,fL,dL]=m6(vc),[Vs,Z6]=Ho(vc,[dL,jl,v6]),yc=jl(),Q6=v6(),[e3,as]=Vs(vc),[hL,bc]=Vs(vc),t3=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=yc(t),[c,u]=I.useState(null),l=I.useRef(!1),f=pr(s),h=n0(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(e3,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(hL,{scope:t,onClose:I.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};t3.displayName=vc;var pL="MenuAnchor",f0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=yc(r);return _.jsx(K4,{...i,...n,ref:t})});f0.displayName=pL;var d0="MenuPortal",[mL,r3]=Vs(d0,{forceMount:void 0}),n3=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=as(d0,t);return _.jsx(mL,{scope:t,forceMount:r,children:_.jsx(Tn,{present:r||s.open,children:_.jsx(Y4,{asChild:!0,container:i,children:n})})})};n3.displayName=d0;var nn="MenuContent",[gL,h0]=Vs(nn),i3=I.forwardRef((e,t)=>{const r=r3(nn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=as(nn,e.__scopeMenu),o=bc(nn,e.__scopeMenu);return _.jsx(Ka.Provider,{scope:e.__scopeMenu,children:_.jsx(Tn,{present:n||s.open,children:_.jsx(Ka.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(vL,{...i,ref:t}):_.jsx(yL,{...i,ref:t})})})})}),vL=I.forwardRef((e,t)=>{const r=as(nn,e.__scopeMenu),n=I.useRef(null),i=Zt(t,n);return I.useEffect(()=>{const s=n.current;if(s)return t$(s)},[]),_.jsx(p0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),yL=I.forwardRef((e,t)=>{const r=as(nn,e.__scopeMenu);return _.jsx(p0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),p0=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,T=as(nn,r),P=bc(nn,r),R=yc(r),N=Q6(r),z=fL(r),[F,W]=I.useState(null),q=I.useRef(null),K=Zt(t,q,T.onContentChange),te=I.useRef(0),se=I.useRef(""),H=I.useRef(0),L=I.useRef(null),D=I.useRef("right"),p=I.useRef(0),d=b?$$:I.Fragment,m=b?{as:xi,allowPinchZoom:!0}:void 0,x=E=>{var ge,ve;const O=se.current+E,M=z().filter(Se=>!Se.disabled),g=document.activeElement,v=(ge=M.find(Se=>Se.ref.current===g))==null?void 0:ge.textValue,k=M.map(Se=>Se.textValue),ee=IL(k,O,v),ie=(ve=M.find(Se=>Se.textValue===ee))==null?void 0:ve.ref.current;(function Se(xe){se.current=xe,window.clearTimeout(te.current),xe!==""&&(te.current=window.setTimeout(()=>Se(""),1e3))})(O),ie&&setTimeout(()=>ie.focus())};I.useEffect(()=>()=>window.clearTimeout(te.current),[]),qB();const C=I.useCallback(E=>{var M,g;return D.current===((M=L.current)==null?void 0:M.side)&&kL(E,(g=L.current)==null?void 0:g.area)},[]);return _.jsx(gL,{scope:r,searchRef:se,onItemEnter:I.useCallback(E=>{C(E)&&E.preventDefault()},[C]),onItemLeave:I.useCallback(E=>{var O;C(E)||((O=q.current)==null||O.focus(),W(null))},[C]),onTriggerLeave:I.useCallback(E=>{C(E)&&E.preventDefault()},[C]),pointerGraceTimerRef:H,onPointerGraceIntentChange:I.useCallback(E=>{L.current=E},[]),children:_.jsx(d,{...m,children:_.jsx(x6,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,E=>{var O;E.preventDefault(),(O=q.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(Hp,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:_.jsx(UB,{asChild:!0,...N,dir:P.dir,orientation:"vertical",loop:n,currentTabStopId:F,onCurrentTabStopIdChange:W,onEntryFocus:tt(c,E=>{P.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":_3(T.open),"data-radix-menu-content":"",dir:P.dir,...R,...w,ref:K,style:{outline:"none",...w.style},onKeyDown:tt(w.onKeyDown,E=>{const M=E.target.closest("[data-radix-menu-content]")===E.currentTarget,g=E.ctrlKey||E.altKey||E.metaKey,v=E.key.length===1;M&&(E.key==="Tab"&&E.preventDefault(),!g&&v&&x(E.key));const k=q.current;if(E.target!==k||!cL.includes(E.key))return;E.preventDefault();const ie=z().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);Y6.includes(E.key)&&ie.reverse(),TL(ie)}),onBlur:tt(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(te.current),se.current="")}),onPointerMove:tt(e.onPointerMove,Xa(E=>{const O=E.target,M=p.current!==E.clientX;if(E.currentTarget.contains(O)&&M){const g=E.clientX>p.current?"right":"left";D.current=g,p.current=E.clientX}}))})})})})})})});i3.displayName=nn;var bL="MenuGroup",m0=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Wt.div,{role:"group",...n,ref:t})});m0.displayName=bL;var wL="MenuLabel",s3=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Wt.div,{...n,ref:t})});s3.displayName=wL;var Hu="MenuItem",Lg="menu.itemSelect",ql=I.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=I.useRef(null),o=bc(Hu,e.__scopeMenu),a=h0(Hu,e.__scopeMenu),c=Zt(t,s),u=I.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(Lg,{bubbles:!0,cancelable:!0});f.addEventListener(Lg,y=>n==null?void 0:n(y),{once:!0}),C4(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(o3,{...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===" "||ah.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});ql.displayName=Hu;var o3=I.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=h0(Hu,r),a=Q6(r),c=I.useRef(null),u=Zt(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(Ka.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:_.jsx(zB,{asChild:!0,...a,focusable:!n,children:_.jsx(Wt.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,Xa(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,Xa(b=>o.onItemLeave(b))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),_L="MenuCheckboxItem",a3=I.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(d3,{scope:e.__scopeMenu,checked:r,children:_.jsx(ql,{role:"menuitemcheckbox","aria-checked":Wu(r)?"mixed":r,...i,ref:t,"data-state":y0(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(Wu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});a3.displayName=_L;var c3="MenuRadioGroup",[xL,SL]=Vs(c3,{value:void 0,onValueChange:()=>{}}),u3=I.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=pr(n);return _.jsx(xL,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(m0,{...i,ref:t})})});u3.displayName=c3;var l3="MenuRadioItem",f3=I.forwardRef((e,t)=>{const{value:r,...n}=e,i=SL(l3,e.__scopeMenu),s=r===i.value;return _.jsx(d3,{scope:e.__scopeMenu,checked:s,children:_.jsx(ql,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":y0(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});f3.displayName=l3;var g0="MenuItemIndicator",[d3,EL]=Vs(g0,{checked:!1}),h3=I.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=EL(g0,r);return _.jsx(Tn,{present:n||Wu(s.checked)||s.checked===!0,children:_.jsx(Wt.span,{...i,ref:t,"data-state":y0(s.checked)})})});h3.displayName=g0;var CL="MenuSeparator",p3=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Wt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});p3.displayName=CL;var ML="MenuArrow",m3=I.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=yc(r);return _.jsx(J4,{...i,...n,ref:t})});m3.displayName=ML;var v0="MenuSub",[AL,g3]=Vs(v0),v3=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=as(v0,t),o=yc(t),[a,c]=I.useState(null),[u,l]=I.useState(null),f=pr(i);return I.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(G4,{...o,children:_.jsx(e3,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(AL,{scope:t,contentId:Ha(),triggerId:Ha(),trigger:a,onTriggerChange:c,children:r})})})};v3.displayName=v0;var _a="MenuSubTrigger",y3=I.forwardRef((e,t)=>{const r=as(_a,e.__scopeMenu),n=bc(_a,e.__scopeMenu),i=g3(_a,e.__scopeMenu),s=h0(_a,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(f0,{asChild:!0,...u,children:_.jsx(o3,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":_3(r.open),...e,ref:Ol(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,Xa(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,Xa(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,T=w==="right",P=T?-5:5,R=h[T?"left":"right"],N=h[T?"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===" "||uL[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});y3.displayName=_a;var b3="MenuSubContent",w3=I.forwardRef((e,t)=>{const r=r3(nn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=as(nn,e.__scopeMenu),o=bc(nn,e.__scopeMenu),a=g3(b3,e.__scopeMenu),c=I.useRef(null),u=Zt(t,c);return _.jsx(Ka.Provider,{scope:e.__scopeMenu,children:_.jsx(Tn,{present:n||s.open,children:_.jsx(Ka.Slot,{scope:e.__scopeMenu,children:_.jsx(p0,{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=lL[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});w3.displayName=b3;function _3(e){return e?"open":"closed"}function Wu(e){return e==="indeterminate"}function y0(e){return Wu(e)?"indeterminate":e?"checked":"unchecked"}function TL(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function OL(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function IL(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=OL(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 PL(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 kL(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return PL(r,t)}function Xa(e){return t=>t.pointerType==="mouse"?e(t):void 0}var jL=t3,RL=f0,NL=n3,DL=i3,BL=m0,$L=s3,LL=ql,FL=a3,UL=u3,zL=f3,VL=h3,qL=p3,HL=m3,WL=v3,GL=y3,KL=w3,b0="DropdownMenu",[XL,kK]=Ho(b0,[Z6]),Ir=Z6(),[JL,x3]=XL(b0),S3=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Ir(t),u=I.useRef(null),[l=!1,f]=mc({prop:i,defaultProp:s,onChange:o});return _.jsx(JL,{scope:t,triggerId:Ha(),triggerRef:u,contentId:Ha(),open:l,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(h=>!h),[f]),modal:a,children:_.jsx(jL,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};S3.displayName=b0;var E3="DropdownMenuTrigger",C3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=x3(E3,r),o=Ir(r);return _.jsx(RL,{asChild:!0,...o,children:_.jsx(Wt.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:Ol(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())})})})});C3.displayName=E3;var YL="DropdownMenuPortal",M3=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Ir(t);return _.jsx(NL,{...n,...r})};M3.displayName=YL;var A3="DropdownMenuContent",T3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=x3(A3,r),s=Ir(r),o=I.useRef(!1);return _.jsx(DL,{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)"}})});T3.displayName=A3;var ZL="DropdownMenuGroup",O3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(BL,{...i,...n,ref:t})});O3.displayName=ZL;var QL="DropdownMenuLabel",I3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx($L,{...i,...n,ref:t})});I3.displayName=QL;var eF="DropdownMenuItem",P3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(LL,{...i,...n,ref:t})});P3.displayName=eF;var tF="DropdownMenuCheckboxItem",k3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(FL,{...i,...n,ref:t})});k3.displayName=tF;var rF="DropdownMenuRadioGroup",j3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(UL,{...i,...n,ref:t})});j3.displayName=rF;var nF="DropdownMenuRadioItem",R3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(zL,{...i,...n,ref:t})});R3.displayName=nF;var iF="DropdownMenuItemIndicator",N3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(VL,{...i,...n,ref:t})});N3.displayName=iF;var sF="DropdownMenuSeparator",D3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(qL,{...i,...n,ref:t})});D3.displayName=sF;var oF="DropdownMenuArrow",aF=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(HL,{...i,...n,ref:t})});aF.displayName=oF;var cF=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Ir(t),[a=!1,c]=mc({prop:n,defaultProp:s,onChange:i});return _.jsx(WL,{...o,open:a,onOpenChange:c,children:r})},uF="DropdownMenuSubTrigger",B3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(GL,{...i,...n,ref:t})});B3.displayName=uF;var lF="DropdownMenuSubContent",$3=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ir(r);return _.jsx(KL,{...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)"}})});$3.displayName=lF;var fF=S3,dF=C3,L3=M3,hF=T3,pF=O3,mF=I3,gF=P3,vF=k3,yF=j3,bF=R3,F3=N3,wF=D3,_F=cF,xF=B3,SF=$3;const EF=["1","2","3"],CF=["vertical","horizontal","both"],Jf={size:{type:"enum",values:EF,default:"1",responsive:!0},radius:s0,scrollbars:{type:"enum",values:CF,default:"both"}},w0=I.forwardRef((e,t)=>{const{rest:r,...n}=Xo(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=Jf.size.default,radius:l=Jf.radius.default,scrollbars:f=Jf.scrollbars.default,...h}=r;return I.createElement(J$,{type:o,scrollHideDelay:a,className:Jt("rt-ScrollAreaRoot",i,Jo(n)),style:s},I.createElement(Y$,{...h,ref:t,className:"rt-ScrollAreaViewport"}),I.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?I.createElement(Bg,{"data-radius":l,orientation:"horizontal",className:Jt("rt-ScrollAreaScrollbar",_t(u,"rt-r-size"))},I.createElement($g,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?I.createElement(Bg,{"data-radius":l,orientation:"vertical",className:Jt("rt-ScrollAreaScrollbar",_t(u,"rt-r-size"))},I.createElement($g,{className:"rt-ScrollAreaThumb"})):null,f==="both"?I.createElement(Z$,{className:"rt-ScrollAreaCorner"}):null)});w0.displayName="ScrollArea";const MF=["1","2"],AF=["solid","soft"],Yf={size:{type:"enum",values:MF,default:"2",responsive:!0},variant:{type:"enum",values:AF,default:"solid"},color:gc,highContrast:Bl},U3={color:gc,shortcut:{type:"string",default:void 0}},z3=e=>I.createElement(fF,{...e});z3.displayName="DropdownMenuRoot";const V3=I.forwardRef((e,t)=>I.createElement(dF,{...e,ref:t,asChild:!0}));V3.displayName="DropdownMenuTrigger";const q3=I.createContext({}),H3=I.forwardRef((e,t)=>{const r=tB(),{className:n,children:i,size:s=Yf.size.default,variant:o=Yf.variant.default,highContrast:a=Yf.highContrast.default,color:c=U3.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return I.createElement(L3,{container:u,forceMount:l},I.createElement(Dl,{asChild:!0},I.createElement(hF,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Jt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,_t(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},I.createElement(w0,{type:"auto"},I.createElement("div",{className:Jt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},I.createElement(q3.Provider,{value:I.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});H3.displayName="DropdownMenuContent";const W3=I.forwardRef((e,t)=>I.createElement(mF,{...e,ref:t,className:Jt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));W3.displayName="DropdownMenuLabel";const G3=I.forwardRef((e,t)=>{const{className:r,children:n,color:i=U3.color.default,shortcut:s,...o}=e;return I.createElement(gF,{"data-accent-color":i,...o,ref:t,className:Jt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},I.createElement(Wo,null,n),s&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});G3.displayName="DropdownMenuItem";const K3=I.forwardRef((e,t)=>I.createElement(pF,{...e,ref:t,className:Jt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));K3.displayName="DropdownMenuGroup";const X3=I.forwardRef((e,t)=>I.createElement(yF,{...e,ref:t,className:Jt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));X3.displayName="DropdownMenuRadioGroup";const J3=I.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return I.createElement(bF,{...i,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},I.createElement(Wo,null,r),I.createElement(F3,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement($l,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});J3.displayName="DropdownMenuRadioItem";const Y3=I.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return I.createElement(vF,{...s,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},I.createElement(Wo,null,r),I.createElement(F3,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},I.createElement($l,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});Y3.displayName="DropdownMenuCheckboxItem";const Z3=e=>I.createElement(_F,{...e});Z3.displayName="DropdownMenuSub";const Q3=I.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return I.createElement(xF,{...i,ref:t,className:Jt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},I.createElement(Wo,null,n),I.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},I.createElement(p6,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});Q3.displayName="DropdownMenuSubTrigger";const e8=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(q3);return I.createElement(L3,{container:i,forceMount:s},I.createElement(Dl,{asChild:!0},I.createElement(SF,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Jt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,_t(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},I.createElement(w0,{type:"auto"},I.createElement("div",{className:Jt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});e8.displayName="DropdownMenuSubContent";const t8=I.forwardRef((e,t)=>I.createElement(wF,{...e,ref:t,className:Jt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));t8.displayName="DropdownMenuSeparator";const _i=Object.assign({},{Root:z3,Trigger:V3,Content:H3,Label:W3,Item:G3,Group:K3,RadioGroup:X3,RadioItem:J3,CheckboxItem:Y3,Sub:Z3,SubTrigger:Q3,SubContent:e8,Separator:t8}),TF=["1","2","3","4"],OF=["classic","solid","soft","surface","outline","ghost"],pa={size:{type:"enum",values:TF,default:"2",responsive:!0},variant:{type:"enum",values:OF,default:"solid"},color:gc,highContrast:Bl,radius:s0},r8=I.forwardRef((e,t)=>{const{rest:r,...n}=Xo(e),{className:i,asChild:s=!1,size:o=pa.size.default,variant:a=pa.variant.default,color:c=pa.color.default,highContrast:u=pa.highContrast.default,radius:l=pa.radius.default,...f}=r,h=s?xi:"button";return I.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Jt("rt-reset","rt-BaseButton",i,_t(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Jo(n))})});r8.displayName="BaseButton";const n8=I.forwardRef((e,t)=>I.createElement(r8,{...e,ref:t,className:Jt("rt-Button",e.className)}));n8.displayName="Button";const IF={loading:{type:"boolean",default:!0}},Yo=I.forwardRef((e,t)=>{const{rest:r,...n}=Xo(e),{className:i,children:s,loading:o=IF.loading.default,...a}=r;if(!o)return I.createElement(I.Fragment,null,s);const c=I.isValidElement(s)?xi:"span";return I.createElement(c,{ref:t,"aria-hidden":!0,className:Jt("rt-Skeleton",i,Jo(n)),"data-inline-skeleton":I.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});Yo.displayName="Skeleton";const PF=zt("/images/ghost_loading.png"),kF=zt("/images/primary_loading.png"),jF={primary:kF,ghost:PF};function RF({size:e="24px",variant:t="primary",wrapStyle:r={}}){return _.jsx(c6,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:_.jsx("img",{src:jF[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const NF="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==",Zf="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 Gr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=ae.useState(Zf),c=u=>{console.log("🚀 ~ file: TokenImage.tsx:25 ~ handleError ~ e:",u),a(Zf)};return ae.useEffect(()=>{a(e||Zf)},[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:NF})]})}function DF({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=qo(),a=ae.useMemo(()=>{if(n&&r)return n(r)},[r]),c=ae.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(RF,{})}),_.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(S4,{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"}),Tl.map(u=>_.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:_.jsx(Gr,{src:u.img})},u.link))]})]}),_.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:_.jsx("use",{xlinkHref:"#icon-close"})})]})}const BF=Ai((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)}))}})),Zo=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=BF(),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=ae.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),Yu.createPortal(_.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>_.jsx(DF,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}};function $F(){const{mevProtect:e,setMevProtect:t}=Xr();return _.jsxs(_i.Root,{children:[_.jsx(_i.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(_i.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:zt("/images/icon_mev@2x.png")}),_.jsx("span",{children:"MEV Protect"})]}),_.jsx(J6,{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 LF({onClick:e}){const[t,r]=ae.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"})})})}function _0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(n8,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function FF(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Xr();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(UF,{onClose:()=>e(!1)})]})}function UF({onClose:e}){const{slippage:t,setSlippage:r}=Xr(),[n,i]=ae.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=ae.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:OR.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("i",{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(_0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function zF({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(FF,{}),_.jsx($F,{}),_.jsx(LF,{onClick:e})]})]})})}function VF(){const[e,t]=ae.useState(!1);return _.jsxs(_i.Root,{open:e,onOpenChange:t,children:[_.jsx(_i.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(_i.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(qF,{}),_.jsx(WF,{onClose:()=>{t(!1)}})]})})]})}function qF(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Xr(),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:Tl.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(Ll,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]}))})]})}const HF=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function WF({onClose:e}){const{addTxToast:t}=Zo(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Xr(),[a,c]=ae.useState(i),[u,l]=ae.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(Ll,{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(_0,{btnIsDisabled:HF(a),text:"Save",onClick:b})]})]})]})}const On=Ai((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 GF=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()}},KF=GF,Fg={"text/plain":"Text","text/html":"Url",default:"Text"},XF="Copy to clipboard: #{key}, Enter";function JF(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function YF(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=KF(),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=Fg[t.format]||Fg.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=JF("message"in t?t.message:XF),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var ZF=YF;const i8=nc(ZF);function QF({currentAccount:e}){const{mutate:t}=Lr.useSwitchAccount(),r=Lr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=On(),s=()=>{i(!n)},o=ae.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);ae.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:$s(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:$s(c==null?void 0:c.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}function eU({connect:e}){const t=Lr.useCurrentAccount();return ae.useEffect(()=>{console.log("TriggerButton currentAccount: ",t)},[t]),_.jsx("div",{children:t?_.jsx(tU,{}):_.jsx(_0,{text:"Connect Wallet",className:"cs-connect-button",onClick:()=>e(!0)})})}function tU(){const{mutate:e}=Lr.useDisconnectWallet(),t=Lr.useCurrentAccount(),{currentWallet:r}=Lr.useCurrentWallet(),{addCommonToast:n}=Zo(),{getExplorerUrl:i}=qo(),s=()=>{t&&(i8(t.address||"",{debug:!1,message:"message"}),n("Copied success"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return ae.useEffect(()=>{console.log("TriggerButton currentWallet: ",r)},[r]),_.jsxs(_i.Root,{children:[_.jsx(_i.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:$s(t==null?void 0:t.address)})]})}),_.jsx(_i.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(QF,{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 rU(){Lr.useCurrentAccount();const{currentWallet:e,connectionStatus:t}=Lr.useCurrentWallet(),{isOpenWalletModal:r,onWalletModal:n,saveCurrentAccount:i}=On(),s=Lr.useWallets();return ae.useEffect(()=>{console.log("test wallet currentWallet: ",e),console.log("test wallet wallets: ",s)},[e,s]),_.jsx(_.Fragment,{children:_.jsx(Lr.ConnectModal,{trigger:_.jsx(eU,{connect:n}),open:r,onOpenChange:o=>n(o)})})}function nU({independentWallet:e,customWallet:t}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:zt("/images/logo@2x.png"),className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(rU,{}),_.jsx(VF,{})]})]}),_.jsx("div",{style:{marginTop:"20px"}})]})}const s8=()=>{const e=ae.useRef(null);ae.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 iU({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=ae.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(sU,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(oU,{info:s,status:r,tx:i,onClose:e})]})}function sU({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(s8,{})}),_.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 oU({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=qo();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"}),Tl.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"?_.jsx("span",{children:" Swap More"}):_.jsx("span",{children:"Retry"})})]})}function Hl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await MR(`${i||Bu.api}${t}`,n):await AR(`${i||Bu.api}${t}`,n)}catch(s){throw console.log("🚀 ~ file: useFetch.tsx:6 ~ fetchByApi ~ error:",s),s}}}}function aU(){const{fetchByApi:e}=Hl(),{setProviders:t}=Xr();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 cU({interval:e,callback:t}){const r=ae.useRef(),n=ae.useRef(null);ae.useEffect(()=>{r.current=t},[t]);const i=ae.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=ae.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return ae.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const qs=Ai((e,t)=>({suiClient:new Da({url:Bu.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new e4,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),uU=(e,t)=>({requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=new Map(n);s.set(Mr(r.coin_type).full_address,r);const o=i.filter(a=>a!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...o]})),wi.setItem(Yd,s)},tokenMap:new Map,setTokenMap:(r,n=!1)=>{e(()=>({tokenMap:r})),n||wi.setItem(Yd,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||wi.setItem(v4,r)}}),wc=Ai(uU);wi.getItem(Yd).then(e=>{e!==null&&wc.getState().setTokenMap(e,!0)});wi.getItem(v4).then(e=>{e!==null&&wc.getState().setTrustedTokenList(e,!0)});function lU(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 Hs(){const{suiClient:e}=qs(),{fetchByApi:t}=Hl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=wc(),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,T)=>(w.set(T.coin_type,T),T.is_trusted&&h.push({...T,coin_type:Mr(T.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){g4(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const b=lU(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=ae.useCallback(f=>{if(f)return n.get(Mr(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Gu(e){const{suiClient:t}=qs(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=On(),{fetchTokenInfo:s}=Hs(),[o,a]=ae.useState([]),{tokenMap:c}=wc(),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({})};ae.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 T=y[w],P=await s(T.coinType),R=vR(T.totalBalance,P==null?void 0:P.decimals),N=rn(R,4);b[Mr(T.coinType).full_address]={...T,displayBalance:N,totalBalanceFormat:R}}catch{continue}n(b)},h=ae.useMemo(()=>{if(e&&r)return i[e]||i[Mr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const fU=(e,t)=>({isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,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}))}}),In=Ai(fU),dU={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"}},hU={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"}},pU=dU,mU=hU;function gU(e,t){const{fetchTokenInfo:r}=Hs(),{setFromCoin:n,setToCoin:i}=In(),{setSlippage:s,setRpcList:o,setCurrentRpc:a}=Xr(),c=ae.useRef({}),u=async(f,h)=>{const y=f?await r(f):pU,b=h?await r(h):mU;n(y),i(b)},l=(f,h)=>{const y=[Du[0]];let b=Du[0];f.forEach(w=>{const T={name:w,link:w,isCustom:!1};y.push(T),w===h&&(b=T)}),o([...y,{name:"Custom RPC URL",link:"",isCustom:!0}]),console.log("🚀 ~ file: useInitWidget.ts:51 ~ handleInitRpcList ~ defaultRpcInfo:",b),a(b)};return ae.useEffect(()=>{if(!Vp(e,c.current)){const{defaultFromToken:f,defaultToToken:h,defaultSlippage:y,customRpcList:b,defaultRpc:w}=e;u(f,h),y&&s(y),(b==null?void 0:b.length)>0&&l(b,w),c.current=e}},[e]),{handleSetDefaultPair:u}}function vU(){const{currentRpc:e}=Xr(),{setSuiClient:t,setAggregatorSDK:r}=qs(),{currentAccount:n}=On();ae.useEffect(()=>{if(e){const i=new Da({url:e.link});t(i)}},[e]),ae.useEffect(()=>{if(e){const i=new e4(Bu.aggregatorUrl,(n==null?void 0:n.address)||void 0,new Da({url:e.link}),_j.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const yU=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Mr(i).full_address]}),e({coinPriceObj:{...n}})}}),o8=Ai(yU);function Wl(){const{fetchByApi:e}=Hl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=o8(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>qp(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Mr(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=ae.useCallback(a=>{if(!a)return;const c=t[Mr(a).full_address];if(c)return c},[t]),o=ae.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Ve(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const x0=Ai((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),br=[];for(let e=0;e<256;++e)br.push((e+256).toString(16).slice(1));function bU(e,t=0){return(br[e[t+0]]+br[e[t+1]]+br[e[t+2]]+br[e[t+3]]+"-"+br[e[t+4]]+br[e[t+5]]+"-"+br[e[t+6]]+br[e[t+7]]+"-"+br[e[t+8]]+br[e[t+9]]+"-"+br[e[t+10]]+br[e[t+11]]+br[e[t+12]]+br[e[t+13]]+br[e[t+14]]+br[e[t+15]]).toLowerCase()}let Qf;const wU=new Uint8Array(16);function _U(){if(!Qf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qf=crypto.getRandomValues.bind(crypto)}return Qf(wU)}const xU=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ug={randomUUID:xU};function zg(e,t,r){if(Ug.randomUUID&&!t&&!e)return Ug.randomUUID();e=e||{};const n=e.random||(e.rng||_U)();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 bU(n)}const SU=new Da({url:Gv("mainnet")}),EU=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],CU=["deny_list","DenyList","DenyCap","create_regulated_currency"],MU={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},AU=async e=>{let t=!1;if(EU.includes(e))return t;const r=e.split("::"),n=r[0]&&Sn.normalizeSuiAddress(r[0]),i=r[1],s=await SU.getObject({id:n,options:MU}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(CU.join("|"),"i").test(o)&&(t=!0),t},TU=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>qp(i,!1)))==null?void 0:n.join(",")};function OU(){const{fetchByApi:e}=Hl(),t=async n=>{try{const i={...n},s=TU(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=zt("/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=>Pa(b).source_address);f=l==null?void 0:l.filter(b=>{var P,R;const w=Pa((P=b==null?void 0:b.coin_a)==null?void 0:P.address).source_address,T=Pa((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(T)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(w)||y.includes(T)))})}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 IU(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Xr(),{getPoolList:n,getLocalJsonPoolList:i}=OU();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 PU(e){const{routerData:t}=In();return{priceAcceptRouterData:ae.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Ve(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Ve(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function a8(e,t){return{amountLimit:ae.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Ve(s).mul(Ve(1).sub(Ve(e).div(100))).toString():Ve(i).mul(Ve(1).add(Ve(e).div(100))).toString()}},[e,t])}}function kU(e){const{getTokenInfo:t,fetchTokenInfo:r}=Hs();return{formatSwapRouter:ae.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Ve(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=Ve(1).sub(c).toFixed(2):h.percentage=Ve(y).div(s).toFixed(2),c=Ve(c).add(h.percentage);const b=[];l.path.forEach(w=>{i.includes(w.provider)||i.push(w.provider);const T=Mr(w.from).full_address,P=Mr(w.target).full_address,R=t(T),N=t(P);R||a.includes(T)&&a.push(T),N||a.includes(P)&&a.push(P);const z=w.provider===ka.SCALLOP||w.provider===ka.FLOWX||w.provider===ka.FLOWXV3;b.push({from_type:T,to_type:P,pool_address:z?"":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 jU(){const{fromCoin:e,toCoin:t}=In(),{getPoolListByCoinType:r}=IU();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function c8(e,t,r){return ae.useMemo(()=>t&&r&&+t&&+r?e?Ve(r).div(t).toString():Ve(t).div(r).toString():"0",[t,r,e])}function Vg(e){const[t,r]=ae.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await AU(i.coin_type)}catch(s){console.log("🚀 ~ file: useCheckTokenScamsAlert.ts:19 ~ checkTokenScams ~ error:",s)}return!1};return ae.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function RU(){const{aggregatorSDK:e}=qs(),{getSwapPoolAddress:t}=jU(),r=async i=>{const{fromToken:s,toToken:o,amount:a,providersKeys:c,by_amount_in:u,uuid:l}=i,f={from:s.coin_type,target:o.coin_type,amount:new bm(a),byAmountIn:u,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:c};console.log("🚀 ~ file: useFindBestRouting.ts:26 ~ findBestRouters ~ routerParams:",f);try{const h=await e.findRouters(f);if(console.log("🚀 ~ file: useFindBestRouting.ts:145 ~ findBestRouters ~ res:",h),h&&h.insufficientLiquidity)return n(!1,h.insufficientLiquidity,u,l,s,o);if(!h||h.routes.length===0)throw Error("not find router");return n(!1,h.insufficientLiquidity,u,l,s,o,h)}catch(h){console.log("🚀 ~ file: useFindBestRouting.ts:105 ~ findRouters ~ error:",h);const y=await t(),b={from:s.coin_type,target:o.coin_type,amount:new bm(a),byAmountIn:u,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?n(!0,!0,u,l,s,o):n(!0,w.isExceed,u,l,s,o,w.routeData)}catch(w){return console.log("🚀 ~ file: useFindBestRouting.ts:120 ~ swapInPools ~ error:",w),{uuid:l,byAmountIn:u,isExceed:!1,isDegrade:!0}}}},n=(i,s,o,a,c,u,l)=>{if(console.log("🚀 ~ file: useSwap.ts:166 ~ handleRouterData ~ res:",{isDegrade:i,isExceed:s,routerData:l}),l){const f=Jd(l.amountIn.toString(),c.decimals).toString(),h=Jd(l.amountOut.toString(),u.decimals).toString();return{routerData:l,fromAmountUi:f,toAmountUi:h,uuid:a,byAmountIn:o,isExceed:s,isDegrade:i}}else return{uuid:a,byAmountIn:o,isExceed:s,isDegrade:i}};return{findBestRouters:r}}function io(e){const t=ae.useRef(e);return ae.useEffect(()=>{t.current=e},[e]),t}function NU(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 DU(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function BU(e){return!!String(e).includes("Could not find the referenced transaction")}function $U(e){return NU(e)?"User rejected the request":DU(e)?"Exceeded price slippage":BU(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var S0={};Object.defineProperty(S0,"__esModule",{value:!0});var LU=S0.executeAuction=u8,FU=Ex,UU="https://rpc.getshio.com",zU=500,VU=300;function u8(e,t,r){r===void 0&&(r=zU);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),FU.default.post(UU,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,VU)}).catch(s)})}S0.default={executeAuction:u8};function qU(){const{suiClient:e}=qs(),{currentAccount:t}=On(),{mutateAsync:r}=Lr.useSignTransaction(),{mutate:n}=Lr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=ae.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:po.Transaction.from(Sn.fromBase64(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=po.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=po.Transaction.from(c)),typeof c=="string"&&(c=po.Transaction.from(Sn.fromBase64(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 HU(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=qU(),{currentAccount:n}=On(),{suiClient:i}=qs(),{setTransactionData:s}=x0(),{addTxToast:o,removeToast:a}=Zo(),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 cg(u),l(y,b+1)}}const f=async(y,b,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var z,F;const{useDevInspect:T=!1,useMev:P,txAction:R="signTransactionBlock"}=w;console.log("🚀 ~ file: useTransaction.tsx:76 ~ useTransaction ~ option:",{useDevInspect:T,useMev:P,txAction:R,tx:y,toastType:b});let N;b.status="confirmation",s(b);try{let W;if(R==="signTransactionBlock"){const K=await e(y);console.log("🚀 ~ file: useTransaction.tsx:94 ~ useTransaction ~ signTx:",K);const{bytes:te,signature:se}=K;if(P)try{const H=await LU(te,se,500);console.log("🚀 ~ file: useTransaction.tsx:92 ~ useTransaction ~ shioRes: success",H)}catch(H){console.log("🚀 ~ file: useTransaction.tsx:95 ~ useTransaction ~ shioRes : error:",H)}console.log("🚀 ~ useTransaction ~ useMev:",P),W=await t(te,se,T),console.log("🚀 ~ useTransaction ~ response:",W)}else W=await r(y,T);console.log("🚀 ~ file: useTransaction.tsx:24 ~ signAndExecuteTransaction ~ response:",W),b.status="submitted",s({...b}),b.tx=W.digest,N=o(b),await cg(u);const q=await l(W.digest,0);if(!q||((z=q.effects)==null?void 0:z.status.status)==="failure")h(b,(F=q.effects)==null?void 0:F.status.error);else{const K=SR(q,n==null?void 0:n.address,!1);if(console.log("🚀 ~ file: useTransaction.tsx:48 ~ signAndExecuteTransaction ~ balanceChanges:",K),b.buildShowInfo){const te=b.buildShowInfo("success",K);b.buildShowInfo=se=>te}a(N),b.status="success",s({...b})}return q}catch(W){console.log("🚀 ~ file: useTransaction.tsx:144 ~ useTransaction ~ error:",W),h(b,W)}},h=(y,b)=>{console.log("🚀 ~ file: useTransaction.tsx:114 ~ handleError ~ error:",b);const w=$U(b);if(y.buildShowInfo){const T=y.buildShowInfo("confirmation");y.buildShowInfo=P=>(T.toastDescriptionContent=w,T.modalDescriptionText=w,T),y.status="rejected",s({...y})}else y.buildShowInfo=T=>{const P={};return P.toastDescriptionContent=w,P.modalDescriptionText=w,P},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function l8(e,t=1e3){const r=ae.useRef(),n=ae.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return ae.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function WU(){const{aggregatorSDK:e}=qs(),{findBestRouters:t}=RU(),{getTokenAmountValue:r,fetchTokenPrices:n}=Wl(),{providers:i,slippage:s,mevProtect:o}=Xr(),{signAndExecuteTransaction:a}=HU(),{setTransactionData:c}=x0(),{addTxToast:u}=Zo(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:b,fromAmount:w,toAmount:T,setFromAmount:P,setFindRouterLoading:R,setRouterData:N,setByAmountIn:z,byAmountIn:F}=In(),[W,q]=ae.useState(""),K=io(W),te=io(F),se=io(w),H=io(T),L=io(l),D=io(f),{balanceInfo:p,getOwnerCoinBalances:d}=Gu(l==null?void 0:l.coin_type),{balanceInfo:m}=Gu(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),C=r(f==null?void 0:f.coin_type,T),O=l8(async(xe,Xe,Le)=>{if(L.current&&D.current&&+xe){(+se.current||+H.current)&&R(!0);const ot=wR(xe,Xe?L.current.decimals:D.current.decimals),dt=await t({fromToken:L.current,toToken:D.current,amount:ot.toString(),providersKeys:i,by_amount_in:Xe,uuid:Le});R(!1),K.current===Le&&(Xe?+se.current?(b(dt.toAmountUi||""),N(dt)):b(""):+H.current?(P(dt.fromAmountUi||"ß"),N(dt)):P(""))}else v(!Xe)},500),M=(xe,Xe,Le=!1)=>{if(z(Xe),Xe?(P(xe),Le&&b("")):(b(xe),Le&&P("")),+xe){const ot=zg();q(ot),O(xe,Xe,ot)}else R(!1),N(void 0),v(!Xe)},g=(xe,Xe=!0)=>{v(),Xe?((xe==null?void 0:xe.coin_type)===(f==null?void 0:f.coin_type)&&y(l),h(xe)):((xe==null?void 0:xe.coin_type)===(l==null?void 0:l.coin_type)&&h(f),y(xe))},v=xe=>{xe===void 0?(P(""),b("")):xe?P(""):b(""),R(!1),N(void 0)},k=()=>{const xe=te.current?se.current:H.current;if(console.log("🚀 ~ file: useSwap.ts:273 ~ reCalculateRouteData ~ amount:",xe,te.current,se.current,H.current),+xe){const Xe=zg();q(Xe),O(xe,te.current,Xe)}},ee=async xe=>{const{routerData:Xe,byAmountIn:Le,fromAmountUi:ot,toAmountUi:dt}=xe,De=new po.Transaction,vt={routers:Xe.routes,byAmountIn:Le,slippage:Number(s),txb:De};try{await e.fastRouterSwap(vt);const we={status:"confirmation",buildShowInfo:(Ae,Ue)=>{const Ne=`Swap ${rn(ot,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${rn(dt,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Te={modalDescriptionText:Ne,toastTitleText:Ne};if(Ae==="success"){let Oe=ot,$e=dt;Ue&&(Oe=ug(Ue,l)||ot,$e=ug(Ue,f)||dt);const lt=`Swapped ${rn(Oe,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${rn($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Te.toastTitleText=lt,Te.modalDescriptionText=lt}return Te},id:0};c(we),await a(De,we,{useMev:o})?(v(),d()):k()}catch(we){String(we).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(me,Ae){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};ae.useEffect(()=>{ie(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const ie=()=>{const xe=[];l&&xe.push(l.coin_type),f&&xe.push(f.coin_type),xe.length>0&&n(xe)},{isScamsCoin:ge}=Vg(l),{isScamsCoin:ve}=Vg(f),Se=ae.useMemo(()=>{if(!(!ge&&!ve)){if(ge&&ve)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(ge)return`${l==null?void 0:l.symbol} token is `;if(ve)return`${f==null?void 0:f.symbol} token is `}},[ge,ve]);return{handleAmountChange:M,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:C,doSwapAction:ee,reCalculateRouteData:k,refreshMarketPrice:ie,scamsText:Se}}function GU(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=In(),{currentAccount:o}=On(),a=ae.useMemo(()=>{const c={text:"Swap",disabled:!1};return o!=null&&o.address?!t||!r?(c.text="Select a token",c.disabled=!0,c):!+n&&!+i?(c.text="Enter an amount",c.disabled=!0,c):s&&s.isExceed?(c.text="Insufficient liquidity for this trade",c.disabled=!0,c):+n&&Ve(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${t==null?void 0:t.symbol} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c):(c.text="Connect Wallet",c.disabled=!1,c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.isExceed,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function f8({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:`
|
|
92
|
+
`)},_D=0,Js=[];function xD(e){var t=O.useRef([]),r=O.useRef([0,0]),n=O.useRef(),i=O.useState(_D++)[0],s=O.useState(gx)[0],o=O.useRef(e);O.useEffect(function(){o.current=e},[e]),O.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=VN([e.lockRef.current],(e.shards||[]).map(Tm),!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=O.useCallback(function(w,A){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var I=Ac(w),P=r.current,N="deltaX"in w?w.deltaX:P[0]-I[0],F="deltaY"in w?w.deltaY:P[1]-I[1],L,H=w.target,q=Math.abs(N)>Math.abs(F)?"h":"v";if("touches"in w&&q==="h"&&H.type==="range")return!1;var X=Cm(q,H);if(!X)return!0;if(X?L=q:(L=q==="v"?"h":"v",X=Cm(q,H)),!X)return!1;if(!n.current&&"changedTouches"in w&&(N||F)&&(n.current=L),!L)return!0;var re=n.current||L;return yD(re,A,w,re==="h"?N:F,!0)},[]),c=O.useCallback(function(w){var A=w;if(!(!Js.length||Js[Js.length-1]!==s)){var I="deltaY"in A?Am(A):Ac(A),P=t.current.filter(function(L){return L.name===A.type&&(L.target===A.target||A.target===L.shadowParent)&&bD(L.delta,I)})[0];if(P&&P.should){A.cancelable&&A.preventDefault();return}if(!P){var N=(o.current.shards||[]).map(Tm).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=O.useCallback(function(w,A,I,P){var N={name:w,delta:A,target:I,should:P,shadowParent:SD(I)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(F){return F!==N})},1)},[]),l=O.useCallback(function(w){r.current=Ac(w),n.current=void 0},[]),f=O.useCallback(function(w){u(w.type,Am(w),w.target,a(w,e.lockRef.current))},[]),h=O.useCallback(function(w){u(w.type,Ac(w),w.target,a(w,e.lockRef.current))},[]);O.useEffect(function(){return Js.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Ys),document.addEventListener("touchmove",c,Ys),document.addEventListener("touchstart",l,Ys),function(){Js=Js.filter(function(w){return w!==s}),document.removeEventListener("wheel",c,Ys),document.removeEventListener("touchmove",c,Ys),document.removeEventListener("touchstart",l,Ys)}},[]);var y=e.removeScrollBar,_=e.inert;return O.createElement(O.Fragment,null,_?O.createElement(s,{styles:wD(i)}):null,y?O.createElement(fD,{gapMode:e.gapMode}):null)}function SD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ED=ZN(mx,xD);var wx=O.forwardRef(function(e,t){return O.createElement(hl,Ln({},e,{ref:t,sideCar:ED}))});wx.classNames=hl.classNames;const MD=wx;function CD(e,t){return O.useReducer((r,n)=>t[r][n]??r,e)}var g0="ScrollArea",[_x,QW]=Bo(g0),[AD,nn]=_x(g0),xx=O.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=O.useState(null),[u,l]=O.useState(null),[f,h]=O.useState(null),[y,_]=O.useState(null),[w,A]=O.useState(null),[I,P]=O.useState(0),[N,F]=O.useState(0),[L,H]=O.useState(!1),[q,X]=O.useState(!1),re=Jt(t,oe=>c(oe)),ae=d0(i);return b.jsx(AD,{scope:r,type:n,dir:ae,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:h,scrollbarX:y,onScrollbarXChange:_,scrollbarXEnabled:L,onScrollbarXEnabledChange:H,scrollbarY:w,onScrollbarYChange:A,scrollbarYEnabled:q,onScrollbarYEnabledChange:X,onCornerWidthChange:P,onCornerHeightChange:F,children:b.jsx(Gt.div,{dir:ae,...o,ref:re,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});xx.displayName=g0;var Sx="ScrollAreaViewport",Ex=O.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=nn(Sx,r),a=O.useRef(null),c=Jt(t,a,o.onViewportChange);return b.jsxs(b.Fragment,{children:[b.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}),b.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:b.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Ex.displayName=Sx;var Jn="ScrollAreaScrollbar",Mx=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=nn(Jn,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return O.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?b.jsx(TD,{...n,ref:t,forceMount:r}):i.type==="scroll"?b.jsx(OD,{...n,ref:t,forceMount:r}):i.type==="auto"?b.jsx(Cx,{...n,ref:t,forceMount:r}):i.type==="always"?b.jsx(v0,{...n,ref:t}):null});Mx.displayName=Jn;var TD=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=nn(Jn,e.__scopeScrollArea),[s,o]=O.useState(!1);return O.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]),b.jsx(Mn,{present:r||s,children:b.jsx(Cx,{"data-state":s?"visible":"hidden",...n,ref:t})})}),OD=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=nn(Jn,e.__scopeScrollArea),s=e.orientation==="horizontal",o=ml(()=>c("SCROLL_END"),100),[a,c]=CD("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 O.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),O.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]),b.jsx(Mn,{present:r||a!=="hidden",children:b.jsx(v0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:rt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:rt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Cx=O.forwardRef((e,t)=>{const r=nn(Jn,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=O.useState(!1),a=e.orientation==="horizontal",c=ml(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return To(r.viewport,c),To(r.content,c),b.jsx(Mn,{present:n||s,children:b.jsx(v0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),v0=O.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=nn(Jn,e.__scopeScrollArea),s=O.useRef(null),o=O.useRef(0),[a,c]=O.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=kx(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 ND(h,o.current,a,y)}return r==="horizontal"?b.jsx(ID,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,y=Om(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"?b.jsx(kD,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,y=Om(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}),ID=O.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=nn(Jn,e.__scopeScrollArea),[o,a]=O.useState(),c=O.useRef(null),u=Jt(t,c,s.onScrollbarXChange);return O.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(Tx,{"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":pl(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),Px(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:Iu(o.paddingLeft),paddingEnd:Iu(o.paddingRight)}})}})}),kD=O.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=nn(Jn,e.__scopeScrollArea),[o,a]=O.useState(),c=O.useRef(null),u=Jt(t,c,s.onScrollbarYChange);return O.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(Tx,{"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":pl(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),Px(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:Iu(o.paddingTop),paddingEnd:Iu(o.paddingBottom)}})}})}),[jD,Ax]=_x(Jn),Tx=O.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=nn(Jn,r),[_,w]=O.useState(null),A=Jt(t,re=>w(re)),I=O.useRef(null),P=O.useRef(""),N=y.viewport,F=n.content-n.viewport,L=pr(l),H=pr(c),q=ml(f,10);function X(re){if(I.current){const ae=re.clientX-I.current.left,oe=re.clientY-I.current.top;u({x:ae,y:oe})}}return O.useEffect(()=>{const re=ae=>{const oe=ae.target;(_==null?void 0:_.contains(oe))&&L(ae,F)};return document.addEventListener("wheel",re,{passive:!1}),()=>document.removeEventListener("wheel",re,{passive:!1})},[N,_,F,L]),O.useEffect(H,[n,H]),To(_,q),To(y.content,q),b.jsx(jD,{scope:r,scrollbar:_,hasThumb:i,onThumbChange:pr(s),onThumbPointerUp:pr(o),onThumbPositionChange:H,onThumbPointerDown:pr(a),children:b.jsx(Gt.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:rt(e.onPointerDown,re=>{re.button===0&&(re.target.setPointerCapture(re.pointerId),I.current=_.getBoundingClientRect(),P.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),X(re))}),onPointerMove:rt(e.onPointerMove,X),onPointerUp:rt(e.onPointerUp,re=>{const ae=re.target;ae.hasPointerCapture(re.pointerId)&&ae.releasePointerCapture(re.pointerId),document.body.style.webkitUserSelect=P.current,y.viewport&&(y.viewport.style.scrollBehavior=""),I.current=null})})})}),Ou="ScrollAreaThumb",Ox=O.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Ax(Ou,e.__scopeScrollArea);return b.jsx(Mn,{present:r||i.hasThumb,children:b.jsx(PD,{ref:t,...n})})}),PD=O.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=nn(Ou,r),o=Ax(Ou,r),{onThumbPositionChange:a}=o,c=Jt(t,f=>o.onThumbChange(f)),u=O.useRef(),l=ml(()=>{u.current&&(u.current(),u.current=void 0)},100);return O.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(l(),!u.current){const y=DD(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,l,a]),b.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:rt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),_=f.clientX-y.left,w=f.clientY-y.top;o.onThumbPointerDown({x:_,y:w})}),onPointerUp:rt(e.onPointerUp,o.onThumbPointerUp)})});Ox.displayName=Ou;var y0="ScrollAreaCorner",Ix=O.forwardRef((e,t)=>{const r=nn(y0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?b.jsx(RD,{...e,ref:t}):null});Ix.displayName=y0;var RD=O.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=nn(y0,r),[s,o]=O.useState(0),[a,c]=O.useState(0),u=!!(s&&a);return To(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),To(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?b.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 Iu(e){return e?parseInt(e,10):0}function kx(e,t){const r=e/t;return isNaN(r)?0:r}function pl(e){const t=kx(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function ND(e,t,r,n="ltr"){const i=pl(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 jx([c,u],f)(e)}function Om(e,t,r="ltr"){const n=pl(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=IN(e,c);return jx([0,o],[0,a])(u)}function jx(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 Px(e,t){return e>0&&e<t}var DD=(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 ml(e,t){const r=pr(e),n=O.useRef(0);return O.useEffect(()=>()=>window.clearTimeout(n.current),[]),O.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function To(e,t){const r=pr(t);Qi(()=>{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 $D=xx,BD=Ex,Im=Mx,km=Ox,LD=Ix,b0="Switch",[UD,eK]=Bo(b0),[FD,zD]=UD(b0),Rx=O.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]=O.useState(null),_=Jt(t,N=>y(N)),w=O.useRef(!1),A=h?l||!!h.closest("form"):!0,[I=!1,P]=ac({prop:i,defaultProp:s,onChange:u});return b.jsxs(FD,{scope:r,checked:I,disabled:a,children:[b.jsx(Gt.button,{type:"button",role:"switch","aria-checked":I,"aria-required":o,"data-state":$x(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:_,onClick:rt(e.onClick,N=>{P(F=>!F),A&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),A&&b.jsx(VD,{control:h,bubbles:!w.current,name:n,value:c,checked:I,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});Rx.displayName=b0;var Nx="SwitchThumb",Dx=O.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=zD(Nx,r);return b.jsx(Gt.span,{"data-state":$x(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});Dx.displayName=Nx;var VD=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,s=O.useRef(null),o=J4(r),a=c0(t);return O.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]),b.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 $x(e){return e?"checked":"unchecked"}var qD=Rx,GD=Dx;const HD=["1","2","3"],WD=["classic","surface","soft"],aa={size:{type:"enum",values:HD,default:"2",responsive:!0},variant:{type:"enum",values:WD,default:"surface"},color:cc,highContrast:ul,radius:p0},Bx=O.forwardRef((e,t)=>{const{rest:r,...n}=zo(e),{className:i,style:s,size:o=aa.size.default,variant:a=aa.variant.default,color:c=aa.color.default,highContrast:u=aa.highContrast.default,radius:l=aa.radius.default,...f}=r;return O.createElement("span",{"data-radius":l,className:Xt("rt-SwitchRoot",i,wt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Vo(n)),style:s},O.createElement(qD,{"data-accent-color":c,...f,ref:t,className:Xt("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},O.createElement(GD,{className:Xt("rt-SwitchThumb",{"rt-high-contrast":u})})))});Bx.displayName="Switch";var wd=["Enter"," "],KD=["ArrowDown","PageUp","Home"],Lx=["ArrowUp","PageDown","End"],XD=[...KD,...Lx],YD={ltr:[...wd,"ArrowRight"],rtl:[...wd,"ArrowLeft"]},JD={ltr:["ArrowLeft"],rtl:["ArrowRight"]},uc="Menu",[Va,ZD,QD]=nx(uc),[Bs,Ux]=Bo(uc,[QD,sl,sx]),lc=sl(),Fx=sx(),[zx,as]=Bs(uc),[e$,fc]=Bs(uc),Vx=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=lc(t),[c,u]=O.useState(null),l=O.useRef(!1),f=pr(s),h=d0(i);return O.useEffect(()=>{const y=()=>{l.current=!0,document.addEventListener("pointerdown",_,{capture:!0,once:!0}),document.addEventListener("pointermove",_,{capture:!0,once:!0})},_=()=>l.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",_,{capture:!0}),document.removeEventListener("pointermove",_,{capture:!0})}},[]),b.jsx(N4,{...a,children:b.jsx(zx,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:b.jsx(e$,{scope:t,onClose:O.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:h,modal:o,children:n})})})};Vx.displayName=uc;var t$="MenuAnchor",w0=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=lc(r);return b.jsx(D4,{...i,...n,ref:t})});w0.displayName=t$;var _0="MenuPortal",[r$,qx]=Bs(_0,{forceMount:void 0}),Gx=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=as(_0,t);return b.jsx(r$,{scope:t,forceMount:r,children:b.jsx(Mn,{present:r||s.open,children:b.jsx(L4,{asChild:!0,container:i,children:n})})})};Gx.displayName=_0;var tn="MenuContent",[n$,x0]=Bs(tn),Hx=O.forwardRef((e,t)=>{const r=qx(tn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=as(tn,e.__scopeMenu),o=fc(tn,e.__scopeMenu);return b.jsx(Va.Provider,{scope:e.__scopeMenu,children:b.jsx(Mn,{present:n||s.open,children:b.jsx(Va.Slot,{scope:e.__scopeMenu,children:o.modal?b.jsx(i$,{...i,ref:t}):b.jsx(s$,{...i,ref:t})})})})}),i$=O.forwardRef((e,t)=>{const r=as(tn,e.__scopeMenu),n=O.useRef(null),i=Jt(t,n);return O.useEffect(()=>{const s=n.current;if(s)return zN(s)},[]),b.jsx(S0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:rt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),s$=O.forwardRef((e,t)=>{const r=as(tn,e.__scopeMenu);return b.jsx(S0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),S0=O.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:_,...w}=e,A=as(tn,r),I=fc(tn,r),P=lc(r),N=Fx(r),F=ZD(r),[L,H]=O.useState(null),q=O.useRef(null),X=Jt(t,q,A.onContentChange),re=O.useRef(0),ae=O.useRef(""),oe=O.useRef(0),V=O.useRef(null),$=O.useRef("right"),p=O.useRef(0),d=_?MD:O.Fragment,m=_?{as:xi,allowPinchZoom:!0}:void 0,x=C=>{var xe,be;const k=ae.current+C,T=F().filter(Ce=>!Ce.disabled),g=document.activeElement,v=(xe=T.find(Ce=>Ce.ref.current===g))==null?void 0:xe.textValue,R=T.map(Ce=>Ce.textValue),se=v$(R,k,v),ue=(be=T.find(Ce=>Ce.textValue===se))==null?void 0:be.ref.current;(function Ce(Me){ae.current=Me,window.clearTimeout(re.current),Me!==""&&(re.current=window.setTimeout(()=>Ce(""),1e3))})(k),ue&&setTimeout(()=>ue.focus())};O.useEffect(()=>()=>window.clearTimeout(re.current),[]),kN();const E=O.useCallback(C=>{var T,g;return $.current===((T=V.current)==null?void 0:T.side)&&b$(C,(g=V.current)==null?void 0:g.area)},[]);return b.jsx(n$,{scope:r,searchRef:ae,onItemEnter:O.useCallback(C=>{E(C)&&C.preventDefault()},[E]),onItemLeave:O.useCallback(C=>{var k;E(C)||((k=q.current)==null||k.focus(),H(null))},[E]),onTriggerLeave:O.useCallback(C=>{E(C)&&C.preventDefault()},[E]),pointerGraceTimerRef:oe,onPointerGraceIntentChange:O.useCallback(C=>{V.current=C},[]),children:b.jsx(d,{...m,children:b.jsx(lx,{asChild:!0,trapped:i,onMountAutoFocus:rt(s,C=>{var k;C.preventDefault(),(k=q.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:b.jsx(e0,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:h,onDismiss:y,children:b.jsx(TN,{asChild:!0,...N,dir:I.dir,orientation:"vertical",loop:n,currentTabStopId:L,onCurrentTabStopIdChange:H,onEntryFocus:rt(c,C=>{I.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:b.jsx($4,{role:"menu","aria-orientation":"vertical","data-state":u6(A.open),"data-radix-menu-content":"",dir:I.dir,...P,...w,ref:X,style:{outline:"none",...w.style},onKeyDown:rt(w.onKeyDown,C=>{const T=C.target.closest("[data-radix-menu-content]")===C.currentTarget,g=C.ctrlKey||C.altKey||C.metaKey,v=C.key.length===1;T&&(C.key==="Tab"&&C.preventDefault(),!g&&v&&x(C.key));const R=q.current;if(C.target!==R||!XD.includes(C.key))return;C.preventDefault();const ue=F().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);Lx.includes(C.key)&&ue.reverse(),m$(ue)}),onBlur:rt(e.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(re.current),ae.current="")}),onPointerMove:rt(e.onPointerMove,qa(C=>{const k=C.target,T=p.current!==C.clientX;if(C.currentTarget.contains(k)&&T){const g=C.clientX>p.current?"right":"left";$.current=g,p.current=C.clientX}}))})})})})})})});Hx.displayName=tn;var o$="MenuGroup",E0=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Gt.div,{role:"group",...n,ref:t})});E0.displayName=o$;var a$="MenuLabel",Wx=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Gt.div,{...n,ref:t})});Wx.displayName=a$;var ku="MenuItem",jm="menu.itemSelect",gl=O.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=O.useRef(null),o=fc(ku,e.__scopeMenu),a=x0(ku,e.__scopeMenu),c=Jt(t,s),u=O.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const h=new CustomEvent(jm,{bubbles:!0,cancelable:!0});f.addEventListener(jm,y=>n==null?void 0:n(y),{once:!0}),h4(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return b.jsx(Kx,{...i,ref:c,disabled:r,onClick:rt(e.onClick,l),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:rt(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:rt(e.onKeyDown,f=>{const h=a.searchRef.current!=="";r||h&&f.key===" "||wd.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});gl.displayName=ku;var Kx=O.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=x0(ku,r),a=Fx(r),c=O.useRef(null),u=Jt(t,c),[l,f]=O.useState(!1),[h,y]=O.useState("");return O.useEffect(()=>{const _=c.current;_&&y((_.textContent??"").trim())},[s.children]),b.jsx(Va.ItemSlot,{scope:r,disabled:n,textValue:i??h,children:b.jsx(ON,{asChild:!0,...a,focusable:!n,children:b.jsx(Gt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:rt(e.onPointerMove,qa(_=>{n?o.onItemLeave(_):(o.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:rt(e.onPointerLeave,qa(_=>o.onItemLeave(_))),onFocus:rt(e.onFocus,()=>f(!0)),onBlur:rt(e.onBlur,()=>f(!1))})})})}),c$="MenuCheckboxItem",Xx=O.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return b.jsx(e6,{scope:e.__scopeMenu,checked:r,children:b.jsx(gl,{role:"menuitemcheckbox","aria-checked":ju(r)?"mixed":r,...i,ref:t,"data-state":A0(r),onSelect:rt(i.onSelect,()=>n==null?void 0:n(ju(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Xx.displayName=c$;var Yx="MenuRadioGroup",[u$,l$]=Bs(Yx,{value:void 0,onValueChange:()=>{}}),Jx=O.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=pr(n);return b.jsx(u$,{scope:e.__scopeMenu,value:r,onValueChange:s,children:b.jsx(E0,{...i,ref:t})})});Jx.displayName=Yx;var Zx="MenuRadioItem",Qx=O.forwardRef((e,t)=>{const{value:r,...n}=e,i=l$(Zx,e.__scopeMenu),s=r===i.value;return b.jsx(e6,{scope:e.__scopeMenu,checked:s,children:b.jsx(gl,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":A0(s),onSelect:rt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});Qx.displayName=Zx;var M0="MenuItemIndicator",[e6,f$]=Bs(M0,{checked:!1}),t6=O.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=f$(M0,r);return b.jsx(Mn,{present:n||ju(s.checked)||s.checked===!0,children:b.jsx(Gt.span,{...i,ref:t,"data-state":A0(s.checked)})})});t6.displayName=M0;var d$="MenuSeparator",r6=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return b.jsx(Gt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});r6.displayName=d$;var h$="MenuArrow",n6=O.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=lc(r);return b.jsx(B4,{...i,...n,ref:t})});n6.displayName=h$;var C0="MenuSub",[p$,i6]=Bs(C0),s6=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=as(C0,t),o=lc(t),[a,c]=O.useState(null),[u,l]=O.useState(null),f=pr(i);return O.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),b.jsx(N4,{...o,children:b.jsx(zx,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:b.jsx(p$,{scope:t,contentId:Ua(),triggerId:Ua(),trigger:a,onTriggerChange:c,children:r})})})};s6.displayName=C0;var va="MenuSubTrigger",o6=O.forwardRef((e,t)=>{const r=as(va,e.__scopeMenu),n=fc(va,e.__scopeMenu),i=i6(va,e.__scopeMenu),s=x0(va,e.__scopeMenu),o=O.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=O.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return O.useEffect(()=>l,[l]),O.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),b.jsx(w0,{asChild:!0,...u,children:b.jsx(Kx,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":u6(r.open),...e,ref:tl(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:rt(e.onPointerMove,qa(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:rt(e.onPointerLeave,qa(f=>{var y,_;l();const h=(y=r.content)==null?void 0:y.getBoundingClientRect();if(h){const w=(_=r.content)==null?void 0:_.dataset.side,A=w==="right",I=A?-5:5,P=h[A?"left":"right"],N=h[A?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+I,y:f.clientY},{x:P,y:h.top},{x:N,y:h.top},{x:N,y:h.bottom},{x:P,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:rt(e.onKeyDown,f=>{var y;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||YD[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});o6.displayName=va;var a6="MenuSubContent",c6=O.forwardRef((e,t)=>{const r=qx(tn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=as(tn,e.__scopeMenu),o=fc(tn,e.__scopeMenu),a=i6(a6,e.__scopeMenu),c=O.useRef(null),u=Jt(t,c);return b.jsx(Va.Provider,{scope:e.__scopeMenu,children:b.jsx(Mn,{present:n||s.open,children:b.jsx(Va.Slot,{scope:e.__scopeMenu,children:b.jsx(S0,{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:rt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:rt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:rt(e.onKeyDown,l=>{var y;const f=l.currentTarget.contains(l.target),h=JD[o.dir].includes(l.key);f&&h&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),l.preventDefault())})})})})})});c6.displayName=a6;function u6(e){return e?"open":"closed"}function ju(e){return e==="indeterminate"}function A0(e){return ju(e)?"indeterminate":e?"checked":"unchecked"}function m$(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function g$(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function v$(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=g$(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 y$(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 b$(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return y$(r,t)}function qa(e){return t=>t.pointerType==="mouse"?e(t):void 0}var w$=Vx,_$=w0,x$=Gx,S$=Hx,E$=E0,M$=Wx,C$=gl,A$=Xx,T$=Jx,O$=Qx,I$=t6,k$=r6,j$=n6,P$=s6,R$=o6,N$=c6,T0="DropdownMenu",[D$,tK]=Bo(T0,[Ux]),Or=Ux(),[$$,l6]=D$(T0),f6=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Or(t),u=O.useRef(null),[l=!1,f]=ac({prop:i,defaultProp:s,onChange:o});return b.jsx($$,{scope:t,triggerId:Ua(),triggerRef:u,contentId:Ua(),open:l,onOpenChange:f,onOpenToggle:O.useCallback(()=>f(h=>!h),[f]),modal:a,children:b.jsx(w$,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};f6.displayName=T0;var d6="DropdownMenuTrigger",h6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=l6(d6,r),o=Or(r);return b.jsx(_$,{asChild:!0,...o,children:b.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:tl(t,s.triggerRef),onPointerDown:rt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:rt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});h6.displayName=d6;var B$="DropdownMenuPortal",p6=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Or(t);return b.jsx(x$,{...n,...r})};p6.displayName=B$;var m6="DropdownMenuContent",g6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=l6(m6,r),s=Or(r),o=O.useRef(!1);return b.jsx(S$,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:rt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:rt(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)"}})});g6.displayName=m6;var L$="DropdownMenuGroup",v6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(E$,{...i,...n,ref:t})});v6.displayName=L$;var U$="DropdownMenuLabel",y6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(M$,{...i,...n,ref:t})});y6.displayName=U$;var F$="DropdownMenuItem",b6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(C$,{...i,...n,ref:t})});b6.displayName=F$;var z$="DropdownMenuCheckboxItem",w6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(A$,{...i,...n,ref:t})});w6.displayName=z$;var V$="DropdownMenuRadioGroup",_6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(T$,{...i,...n,ref:t})});_6.displayName=V$;var q$="DropdownMenuRadioItem",x6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(O$,{...i,...n,ref:t})});x6.displayName=q$;var G$="DropdownMenuItemIndicator",S6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(I$,{...i,...n,ref:t})});S6.displayName=G$;var H$="DropdownMenuSeparator",E6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(k$,{...i,...n,ref:t})});E6.displayName=H$;var W$="DropdownMenuArrow",K$=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(j$,{...i,...n,ref:t})});K$.displayName=W$;var X$=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Or(t),[a=!1,c]=ac({prop:n,defaultProp:s,onChange:i});return b.jsx(P$,{...o,open:a,onOpenChange:c,children:r})},Y$="DropdownMenuSubTrigger",M6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(R$,{...i,...n,ref:t})});M6.displayName=Y$;var J$="DropdownMenuSubContent",C6=O.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Or(r);return b.jsx(N$,{...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)"}})});C6.displayName=J$;var Z$=f6,Q$=h6,A6=p6,eB=g6,tB=v6,rB=y6,nB=b6,iB=w6,sB=_6,oB=x6,T6=S6,aB=E6,cB=X$,uB=M6,lB=C6;const fB=["1","2","3"],dB=["vertical","horizontal","both"],hf={size:{type:"enum",values:fB,default:"1",responsive:!0},radius:p0,scrollbars:{type:"enum",values:dB,default:"both"}},O0=O.forwardRef((e,t)=>{const{rest:r,...n}=zo(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=hf.size.default,radius:l=hf.radius.default,scrollbars:f=hf.scrollbars.default,...h}=r;return O.createElement($D,{type:o,scrollHideDelay:a,className:Xt("rt-ScrollAreaRoot",i,Vo(n)),style:s},O.createElement(BD,{...h,ref:t,className:"rt-ScrollAreaViewport"}),O.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?O.createElement(Im,{"data-radius":l,orientation:"horizontal",className:Xt("rt-ScrollAreaScrollbar",wt(u,"rt-r-size"))},O.createElement(km,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?O.createElement(Im,{"data-radius":l,orientation:"vertical",className:Xt("rt-ScrollAreaScrollbar",wt(u,"rt-r-size"))},O.createElement(km,{className:"rt-ScrollAreaThumb"})):null,f==="both"?O.createElement(LD,{className:"rt-ScrollAreaCorner"}):null)});O0.displayName="ScrollArea";const hB=["1","2"],pB=["solid","soft"],pf={size:{type:"enum",values:hB,default:"2",responsive:!0},variant:{type:"enum",values:pB,default:"solid"},color:cc,highContrast:ul},O6={color:cc,shortcut:{type:"string",default:void 0}},I6=e=>O.createElement(Z$,{...e});I6.displayName="DropdownMenuRoot";const k6=O.forwardRef((e,t)=>O.createElement(Q$,{...e,ref:t,asChild:!0}));k6.displayName="DropdownMenuTrigger";const j6=O.createContext({}),P6=O.forwardRef((e,t)=>{const r=zR(),{className:n,children:i,size:s=pf.size.default,variant:o=pf.variant.default,highContrast:a=pf.highContrast.default,color:c=O6.color.default,container:u,forceMount:l,...f}=e,h=c??r.accentColor;return O.createElement(A6,{container:u,forceMount:l},O.createElement(cl,{asChild:!0},O.createElement(eB,{"data-accent-color":h,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,wt(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},O.createElement(O0,{type:"auto"},O.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},O.createElement(j6.Provider,{value:O.useMemo(()=>({size:s,variant:o,color:h,highContrast:a}),[s,o,h,a])},i))))))});P6.displayName="DropdownMenuContent";const R6=O.forwardRef((e,t)=>O.createElement(rB,{...e,ref:t,className:Xt("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));R6.displayName="DropdownMenuLabel";const N6=O.forwardRef((e,t)=>{const{className:r,children:n,color:i=O6.color.default,shortcut:s,...o}=e;return O.createElement(nB,{"data-accent-color":i,...o,ref:t,className:Xt("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},O.createElement(Lo,null,n),s&&O.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});N6.displayName="DropdownMenuItem";const D6=O.forwardRef((e,t)=>O.createElement(tB,{...e,ref:t,className:Xt("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));D6.displayName="DropdownMenuGroup";const $6=O.forwardRef((e,t)=>O.createElement(sB,{...e,ref:t,className:Xt("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));$6.displayName="DropdownMenuRadioGroup";const B6=O.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return O.createElement(oB,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},O.createElement(Lo,null,r),O.createElement(T6,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},O.createElement(ll,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});B6.displayName="DropdownMenuRadioItem";const L6=O.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return O.createElement(iB,{...s,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},O.createElement(Lo,null,r),O.createElement(T6,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},O.createElement(ll,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&O.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});L6.displayName="DropdownMenuCheckboxItem";const U6=e=>O.createElement(cB,{...e});U6.displayName="DropdownMenuSub";const F6=O.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return O.createElement(uB,{...i,ref:t,className:Xt("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},O.createElement(Lo,null,n),O.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},O.createElement(rx,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});F6.displayName="DropdownMenuSubTrigger";const z6=O.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=O.useContext(j6);return O.createElement(A6,{container:i,forceMount:s},O.createElement(cl,{asChild:!0},O.createElement(lB,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:Xt("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,wt(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},O.createElement(O0,{type:"auto"},O.createElement("div",{className:Xt("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});z6.displayName="DropdownMenuSubContent";const V6=O.forwardRef((e,t)=>O.createElement(aB,{...e,ref:t,className:Xt("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));V6.displayName="DropdownMenuSeparator";const bi=Object.assign({},{Root:I6,Trigger:k6,Content:P6,Label:R6,Item:N6,Group:D6,RadioGroup:$6,RadioItem:B6,CheckboxItem:L6,Sub:U6,SubTrigger:F6,SubContent:z6,Separator:V6}),mB=["1","2","3","4"],gB=["classic","solid","soft","surface","outline","ghost"],ca={size:{type:"enum",values:mB,default:"2",responsive:!0},variant:{type:"enum",values:gB,default:"solid"},color:cc,highContrast:ul,radius:p0},q6=O.forwardRef((e,t)=>{const{rest:r,...n}=zo(e),{className:i,asChild:s=!1,size:o=ca.size.default,variant:a=ca.variant.default,color:c=ca.color.default,highContrast:u=ca.highContrast.default,radius:l=ca.radius.default,...f}=r,h=s?xi:"button";return O.createElement(h,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:Xt("rt-reset","rt-BaseButton",i,wt(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Vo(n))})});q6.displayName="BaseButton";const G6=O.forwardRef((e,t)=>O.createElement(q6,{...e,ref:t,className:Xt("rt-Button",e.className)}));G6.displayName="Button";const vB={loading:{type:"boolean",default:!0}},qo=O.forwardRef((e,t)=>{const{rest:r,...n}=zo(e),{className:i,children:s,loading:o=vB.loading.default,...a}=r;if(!o)return O.createElement(O.Fragment,null,s);const c=O.isValidElement(s)?xi:"span";return O.createElement(c,{ref:t,"aria-hidden":!0,className:Xt("rt-Skeleton",i,Vo(n)),"data-inline-skeleton":O.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});qo.displayName="Skeleton";const yB=Ft("/images/ghost_loading.png"),bB=Ft("/images/primary_loading.png"),wB={primary:bB,ghost:yB};function _B({size:e="24px",variant:t="primary",wrapStyle:r={}}){return b.jsx(Y4,{align:"center",justify:"center",style:{width:"100%",height:"100%",...r},children:b.jsx("img",{src:wB[t],alt:"Loading",style:{width:e,height:e,animation:"spin 1s linear infinite"}})})}const xB="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==",mf="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 Gr({src:e,alt:t,className:r,style:n,showWarn:i,...s}){const[o,a]=ie.useState(mf),c=u=>{a(mf)};return ie.useEffect(()=>{a(e||mf)},[e]),b.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative"},children:[b.jsx("img",{src:o,alt:t||"",className:r,loading:"lazy",decoding:"async",style:{borderRadius:"100%",...n},onError:c,...s}),i&&b.jsx("img",{style:{position:"absolute",right:-2,bottom:-2,width:"16px",height:"16px"},src:xB})]})}function SB({toastData:e,onClose:t}){const{status:r,buildShowInfo:n,tx:i,id:s}=e,{getExplorerUrl:o}=$o(),a=ie.useMemo(()=>{if(n&&r)return n(r)},[r]),c=ie.useMemo(()=>{if(r){if(r==="rejected")return"#ff5073";if(r==="success")return"#68ffd8"}return"#909ca4"},[r]);return b.jsxs("div",{className:"cs-toast",children:[b.jsxs("div",{style:{gap:"0px",display:"flex",flexDirection:"column"},children:[b.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[r==="submitted"&&b.jsx("div",{children:b.jsx(_B,{})}),b.jsxs("svg",{className:"cs-icon",style:{width:"16px",height:"16px",fill:c},children:[r==="rejected"&&b.jsx("use",{xlinkHref:"#icon-close"}),r==="success"&&b.jsx("use",{xlinkHref:"#icon-sel"})]}),r==="submitted"&&b.jsxs("span",{style:{marginLeft:"-28px"},children:[" ","Transaction in progress"," "]}),r==="rejected"&&b.jsx("span",{className:"red",children:(a==null?void 0:a.toastTitleText)||"Transaction failed"}),r==="success"&&b.jsx("span",{className:"green",children:(a==null?void 0:a.toastTitleText)||"Transaction Successful"})]}),r==="submitted"&&b.jsxs("div",{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():b.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&i&&b.jsx(f4,{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"&&b.jsxs(b.Fragment,{children:[a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():b.jsx("span",{children:a==null?void 0:a.toastDescriptionContent}),!(a!=null&&a.toastDescriptionContent)&&b.jsx("span",{children:"Something went wrong"})]}),r==="success"&&b.jsx(b.Fragment,{children:a!=null&&a.toastDescriptionContent&&typeof a.toastDescriptionContent=="function"?a.toastDescriptionContent():b.jsx("span",{children:a==null?void 0:a.toastDescriptionContent})}),r==="success"&&i&&b.jsxs("div",{className:"view-transaction",children:[b.jsx("span",{children:"View Transaction"}),el.map(u=>b.jsx("a",{href:o(i,"tx",u.link),target:"_blank",children:b.jsx(Gr,{src:u.img})},u.link))]})]}),b.jsx("svg",{className:"cs-icon close","aria-hidden":"true",onClick:()=>t(s),children:b.jsx("use",{xlinkHref:"#icon-close"})})]})}const EB=Ti((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)}))}})),Go=(e="cs-swap-widget")=>{const{toasts:t,setToasts:r,removeToast:n}=EB(),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=ie.useCallback(()=>{let a=document.getElementById(e);return a||(a=document.createElement("div"),a.id=e,document.body.appendChild(a)),Uu.createPortal(b.jsx("div",{className:"cs-toast-wrapper",children:t&&t.map(c=>b.jsx(SB,{toastData:c,onClose:()=>{n(c.id)}},c.id))}),a)},[t]);return{addCommonToast:i,addTxToast:s,ToastContainer:o,removeToast:n}};function MB(){const{mevProtect:e,setMevProtect:t}=Wr();return b.jsxs(bi.Root,{children:[b.jsx(bi.Trigger,{children:b.jsx("div",{className:"cs-settings-btn",children:b.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:e?"var(--cs-primary)":"var(--cs-icon-fill)",children:b.jsx("use",{xlinkHref:"#icon-mev"})})})}),b.jsx(bi.Content,{variant:"soft",className:"cs-dropdown-content",side:"bottom",align:"end",style:{maxWidth:"328px"},children:b.jsxs("div",{className:"mev-settings-box",children:[b.jsxs("div",{className:"mev-setting-title",children:[b.jsxs("div",{className:"name",children:[b.jsx("img",{src:Ft("/images/icon_mev@2x.png")}),b.jsx("span",{children:"MEV Protect"})]}),b.jsx(Bx,{checked:e,className:"cs-switch",onClick:()=>{t(!e)}})]}),b.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 CB({onClick:e}){const[t,r]=ie.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1)},1e3),e()};return b.jsx("div",{className:"refresh-button",children:b.jsx("svg",{className:t?"rotate cs-icon-hover":"cs-icon-hover","aria-hidden":"true",onClick:n,children:b.jsx("use",{xlinkHref:"#icon-refresh"})})})}function I0(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return b.jsx(G6,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function AB(){const{setIsOpenSlippageDialog:e,isOpenSlippageDialog:t,slippage:r}=Wr();return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"slippage-button",onClick:()=>e(!0),children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-verticalslider"})}),b.jsxs("span",{children:[r,"%"]})]}),t&&b.jsx(TB,{onClose:()=>e(!1)})]})}function TB({onClose:e}){const{slippage:t,setSlippage:r}=Wr(),[n,i]=ie.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=ie.useMemo(()=>+n?Number(n)>50||Number(n)<.01:!0,[t,n]);return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),b.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:b.jsxs("div",{className:"slippage-settings",children:[b.jsxs("div",{className:"slippage-settings-header",children:[b.jsx("div",{className:"title",children:"Settings"}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:b.jsx("use",{xlinkHref:"#icon-close"})})]}),b.jsxs("div",{className:"title",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-verticalslider"})}),b.jsx("span",{children:"Slippage Tolerance"})]}),b.jsxs("div",{className:"form-box",children:[b.jsx("div",{className:"slippage-tab-list",children:gj.map(u=>b.jsxs("span",{className:u.display===n?"active":"",onClick:()=>s(u),children:[u.display,"%"]}))}),b.jsxs("div",{className:"input-box",children:[b.jsx("span",{children:"Custom"}),b.jsx("input",{className:"cs-input",placeholder:"0.0",value:n,onChange:o}),b.jsx("i",{children:"%"})]})]}),Number(n)<=.05&&b.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(n)<=50&&Number(n)>1&&b.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(n)>50&&b.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),b.jsx(I0,{text:"Save",btnIsDisabled:c,className:"slippage-save-btn",onClick:a})]})})]})}function OB({handleRefresh:e}){return b.jsx(b.Fragment,{children:b.jsxs("div",{className:"swap-header",children:[b.jsx("h3",{className:"swap-title",children:"Swap"}),b.jsxs("div",{className:"right",children:[b.jsx(AB,{}),b.jsx(MB,{}),b.jsx(CB,{onClick:e})]})]})})}function IB(){const[e,t]=ie.useState(!1);return b.jsxs(bi.Root,{open:e,onOpenChange:t,children:[b.jsx(bi.Trigger,{children:b.jsx("div",{className:"cs-settings-btn",children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-settings"})})})}),b.jsx(bi.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:b.jsxs("div",{className:"cs-settings-box",children:[b.jsx("h3",{children:"Settings"}),b.jsx(kB,{}),b.jsx(PB,{onClose:()=>{t(!1)}})]})})]})}function kB(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=Wr(),i=s=>{t(s)};return b.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[b.jsxs("h3",{className:"card-title",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-plorer"})}),b.jsx("span",{children:"Preferred Explorer"})]}),b.jsx("div",{className:"explorer-checkbox-group",children:el.map(s=>b.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[b.jsx(fl,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox"}),b.jsx("img",{src:s.img}),b.jsx("span",{children:s.name})]}))})]})}const jB=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function PB({onClose:e}){const{addTxToast:t}=Go(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=Wr(),[a,c]=ie.useState(i),[u,l]=ie.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)},_=()=>{if(a){const w={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(w),f(a),e()}};return b.jsxs("div",{className:"settings-card rpc-settings-card",children:[b.jsxs("h3",{className:"card-title",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-settings"})}),b.jsx("span",{children:"RPC Node"})]}),b.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(w=>b.jsxs("div",{className:"rpc-item",onClick:()=>h(w),children:[b.jsx(fl,{color:"indigo",checked:u.name===w.name,variant:"soft",className:"cs-checkbox"}),b.jsx("span",{children:w.name})]})),u.isCustom&&b.jsxs("div",{className:"custom-rpc-input-box",children:[b.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),b.jsx(I0,{btnIsDisabled:jB(a),text:"Save",onClick:_})]})]})]})}const Cn=Ti((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 RB=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()}},NB=RB,Pm={"text/plain":"Text","text/html":"Url",default:"Text"},DB="Copy to clipboard: #{key}, Enter";function $B(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function BB(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=NB(),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=Pm[t.format]||Pm.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=$B("message"in t?t.message:DB),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var LB=BB;const H6=Qa(LB);function UB({currentAccount:e}){const{mutate:t}=$r.useSwitchAccount(),r=$r.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i}=Cn(),s=()=>{i(!n)};ie.useEffect(()=>()=>{i(!1)},[]);const o=ie.useMemo(()=>r.filter(c=>c.address!==e),[r,e]);ie.useEffect(()=>{},[o]);const a=c=>{t({account:c},{onSuccess:()=>{}})};return b.jsxs("div",{className:"cs-account-switch",children:[b.jsxs("div",{className:"account",onClick:s,children:[b.jsx("span",{children:Ps(e)}),(o==null?void 0:o.length)>0&&b.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-unfold"})})]}),b.jsx("div",{className:`account-list ${n?"open":"close"}`,children:o.map(c=>b.jsxs("div",{className:"account-item",children:[b.jsxs("div",{className:"left",children:[b.jsx("div",{className:"label",children:c==null?void 0:c.label}),b.jsx("div",{className:"address",children:Ps(c==null?void 0:c.address)})]}),b.jsx("button",{className:"cs-outline-btn",onClick:()=>a(c),children:"Switch"})]}))})]})}function FB({connect:e}){const t=$r.useCurrentAccount();return ie.useEffect(()=>{},[t]),b.jsx("div",{children:t?b.jsx(zB,{}):b.jsx(I0,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})}function zB(){const{mutate:e}=$r.useDisconnectWallet(),t=$r.useCurrentAccount(),{currentWallet:r}=$r.useCurrentWallet(),{addCommonToast:n}=Go(),{getExplorerUrl:i}=$o(),s=()=>{t&&(H6(t.address||"",{debug:!1,message:"message"}),n("Copied"))},o=()=>{t&&window.open(i(t.address,"account"),"_blank")};return ie.useEffect(()=>{},[r]),b.jsxs(bi.Root,{children:[b.jsx(bi.Trigger,{children:b.jsxs("div",{className:"cs-connected-button",children:[b.jsx("img",{src:r==null?void 0:r.icon,style:{width:"20px",height:"20px"}}),b.jsx("span",{children:Ps(t==null?void 0:t.address)})]})}),b.jsx(bi.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"#2B3643"},side:"bottom",align:"end",children:b.jsxs("div",{className:"account-op-box",children:[b.jsx("span",{style:{fontSize:"14px",color:"#909CA4",marginBottom:"6px"},children:t==null?void 0:t.label}),b.jsx(UB,{currentAccount:t==null?void 0:t.address}),b.jsxs("div",{className:"account-op-item",onClick:s,style:{marginTop:"12px"},children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-copy"})}),b.jsx("span",{children:"Copy address"})]}),b.jsxs("div",{className:"account-op-item",onClick:o,children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-link"})}),b.jsx("span",{children:"Open explorer"})]}),b.jsxs("div",{className:"account-op-item",onClick:()=>e(),children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-disconnect"})}),b.jsx("span",{children:"Disconnect"})]})]})})]})}function VB(){$r.useCurrentAccount(),$r.useCurrentWallet();const{isOpenWalletModal:e,onWalletModal:t,saveCurrentAccount:r}=Cn();return $r.useWallets(),b.jsx(b.Fragment,{children:b.jsx($r.ConnectModal,{trigger:b.jsx(FB,{connect:t}),open:e,onOpenChange:n=>t(n)})})}function qB({independentWallet:e,customWallet:t}){return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"widget-header",children:[b.jsx("img",{src:Ft("/images/logo@2x.png"),className:"cetus-logo"}),b.jsxs("div",{className:"right",children:[e&&b.jsx(VB,{}),b.jsx(IB,{})]})]}),b.jsx("div",{style:{marginTop:"20px"}})]})}const W6=()=>{const e=ie.useRef(null);ie.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 b.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:b.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)=>b.jsx("div",{style:t(i),children:b.jsx("div",{style:r})},i))})})};function GB({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=ie.useMemo(()=>{if(n&&r)return n(r)},[r]);return b.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&b.jsx(HB,{info:s,status:r}),(r==="success"||r==="rejected")&&b.jsx(WB,{info:s,status:r,tx:i,onClose:e})]})}function HB({info:e,status:t}){return b.jsxs("div",{className:"progress-dialog",children:[b.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),b.jsx("div",{className:"loading-box",children:b.jsx(W6,{})}),b.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),b.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function WB({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=$o();return b.jsxs("div",{className:"finally-status-dialog",children:[b.jsxs("div",{className:"center-content",children:[b.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[b.jsx("div",{className:"status-icon-box",children:b.jsx("div",{className:"status-icon",children:b.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?b.jsx("use",{xlinkHref:"#icon-sel"}):b.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?b.jsx("span",{children:"Swap Success"}):b.jsx("span",{children:"Swap failed"})]}),b.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&b.jsxs("div",{className:"view-transaction",children:[b.jsx("span",{children:"View Transaction"}),el.map(s=>b.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:b.jsx("img",{src:s.img})},s.link))]})]}),b.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?b.jsx("span",{children:" Swap More"}):b.jsx("span",{children:"Retry"})})]})}function vl(){return{fetchByApi:async(t,r,n,i)=>{try{return r==="GET"?await hj(`${i||Su.api}${t}`,n):await pj(`${i||Su.api}${t}`,n)}catch(s){throw s}}}}function KB(){const{fetchByApi:e}=vl(),{setProviders:t}=Wr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function XB({interval:e,callback:t}){const r=ie.useRef(),n=ie.useRef(null);ie.useEffect(()=>{r.current=t},[t]);const i=ie.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=ie.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return ie.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const Ls=Ti((e,t)=>({suiClient:new ja({url:Su.fullRpcUrl}),setSuiClient:r=>{e(()=>({suiClient:r}))},aggregatorSDK:new F_,setAggregatorSDK:r=>{e(()=>({aggregatorSDK:r}))}})),YB=(e,t)=>({requestTokenList:[],addRequestTokenList:r=>{e(()=>({requestTokenList:[...t().requestTokenList,r]}))},setToken:r=>{const{tokenMap:n,requestTokenList:i}=t(),s=new Map(n);s.set(Mr(r.coin_type).full_address,r);const o=i.filter(a=>a!==r.coin_type);e(()=>({tokenMap:s,requestTokenList:[...o]})),yi.setItem(ld,s)},tokenMap:new Map,setTokenMap:(r,n=!1)=>{e(()=>({tokenMap:r})),n||yi.setItem(ld,r)},trustedTokenList:[],setTrustedTokenList:(r,n=!1)=>{e(()=>({trustedTokenList:r})),n||yi.setItem(s4,r)}}),dc=Ti(YB);yi.getItem(ld).then(e=>{e!==null&&dc.getState().setTokenMap(e,!0)});yi.getItem(s4).then(e=>{e!==null&&dc.getState().setTrustedTokenList(e,!0)});function JB(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 Us(){const{suiClient:e}=Ls(),{fetchByApi:t}=vl(),{setTokenMap:r,tokenMap:n,setToken:i,requestTokenList:s,addRequestTokenList:o,setTrustedTokenList:a}=dc(),c=async()=>{var _;const f=await t("/v2/sui/coins_info","GET"),h=[],y=(_=f==null?void 0:f.list)==null?void 0:_.reduce((w,A)=>(w.set(A.coin_type,A),A.is_trusted&&h.push({...A,coin_type:Mr(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){i4(f)&&(y.iconUrl="https://archive.cetus.zone/assets/image/sui/sui.png");const _=JB(y,f);return i(_),_}}catch{}},l=ie.useCallback(f=>{if(f)return n.get(Mr(f).full_address)||n.get(f)},[n]);return{getTokens:c,fetchTokenInfo:u,getTokenInfo:l}}function Pu(e){const{suiClient:t}=Ls(),{currentAccount:r,setTokenBalanceObj:n,tokenBalanceObj:i}=Cn(),{fetchTokenInfo:s}=Us(),[o,a]=ie.useState([]),{tokenMap:c}=dc(),u=async(y=(r==null?void 0:r.address)||"",_)=>{try{if(!y){l();return}let w=[];_?w=[await t.getBalance({owner:y,coinType:_})]:w=[...await t.getAllBalances({owner:y})],a(w)}catch{a([])}},l=()=>{n({})};ie.useEffect(()=>{(o==null?void 0:o.length)>0&&(c!=null&&c.size)&&f(o)},[o,c]);const f=async y=>{const _={};for(let w=0;w<(y==null?void 0:y.length);w++)try{const A=y[w],I=await s(A.coinType),P=ij(A.totalBalance,I==null?void 0:I.decimals),N=en(P,4);_[Mr(A.coinType).full_address]={...A,displayBalance:N,totalBalanceFormat:P}}catch{continue}n(_)},h=ie.useMemo(()=>{if(e&&r)return i[e]||i[Mr(e).full_address]},[e,i,r]);return{getOwnerCoinBalances:u,balanceInfo:h}}const ZB=(e,t)=>({defaultFromCoin:void 0,defaultToCoin:void 0,isOpenSecondary:!1,byAmountIn:!0,findRouterLoading:!1,fromAmount:"",toAmount:"",fromCoin:void 0,toCoin:void 0,routerData:void 0,setDefaultCoin:(r,n)=>{e(()=>({defaultFromCoin:r,defaultToCoin: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}))}}),sn=Ti(ZB),QB={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"}},eL={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"}},K6=QB,X6=eL;function tL(e,t){const{fetchTokenInfo:r}=Us(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s}=sn(),{setSlippage:o,setRpcList:a,setCurrentRpc:c}=Wr(),u=ie.useRef({}),l=async(h,y)=>{const _=h?await r(h):K6,w=y?await r(y):X6;n(_),i(w),s(_,w)},f=(h,y)=>{const _=[xu[0]];let w=xu[0];h.forEach(A=>{const I={name:A,link:A,isCustom:!1};_.push(I),A===y&&(w=I)}),a([..._,{name:"Custom RPC URL",link:"",isCustom:!0}]),c(w)};return ie.useEffect(()=>{if(!Zh(e,u.current)){const{defaultFromToken:h,defaultToToken:y,defaultSlippage:_,customRpcList:w,defaultRpc:A}=e;l(h,y),_&&o(_),(w==null?void 0:w.length)>0&&f(w,A),u.current=e}},[e]),{handleSetDefaultPair:l}}function rL(){const{currentRpc:e}=Wr(),{setSuiClient:t,setAggregatorSDK:r}=Ls(),{currentAccount:n}=Cn();ie.useEffect(()=>{if(e){const i=new ja({url:e.link});t(i)}},[e]),ie.useEffect(()=>{if(e){const i=new F_(Su.aggregatorUrl,(n==null?void 0:n.address)||void 0,new ja({url:e.link}),ak.Mainnet);r(i)}},[e.link,n==null?void 0:n.address])}const nL=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Mr(i).full_address]}),e({coinPriceObj:{...n}})}}),Y6=Ti(nL);function yl(){const{fetchByApi:e}=vl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=Y6(),i=async a=>{try{const u=(await e("/v2/sui/market_price","GET",{base_symbol_address_pair:a.map(l=>Qh(l,!1))})).prices;if(u){const l={};u.forEach(f=>{l[Mr(f.base_symbol).full_address]=f}),r(l)}return u}catch{return n(a),null}},s=ie.useCallback(a=>{if(!a)return;const c=t[Mr(a).full_address];if(c)return c},[t]),o=ie.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Ve(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}const k0=Ti((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),yr=[];for(let e=0;e<256;++e)yr.push((e+256).toString(16).slice(1));function iL(e,t=0){return(yr[e[t+0]]+yr[e[t+1]]+yr[e[t+2]]+yr[e[t+3]]+"-"+yr[e[t+4]]+yr[e[t+5]]+"-"+yr[e[t+6]]+yr[e[t+7]]+"-"+yr[e[t+8]]+yr[e[t+9]]+"-"+yr[e[t+10]]+yr[e[t+11]]+yr[e[t+12]]+yr[e[t+13]]+yr[e[t+14]]+yr[e[t+15]]).toLowerCase()}let gf;const sL=new Uint8Array(16);function oL(){if(!gf){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");gf=crypto.getRandomValues.bind(crypto)}return gf(sL)}const aL=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Rm={randomUUID:aL};function Nm(e,t,r){if(Rm.randomUUID&&!t&&!e)return Rm.randomUUID();e=e||{};const n=e.random||(e.rng||oL)();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 iL(n)}var Wc=(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))(Wc||{});const cL=new ja({url:Qg("mainnet")}),uL=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],lL=["deny_list","DenyList","DenyCap","create_regulated_currency"],fL={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},dL=async e=>{let t=!1;if(uL.includes(e))return t;const r=e.split("::"),n=r[0]&&Nr(r[0]),i=r[1],s=await cL.getObject({id:n,options:fL}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(lL.join("|"),"i").test(o)&&(t=!0),t},hL=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>Qh(i,!1)))==null?void 0:n.join(",")};function pL(){const{fetchByApi:e}=vl(),t=async n=>{try{const i={...n},s=hL(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(_=>Ta(_).source_address);f=l==null?void 0:l.filter(_=>{var I,P;const w=Ta((I=_==null?void 0:_.coin_a)==null?void 0:I.address).source_address,A=Ta((P=_==null?void 0:_.coin_b)==null?void 0:P.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 mL(e=!0){const{poolApiMap:t,setPoolApiMap:r}=Wr(),{getPoolList:n,getLocalJsonPoolList:i}=pL();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 gL(e){const{routerData:t}=sn();return{priceAcceptRouterData:ie.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Ve(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Ve(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function J6(e,t){return{amountLimit:ie.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Ve(s).mul(Ve(1).sub(Ve(e).div(100))).toString():Ve(i).mul(Ve(1).add(Ve(e).div(100))).toString()}},[e,t])}}function vL(e){const{getTokenInfo:t,fetchTokenInfo:r}=Us();return{formatSwapRouter:ie.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Ve(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=Ve(1).sub(c).toFixed(2):h.percentage=Ve(y).div(s).toFixed(2),c=Ve(c).add(h.percentage);const _=[];l.path.forEach(w=>{i.includes(w.provider)||i.push(w.provider);const A=Mr(w.from).full_address,I=Mr(w.target).full_address,P=t(A),N=t(I);P||a.includes(A)&&a.push(A),N||a.includes(I)&&a.push(I);const F=w.provider===Oa.SCALLOP||w.provider===Oa.FLOWX||w.provider===Oa.FLOWXV3;_.push({from_type:A,to_type:I,pool_address:F?"":w.id,fee_rate:w.feeRate,provider:w.provider})}),h.paths=_,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 yL(){const{fromCoin:e,toCoin:t}=sn(),{getPoolListByCoinType:r}=mL();return{getSwapPoolAddress:async()=>e&&t?(await r(e.coin_type,t.coin_type)).map(o=>o.address):[]}}function Z6(e,t,r){return ie.useMemo(()=>t&&r&&+t&&+r?e?Ve(r).div(t).toString():Ve(t).div(r).toString():"0",[t,r,e])}function Dm(e){const[t,r]=ie.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await dL(i.coin_type)}catch{}return!1};return ie.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function bL(){const{defaultFromCoin:e,defaultToCoin:t}=sn();return{isCustomMode:ie.useMemo(()=>(e==null?void 0:e.coin_type)!==K6.coin_type||(t==null?void 0:t.coin_type)!==X6.coin_type,[e,t])}}function wL(){const{aggregatorSDK:e}=Ls(),{getSwapPoolAddress:t}=yL(),r=s=>s&&s.error?s.error.code===Wc.InsufficientLiquidity||Wc.HoneyPot||Wc.NumberTooLarge:!1,n=async s=>{const{fromToken:o,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:f}=s,h={from:o.coin_type,target:a.coin_type,amount:new Yp(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u};try{const y=await e.findRouters(h);if(y&&r(y))return i(!1,y.insufficientLiquidity,l,f,o,a);if(!y||y.routes.length===0)throw Error("not find router");return i(!1,y.insufficientLiquidity,l,f,o,a,y)}catch{const _=await t(),w={from:o.coin_type,target:a.coin_type,amount:new Yp(c),byAmountIn:l,pools:_};try{const A=await e.swapInPools(w);return!A||!A.routeData?i(!0,!0,l,f,o,a):i(!0,A.isExceed,l,f,o,a,A.routeData)}catch{return{uuid:f,byAmountIn:l,isExceed:!1,isDegrade:!0}}}},i=(s,o,a,c,u,l,f)=>{if(f){const h=ud(f.amountIn.toString(),u.decimals).toString(),y=ud(f.amountOut.toString(),l.decimals).toString();return{routerData:f,fromAmountUi:h,toAmountUi:y,uuid:c,byAmountIn:a,isExceed:o,isDegrade:s}}else return{uuid:c,byAmountIn:a,isExceed:o,isDegrade:s}};return{findBestRouters:n}}function Zs(e){const t=ie.useRef(e);return ie.useEffect(()=>{t.current=e},[e]),t}function _L(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function xL(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function SL(e){return!!String(e).includes("Could not find the referenced transaction")}function EL(e){return _L(e)?"User rejected the request":xL(e)?"Exceeded price slippage":SL(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":"Transaction failed"}var j0={},ML=z_();const CL=Qa(ML);function Q6(e,t){return function(){return e.apply(t,arguments)}}const{toString:AL}=Object.prototype,{getPrototypeOf:P0}=Object,bl=(e=>t=>{const r=AL.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),An=e=>(e=e.toLowerCase(),t=>bl(t)===e),wl=e=>t=>typeof t===e,{isArray:Ho}=Array,Ga=wl("undefined");function TL(e){return e!==null&&!Ga(e)&&e.constructor!==null&&!Ga(e.constructor)&&qr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const e8=An("ArrayBuffer");function OL(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&e8(e.buffer),t}const IL=wl("string"),qr=wl("function"),t8=wl("number"),_l=e=>e!==null&&typeof e=="object",kL=e=>e===!0||e===!1,Kc=e=>{if(bl(e)!=="object")return!1;const t=P0(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},jL=An("Date"),PL=An("File"),RL=An("Blob"),NL=An("FileList"),DL=e=>_l(e)&&qr(e.pipe),$L=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||qr(e.append)&&((t=bl(e))==="formdata"||t==="object"&&qr(e.toString)&&e.toString()==="[object FormData]"))},BL=An("URLSearchParams"),[LL,UL,FL,zL]=["ReadableStream","Request","Response","Headers"].map(An),VL=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function hc(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ho(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 r8(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 Os=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:io)(),n8=e=>!Ga(e)&&e!==Os;function _d(){const{caseless:e}=n8(this)&&this||{},t={},r=(n,i)=>{const s=e&&r8(t,i)||i;Kc(t[s])&&Kc(n)?t[s]=_d(t[s],n):Kc(n)?t[s]=_d({},n):Ho(n)?t[s]=n.slice():t[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&hc(arguments[n],r);return t}const qL=(e,t,r,{allOwnKeys:n}={})=>(hc(t,(i,s)=>{r&&qr(i)?e[s]=Q6(i,r):e[s]=i},{allOwnKeys:n}),e),GL=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),HL=(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)},WL=(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&&P0(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},KL=(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},XL=e=>{if(!e)return null;if(Ho(e))return e;let t=e.length;if(!t8(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},YL=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&P0(Uint8Array)),JL=(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])}},ZL=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},QL=An("HTMLFormElement"),eU=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),$m=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),tU=An("RegExp"),i8=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};hc(r,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(n[s]=o||i)}),Object.defineProperties(e,n)},rU=e=>{i8(e,(t,r)=>{if(qr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(qr(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+"'")})}})},nU=(e,t)=>{const r={},n=i=>{i.forEach(s=>{r[s]=!0})};return Ho(e)?n(e):n(String(e).split(t)),r},iU=()=>{},sU=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,vf="abcdefghijklmnopqrstuvwxyz",Bm="0123456789",s8={DIGIT:Bm,ALPHA:vf,ALPHA_DIGIT:vf+vf.toUpperCase()+Bm},oU=(e=16,t=s8.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function aU(e){return!!(e&&qr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const cU=e=>{const t=new Array(10),r=(n,i)=>{if(_l(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;const s=Ho(n)?[]:{};return hc(n,(o,a)=>{const c=r(o,i+1);!Ga(c)&&(s[a]=c)}),t[i]=void 0,s}}return n};return r(e,0)},uU=An("AsyncFunction"),lU=e=>e&&(_l(e)||qr(e))&&qr(e.then)&&qr(e.catch),o8=((e,t)=>e?setImmediate:t?((r,n)=>(Os.addEventListener("message",({source:i,data:s})=>{i===Os&&s===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Os.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",qr(Os.postMessage)),fU=typeof queueMicrotask<"u"?queueMicrotask.bind(Os):typeof Wi<"u"&&Wi.nextTick||o8;var fe={isArray:Ho,isArrayBuffer:e8,isBuffer:TL,isFormData:$L,isArrayBufferView:OL,isString:IL,isNumber:t8,isBoolean:kL,isObject:_l,isPlainObject:Kc,isReadableStream:LL,isRequest:UL,isResponse:FL,isHeaders:zL,isUndefined:Ga,isDate:jL,isFile:PL,isBlob:RL,isRegExp:tU,isFunction:qr,isStream:DL,isURLSearchParams:BL,isTypedArray:YL,isFileList:NL,forEach:hc,merge:_d,extend:qL,trim:VL,stripBOM:GL,inherits:HL,toFlatObject:WL,kindOf:bl,kindOfTest:An,endsWith:KL,toArray:XL,forEachEntry:JL,matchAll:ZL,isHTMLForm:QL,hasOwnProperty:$m,hasOwnProp:$m,reduceDescriptors:i8,freezeMethods:rU,toObjectSet:nU,toCamelCase:eU,noop:iU,toFiniteNumber:sU,findKey:r8,global:Os,isContextDefined:n8,ALPHABET:s8,generateString:oU,isSpecCompliantForm:aU,toJSONObject:cU,isAsyncFn:uU,isThenable:lU,setImmediate:o8,asap:fU};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 a8=pt.prototype,c8={};["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=>{c8[e]={value:e}});Object.defineProperties(pt,c8);Object.defineProperty(a8,"isAxiosError",{value:!0});pt.from=(e,t,r,n,i,s)=>{const o=Object.create(a8);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 dU=null;function xd(e){return fe.isPlainObject(e)||fe.isArray(e)}function u8(e){return fe.endsWith(e,"[]")?e.slice(0,-2):e}function Lm(e,t,r){return e?e.concat(t).map(function(i,s){return i=u8(i),!r&&s?"["+i+"]":i}).join(r?".":""):t}function hU(e){return fe.isArray(e)&&!e.some(xd)}const pU=fe.toFlatObject(fe,{},null,function(t){return/^is[A-Z]/.test(t)});function xl(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(_){if(_===null)return"";if(fe.isDate(_))return _.toISOString();if(!c&&fe.isBlob(_))throw new pt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(_)||fe.isTypedArray(_)?c&&typeof Blob=="function"?new Blob([_]):CL.from(_):_}function l(_,w,A){let I=_;if(_&&!A&&typeof _=="object"){if(fe.endsWith(w,"{}"))w=n?w:w.slice(0,-2),_=JSON.stringify(_);else if(fe.isArray(_)&&hU(_)||(fe.isFileList(_)||fe.endsWith(w,"[]"))&&(I=fe.toArray(_)))return w=u8(w),I.forEach(function(N,F){!(fe.isUndefined(N)||N===null)&&t.append(o===!0?Lm([w],F,s):o===null?w:w+"[]",u(N))}),!1}return xd(_)?!0:(t.append(Lm(A,w,s),u(_)),!1)}const f=[],h=Object.assign(pU,{defaultVisitor:l,convertValue:u,isVisitable:xd});function y(_,w){if(!fe.isUndefined(_)){if(f.indexOf(_)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(_),fe.forEach(_,function(I,P){(!(fe.isUndefined(I)||I===null)&&i.call(t,I,fe.isString(P)?P.trim():P,w,h))===!0&&y(I,w?w.concat(P):[P])}),f.pop()}}if(!fe.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Um(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function R0(e,t){this._pairs=[],e&&xl(e,this,t)}const l8=R0.prototype;l8.append=function(t,r){this._pairs.push([t,r])};l8.toString=function(t){const r=t?function(n){return t.call(this,n,Um)}:Um;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function mU(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function f8(e,t,r){if(!t)return e;const n=r&&r.encode||mU;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 R0(t,r).toString(n),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class gU{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 Fm=gU,d8={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vU=typeof URLSearchParams<"u"?URLSearchParams:R0,yU=typeof FormData<"u"?FormData:null,bU=typeof Blob<"u"?Blob:null,wU={isBrowser:!0,classes:{URLSearchParams:vU,FormData:yU,Blob:bU},protocols:["http","https","file","blob","url","data"]};const N0=typeof window<"u"&&typeof document<"u",Sd=typeof navigator=="object"&&navigator||void 0,_U=N0&&(!Sd||["ReactNative","NativeScript","NS"].indexOf(Sd.product)<0),xU=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),SU=N0&&window.location.href||"http://localhost";var EU=Object.freeze({__proto__:null,hasBrowserEnv:N0,hasStandardBrowserWebWorkerEnv:xU,hasStandardBrowserEnv:_U,navigator:Sd,origin:SU}),Er={...EU,...wU};function MU(e,t){return xl(e,new Er.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){return Er.isNode&&fe.isBuffer(r)?(this.append(n,r.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function CU(e){return fe.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function AU(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 h8(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]=AU(i[o])),!a)}if(fe.isFormData(e)&&fe.isFunction(e.entries)){const r={};return fe.forEachEntry(e,(n,i)=>{t(CU(n),i,r,0)}),r}return null}function TU(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 D0={transitional:d8,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(h8(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 MU(t,this.formSerializer).toString();if((a=fe.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return xl(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(r.setContentType("application/json",!1),TU(t)):t}],transformResponse:[function(t){const r=this.transitional||D0.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:Er.classes.FormData,Blob:Er.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=>{D0.headers[e]={}});var $0=D0;const OU=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 IU=e=>{const t={};let r,n,i;return e&&e.split(`
|
|
93
|
+
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&OU[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const zm=Symbol("internals");function ua(e){return e&&String(e).trim().toLowerCase()}function Xc(e){return e===!1||e==null?e:fe.isArray(e)?e.map(Xc):String(e)}function kU(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 jU=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function yf(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 PU(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function RU(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 Sl{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function s(a,c,u){const l=ua(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]=Xc(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())&&!jU(t))o(IU(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=ua(t),t){const n=fe.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return kU(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=ua(t),t){const n=fe.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||yf(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function s(o){if(o=ua(o),o){const a=fe.findKey(n,o);a&&(!r||yf(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||yf(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]=Xc(i),delete r[s];return}const a=t?PU(s):String(s).trim();a!==s&&delete r[s],r[a]=Xc(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(`
|
|
94
|
+
`)}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[zm]=this[zm]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=ua(o);n[a]||(RU(i,o),n[a]=!0)}return fe.isArray(t)?t.forEach(s):s(t),this}}Sl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(Sl.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});fe.freezeMethods(Sl);var _n=Sl;function bf(e,t){const r=this||$0,n=t||r,i=_n.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 p8(e){return!!(e&&e.__CANCEL__)}function Wo(e,t,r){pt.call(this,e??"canceled",pt.ERR_CANCELED,t,r),this.name="CanceledError"}fe.inherits(Wo,pt,{__CANCEL__:!0});function m8(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 NU(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function DU(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 $U(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 Ru=(e,t,r=3)=>{let n=0;const i=DU(50,250);return $U(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)},Vm=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},qm=e=>(...t)=>fe.asap(()=>e(...t));var BU=Er.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Er.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Er.origin),Er.navigator&&/(msie|trident)/i.test(Er.navigator.userAgent)):()=>!0,LU=Er.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 UU(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function FU(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function g8(e,t){return e&&!UU(t)?FU(e,t):t}const Gm=e=>e instanceof _n?{...e}:e;function Ns(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(Gm(u),Gm(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 v8=e=>{const t=Ns({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;t.headers=o=_n.from(o),t.url=f8(g8(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(Er.hasStandardBrowserEnv||Er.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(Er.hasStandardBrowserEnv&&(n&&fe.isFunction(n)&&(n=n(t)),n||n!==!1&&BU(t.url))){const u=i&&s&&LU.read(s);u&&o.set(i,u)}return t};const zU=typeof XMLHttpRequest<"u";var VU=zU&&function(e){return new Promise(function(r,n){const i=v8(e);let s=i.data;const o=_n.from(i.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=i,l,f,h,y,_;function w(){y&&y(),_&&_(),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 I(){if(!A)return;const N=_n.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};m8(function(q){r(q),w()},function(q){n(q),w()},L),A=null}"onloadend"in A?A.onloadend=I:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(I)},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||d8;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,_]=Ru(u,!0),A.addEventListener("progress",h)),c&&A.upload&&([f,y]=Ru(c),A.upload.addEventListener("progress",f),A.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(l=N=>{A&&(n(!N||N.type?new Wo(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 P=NU(i.url);if(P&&Er.protocols.indexOf(P)===-1){n(new pt("Unsupported protocol "+P+":",pt.ERR_BAD_REQUEST,e));return}A.send(s||null)})};const qU=(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 Wo(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}};var GU=qU;const HU=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},WU=async function*(e,t){for await(const r of KU(e))yield*HU(r,t)},KU=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()}},Hm=(e,t,r,n)=>{const i=WU(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})},El=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",y8=El&&typeof ReadableStream=="function",XU=El&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),b8=(e,...t)=>{try{return!!e(...t)}catch{return!1}},YU=y8&&b8(()=>{let e=!1;const t=new Request(Er.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Wm=64*1024,Ed=y8&&b8(()=>fe.isReadableStream(new Response("").body)),Nu={stream:Ed&&(e=>e.body)};El&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Nu[t]&&(Nu[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 JU=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(Er.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 XU(e)).byteLength},ZU=async(e,t)=>{const r=fe.toFiniteNumber(e.getContentLength());return r??JU(t)};var QU=El&&(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}=v8(e);u=u?(u+"").toLowerCase():"text";let y=GU([i,s&&s.toAbortSignal()],o),_;const w=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let A;try{if(c&&YU&&r!=="get"&&r!=="head"&&(A=await ZU(l,n))!==0){let L=new Request(t,{method:"POST",body:n,duplex:"half"}),H;if(fe.isFormData(n)&&(H=L.headers.get("content-type"))&&l.setContentType(H),L.body){const[q,X]=Vm(A,Ru(qm(c)));n=Hm(L.body,Wm,q,X)}}fe.isString(f)||(f=f?"include":"omit");const I="credentials"in Request.prototype;_=new Request(t,{...h,signal:y,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:I?f:void 0});let P=await fetch(_);const N=Ed&&(u==="stream"||u==="response");if(Ed&&(a||N&&w)){const L={};["status","statusText","headers"].forEach(re=>{L[re]=P[re]});const H=fe.toFiniteNumber(P.headers.get("content-length")),[q,X]=a&&Vm(H,Ru(qm(a),!0))||[];P=new Response(Hm(P.body,Wm,q,()=>{X&&X(),w&&w()}),L)}u=u||"text";let F=await Nu[fe.findKey(Nu,u)||"text"](P,e);return!N&&w&&w(),await new Promise((L,H)=>{m8(L,H,{data:F,headers:_n.from(P.headers),status:P.status,statusText:P.statusText,config:e,request:_})})}catch(I){throw w&&w(),I&&I.name==="TypeError"&&/fetch/i.test(I.message)?Object.assign(new pt("Network Error",pt.ERR_NETWORK,e,_),{cause:I.cause||I}):pt.from(I,I&&I.code,e,_)}});const Md={http:dU,xhr:VU,fetch:QU};fe.forEach(Md,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Km=e=>`- ${e}`,eF=e=>fe.isFunction(e)||e===null||e===!1;var w8={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,!eF(r)&&(n=Md[(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 :
|
|
95
|
+
`+s.map(Km).join(`
|
|
96
|
+
`):" "+Km(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:Md};function wf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wo(null,e)}function Xm(e){return wf(e),e.headers=_n.from(e.headers),e.data=bf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),w8.getAdapter(e.adapter||$0.adapter)(e).then(function(n){return wf(e),n.data=bf.call(e,e.transformResponse,n),n.headers=_n.from(n.headers),n},function(n){return p8(n)||(wf(e),n&&n.response&&(n.response.data=bf.call(e,e.transformResponse,n.response),n.response.headers=_n.from(n.response.headers))),Promise.reject(n)})}const _8="1.7.9",Ml={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ml[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Ym={};Ml.transitional=function(t,r,n){function i(s,o){return"[Axios v"+_8+"] 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&&!Ym[o]&&(Ym[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}};Ml.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function tF(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 Yc={assertOptions:tF,validators:Ml};const jn=Yc.validators;class Du{constructor(t){this.defaults=t,this.interceptors={request:new Fm,response:new Fm}}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+=`
|
|
97
|
+
`+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Ns(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&Yc.assertOptions(n,{silentJSONParsing:jn.transitional(jn.boolean),forcedJSONParsing:jn.transitional(jn.boolean),clarifyTimeoutError:jn.transitional(jn.boolean)},!1),i!=null&&(fe.isFunction(i)?r.paramsSerializer={serialize:i}:Yc.assertOptions(i,{encode:jn.function,serialize:jn.function},!0)),Yc.assertOptions(r,{baseUrl:jn.spelling("baseURL"),withXsrfToken:jn.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"],_=>{delete s[_]}),r.headers=_n.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 _=[Xm.bind(this),void 0];for(_.unshift.apply(_,a),_.push.apply(_,u),h=_.length,l=Promise.resolve(r);f<h;)l=l.then(_[f++],_[f++]);return l}h=a.length;let y=r;for(f=0;f<h;){const _=a[f++],w=a[f++];try{y=_(y)}catch(A){w.call(this,A);break}}try{l=Xm.call(this,y)}catch(_){return Promise.reject(_)}for(f=0,h=u.length;f<h;)l=l.then(u[f++],u[f++]);return l}getUri(t){t=Ns(this.defaults,t);const r=g8(t.baseURL,t.url);return f8(r,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){Du.prototype[t]=function(r,n){return this.request(Ns(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(Ns(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Du.prototype[t]=r(),Du.prototype[t+"Form"]=r(!0)});var Jc=Du;class B0{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 Wo(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 B0(function(i){t=i}),cancel:t}}}var rF=B0;function nF(e){return function(r){return e.apply(null,r)}}function iF(e){return fe.isObject(e)&&e.isAxiosError===!0}const Cd={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(Cd).forEach(([e,t])=>{Cd[t]=e});var sF=Cd;function x8(e){const t=new Jc(e),r=Q6(Jc.prototype.request,t);return fe.extend(r,Jc.prototype,t,{allOwnKeys:!0}),fe.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return x8(Ns(e,i))},r}const cr=x8($0);cr.Axios=Jc;cr.CanceledError=Wo;cr.CancelToken=rF;cr.isCancel=p8;cr.VERSION=_8;cr.toFormData=xl;cr.AxiosError=pt;cr.Cancel=cr.CanceledError;cr.all=function(t){return Promise.all(t)};cr.spread=nF;cr.isAxiosError=iF;cr.mergeConfig=Ns;cr.AxiosHeaders=_n;cr.formToJSON=e=>h8(fe.isHTMLForm(e)?new FormData(e):e);cr.getAdapter=w8.getAdapter;cr.HttpStatusCode=sF;cr.default=cr;var oF=cr;Object.defineProperty(j0,"__esModule",{value:!0});var aF=j0.executeAuction=S8,cF=oF,uF="https://rpc.getshio.com",lF=500,fF=300;function S8(e,t,r){r===void 0&&(r=lF);var n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise(function(i,s){setTimeout(i,r),cF.default.post(uF,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(function(o){console.log("Shio executeAuction response:",o.data),setTimeout(i,fF)}).catch(s)})}j0.default={executeAuction:S8};function dF(){const{suiClient:e}=Ls(),{currentAccount:t}=Cn(),{mutateAsync:r}=$r.useSignTransaction(),{mutate:n}=$r.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=ie.useMemo(()=>t==null?void 0:t.chains[0],[t]),s=async(c,u,l=!1)=>{var h,y;if(l){const _=await e.devInspectTransactionBlock({transactionBlock:uo.Transaction.from(xn(c)),sender:t.address});if(!_||((h=_.effects)==null?void 0:h.status.status)==="failure")throw Error((y=_.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=uo.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,_)=>{n({transaction:l,chain:i},{onSuccess:w=>{y(w)},onError:w=>{console.error("signAndExecuteTransactionBlock transaction failed",w),_(w)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=uo.Transaction.from(c)),typeof c=="string"&&(c=uo.Transaction.from(xn(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,_)=>{console.error("signTransactionBlock onSettled",{data:f,error:h,variables:y})}})})),executeTransactionBlock:s}}function hF(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=dF(),{currentAccount:n}=Cn(),{suiClient:i}=Ls(),{setTransactionData:s}=k0(),{addTxToast:o,removeToast:a}=Go(),c=5,u=2e3;async function l(y,_=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 ${_} failed:`,w),_>=c)throw new Error("Failed to fetch transaction status after maximum retries.");return await tm(u),l(y,_+1)}}const f=async(y,_,w={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock"})=>{var F,L;const{useDevInspect:A=!1,useMev:I,txAction:P="signTransactionBlock"}=w;let N;_.status="confirmation",s(_);try{let H;if(P==="signTransactionBlock"){const X=await e(y),{bytes:re,signature:ae}=X;if(I)try{const oe=await aF(re,ae,500)}catch{}H=await t(re,ae,A)}else H=await r(y,A);_.status="submitted",s({..._}),_.tx=H.digest,N=o(_),await tm(u);const q=await l(H.digest,0);if(!q||((F=q.effects)==null?void 0:F.status.status)==="failure")h(_,(L=q.effects)==null?void 0:L.status.error);else{const X=lj(q,n==null?void 0:n.address,!1);if(_.buildShowInfo){const re=_.buildShowInfo("success",X);_.buildShowInfo=ae=>re}a(N),_.status="success",s({..._})}return q}catch(H){h(_,H)}},h=(y,_)=>{const w=EL(_);if(y.buildShowInfo){const A=y.buildShowInfo("confirmation");y.buildShowInfo=I=>(A.toastDescriptionContent=w,A.modalDescriptionText=w,A),y.status="rejected",s({...y})}else y.buildShowInfo=A=>{const I={};return I.toastDescriptionContent=w,I.modalDescriptionText=w,I},y.status="rejected",s({...y})};return{signAndExecuteTransaction:f}}function E8(e,t=1e3){const r=ie.useRef(),n=ie.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return ie.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function pF(){const{aggregatorSDK:e}=Ls(),{findBestRouters:t}=wL(),{getTokenAmountValue:r,fetchTokenPrices:n}=yl(),{providers:i,slippage:s,mevProtect:o}=Wr(),{signAndExecuteTransaction:a}=hF(),{setTransactionData:c}=k0(),{addTxToast:u}=Go(),{fromCoin:l,toCoin:f,setFromCoin:h,setToCoin:y,setToAmount:_,fromAmount:w,toAmount:A,setFromAmount:I,setFindRouterLoading:P,setRouterData:N,setByAmountIn:F,byAmountIn:L}=sn(),[H,q]=ie.useState(""),X=Zs(H),re=Zs(L),ae=Zs(w),oe=Zs(A),V=Zs(l),$=Zs(f),{balanceInfo:p,getOwnerCoinBalances:d}=Pu(l==null?void 0:l.coin_type),{balanceInfo:m}=Pu(f==null?void 0:f.coin_type),x=r(l==null?void 0:l.coin_type,w),E=r(f==null?void 0:f.coin_type,A),k=E8(async(Me,Ke,Ue)=>{if(V.current&&$.current&&+Me){(+ae.current||+oe.current)&&P(!0);const lt=aj(Me,Ke?V.current.decimals:$.current.decimals),ht=await t({fromToken:V.current,toToken:$.current,amount:lt.toString(),providersKeys:i,by_amount_in:Ke,uuid:Ue});P(!1),X.current===Ue&&(Ke?+ae.current?(_(ht.toAmountUi||""),N(ht)):_(""):+oe.current?(I(ht.fromAmountUi||"ß"),N(ht)):I(""))}else v(!Ke)},500),T=(Me,Ke,Ue=!1)=>{if(F(Ke),Ke?(I(Me),Ue&&_("")):(_(Me),Ue&&I("")),+Me){const lt=Nm();q(lt),k(Me,Ke,lt)}else P(!1),N(void 0),v(!Ke)},g=(Me,Ke=!0)=>{v(),Ke?((Me==null?void 0:Me.coin_type)===(f==null?void 0:f.coin_type)&&y(l),h(Me)):((Me==null?void 0:Me.coin_type)===(l==null?void 0:l.coin_type)&&h(f),y(Me))},v=Me=>{Me===void 0?(I(""),_("")):Me?I(""):_(""),P(!1),N(void 0)},R=()=>{const Me=re.current?ae.current:oe.current;if(+Me){const Ke=Nm();q(Ke),k(Me,re.current,Ke)}},se=async(Me,Ke)=>{const{routerData:Ue,byAmountIn:lt,fromAmountUi:ht,toAmountUi:$e}=Me,mt=new uo.Transaction,we={routers:Ue.routes,byAmountIn:lt,slippage:Number(s),txb:mt};Ke&&(we.partner=Ke);try{await e.fastRouterSwap(we);const me={status:"confirmation",buildShowInfo:(qe,De)=>{const Oe=`Swap ${en(ht,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${en($e,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`,Ie={modalDescriptionText:Oe,toastTitleText:Oe};if(qe==="success"){let Le=ht,ft=$e;De&&(Le=rm(De,l)||ht,ft=rm(De,f)||$e);const dt=`Swapped ${en(Le,l==null?void 0:l.decimals)} ${l==null?void 0:l.symbol} for ${en(ft,f==null?void 0:f.decimals)} ${f==null?void 0:f.symbol}`;Ie.toastTitleText=dt,Ie.modalDescriptionText=dt}return Ie},id:0};c(me),await a(mt,me,{useMev:o})?(v(),d()):R()}catch(me){String(me).includes("TypeError: Failed to fetch")&&u({id:0,status:"rejected",buildShowInfo(Te,qe){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};ie.useEffect(()=>{ue(),v()},[l==null?void 0:l.coin_type,f==null?void 0:f.coin_type]);const ue=()=>{const Me=[];l&&Me.push(l.coin_type),f&&Me.push(f.coin_type),Me.length>0&&n(Me)},{isScamsCoin:xe}=Dm(l),{isScamsCoin:be}=Dm(f),Ce=ie.useMemo(()=>{if(!(!xe&&!be)){if(xe&&be)return`${l==null?void 0:l.symbol} and ${f==null?void 0:f.symbol} are`;if(xe)return`${l==null?void 0:l.symbol} token is `;if(be)return`${f==null?void 0:f.symbol} token is `}},[xe,be]);return{handleAmountChange:T,handleSelectToken:g,fromBalanceInfo:p,toBalanceInfo:m,fromAmountValue:x,toAmountValue:E,doSwapAction:se,reCalculateRouteData:R,refreshMarketPrice:ue,scamsText:Ce}}function mF(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=sn(),{currentAccount:o}=Cn(),a=ie.useMemo(()=>{const c={text:"Swap",disabled:!1};return o!=null&&o.address?!t||!r?(c.text="Select a token",c.disabled=!0,c):!+n&&!+i?(c.text="Enter an amount",c.disabled=!0,c):s&&s.isExceed?(c.text="Insufficient liquidity for this trade",c.disabled=!0,c):+n&&Ve(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${t==null?void 0:t.symbol} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c):(c.text="Connect Wallet",c.disabled=!1,c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.isExceed,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function M8({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 b.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",children:[b.jsx("circle",{cx:"50",cy:"50",r:s,fill:"none",stroke:n,strokeWidth:t}),b.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"}}),b.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]=ae.useState(!0),a=c8(s,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[_.jsx(Gr,{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"," ",Pc(s?e.symbol:t.symbol)," ","="," ",i?_.jsx(Yo,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):rn(a,t.decimals)," ",Pc(s?t.symbol:e.symbol)]}),_.jsx(Gr,{src:s?t.logo_url:e.logo_url}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function d8(e,t,r,n){const{getTokenPrice:i}=Wl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=c8(!0,r,n),c=ae.useMemo(()=>{if(o&&s)return Ve(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=ae.useMemo(()=>{if(c&&+a)return Ve(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=ae.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=ae.useMemo(()=>u&&Ve(u).lt(0)?Ve(u).abs().gt(5):!1,[u]),h=ae.useMemo(()=>u&&Ve(u).lt(0)?Ve(u).abs().gt(10):!1,[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h}}function Ja({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=ae.useState(!1),[o,a]=ae.useState(!1),c=ae.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};ae.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=ae.useRef(null),[y,b]=ae.useState({left:void 0,top:void 0});return ae.useEffect(()=>{var w;if(i&&h.current){const T=(w=h.current)==null?void 0:w.getBoundingClientRect();let P,R;r==="top"?(P=`${window.scrollX+T.left+T.width/2}px`,R=`${window.scrollY+T.top-2*T.height-8}px`):r==="bottom"?(P=`${window.scrollX+T.left+T.width/2}px`,R=`${window.scrollY+T.bottom}px`):r==="left"?(P=`${window.scrollX+T.left-8}px`,R=`${window.scrollY+T.top+T.height/2}px`):r==="right"?(P=`${window.scrollX+T.right+8}px`,R=`${window.scrollY+T.top+T.height/2}px`):(P=`${window.scrollX+T.left+T.width/2}px`,R=`${window.scrollY+T.top+T.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&&Yu.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 h8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=In(),{priceImpact:a,sources:c,marketPrice:u}=d8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi),l=ae.useMemo(()=>{if(a){if(Ve(a).gt(0))return"green";const f=Ve(a).abs();return f.gt(1)&&f.lt(10)?"yellow":f.gte(10)?"red":"green"}return"yellow"},[a]);return _.jsxs(_.Fragment,{children:[!r&&Ve(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",{children:"Price Impact"}),_.jsx(Ja,{content:_.jsx(KU,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),position:"bottom",delay:300,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(Yo,{style:{width:"80px",height:"20px"}}),!e&&_.jsxs("div",{className:"right",children:[_.jsx("span",{className:l,children:a?mR(a,2):"Incalculable"}),_.jsx("div",{className:"platforms",children:c.map(f=>_.jsx(Ja,{content:_.jsx("span",{style:{fontSize:"12px"},children:_4[f]}),position:"top",delay:300,children:_.jsx(Gr,{src:DR[f]})},f))})]})]})]})]})}function KU({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[_.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:"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(s=>_4[s]+" ").join("")})]})]})}function p8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=In();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(Yo,{style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[rn(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,sn.ROUND_DOWN)," ",o?s==null?void 0:s.symbol:i==null?void 0:i.symbol]})]})}function XU({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(S4,{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 JU({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(JU,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Lc=globalThis||void 0||self;var YU=typeof Lc=="object"&&Lc&&Lc.Object===Object&&Lc;const m8=YU;var ZU=typeof self=="object"&&self&&self.Object===Object&&self,QU=m8||ZU||Function("return this")();const ri=QU;var ez=ri.Symbol;const Zn=ez;var g8=Object.prototype,tz=g8.hasOwnProperty,rz=g8.toString,ma=Zn?Zn.toStringTag:void 0;function nz(e){var t=tz.call(e,ma),r=e[ma];try{e[ma]=void 0;var n=!0}catch{}var i=rz.call(e);return n&&(t?e[ma]=r:delete e[ma]),i}var iz=Object.prototype,sz=iz.toString;function oz(e){return sz.call(e)}var az="[object Null]",cz="[object Undefined]",qg=Zn?Zn.toStringTag:void 0;function Qo(e){return e==null?e===void 0?cz:az:qg&&qg in Object(e)?nz(e):oz(e)}function ns(e){return e!=null&&typeof e=="object"}var uz="[object Symbol]";function Ya(e){return typeof e=="symbol"||ns(e)&&Qo(e)==uz}function uu(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 lz=Array.isArray;const zr=lz;var fz=1/0,Hg=Zn?Zn.prototype:void 0,Wg=Hg?Hg.toString:void 0;function v8(e){if(typeof e=="string")return e;if(zr(e))return uu(e,v8)+"";if(Ya(e))return Wg?Wg.call(e):"";var t=e+"";return t=="0"&&1/e==-fz?"-0":t}function ea(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function y8(e){return e}var dz="[object AsyncFunction]",hz="[object Function]",pz="[object GeneratorFunction]",mz="[object Proxy]";function b8(e){if(!ea(e))return!1;var t=Qo(e);return t==hz||t==pz||t==dz||t==mz}var gz=ri["__core-js_shared__"];const ed=gz;var Gg=function(){var e=/[^.]+$/.exec(ed&&ed.keys&&ed.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function vz(e){return!!Gg&&Gg in e}var yz=Function.prototype,bz=yz.toString;function Ws(e){if(e!=null){try{return bz.call(e)}catch{}try{return e+""}catch{}}return""}var wz=/[\\^$.*+?()[\]{}|]/g,_z=/^\[object .+?Constructor\]$/,xz=Function.prototype,Sz=Object.prototype,Ez=xz.toString,Cz=Sz.hasOwnProperty,Mz=RegExp("^"+Ez.call(Cz).replace(wz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Az(e){if(!ea(e)||vz(e))return!1;var t=b8(e)?Mz:_z;return t.test(Ws(e))}function Tz(e,t){return e==null?void 0:e[t]}function Gs(e,t){var r=Tz(e,t);return Az(r)?r:void 0}var Oz=Gs(ri,"WeakMap");const ch=Oz;var Kg=Object.create,Iz=function(){function e(){}return function(t){if(!ea(t))return{};if(Kg)return Kg(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const Pz=Iz;function kz(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var jz=function(){try{var e=Gs(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Xg=jz;function Rz(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var Nz=9007199254740991,Dz=/^(?:0|[1-9]\d*)$/;function w8(e,t){var r=typeof e;return t=t??Nz,!!t&&(r=="number"||r!="symbol"&&Dz.test(e))&&e>-1&&e%1==0&&e<t}function _8(e,t,r){t=="__proto__"&&Xg?Xg(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function M0(e,t){return e===t||e!==e&&t!==t}var Bz=Object.prototype,$z=Bz.hasOwnProperty;function x8(e,t,r){var n=e[t];(!($z.call(e,t)&&M0(n,r))||r===void 0&&!(t in e))&&_8(e,t,r)}function Gl(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?_8(r,a,c):x8(r,a,c)}return r}var Lz=9007199254740991;function A0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Lz}function Kl(e){return e!=null&&A0(e.length)&&!b8(e)}var Fz=Object.prototype;function T0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Fz;return e===r}function Uz(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var zz="[object Arguments]";function Jg(e){return ns(e)&&Qo(e)==zz}var S8=Object.prototype,Vz=S8.hasOwnProperty,qz=S8.propertyIsEnumerable,Hz=Jg(function(){return arguments}())?Jg:function(e){return ns(e)&&Vz.call(e,"callee")&&!qz.call(e,"callee")};const E8=Hz;function Wz(){return!1}var C8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Yg=C8&&typeof module=="object"&&module&&!module.nodeType&&module,Gz=Yg&&Yg.exports===C8,Zg=Gz?ri.Buffer:void 0,Kz=Zg?Zg.isBuffer:void 0,Xz=Kz||Wz;const Ku=Xz;var Jz="[object Arguments]",Yz="[object Array]",Zz="[object Boolean]",Qz="[object Date]",eV="[object Error]",tV="[object Function]",rV="[object Map]",nV="[object Number]",iV="[object Object]",sV="[object RegExp]",oV="[object Set]",aV="[object String]",cV="[object WeakMap]",uV="[object ArrayBuffer]",lV="[object DataView]",fV="[object Float32Array]",dV="[object Float64Array]",hV="[object Int8Array]",pV="[object Int16Array]",mV="[object Int32Array]",gV="[object Uint8Array]",vV="[object Uint8ClampedArray]",yV="[object Uint16Array]",bV="[object Uint32Array]",Xt={};Xt[fV]=Xt[dV]=Xt[hV]=Xt[pV]=Xt[mV]=Xt[gV]=Xt[vV]=Xt[yV]=Xt[bV]=!0;Xt[Jz]=Xt[Yz]=Xt[uV]=Xt[Zz]=Xt[lV]=Xt[Qz]=Xt[eV]=Xt[tV]=Xt[rV]=Xt[nV]=Xt[iV]=Xt[sV]=Xt[oV]=Xt[aV]=Xt[cV]=!1;function wV(e){return ns(e)&&A0(e.length)&&!!Xt[Qo(e)]}function Xl(e){return function(t){return e(t)}}var M8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ja=M8&&typeof module=="object"&&module&&!module.nodeType&&module,_V=ja&&ja.exports===M8,td=_V&&m8.process,xV=function(){try{var e=ja&&ja.require&&ja.require("util").types;return e||td&&td.binding&&td.binding("util")}catch{}}();const No=xV;var Qg=No&&No.isTypedArray,SV=Qg?Xl(Qg):wV;const A8=SV;var EV=Object.prototype,CV=EV.hasOwnProperty;function T8(e,t){var r=zr(e),n=!r&&E8(e),i=!r&&!n&&Ku(e),s=!r&&!n&&!i&&A8(e),o=r||n||i||s,a=o?Uz(e.length,String):[],c=a.length;for(var u in e)(t||CV.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||w8(u,c)))&&a.push(u);return a}function O8(e,t){return function(r){return e(t(r))}}var MV=O8(Object.keys,Object);const AV=MV;var TV=Object.prototype,OV=TV.hasOwnProperty;function IV(e){if(!T0(e))return AV(e);var t=[];for(var r in Object(e))OV.call(e,r)&&r!="constructor"&&t.push(r);return t}function _c(e){return Kl(e)?T8(e):IV(e)}function PV(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var kV=Object.prototype,jV=kV.hasOwnProperty;function RV(e){if(!ea(e))return PV(e);var t=T0(e),r=[];for(var n in e)n=="constructor"&&(t||!jV.call(e,n))||r.push(n);return r}function O0(e){return Kl(e)?T8(e,!0):RV(e)}var NV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,DV=/^\w*$/;function I0(e,t){if(zr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ya(e)?!0:DV.test(e)||!NV.test(e)||t!=null&&e in Object(t)}var BV=Gs(Object,"create");const Za=BV;function $V(){this.__data__=Za?Za(null):{},this.size=0}function LV(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var FV="__lodash_hash_undefined__",UV=Object.prototype,zV=UV.hasOwnProperty;function VV(e){var t=this.__data__;if(Za){var r=t[e];return r===FV?void 0:r}return zV.call(t,e)?t[e]:void 0}var qV=Object.prototype,HV=qV.hasOwnProperty;function WV(e){var t=this.__data__;return Za?t[e]!==void 0:HV.call(t,e)}var GV="__lodash_hash_undefined__";function KV(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Za&&t===void 0?GV:t,this}function Fs(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])}}Fs.prototype.clear=$V;Fs.prototype.delete=LV;Fs.prototype.get=VV;Fs.prototype.has=WV;Fs.prototype.set=KV;function XV(){this.__data__=[],this.size=0}function Jl(e,t){for(var r=e.length;r--;)if(M0(e[r][0],t))return r;return-1}var JV=Array.prototype,YV=JV.splice;function ZV(e){var t=this.__data__,r=Jl(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():YV.call(t,r,1),--this.size,!0}function QV(e){var t=this.__data__,r=Jl(t,e);return r<0?void 0:t[r][1]}function eq(e){return Jl(this.__data__,e)>-1}function tq(e,t){var r=this.__data__,n=Jl(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Ti(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])}}Ti.prototype.clear=XV;Ti.prototype.delete=ZV;Ti.prototype.get=QV;Ti.prototype.has=eq;Ti.prototype.set=tq;var rq=Gs(ri,"Map");const Qa=rq;function nq(){this.size=0,this.__data__={hash:new Fs,map:new(Qa||Ti),string:new Fs}}function iq(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Yl(e,t){var r=e.__data__;return iq(t)?r[typeof t=="string"?"string":"hash"]:r.map}function sq(e){var t=Yl(this,e).delete(e);return this.size-=t?1:0,t}function oq(e){return Yl(this,e).get(e)}function aq(e){return Yl(this,e).has(e)}function cq(e,t){var r=Yl(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Oi(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])}}Oi.prototype.clear=nq;Oi.prototype.delete=sq;Oi.prototype.get=oq;Oi.prototype.has=aq;Oi.prototype.set=cq;var uq="Expected a function";function P0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(uq);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(P0.Cache||Oi),r}P0.Cache=Oi;var lq=500;function fq(e){var t=P0(e,function(n){return r.size===lq&&r.clear(),n}),r=t.cache;return t}var dq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hq=/\\(\\)?/g,pq=fq(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(dq,function(r,n,i,s){t.push(i?s.replace(hq,"$1"):n||r)}),t});const mq=pq;function gq(e){return e==null?"":v8(e)}function I8(e,t){return zr(e)?e:I0(e,t)?[e]:mq(gq(e))}var vq=1/0;function Zl(e){if(typeof e=="string"||Ya(e))return e;var t=e+"";return t=="0"&&1/e==-vq?"-0":t}function k0(e,t){t=I8(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Zl(t[r++])];return r&&r==n?e:void 0}function yq(e,t,r){var n=e==null?void 0:k0(e,t);return n===void 0?r:n}function P8(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var bq=O8(Object.getPrototypeOf,Object);const k8=bq;function wq(){this.__data__=new Ti,this.size=0}function _q(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function xq(e){return this.__data__.get(e)}function Sq(e){return this.__data__.has(e)}var Eq=200;function Cq(e,t){var r=this.__data__;if(r instanceof Ti){var n=r.__data__;if(!Qa||n.length<Eq-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Oi(n)}return r.set(e,t),this.size=r.size,this}function Wn(e){var t=this.__data__=new Ti(e);this.size=t.size}Wn.prototype.clear=wq;Wn.prototype.delete=_q;Wn.prototype.get=xq;Wn.prototype.has=Sq;Wn.prototype.set=Cq;function Mq(e,t){return e&&Gl(t,_c(t),e)}function Aq(e,t){return e&&Gl(t,O0(t),e)}var j8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ev=j8&&typeof module=="object"&&module&&!module.nodeType&&module,Tq=ev&&ev.exports===j8,tv=Tq?ri.Buffer:void 0,rv=tv?tv.allocUnsafe:void 0;function Oq(e,t){if(t)return e.slice();var r=e.length,n=rv?rv(r):new e.constructor(r);return e.copy(n),n}function R8(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 N8(){return[]}var Iq=Object.prototype,Pq=Iq.propertyIsEnumerable,nv=Object.getOwnPropertySymbols,kq=nv?function(e){return e==null?[]:(e=Object(e),R8(nv(e),function(t){return Pq.call(e,t)}))}:N8;const j0=kq;function jq(e,t){return Gl(e,j0(e),t)}var Rq=Object.getOwnPropertySymbols,Nq=Rq?function(e){for(var t=[];e;)P8(t,j0(e)),e=k8(e);return t}:N8;const D8=Nq;function Dq(e,t){return Gl(e,D8(e),t)}function B8(e,t,r){var n=t(e);return zr(e)?n:P8(n,r(e))}function uh(e){return B8(e,_c,j0)}function Bq(e){return B8(e,O0,D8)}var $q=Gs(ri,"DataView");const lh=$q;var Lq=Gs(ri,"Promise");const fh=Lq;var Fq=Gs(ri,"Set");const dh=Fq;var iv="[object Map]",Uq="[object Object]",sv="[object Promise]",ov="[object Set]",av="[object WeakMap]",cv="[object DataView]",zq=Ws(lh),Vq=Ws(Qa),qq=Ws(fh),Hq=Ws(dh),Wq=Ws(ch),Ss=Qo;(lh&&Ss(new lh(new ArrayBuffer(1)))!=cv||Qa&&Ss(new Qa)!=iv||fh&&Ss(fh.resolve())!=sv||dh&&Ss(new dh)!=ov||ch&&Ss(new ch)!=av)&&(Ss=function(e){var t=Qo(e),r=t==Uq?e.constructor:void 0,n=r?Ws(r):"";if(n)switch(n){case zq:return cv;case Vq:return iv;case qq:return sv;case Hq:return ov;case Wq:return av}return t});const ec=Ss;var Gq=Object.prototype,Kq=Gq.hasOwnProperty;function Xq(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&Kq.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Jq=ri.Uint8Array;const Xu=Jq;function R0(e){var t=new e.constructor(e.byteLength);return new Xu(t).set(new Xu(e)),t}function Yq(e,t){var r=t?R0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var Zq=/\w*$/;function Qq(e){var t=new e.constructor(e.source,Zq.exec(e));return t.lastIndex=e.lastIndex,t}var uv=Zn?Zn.prototype:void 0,lv=uv?uv.valueOf:void 0;function eH(e){return lv?Object(lv.call(e)):{}}function tH(e,t){var r=t?R0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var rH="[object Boolean]",nH="[object Date]",iH="[object Map]",sH="[object Number]",oH="[object RegExp]",aH="[object Set]",cH="[object String]",uH="[object Symbol]",lH="[object ArrayBuffer]",fH="[object DataView]",dH="[object Float32Array]",hH="[object Float64Array]",pH="[object Int8Array]",mH="[object Int16Array]",gH="[object Int32Array]",vH="[object Uint8Array]",yH="[object Uint8ClampedArray]",bH="[object Uint16Array]",wH="[object Uint32Array]";function _H(e,t,r){var n=e.constructor;switch(t){case lH:return R0(e);case rH:case nH:return new n(+e);case fH:return Yq(e,r);case dH:case hH:case pH:case mH:case gH:case vH:case yH:case bH:case wH:return tH(e,r);case iH:return new n;case sH:case cH:return new n(e);case oH:return Qq(e);case aH:return new n;case uH:return eH(e)}}function xH(e){return typeof e.constructor=="function"&&!T0(e)?Pz(k8(e)):{}}var SH="[object Map]";function EH(e){return ns(e)&&ec(e)==SH}var fv=No&&No.isMap,CH=fv?Xl(fv):EH;const MH=CH;var AH="[object Set]";function TH(e){return ns(e)&&ec(e)==AH}var dv=No&&No.isSet,OH=dv?Xl(dv):TH;const IH=OH;var PH=1,kH=2,jH=4,$8="[object Arguments]",RH="[object Array]",NH="[object Boolean]",DH="[object Date]",BH="[object Error]",L8="[object Function]",$H="[object GeneratorFunction]",LH="[object Map]",FH="[object Number]",F8="[object Object]",UH="[object RegExp]",zH="[object Set]",VH="[object String]",qH="[object Symbol]",HH="[object WeakMap]",WH="[object ArrayBuffer]",GH="[object DataView]",KH="[object Float32Array]",XH="[object Float64Array]",JH="[object Int8Array]",YH="[object Int16Array]",ZH="[object Int32Array]",QH="[object Uint8Array]",eW="[object Uint8ClampedArray]",tW="[object Uint16Array]",rW="[object Uint32Array]",Ht={};Ht[$8]=Ht[RH]=Ht[WH]=Ht[GH]=Ht[NH]=Ht[DH]=Ht[KH]=Ht[XH]=Ht[JH]=Ht[YH]=Ht[ZH]=Ht[LH]=Ht[FH]=Ht[F8]=Ht[UH]=Ht[zH]=Ht[VH]=Ht[qH]=Ht[QH]=Ht[eW]=Ht[tW]=Ht[rW]=!0;Ht[BH]=Ht[L8]=Ht[HH]=!1;function lu(e,t,r,n,i,s){var o,a=t&PH,c=t&kH,u=t&jH;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ea(e))return e;var l=zr(e);if(l){if(o=Xq(e),!a)return kz(e,o)}else{var f=ec(e),h=f==L8||f==$H;if(Ku(e))return Oq(e,a);if(f==F8||f==$8||h&&!i){if(o=c||h?{}:xH(e),!a)return c?Dq(e,Aq(o,e)):jq(e,Mq(o,e))}else{if(!Ht[f])return i?e:{};o=_H(e,f,a)}}s||(s=new Wn);var y=s.get(e);if(y)return y;s.set(e,o),IH(e)?e.forEach(function(T){o.add(lu(T,t,r,T,e,s))}):MH(e)&&e.forEach(function(T,P){o.set(P,lu(T,t,r,P,e,s))});var b=u?c?Bq:uh:c?O0:_c,w=l?void 0:b(e);return Rz(w||e,function(T,P){w&&(P=T,T=e[P]),x8(o,P,lu(T,t,r,P,e,s))}),o}var nW=1,iW=4;function sW(e){return lu(e,nW|iW)}var oW="__lodash_hash_undefined__";function aW(e){return this.__data__.set(e,oW),this}function cW(e){return this.__data__.has(e)}function Ju(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Oi;++t<r;)this.add(e[t])}Ju.prototype.add=Ju.prototype.push=aW;Ju.prototype.has=cW;function uW(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 lW(e,t){return e.has(t)}var fW=1,dW=2;function U8(e,t,r,n,i,s){var o=r&fW,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&dW?new Ju:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var b=e[f],w=t[f];if(n)var T=o?n(w,b,f,t,e,s):n(b,w,f,e,t,s);if(T!==void 0){if(T)continue;h=!1;break}if(y){if(!uW(t,function(P,R){if(!lW(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 hW(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function pW(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var mW=1,gW=2,vW="[object Boolean]",yW="[object Date]",bW="[object Error]",wW="[object Map]",_W="[object Number]",xW="[object RegExp]",SW="[object Set]",EW="[object String]",CW="[object Symbol]",MW="[object ArrayBuffer]",AW="[object DataView]",hv=Zn?Zn.prototype:void 0,rd=hv?hv.valueOf:void 0;function TW(e,t,r,n,i,s,o){switch(r){case AW:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case MW:return!(e.byteLength!=t.byteLength||!s(new Xu(e),new Xu(t)));case vW:case yW:case _W:return M0(+e,+t);case bW:return e.name==t.name&&e.message==t.message;case xW:case EW:return e==t+"";case wW:var a=hW;case SW:var c=n&mW;if(a||(a=pW),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=gW,o.set(e,t);var l=U8(a(e),a(t),n,i,s,o);return o.delete(e),l;case CW:if(rd)return rd.call(e)==rd.call(t)}return!1}var OW=1,IW=Object.prototype,PW=IW.hasOwnProperty;function kW(e,t,r,n,i,s){var o=r&OW,a=uh(e),c=a.length,u=uh(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:PW.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 T=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}T||(T=h=="constructor")}if(w&&!T){var z=e.constructor,F=t.constructor;z!=F&&"constructor"in e&&"constructor"in t&&!(typeof z=="function"&&z instanceof z&&typeof F=="function"&&F instanceof F)&&(w=!1)}return s.delete(e),s.delete(t),w}var jW=1,pv="[object Arguments]",mv="[object Array]",Fc="[object Object]",RW=Object.prototype,gv=RW.hasOwnProperty;function NW(e,t,r,n,i,s){var o=zr(e),a=zr(t),c=o?mv:ec(e),u=a?mv:ec(t);c=c==pv?Fc:c,u=u==pv?Fc:u;var l=c==Fc,f=u==Fc,h=c==u;if(h&&Ku(e)){if(!Ku(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new Wn),o||A8(e)?U8(e,t,r,n,i,s):TW(e,t,c,r,n,i,s);if(!(r&jW)){var y=l&&gv.call(e,"__wrapped__"),b=f&&gv.call(t,"__wrapped__");if(y||b){var w=y?e.value():e,T=b?t.value():t;return s||(s=new Wn),i(w,T,r,n,s)}}return h?(s||(s=new Wn),kW(e,t,r,n,i,s)):!1}function Ql(e,t,r,n,i){return e===t?!0:e==null||t==null||!ns(e)&&!ns(t)?e!==e&&t!==t:NW(e,t,r,n,Ql,i)}var DW=1,BW=2;function $W(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 Wn;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?Ql(l,u,DW|BW,n,f):h))return!1}}return!0}function z8(e){return e===e&&!ea(e)}function LW(e){for(var t=_c(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,z8(i)]}return t}function V8(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function FW(e){var t=LW(e);return t.length==1&&t[0][2]?V8(t[0][0],t[0][1]):function(r){return r===e||$W(r,e,t)}}function UW(e,t){return e!=null&&t in Object(e)}function zW(e,t,r){t=I8(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Zl(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&&A0(i)&&w8(o,i)&&(zr(e)||E8(e)))}function VW(e,t){return e!=null&&zW(e,t,UW)}var qW=1,HW=2;function WW(e,t){return I0(e)&&z8(t)?V8(Zl(e),t):function(r){var n=yq(r,e);return n===void 0&&n===t?VW(r,e):Ql(t,n,qW|HW)}}function GW(e){return function(t){return t==null?void 0:t[e]}}function KW(e){return function(t){return k0(t,e)}}function XW(e){return I0(e)?GW(Zl(e)):KW(e)}function q8(e){return typeof e=="function"?e:e==null?y8:typeof e=="object"?zr(e)?WW(e[0],e[1]):FW(e):XW(e)}function JW(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 YW=JW();const ZW=YW;function QW(e,t){return e&&ZW(e,t,_c)}function eG(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 tG=eG(QW);const H8=tG;function rG(e,t){var r=[];return H8(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function nG(e,t){var r=zr(e)?R8:rG;return r(e,q8(t))}function iG(e,t){var r=-1,n=Kl(e)?Array(e.length):[];return H8(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function sG(e,t){return Ql(e,t)}function oG(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function aG(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Ya(e),o=t!==void 0,a=t===null,c=t===t,u=Ya(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 cG(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=aG(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 uG(e,t,r){t.length?t=uu(t,function(s){return zr(s)?function(o){return k0(o,s.length===1?s[0]:s)}:s}):t=[y8];var n=-1;t=uu(t,Xl(q8));var i=iG(e,function(s,o,a){var c=uu(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return oG(i,function(s,o){return cG(s,o,r)})}function lG(e,t,r,n){return e==null?[]:(zr(t)||(t=t==null?[]:[t]),r=n?void 0:r,zr(r)||(r=r==null?[]:[r]),uG(e,t,r))}function fG({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=In(),s=ae.useRef(!1),{slippage:o}=Xr(),[a,c]=ae.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=a8(o,a),{showPriceImpactTips:y,showPriceImpactWarn:b}=d8(n,i,u,l),{priceAcceptRouterData:w}=PU(a),[T,P]=ae.useState(!1),[R,N]=ae.useState(!1);ae.useMemo(()=>f?i:n,[f]);const z=ae.useMemo(()=>w!==void 0,[w]),F=()=>{if(w){if(s.current)return;s.current=!0;const q=sW(w);c(q),setTimeout(()=>{s.current=!1},300)}},W=ae.useMemo(()=>T?!1:!!b,[T,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:Po(u||"")}),_.jsx("img",{src:n==null?void 0:n.logo_url}),_.jsx("span",{className:"symbol",children: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:Po(l||"")}),_.jsx("img",{src:i==null?void 0:i.logo_url}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]}),_.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"16px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[_.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",margin:"-1px"},children:_.jsx(E0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&_.jsx("div",{style:{paddingBottom:"10px"},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(p8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),_.jsx(h8,{isLoading:!1,routerData:a,noTips:!0}),b&&_.jsxs("div",{style:{width:"100%",marginTop:"16px",gap:"1px"},children:[_.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"10px",paddingBottom:"10px",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:T?"#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."})]})]})]}),!z&&_.jsx("button",{disabled:W||R,className:"swap-btn cs-solid-btn",onClick:()=>{R||(N(!0),t(a))},children:R?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(f8,{})}):"Confirm Swap"}),z&&_.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:F,children:"Accept"})})]})]})}function ef(e){const{text:t}=e,[r,n]=ae.useState(!1),{addCommonToast:i}=Zo(),s=o=>{r||(Al(o),i8(t,{debug:!1,message:"message"}),i("Copied success"),n(!r))};return ae.useEffect(()=>{r&&setTimeout(()=>{n(!1)},2e3)},[r]),_.jsx(_.Fragment,{children:_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:s,children:_.jsx("use",{xlinkHref:r?"#icon-sel":"#icon-copy"})})})}function dG({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=In(),{getTokenInfo:a}=Hs(),c=ae.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(W8,{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(Gr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:rn(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",style:{backgroundColor:"#1B242C"},children:_.jsx("div",{className:"center",style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px"},children:c==null?void 0:c.map((u,l)=>_.jsxs("div",{className:"route-item-box-h5",children:[_.jsxs("div",{className:"percent",children:[Ve(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(Ja,{position:"bottom",content:_.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[_.jsx(pG,{poolAddress:f.pool_address}),_.jsx(vv,{token:f.fromToken}),_.jsx(vv,{token:f.toToken})]}),children:_.jsx(hG,{path:f})})},f.to_type))})]},l))})}),_.jsxs("div",{className:"center",style:{gap:"4px"},children:[_.jsx(Gr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),_.jsx("span",{className:"amount",children:rn(o,i==null?void 0:i.decimals)}),_.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function hG({path:e}){var t,r,n;return _.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[_.jsx(Gr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx(Gr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),_.jsxs("span",{className:"provider",children:[(n=x4[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&_.jsxs("div",{className:"fee-tier",children:[" ",Ve(e.fee_rate).mul(100).toString(),"%"]})]})}function vv({token:e}){const{getExplorerUrl:t}=qo();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"},children:[_.jsx(Gr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:e==null?void 0:e.symbol})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:Al,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:$s(e==null?void 0:e.coin_type)}),_.jsx(ef,{text:(e==null?void 0:e.coin_type)||""})]})]})}function pG({poolAddress:e}){const{getExplorerUrl:t}=qo();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:Al,href:t(e,"poolAddress"),target:"_blank",children:$s(e)}),_.jsx(ef,{text:e})]})]}),e&&_.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function W8({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var a,c,u;const[n,i]=ae.useState(!1),{getTokenInfo:s}=Hs(),o=ae.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(Yo,{style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[_.jsx("span",{style:{textAlign:"right",color:"#fff"},children:o?(c=(a=r==null?void 0:r.routers[0])==null?void 0:a.paths)==null?void 0:c.map((l,f)=>{var h,y,b;return f===0?`${(h=s(l==null?void 0:l.from_type))==null?void 0:h.symbol} > ${(y=s(l==null?void 0:l.to_type))==null?void 0:y.symbol}`:(b=s(l==null?void 0:l.to_type))==null?void 0:b.symbol}).join(" > "):r==null?void 0:r.router_summery}),_.jsx("div",{className:"providers",children:(u=r==null?void 0:r.providers)==null?void 0:u.map((l,f)=>_.jsx(Ja,{content:_.jsx("div",{children:x4[l].name}),position:"top",delay:300,children:_.jsx(Gr,{src:yr[l],style:{width:"16px",height:"16px"}})},l))}),e&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px"},children:_.jsx("use",{xlinkHref:"#icon-spread"})})]}),n&&e&&_.jsx(dG,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const xc=Ai((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||wi.setItem(y4,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=ng(r.coin_type);o=i.filter(c=>ng(c.coin_type)!==a)}return s(o),wi.setItem(b4,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}))}}));wi.getItem(y4).then(e=>{e!==null&&xc.getState().setCollectTokenMap(e,!0)});wi.getItem(b4).then(e=>{e&&xc.getState().setImportTokenList(e)});function G8(){const{setCollectTokenMap:e,collectTokenMap:t}=xc(),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=ae.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function mG(e){const{trustedTokenList:t}=wc(),{tokenBalanceObj:r,currentAccount:n}=On(),{coinPriceObj:i}=o8(),{getTokenAmountValue:s}=Wl(),{fetchTokenInfo:o}=Hs(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:b,setImportTokenIsLoading:w,currentImportTokenData:T,searchInput:P,setSearchInput:R,importTokenIsLoading:N,showTokenListIsLoading:z,setCurrentTypeTab:F}=xc(),[W,q]=ae.useState(!1);ae.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[K,te]=ae.useState(!1);ae.useEffect(()=>{ag(i)||te(!0)},[i]);const se=ae.useRef({}),[H,L]=ae.useState(!1);ae.useEffect(()=>{(!ag(r)||!Vp(se.current,r))&&(se.current=r,L(!0))},[r]);const D=(v,k)=>{const ee=k&&k.toLocaleLowerCase().trim(),ie=v.map(ve=>{let Se=0,xe=0;ve.symbol.toLowerCase()===ee||ve.name.toLowerCase()===ee||ve.coin_type.toLowerCase()===ee?(Se=1e3,xe=2):ve.symbol.toLowerCase().indexOf(ee)>-1?(Se=100,xe=0):ve.name.toLowerCase().indexOf(ee)>-1?(Se=10,xe=0):ve.coin_type.toLowerCase().indexOf(ee)>-1?(Se=1,xe=0):ve.coin_type.toLowerCase()=="0x2::sui::sui"&&(xe=1);let Xe=Array.isArray(ve==null?void 0:ve.coin_priority)?Number(ve.coin_priority[0])||0:Number(ve==null?void 0:ve.coin_priority)||0;return e===ve.coin_type&&!k&&(xe=12,Se=1e3,Xe=1e4),{...ve,mark:Se,sort:xe,coin_priority_sort:Xe,rateNumber:Number((ve==null?void 0:ve.rate)||"0"),balanceNumber:Number((ve==null?void 0:ve.balance)||"0")}});return lG(ie,[ve=>!k&&e===ve.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(),ie=["symbol","name","coin_type"];return nG(ee.length===0?l:[...l,...f],ve=>ie.some(Se=>{const xe=ve[Se];return typeof xe=="string"?(k?xe:xe.toLowerCase()).includes(ee):!1}))},d=v=>{v||b(void 0);const k=p(v);if(console.log("🚀 ~ file: useTokenSelect.ts:182 ~ handleSearch ~ filterList:",k),(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(p4(v)){const ee=v.trim(),ie=Mr(ee).full_address,ge=await o(ie);if(!ge){u([]);return}const ve=((k=r==null?void 0:r[ee])==null?void 0:k.totalBalanceFormat)||"0",Se=Ve(ve).gt("0")?s(ee,ve):"0",xe={...ge,balance:ve,rate:Se};u([xe]),b(xe)}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)}},C=()=>{if(T){const v=y(T,!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(ie=>v=="Native"?!ie.labels||ie.labels.length==0||ie.labels=="Native":ie.labels&&ie.labels.length>0&&ie.labels[0].toLowerCase()==v.toLowerCase()),ee=D(k,P);u(ee)};ae.useEffect(()=>{if(!W||!(t!=null&&t.length)){h([]);return}if(!(n!=null&&n.address))h(t);else if(n!=null&&n.address&&K){const v=[];for(const k of t){const ee=r==null?void 0:r[k==null?void 0:k.coin_type],ie=(ee==null?void 0:ee.totalBalanceFormat)||"0",ge=(ee==null?void 0:ee.displayBalance)||"0",ve=Ve(ie).gt("0")?s(k==null?void 0:k.coin_type,ie):"0";v.push({...k,balance:ge,rate:rn(ve,4)})}h(v)}},[W,K,H,n==null?void 0:n.address]);const M=ae.useRef([]);ae.useEffect(()=>{if((l==null?void 0:l.length)>0&&!sG(M.current,l)){M.current=l;const v=D(l);e&&f.find(ee=>ee.coin_type===e)!==void 0?(F("Imported"),x("Imported")):u(v)}},[l,e]);const g=ae.useMemo(()=>{if(a==="Default"){if(P&&!z&&(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,T,N,z]);return{showTokenList:c,handleSearch:d,handleChangePlatform:O,currentImportTokenData:T,handleChangeType:x,handleImportClick:C,handleDeleteImportClick:E,isNoData:g}}function gG({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(vG,{token:r,onHandleTokenAction:t},r.coin_type))})}function vG({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"})})})]})}function yG({onClose:e,token:t,onSureImport:r}){const[n,i]=ae.useState(!1);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:[_.jsxs("div",{className:"import-token-info",children:[_.jsx(Gr,{style:{marginRight:"4px",borderRadius:"36px"},src:t.logo_url}),_.jsxs("div",{className:"info",children:[_.jsxs("div",{className:"name",children:[_.jsxs("span",{children:[" ",t.symbol," "]}),_.jsx("svg",{className:"cs-icon external-warning","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})})]}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:$s(t.coin_type)}),_.jsx(ef,{text:t.coin_type})]})]})]}),_.jsxs("div",{className:"tip-text-box",children:[_.jsx("p",{className:"tips-text",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."}),_.jsxs("div",{className:"risk-checkbox",children:[_.jsx(Ll,{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,children:"Confirm"})]})]})]})]})}const bG=zt("/images/img_no_data@2x.png");function wG(e){const{img:t=bG,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 _G({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 yv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function xG(e,t){return!!(e===t||yv(e)&&yv(t))}function SG(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!xG(e[r],t[r]))return!1;return!0}function EG(e,t){t===void 0&&(t=SG);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 hh(){return hh=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},hh.apply(null,arguments)}function bv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ph(e,t){return ph=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ph(e,t)}function CG(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ph(e,t)}var wv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function MG(e,t){return!!(e===t||wv(e)&&wv(t))}function AG(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!MG(e[r],t[r]))return!1;return!0}function nd(e,t){t===void 0&&(t=AG);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 _v(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 TG=typeof performance=="object"&&typeof performance.now=="function",xv=TG?function(){return performance.now()}:function(){return Date.now()};function Sv(e){cancelAnimationFrame(e.id)}function OG(e,t){var r=xv();function n(){xv()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var id=-1;function Ev(e){if(e===void 0&&(e=!1),id===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),id=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return id}var so=null;function Cv(e){if(e===void 0&&(e=!1),so===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?so="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?so="negative":so="positive-ascending"),document.body.removeChild(t),so}return so}bn.env.NODE_ENV;var IG=150,PG=function(t,r){return t},fu=null,du=null;bn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(fu=new WeakSet,du=new WeakSet);function kG(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){CG(h,f);function h(b){var w;return w=f.call(this,b)||this,w._instanceProps=c(w.props,bv(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:bv(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=nd(function(T,P,R,N){return w.props.onItemsRendered({overscanStartIndex:T,overscanStopIndex:P,visibleStartIndex:R,visibleStopIndex:N})}),w._callOnScroll=void 0,w._callOnScroll=nd(function(T,P,R){return w.props.onScroll({scrollDirection:T,scrollOffset:P,scrollUpdateWasRequested:R})}),w._getItemStyle=void 0,w._getItemStyle=function(T){var P=w.props,R=P.direction,N=P.itemSize,z=P.layout,F=w._getItemStyleCache(u&&N,u&&z,u&&R),W;if(F.hasOwnProperty(T))W=F[T];else{var q=r(w.props,T,w._instanceProps),K=i(w.props,T,w._instanceProps),te=R==="horizontal"||z==="horizontal",se=R==="rtl",H=te?q:0;F[T]=W={position:"absolute",left:se?void 0:H,right:se?H:void 0,top:te?0:q,height:te?"100%":K,width:te?K:"100%"}}return W},w._getItemStyleCache=void 0,w._getItemStyleCache=nd(function(T,P,R){return{}}),w._onScrollHorizontal=function(T){var P=T.currentTarget,R=P.clientWidth,N=P.scrollLeft,z=P.scrollWidth;w.setState(function(F){if(F.scrollOffset===N)return null;var W=w.props.direction,q=N;if(W==="rtl")switch(Cv()){case"negative":q=-N;break;case"positive-descending":q=z-R-N;break}return q=Math.max(0,Math.min(q,z-R)),{isScrolling:!0,scrollDirection:F.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(T){var P=T.currentTarget,R=P.clientHeight,N=P.scrollHeight,z=P.scrollTop;w.setState(function(F){if(F.scrollOffset===z)return null;var W=Math.max(0,Math.min(z,N-R));return{isScrolling:!0,scrollDirection:F.scrollOffset<W?"forward":"backward",scrollOffset:W,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(T){var P=w.props.outerRef;w._outerRef=T,typeof P=="function"?P(T):P!=null&&typeof P=="object"&&P.hasOwnProperty("current")&&(P.current=T)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&Sv(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=OG(w._resetIsScrolling,IG)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,T){return jG(w,T),l(w),null};var y=h.prototype;return y.scrollTo=function(w){w=Math.max(0,w),this.setState(function(T){return T.scrollOffset===w?null:{scrollDirection:T.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(w,T){T===void 0&&(T="auto");var P=this.props,R=P.itemCount,N=P.layout,z=this.state.scrollOffset;w=Math.max(0,Math.min(w,R-1));var F=0;if(this._outerRef){var W=this._outerRef;N==="vertical"?F=W.scrollWidth>W.clientWidth?Ev():0:F=W.scrollHeight>W.clientHeight?Ev():0}this.scrollTo(s(this.props,w,T,z,this._instanceProps,F))},y.componentDidMount=function(){var w=this.props,T=w.direction,P=w.initialScrollOffset,R=w.layout;if(typeof P=="number"&&this._outerRef!=null){var N=this._outerRef;T==="horizontal"||R==="horizontal"?N.scrollLeft=P:N.scrollTop=P}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,T=w.direction,P=w.layout,R=this.state,N=R.scrollOffset,z=R.scrollUpdateWasRequested;if(z&&this._outerRef!=null){var F=this._outerRef;if(T==="horizontal"||P==="horizontal")if(T==="rtl")switch(Cv()){case"negative":F.scrollLeft=-N;break;case"positive-ascending":F.scrollLeft=N;break;default:var W=F.clientWidth,q=F.scrollWidth;F.scrollLeft=q-W-N;break}else F.scrollLeft=N;else F.scrollTop=N}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Sv(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,T=w.children,P=w.className,R=w.direction,N=w.height,z=w.innerRef,F=w.innerElementType,W=w.innerTagName,q=w.itemCount,K=w.itemData,te=w.itemKey,se=te===void 0?PG:te,H=w.layout,L=w.outerElementType,D=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,C=R==="horizontal"||H==="horizontal",E=C?this._onScrollHorizontal:this._onScrollVertical,O=this._getRangeToRender(),M=O[0],g=O[1],v=[];if(q>0)for(var k=M;k<=g;k++)v.push(ae.createElement(T,{data:K,key:se(k,K),index:k,isScrolling:d?x:void 0,style:this._getItemStyle(k)}));var ee=n(this.props,this._instanceProps);return ae.createElement(L||D||"div",{className:P,onScroll:E,ref:this._outerRefSetter,style:hh({position:"relative",height:N,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},p)},ae.createElement(F||W||"div",{children:v,ref:z,style:{height:C?"100%":ee,pointerEvents:x?"none":void 0,width:C?ee:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var T=this._getRangeToRender(),P=T[0],R=T[1],N=T[2],z=T[3];this._callOnItemsRendered(P,R,N,z)}}if(typeof this.props.onScroll=="function"){var F=this.state,W=F.scrollDirection,q=F.scrollOffset,K=F.scrollUpdateWasRequested;this._callOnScroll(W,q,K)}},y._getRangeToRender=function(){var w=this.props,T=w.itemCount,P=w.overscanCount,R=this.state,N=R.isScrolling,z=R.scrollDirection,F=R.scrollOffset;if(T===0)return[0,0,0,0];var W=o(this.props,F,this._instanceProps),q=a(this.props,W,F,this._instanceProps),K=!N||z==="backward"?Math.max(1,P):1,te=!N||z==="forward"?Math.max(1,P):1;return[Math.max(0,W-K),Math.max(0,Math.min(T-1,q+te)),W,q]},h}(ae.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var jG=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(bn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&du&&!du.has(l)&&(du.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":fu&&!fu.has(l)&&(fu.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.'))}},RG=kG({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),T=Math.min(w,r*l),P=Math.max(0,r*l-b+l+o);switch(n==="smart"&&(i>=P-b&&i<=T+b?n="auto":n="center"),n){case"start":return T;case"end":return P;case"center":{var R=Math.round(P+(T-P)/2);return R<Math.ceil(b/2)?0:R>w+Math.floor(b/2)?w:R}case"auto":default:return i>=P&&i<=T?i:i<P?P:T}},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(bn.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 Mv(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 NG=["style"],DG=["style"];function BG(e,t){var r=e.style,n=_v(e,NG),i=t.style,s=_v(t,DG);return!Mv(r,i)&&!Mv(n,s)}const $G=ae.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(UG,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},BG),LG=EG((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function FG({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=ae.useRef(null);ae.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=LG(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(RG,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:$G})})}function UG({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=G8(),{getExplorerUrl:s}=qo();return _.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Gr,{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:e.symbol})}),_.jsx("p",{className:"token-name",children:e==null?void 0:e.name}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:Al,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:$s(e==null?void 0:e.coin_type)}),_.jsx(ef,{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?`${d4(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 zG({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 VG({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=mG(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:b,platformList:w,isOpenImportDialog:T,setIsOpenImportDialog:P,setSearchInput:R,searchInput:N,importTokenIsLoading:z,currentImportTokenData:F,setCurrentImportTokenData:W}=xc();ae.useEffect(()=>()=>{R(""),b("All"),h("Default"),W(void 0)},[]);const{handleCollectToken:q,collectTokenMap:K}=G8(),te=x=>{h(x),a(x)},se=x=>{b(x),o(x)},H=()=>{P(!1)},L=()=>{c(),P(!1)},D=x=>{let C=x.replace(/[^[a-zA-Z0-9\s]+$/g,"").trim();R(C),C?(p(C),console.log("🚀🚀🚀 ~ file: index.tsx:36 ~ changeInputValue ~ regValue:",C)):(s(""),te("Default"))},p=l8(x=>{p4(x)?s(qp(x,!1)):s(x)},300),d=(x,C)=>{if(C==="delete_import"){u(x);return}if(C==="collect_token"||C==="un_collect"){q(x);return}C==="select_token"&&(t(x),e())},m=ae.useMemo(()=>Array.from(K.values()),[K]);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:x=>D(x.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:x=>{D("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),m.length>0&&_.jsx(gG,{tokenList:m,onHandleTokenAction:d}),N.length===0&&_.jsx(zG,{currentType:f,changeTab:te}),N.length===0&&f==="Default"&&_.jsx(_G,{tabList:w,currentTab:y,changeTab:se})]}),i&&_.jsx(qG,{searchInputLength:N.length}),z&&_.jsx(s8,{}),F&&_.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&&_.jsx(FG,{showTokenList:n,showCollect:!F,showDelete:!F&&f==="Imported",onHandleTokenAction:d}),F&&_.jsx("div",{className:"center",style:{position:"absolute",top:"280px",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:()=>{L(),d(F,"select_token")},children:"Import"})}),T&&_.jsx(yG,{onClose:H,token:F,onSureImport:L})]})]})}function qG({searchInputLength:e}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(wG,{text:e>0?"No tokens found":"No Imported Tokens",subItem:e>0?_.jsx("div",{children:_.jsx(Ja,{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 K8(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 tc;(function(e){e.event="event",e.props="prop"})(tc||(tc={}));function Fi(){}function HG(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 rc(e){return!!(e||"").match(/\d/)}function Co(e){return e==null}function WG(e){return typeof e=="number"&&isNaN(e)}function X8(e){return Co(e)||WG(e)||typeof e=="number"&&!isFinite(e)}function J8(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function GG(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 KG(e,t,r){var n=GG(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 XG(e){var t=ae.useRef(e);t.current=e;var r=ae.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function N0(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 JG(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 Y8(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Av(e,t){return Array(t+1).join(e)}function Z8(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."+Av("0",Math.abs(o))+i:o>=a?i=i+Av("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Tv(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=N0(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,T,P){return w.length>P?(Number(w[0])+Number(T)).toString()+w.substring(1,w.length):T+w},l[0]));var h=Y8(l[1]||"",t,r),y=a?"-":"",b=n?".":"";return""+y+f+b+h}function As(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 Q8=HG(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}}}),YG=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function ZG(e,t,r){return Math.min(Math.max(e,t),r)}function sd(e){return Math.max(e.selectionStart,e.selectionEnd)}function QG(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function eK(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function tK(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function rK(e,t,r,n,i,s,o){o===void 0&&(o=tK);var a=i.findIndex(function(z){return z}),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 T=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:b});if(T&&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 Ov(e,t,r,n){var i=e.length;if(t=ZG(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 nK(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(rc(e[r])||rc(e[r-1]));return t}function eS(e,t,r,n,i,s){s===void 0&&(s=Fi);var o=XG(function(b,w){var T,P;return X8(b)?(P="",T=""):typeof b=="number"||w?(P=typeof b=="number"?Z8(b):b,T=n(P)):(P=i(b,void 0),T=n(P)),{formattedValue:T,numAsString:P}}),a=ae.useState(function(){return o(Co(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;Co(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return ae.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function iK(e){return e.replace(/[^0-9]/g,"")}function sK(e){return e}function oK(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=sK);var a=e.removeFormatting;a===void 0&&(a=iK);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=Fi);var y=e.onKeyDown;y===void 0&&(y=Fi);var b=e.onMouseUp;b===void 0&&(b=Fi);var w=e.onFocus;w===void 0&&(w=Fi);var T=e.onBlur;T===void 0&&(T=Fi);var P=e.value,R=e.getCaretBoundary;R===void 0&&(R=nK);var N=e.isValidInputCharacter;N===void 0&&(N=rc);var z=e.isCharacterSame,F=K8(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),W=eS(P,c,!!u,o,a,l),q=W[0],K=q.formattedValue,te=q.numAsString,se=W[1],H=ae.useRef(),L=ae.useRef({formattedValue:K,numAsString:te}),D=function(we,me){L.current={formattedValue:we.formattedValue,numAsString:we.value},se(we,me)},p=ae.useState(!1),d=p[0],m=p[1],x=ae.useRef(null),C=ae.useRef({setCaretTimeout:null,focusTimeout:null});ae.useEffect(function(){return m(!0),function(){clearTimeout(C.current.setCaretTimeout),clearTimeout(C.current.focusTimeout)}},[]);var E=o,O=function(we,me){var Ae=parseFloat(me);return{formattedValue:we,value:me,floatValue:isNaN(Ae)?void 0:Ae}},M=function(we,me,Ae){we.selectionStart===0&&we.selectionEnd===we.value.length||(As(we,me),C.current.setCaretTimeout=setTimeout(function(){we.value===Ae&&we.selectionStart!==me&&As(we,me)},0))},g=function(we,me,Ae){return Ov(we,me,R(we),Ae)},v=function(we,me,Ae){var Ue=R(me),Ne=rK(me,K,we,Ae,Ue,N,z);return Ne=Ov(me,Ne,Ue),Ne},k=function(we){var me=we.formattedValue;me===void 0&&(me="");var Ae=we.input,Ue=we.source,Ne=we.event,Te=we.numAsString,Oe;if(Ae){var $e=we.inputValue||Ae.value,lt=sd(Ae);Ae.value=me,Oe=v($e,me,lt),Oe!==void 0&&M(Ae,Oe,me)}me!==K&&D(O(me,Te),{event:Ne,source:Ue})};ae.useEffect(function(){var we=L.current,me=we.formattedValue,Ae=we.numAsString;(K!==me||te!==Ae)&&D(O(K,te),{event:void 0,source:tc.props})},[K,te]);var ee=x.current?sd(x.current):void 0,ie=typeof window<"u"?ae.useLayoutEffect:ae.useEffect;ie(function(){var we=x.current;if(K!==L.current.formattedValue&&we){var me=v(L.current.formattedValue,K,ee);we.value=K,M(we,me,K)}},[K]);var ge=function(we,me,Ae){var Ue=me.target,Ne=H.current?YG(H.current,Ue.selectionEnd):Q8(K,we),Te=Object.assign(Object.assign({},Ne),{lastValue:K}),Oe=a(we,Te),$e=E(Oe);if(Oe=a($e,void 0),f&&!f(O($e,Oe))){var lt=me.target,pt=sd(lt),He=v(we,K,pt);return lt.value=K,M(lt,He,K),!1}return k({formattedValue:$e,numAsString:Oe,inputValue:we,event:me,source:Ae,input:me.target}),!0},ve=function(we,me){me===void 0&&(me=0);var Ae=we.selectionStart,Ue=we.selectionEnd;H.current={selectionStart:Ae,selectionEnd:Ue+me}},Se=function(we){var me=we.target,Ae=me.value,Ue=ge(Ae,we,tc.event);Ue&&h(we),H.current=void 0},xe=function(we){var me=we.target,Ae=we.key,Ue=me.selectionStart,Ne=me.selectionEnd,Te=me.value;Te===void 0&&(Te="");var Oe;Ae==="ArrowLeft"||Ae==="Backspace"?Oe=Math.max(Ue-1,0):Ae==="ArrowRight"?Oe=Math.min(Ue+1,Te.length):Ae==="Delete"&&(Oe=Ue);var $e=0;Ae==="Delete"&&Ue===Ne&&($e=1);var lt=Ae==="ArrowLeft"||Ae==="ArrowRight";if(Oe===void 0||Ue!==Ne&&!lt){y(we),ve(me,$e);return}var pt=Oe;if(lt){var He=Ae==="ArrowLeft"?"left":"right";pt=g(Te,Oe,He),pt!==Oe&&we.preventDefault()}else Ae==="Delete"&&!N(Te[Oe])?pt=g(Te,Oe,"right"):Ae==="Backspace"&&!N(Te[Oe])&&(pt=g(Te,Oe,"left"));pt!==Oe&&M(me,pt,Te),y(we),ve(me,$e)},Xe=function(we){var me=we.target,Ae=function(){var Ue=me.selectionStart,Ne=me.selectionEnd,Te=me.value;if(Te===void 0&&(Te=""),Ue===Ne){var Oe=g(Te,Ue);Oe!==Ue&&M(me,Oe,Te)}};Ae(),requestAnimationFrame(function(){Ae()}),b(we),ve(me)},Le=function(we){we.persist&&we.persist();var me=we.target,Ae=we.currentTarget;x.current=me,C.current.focusTimeout=setTimeout(function(){var Ue=me.selectionStart,Ne=me.selectionEnd,Te=me.value;Te===void 0&&(Te="");var Oe=g(Te,Ue);Oe!==Ue&&!(Ue===0&&Ne===Te.length)&&M(me,Oe,Te),w(Object.assign(Object.assign({},we),{currentTarget:Ae}))},0)},ot=function(we){x.current=null,clearTimeout(C.current.focusTimeout),clearTimeout(C.current.setCaretTimeout),T(we)},dt=d&&QG()?"numeric":void 0,De=Object.assign({inputMode:dt},F,{type:t,value:K,onChange:Se,onKeyDown:xe,onMouseUp:Xe,onFocus:Le,onBlur:ot});if(r==="text")return i?ae.createElement(ae.Fragment,null,i(K,F)||null):ae.createElement("span",Object.assign({},F,{ref:s}),K);if(n){var vt=n;return ae.createElement(vt,Object.assign({},De,{ref:s}))}return ae.createElement("input",Object.assign({},De,{ref:s}))}function Iv(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=tf(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=N0(e,o),y=h.beforeDecimal,b=h.afterDecimal,w=h.addNegation;return r!==void 0&&(b=Y8(b,r,!!n)),u&&(y=KG(y,u,a)),i&&(y=i+y),s&&(b=b+s),w&&(y="-"+y),e=y+(f&&l||"")+b,e}function tf(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 aK(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 cK(e,t){return new RegExp("(^-)|[0-9]|"+J8(e),t?"g":void 0)}function uK(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function lK(e,t,r){var n;t===void 0&&(t=eK(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=tf(r),y=h.allowedDecimalSeparators,b=h.decimalSeparator,w=e[f]===b;if(rc(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var T=a===0?"":b;e=e.substring(0,l)+T+e.substring(l+1,e.length)}var P=function(x,C,E){var O=!1,M=!1;s.startsWith("-")?O=!1:x.startsWith("--")?(O=!1,M=!0):o.startsWith("-")&&x.length===o.length?O=!1:x[0]==="-"&&(O=!0);var g=O?1:0;return M&&(g=2),g&&(x=x.substring(g),C-=g,E-=g),{value:x,start:C,end:E,hasNegation:O}},R=P(e,l,f),N=R.hasNegation;n=R,e=n.value,l=n.start,f=n.end;var z=P(t.lastValue,c.start,c.end),F=z.start,W=z.end,q=z.value,K=e.substring(l,f);e.length&&q.length&&(F>q.length-o.length||W<s.length)&&!(K&&o.startsWith(K))&&(e=q);var te=0;e.startsWith(s)?te+=s.length:l<s.length&&(te=l),e=e.substring(te),f-=te;var se=e.length,H=e.length-o.length;e.endsWith(o)?se=H:(f>H||f>e.length-o.length)&&(se=f),e=e.substring(0,se),e=aK(N?"-"+e:e,i),e=(e.match(cK(b,!0))||[]).join("");var L=e.indexOf(b);e=e.replace(new RegExp(J8(b),"g"),function(x,C){return C===L?".":""});var D=N0(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 fK(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 dK(e){var t=tf(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 L0({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i}){const[s,o]=ie.useState(!0),a=Z6(s,r,n);return b.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{o(!s)},children:[b.jsx(Gr,{src:s?e.logo_url:t.logo_url}),b.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?b.jsx(qo,{style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):en(a,t.decimals)," ",Un(s?t.symbol:e.symbol)]}),b.jsx(Gr,{src:s?t.logo_url:e.logo_url}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-swap"})})]})}function C8(e,t,r,n){const{getTokenPrice:i}=yl(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=Z6(!0,r,n),c=ie.useMemo(()=>{if(o&&s)return Ve(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=ie.useMemo(()=>{if(c&&+a)return Ve(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=ie.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=ie.useMemo(()=>u&&Ve(u).lt(0)?Ve(u).abs().gt(5):!1,[u]),h=ie.useMemo(()=>u&&Ve(u).lt(0)?Ve(u).abs().gt(10):!1,[u]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:f,showPriceImpactWarn:h}}function Ha({content:e,children:t,position:r="top",delay:n=0}){const[i,s]=ie.useState(!1),[o,a]=ie.useState(!1),c=ie.useRef(null),u=()=>{c.current&&(clearTimeout(c.current),c.current=null),s(!0)};ie.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=ie.useRef(null),[y,_]=ie.useState({left:void 0,top:void 0});return ie.useEffect(()=>{var w;if(i&&h.current){const A=(w=h.current)==null?void 0:w.getBoundingClientRect();let I,P;r==="top"?(I=`${window.scrollX+A.left+A.width/2}px`,P=`${window.scrollY+A.top-2*A.height-8}px`):r==="bottom"?(I=`${window.scrollX+A.left+A.width/2}px`,P=`${window.scrollY+A.bottom}px`):r==="left"?(I=`${window.scrollX+A.left-8}px`,P=`${window.scrollY+A.top+A.height/2}px`):r==="right"?(I=`${window.scrollX+A.right+8}px`,P=`${window.scrollY+A.top+A.height/2}px`):(I=`${window.scrollX+A.left+A.width/2}px`,P=`${window.scrollY+A.top+A.height/2}px`),_({left:I,top:P})}},[i]),b.jsxs("div",{ref:h,style:{position:"relative",display:"inline-block"},onMouseEnter:u,onMouseLeave:l,children:[t,i&&Uu.createPortal(b.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 A8({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=sn(),{priceImpact:a,sources:c,marketPrice:u}=C8(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi),l=ie.useMemo(()=>{if(a){if(Ve(a).gt(0))return"green";const f=Ve(a).abs();return f.gt(1)&&f.lt(10)?"yellow":f.gte(10)?"red":"green"}return"yellow"},[a]);return b.jsxs(b.Fragment,{children:[!r&&Ve(a).lte(-30)&&b.jsx("div",{className:"price-impact-tips red",children:"Price Impact Alert. Be cautious before submitting your order."}),b.jsxs("div",{className:"price-impact-block",children:[b.jsxs("div",{className:"left",children:[b.jsx("span",{children:"Price Impact"}),b.jsx(Ha,{content:b.jsx(gF,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u}),position:"bottom",delay:300,children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:b.jsx("use",{xlinkHref:"#icon-tips"})})})]}),b.jsxs("div",{children:[e&&b.jsx(qo,{style:{width:"80px",height:"20px"}}),!e&&b.jsxs("div",{className:"right",children:[b.jsx("span",{className:l,children:a?rj(a,2):"Incalculable"}),b.jsx("div",{className:"platforms",children:c.map(f=>b.jsx(Ha,{content:b.jsx("span",{style:{fontSize:"12px"},children:u4[f]}),position:"top",delay:300,children:b.jsx(Gr,{src:Sj[f]})},f))})]})]})]})]})}function gF({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i}){return b.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[b.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",lineHeight:"18px",width:"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),b.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[b.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-title)"},children:"Market price sources:"}),r&&n?b.jsx(L0,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1}):b.jsx("p",{style:{color:"var(--cs-text-title)",fontSize:"12px"},children:"Price is unknown"})]}),b.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"5px"},children:[b.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),b.jsx("p",{style:{color:"var(--cs-text-con)",fontSize:"12px",whiteSpace:"pre"},children:i.map(s=>u4[s]+" ").join("")})]})]})}function T8({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=sn();return b.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[b.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?b.jsx(qo,{style:{height:"18px",width:"80px"}}):b.jsxs("div",{className:"right",children:[en(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,rn.ROUND_DOWN)," ",Un(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function vF({scamsText:e}){return b.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid #2A3238",paddingTop:"12px",width:"100%",backgroundColor:"#161A1E"},children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[b.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"#ffca68"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-alert"})}),b.jsx("span",{style:{color:"#ffca68",marginLeft:"4px"},children:"Alert"})]}),b.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid #2A3238",lineHeight:"1"},children:b.jsx(f4,{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 yF({onClick:e}){return b.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-back"})}),b.jsx("span",{children:"Back"})]})}function U0({title:e,backClick:t}){return b.jsxs("div",{className:"cs-have-back-header",children:[b.jsx(yF,{onClick:t}),b.jsx("span",{className:"title",children:e})]})}const Tc=globalThis||void 0||self;var bF=typeof Tc=="object"&&Tc&&Tc.Object===Object&&Tc;const O8=bF;var wF=typeof self=="object"&&self&&self.Object===Object&&self,_F=O8||wF||Function("return this")();const Zn=_F;var xF=Zn.Symbol;const Xn=xF;var I8=Object.prototype,SF=I8.hasOwnProperty,EF=I8.toString,la=Xn?Xn.toStringTag:void 0;function MF(e){var t=SF.call(e,la),r=e[la];try{e[la]=void 0;var n=!0}catch{}var i=EF.call(e);return n&&(t?e[la]=r:delete e[la]),i}var CF=Object.prototype,AF=CF.toString;function TF(e){return AF.call(e)}var OF="[object Null]",IF="[object Undefined]",Jm=Xn?Xn.toStringTag:void 0;function Ko(e){return e==null?e===void 0?IF:OF:Jm&&Jm in Object(e)?MF(e):TF(e)}function ns(e){return e!=null&&typeof e=="object"}var kF="[object Symbol]";function Wa(e){return typeof e=="symbol"||ns(e)&&Ko(e)==kF}function Zc(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 jF=Array.isArray;const Ur=jF;var PF=1/0,Zm=Xn?Xn.prototype:void 0,Qm=Zm?Zm.toString:void 0;function k8(e){if(typeof e=="string")return e;if(Ur(e))return Zc(e,k8)+"";if(Wa(e))return Qm?Qm.call(e):"";var t=e+"";return t=="0"&&1/e==-PF?"-0":t}function Xo(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function j8(e){return e}var RF="[object AsyncFunction]",NF="[object Function]",DF="[object GeneratorFunction]",$F="[object Proxy]";function P8(e){if(!Xo(e))return!1;var t=Ko(e);return t==NF||t==DF||t==RF||t==$F}var BF=Zn["__core-js_shared__"];const _f=BF;var eg=function(){var e=/[^.]+$/.exec(_f&&_f.keys&&_f.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function LF(e){return!!eg&&eg in e}var UF=Function.prototype,FF=UF.toString;function Fs(e){if(e!=null){try{return FF.call(e)}catch{}try{return e+""}catch{}}return""}var zF=/[\\^$.*+?()[\]{}|]/g,VF=/^\[object .+?Constructor\]$/,qF=Function.prototype,GF=Object.prototype,HF=qF.toString,WF=GF.hasOwnProperty,KF=RegExp("^"+HF.call(WF).replace(zF,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function XF(e){if(!Xo(e)||LF(e))return!1;var t=P8(e)?KF:VF;return t.test(Fs(e))}function YF(e,t){return e==null?void 0:e[t]}function zs(e,t){var r=YF(e,t);return XF(r)?r:void 0}var JF=zs(Zn,"WeakMap");const Ad=JF;var tg=Object.create,ZF=function(){function e(){}return function(t){if(!Xo(t))return{};if(tg)return tg(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const QF=ZF;function ez(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var tz=function(){try{var e=zs(Object,"defineProperty");return e({},"",{}),e}catch{}}();const rg=tz;function rz(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var nz=9007199254740991,iz=/^(?:0|[1-9]\d*)$/;function R8(e,t){var r=typeof e;return t=t??nz,!!t&&(r=="number"||r!="symbol"&&iz.test(e))&&e>-1&&e%1==0&&e<t}function N8(e,t,r){t=="__proto__"&&rg?rg(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function F0(e,t){return e===t||e!==e&&t!==t}var sz=Object.prototype,oz=sz.hasOwnProperty;function D8(e,t,r){var n=e[t];(!(oz.call(e,t)&&F0(n,r))||r===void 0&&!(t in e))&&N8(e,t,r)}function Cl(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?N8(r,a,c):D8(r,a,c)}return r}var az=9007199254740991;function z0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=az}function Al(e){return e!=null&&z0(e.length)&&!P8(e)}var cz=Object.prototype;function V0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||cz;return e===r}function uz(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var lz="[object Arguments]";function ng(e){return ns(e)&&Ko(e)==lz}var $8=Object.prototype,fz=$8.hasOwnProperty,dz=$8.propertyIsEnumerable,hz=ng(function(){return arguments}())?ng:function(e){return ns(e)&&fz.call(e,"callee")&&!dz.call(e,"callee")};const B8=hz;function pz(){return!1}var L8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ig=L8&&typeof module=="object"&&module&&!module.nodeType&&module,mz=ig&&ig.exports===L8,sg=mz?Zn.Buffer:void 0,gz=sg?sg.isBuffer:void 0,vz=gz||pz;const $u=vz;var yz="[object Arguments]",bz="[object Array]",wz="[object Boolean]",_z="[object Date]",xz="[object Error]",Sz="[object Function]",Ez="[object Map]",Mz="[object Number]",Cz="[object Object]",Az="[object RegExp]",Tz="[object Set]",Oz="[object String]",Iz="[object WeakMap]",kz="[object ArrayBuffer]",jz="[object DataView]",Pz="[object Float32Array]",Rz="[object Float64Array]",Nz="[object Int8Array]",Dz="[object Int16Array]",$z="[object Int32Array]",Bz="[object Uint8Array]",Lz="[object Uint8ClampedArray]",Uz="[object Uint16Array]",Fz="[object Uint32Array]",Kt={};Kt[Pz]=Kt[Rz]=Kt[Nz]=Kt[Dz]=Kt[$z]=Kt[Bz]=Kt[Lz]=Kt[Uz]=Kt[Fz]=!0;Kt[yz]=Kt[bz]=Kt[kz]=Kt[wz]=Kt[jz]=Kt[_z]=Kt[xz]=Kt[Sz]=Kt[Ez]=Kt[Mz]=Kt[Cz]=Kt[Az]=Kt[Tz]=Kt[Oz]=Kt[Iz]=!1;function zz(e){return ns(e)&&z0(e.length)&&!!Kt[Ko(e)]}function Tl(e){return function(t){return e(t)}}var U8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ia=U8&&typeof module=="object"&&module&&!module.nodeType&&module,Vz=Ia&&Ia.exports===U8,xf=Vz&&O8.process,qz=function(){try{var e=Ia&&Ia.require&&Ia.require("util").types;return e||xf&&xf.binding&&xf.binding("util")}catch{}}();const Oo=qz;var og=Oo&&Oo.isTypedArray,Gz=og?Tl(og):zz;const F8=Gz;var Hz=Object.prototype,Wz=Hz.hasOwnProperty;function z8(e,t){var r=Ur(e),n=!r&&B8(e),i=!r&&!n&&$u(e),s=!r&&!n&&!i&&F8(e),o=r||n||i||s,a=o?uz(e.length,String):[],c=a.length;for(var u in e)(t||Wz.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||R8(u,c)))&&a.push(u);return a}function V8(e,t){return function(r){return e(t(r))}}var Kz=V8(Object.keys,Object);const Xz=Kz;var Yz=Object.prototype,Jz=Yz.hasOwnProperty;function Zz(e){if(!V0(e))return Xz(e);var t=[];for(var r in Object(e))Jz.call(e,r)&&r!="constructor"&&t.push(r);return t}function pc(e){return Al(e)?z8(e):Zz(e)}function Qz(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var eV=Object.prototype,tV=eV.hasOwnProperty;function rV(e){if(!Xo(e))return Qz(e);var t=V0(e),r=[];for(var n in e)n=="constructor"&&(t||!tV.call(e,n))||r.push(n);return r}function q0(e){return Al(e)?z8(e,!0):rV(e)}var nV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,iV=/^\w*$/;function G0(e,t){if(Ur(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Wa(e)?!0:iV.test(e)||!nV.test(e)||t!=null&&e in Object(t)}var sV=zs(Object,"create");const Ka=sV;function oV(){this.__data__=Ka?Ka(null):{},this.size=0}function aV(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var cV="__lodash_hash_undefined__",uV=Object.prototype,lV=uV.hasOwnProperty;function fV(e){var t=this.__data__;if(Ka){var r=t[e];return r===cV?void 0:r}return lV.call(t,e)?t[e]:void 0}var dV=Object.prototype,hV=dV.hasOwnProperty;function pV(e){var t=this.__data__;return Ka?t[e]!==void 0:hV.call(t,e)}var mV="__lodash_hash_undefined__";function gV(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ka&&t===void 0?mV:t,this}function Ds(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])}}Ds.prototype.clear=oV;Ds.prototype.delete=aV;Ds.prototype.get=fV;Ds.prototype.has=pV;Ds.prototype.set=gV;function vV(){this.__data__=[],this.size=0}function Ol(e,t){for(var r=e.length;r--;)if(F0(e[r][0],t))return r;return-1}var yV=Array.prototype,bV=yV.splice;function wV(e){var t=this.__data__,r=Ol(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():bV.call(t,r,1),--this.size,!0}function _V(e){var t=this.__data__,r=Ol(t,e);return r<0?void 0:t[r][1]}function xV(e){return Ol(this.__data__,e)>-1}function SV(e,t){var r=this.__data__,n=Ol(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Oi(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])}}Oi.prototype.clear=vV;Oi.prototype.delete=wV;Oi.prototype.get=_V;Oi.prototype.has=xV;Oi.prototype.set=SV;var EV=zs(Zn,"Map");const Xa=EV;function MV(){this.size=0,this.__data__={hash:new Ds,map:new(Xa||Oi),string:new Ds}}function CV(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Il(e,t){var r=e.__data__;return CV(t)?r[typeof t=="string"?"string":"hash"]:r.map}function AV(e){var t=Il(this,e).delete(e);return this.size-=t?1:0,t}function TV(e){return Il(this,e).get(e)}function OV(e){return Il(this,e).has(e)}function IV(e,t){var r=Il(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ii(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])}}Ii.prototype.clear=MV;Ii.prototype.delete=AV;Ii.prototype.get=TV;Ii.prototype.has=OV;Ii.prototype.set=IV;var kV="Expected a function";function H0(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(kV);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(H0.Cache||Ii),r}H0.Cache=Ii;var jV=500;function PV(e){var t=H0(e,function(n){return r.size===jV&&r.clear(),n}),r=t.cache;return t}var RV=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,NV=/\\(\\)?/g,DV=PV(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(RV,function(r,n,i,s){t.push(i?s.replace(NV,"$1"):n||r)}),t});const $V=DV;function BV(e){return e==null?"":k8(e)}function q8(e,t){return Ur(e)?e:G0(e,t)?[e]:$V(BV(e))}var LV=1/0;function kl(e){if(typeof e=="string"||Wa(e))return e;var t=e+"";return t=="0"&&1/e==-LV?"-0":t}function W0(e,t){t=q8(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[kl(t[r++])];return r&&r==n?e:void 0}function UV(e,t,r){var n=e==null?void 0:W0(e,t);return n===void 0?r:n}function G8(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var FV=V8(Object.getPrototypeOf,Object);const H8=FV;function zV(){this.__data__=new Oi,this.size=0}function VV(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function qV(e){return this.__data__.get(e)}function GV(e){return this.__data__.has(e)}var HV=200;function WV(e,t){var r=this.__data__;if(r instanceof Oi){var n=r.__data__;if(!Xa||n.length<HV-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ii(n)}return r.set(e,t),this.size=r.size,this}function qn(e){var t=this.__data__=new Oi(e);this.size=t.size}qn.prototype.clear=zV;qn.prototype.delete=VV;qn.prototype.get=qV;qn.prototype.has=GV;qn.prototype.set=WV;function KV(e,t){return e&&Cl(t,pc(t),e)}function XV(e,t){return e&&Cl(t,q0(t),e)}var W8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ag=W8&&typeof module=="object"&&module&&!module.nodeType&&module,YV=ag&&ag.exports===W8,cg=YV?Zn.Buffer:void 0,ug=cg?cg.allocUnsafe:void 0;function JV(e,t){if(t)return e.slice();var r=e.length,n=ug?ug(r):new e.constructor(r);return e.copy(n),n}function K8(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 X8(){return[]}var ZV=Object.prototype,QV=ZV.propertyIsEnumerable,lg=Object.getOwnPropertySymbols,eq=lg?function(e){return e==null?[]:(e=Object(e),K8(lg(e),function(t){return QV.call(e,t)}))}:X8;const K0=eq;function tq(e,t){return Cl(e,K0(e),t)}var rq=Object.getOwnPropertySymbols,nq=rq?function(e){for(var t=[];e;)G8(t,K0(e)),e=H8(e);return t}:X8;const Y8=nq;function iq(e,t){return Cl(e,Y8(e),t)}function J8(e,t,r){var n=t(e);return Ur(e)?n:G8(n,r(e))}function Td(e){return J8(e,pc,K0)}function sq(e){return J8(e,q0,Y8)}var oq=zs(Zn,"DataView");const Od=oq;var aq=zs(Zn,"Promise");const Id=aq;var cq=zs(Zn,"Set");const kd=cq;var fg="[object Map]",uq="[object Object]",dg="[object Promise]",hg="[object Set]",pg="[object WeakMap]",mg="[object DataView]",lq=Fs(Od),fq=Fs(Xa),dq=Fs(Id),hq=Fs(kd),pq=Fs(Ad),_s=Ko;(Od&&_s(new Od(new ArrayBuffer(1)))!=mg||Xa&&_s(new Xa)!=fg||Id&&_s(Id.resolve())!=dg||kd&&_s(new kd)!=hg||Ad&&_s(new Ad)!=pg)&&(_s=function(e){var t=Ko(e),r=t==uq?e.constructor:void 0,n=r?Fs(r):"";if(n)switch(n){case lq:return mg;case fq:return fg;case dq:return dg;case hq:return hg;case pq:return pg}return t});const Ya=_s;var mq=Object.prototype,gq=mq.hasOwnProperty;function vq(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&gq.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var yq=Zn.Uint8Array;const Bu=yq;function X0(e){var t=new e.constructor(e.byteLength);return new Bu(t).set(new Bu(e)),t}function bq(e,t){var r=t?X0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var wq=/\w*$/;function _q(e){var t=new e.constructor(e.source,wq.exec(e));return t.lastIndex=e.lastIndex,t}var gg=Xn?Xn.prototype:void 0,vg=gg?gg.valueOf:void 0;function xq(e){return vg?Object(vg.call(e)):{}}function Sq(e,t){var r=t?X0(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var Eq="[object Boolean]",Mq="[object Date]",Cq="[object Map]",Aq="[object Number]",Tq="[object RegExp]",Oq="[object Set]",Iq="[object String]",kq="[object Symbol]",jq="[object ArrayBuffer]",Pq="[object DataView]",Rq="[object Float32Array]",Nq="[object Float64Array]",Dq="[object Int8Array]",$q="[object Int16Array]",Bq="[object Int32Array]",Lq="[object Uint8Array]",Uq="[object Uint8ClampedArray]",Fq="[object Uint16Array]",zq="[object Uint32Array]";function Vq(e,t,r){var n=e.constructor;switch(t){case jq:return X0(e);case Eq:case Mq:return new n(+e);case Pq:return bq(e,r);case Rq:case Nq:case Dq:case $q:case Bq:case Lq:case Uq:case Fq:case zq:return Sq(e,r);case Cq:return new n;case Aq:case Iq:return new n(e);case Tq:return _q(e);case Oq:return new n;case kq:return xq(e)}}function qq(e){return typeof e.constructor=="function"&&!V0(e)?QF(H8(e)):{}}var Gq="[object Map]";function Hq(e){return ns(e)&&Ya(e)==Gq}var yg=Oo&&Oo.isMap,Wq=yg?Tl(yg):Hq;const Kq=Wq;var Xq="[object Set]";function Yq(e){return ns(e)&&Ya(e)==Xq}var bg=Oo&&Oo.isSet,Jq=bg?Tl(bg):Yq;const Zq=Jq;var Qq=1,eG=2,tG=4,Z8="[object Arguments]",rG="[object Array]",nG="[object Boolean]",iG="[object Date]",sG="[object Error]",Q8="[object Function]",oG="[object GeneratorFunction]",aG="[object Map]",cG="[object Number]",e3="[object Object]",uG="[object RegExp]",lG="[object Set]",fG="[object String]",dG="[object Symbol]",hG="[object WeakMap]",pG="[object ArrayBuffer]",mG="[object DataView]",gG="[object Float32Array]",vG="[object Float64Array]",yG="[object Int8Array]",bG="[object Int16Array]",wG="[object Int32Array]",_G="[object Uint8Array]",xG="[object Uint8ClampedArray]",SG="[object Uint16Array]",EG="[object Uint32Array]",qt={};qt[Z8]=qt[rG]=qt[pG]=qt[mG]=qt[nG]=qt[iG]=qt[gG]=qt[vG]=qt[yG]=qt[bG]=qt[wG]=qt[aG]=qt[cG]=qt[e3]=qt[uG]=qt[lG]=qt[fG]=qt[dG]=qt[_G]=qt[xG]=qt[SG]=qt[EG]=!0;qt[sG]=qt[Q8]=qt[hG]=!1;function Qc(e,t,r,n,i,s){var o,a=t&Qq,c=t&eG,u=t&tG;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!Xo(e))return e;var l=Ur(e);if(l){if(o=vq(e),!a)return ez(e,o)}else{var f=Ya(e),h=f==Q8||f==oG;if($u(e))return JV(e,a);if(f==e3||f==Z8||h&&!i){if(o=c||h?{}:qq(e),!a)return c?iq(e,XV(o,e)):tq(e,KV(o,e))}else{if(!qt[f])return i?e:{};o=Vq(e,f,a)}}s||(s=new qn);var y=s.get(e);if(y)return y;s.set(e,o),Zq(e)?e.forEach(function(A){o.add(Qc(A,t,r,A,e,s))}):Kq(e)&&e.forEach(function(A,I){o.set(I,Qc(A,t,r,I,e,s))});var _=u?c?sq:Td:c?q0:pc,w=l?void 0:_(e);return rz(w||e,function(A,I){w&&(I=A,A=e[I]),D8(o,I,Qc(A,t,r,I,e,s))}),o}var MG=1,CG=4;function AG(e){return Qc(e,MG|CG)}var TG="__lodash_hash_undefined__";function OG(e){return this.__data__.set(e,TG),this}function IG(e){return this.__data__.has(e)}function Lu(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ii;++t<r;)this.add(e[t])}Lu.prototype.add=Lu.prototype.push=OG;Lu.prototype.has=IG;function kG(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 jG(e,t){return e.has(t)}var PG=1,RG=2;function t3(e,t,r,n,i,s){var o=r&PG,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&RG?new Lu:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var _=e[f],w=t[f];if(n)var A=o?n(w,_,f,t,e,s):n(_,w,f,e,t,s);if(A!==void 0){if(A)continue;h=!1;break}if(y){if(!kG(t,function(I,P){if(!jG(y,P)&&(_===I||i(_,I,r,n,s)))return y.push(P)})){h=!1;break}}else if(!(_===w||i(_,w,r,n,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function NG(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function DG(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var $G=1,BG=2,LG="[object Boolean]",UG="[object Date]",FG="[object Error]",zG="[object Map]",VG="[object Number]",qG="[object RegExp]",GG="[object Set]",HG="[object String]",WG="[object Symbol]",KG="[object ArrayBuffer]",XG="[object DataView]",wg=Xn?Xn.prototype:void 0,Sf=wg?wg.valueOf:void 0;function YG(e,t,r,n,i,s,o){switch(r){case XG:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case KG:return!(e.byteLength!=t.byteLength||!s(new Bu(e),new Bu(t)));case LG:case UG:case VG:return F0(+e,+t);case FG:return e.name==t.name&&e.message==t.message;case qG:case HG:return e==t+"";case zG:var a=NG;case GG:var c=n&$G;if(a||(a=DG),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=BG,o.set(e,t);var l=t3(a(e),a(t),n,i,s,o);return o.delete(e),l;case WG:if(Sf)return Sf.call(e)==Sf.call(t)}return!1}var JG=1,ZG=Object.prototype,QG=ZG.hasOwnProperty;function eH(e,t,r,n,i,s){var o=r&JG,a=Td(e),c=a.length,u=Td(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var h=a[f];if(!(o?h in t:QG.call(t,h)))return!1}var y=s.get(e),_=s.get(t);if(y&&_)return y==t&&_==e;var w=!0;s.set(e,t),s.set(t,e);for(var A=o;++f<c;){h=a[f];var I=e[h],P=t[h];if(n)var N=o?n(P,I,h,t,e,s):n(I,P,h,e,t,s);if(!(N===void 0?I===P||i(I,P,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 tH=1,_g="[object Arguments]",xg="[object Array]",Oc="[object Object]",rH=Object.prototype,Sg=rH.hasOwnProperty;function nH(e,t,r,n,i,s){var o=Ur(e),a=Ur(t),c=o?xg:Ya(e),u=a?xg:Ya(t);c=c==_g?Oc:c,u=u==_g?Oc:u;var l=c==Oc,f=u==Oc,h=c==u;if(h&&$u(e)){if(!$u(t))return!1;o=!0,l=!1}if(h&&!l)return s||(s=new qn),o||F8(e)?t3(e,t,r,n,i,s):YG(e,t,c,r,n,i,s);if(!(r&tH)){var y=l&&Sg.call(e,"__wrapped__"),_=f&&Sg.call(t,"__wrapped__");if(y||_){var w=y?e.value():e,A=_?t.value():t;return s||(s=new qn),i(w,A,r,n,s)}}return h?(s||(s=new qn),eH(e,t,r,n,i,s)):!1}function jl(e,t,r,n,i){return e===t?!0:e==null||t==null||!ns(e)&&!ns(t)?e!==e&&t!==t:nH(e,t,r,n,jl,i)}var iH=1,sH=2;function oH(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 qn;if(n)var h=n(u,l,c,e,t,f);if(!(h===void 0?jl(l,u,iH|sH,n,f):h))return!1}}return!0}function r3(e){return e===e&&!Xo(e)}function aH(e){for(var t=pc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,r3(i)]}return t}function n3(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function cH(e){var t=aH(e);return t.length==1&&t[0][2]?n3(t[0][0],t[0][1]):function(r){return r===e||oH(r,e,t)}}function uH(e,t){return e!=null&&t in Object(e)}function lH(e,t,r){t=q8(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=kl(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&&z0(i)&&R8(o,i)&&(Ur(e)||B8(e)))}function fH(e,t){return e!=null&&lH(e,t,uH)}var dH=1,hH=2;function pH(e,t){return G0(e)&&r3(t)?n3(kl(e),t):function(r){var n=UV(r,e);return n===void 0&&n===t?fH(r,e):jl(t,n,dH|hH)}}function mH(e){return function(t){return t==null?void 0:t[e]}}function gH(e){return function(t){return W0(t,e)}}function vH(e){return G0(e)?mH(kl(e)):gH(e)}function i3(e){return typeof e=="function"?e:e==null?j8:typeof e=="object"?Ur(e)?pH(e[0],e[1]):cH(e):vH(e)}function yH(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 bH=yH();const wH=bH;function _H(e,t){return e&&wH(e,t,pc)}function xH(e,t){return function(r,n){if(r==null)return r;if(!Al(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 SH=xH(_H);const s3=SH;function EH(e,t){var r=[];return s3(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function MH(e,t){var r=Ur(e)?K8:EH;return r(e,i3(t))}function CH(e,t){var r=-1,n=Al(e)?Array(e.length):[];return s3(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function AH(e,t){return jl(e,t)}function TH(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function OH(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Wa(e),o=t!==void 0,a=t===null,c=t===t,u=Wa(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 IH(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=OH(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 kH(e,t,r){t.length?t=Zc(t,function(s){return Ur(s)?function(o){return W0(o,s.length===1?s[0]:s)}:s}):t=[j8];var n=-1;t=Zc(t,Tl(i3));var i=CH(e,function(s,o,a){var c=Zc(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return TH(i,function(s,o){return IH(s,o,r)})}function jH(e,t,r,n){return e==null?[]:(Ur(t)||(t=t==null?[]:[t]),r=n?void 0:r,Ur(r)||(r=r==null?[]:[r]),kH(e,t,r))}function PH({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=sn(),s=ie.useRef(!1),{slippage:o}=Wr(),[a,c]=ie.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:h}=J6(o,a),{showPriceImpactTips:y,showPriceImpactWarn:_}=C8(n,i,u,l),{priceAcceptRouterData:w}=gL(a),[A,I]=ie.useState(!1),[P,N]=ie.useState(!1);ie.useMemo(()=>f?i:n,[f]);const F=ie.useMemo(()=>w!==void 0,[w]),L=()=>{if(w){if(s.current)return;s.current=!0;const q=AG(w);c(q),setTimeout(()=>{s.current=!1},300)}},H=ie.useMemo(()=>A?!1:!!_,[A,_]);return b.jsxs("div",{className:"secondary-dialog",children:[b.jsx(U0,{title:"Review your order",backClick:e}),b.jsxs("div",{className:"secondary-content",children:[b.jsxs("div",{className:"trade-info",children:[b.jsxs("div",{className:"amount-info",children:[b.jsx("span",{className:"amount",children:Mo(u||"")}),b.jsx("img",{src:n==null?void 0:n.logo_url}),b.jsx("span",{className:"symbol",children:Un((n==null?void 0:n.symbol)||"")})]}),b.jsx("div",{className:"dividing-line",children:b.jsx("div",{className:"swap-icon",children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-trade"})})})}),b.jsxs("div",{className:"amount-info",children:[b.jsx("span",{className:"amount",children:Mo(l||"")}),b.jsx("img",{src:i==null?void 0:i.logo_url}),b.jsx("span",{className:"symbol",children:Un((i==null?void 0:i.symbol)||"")})]})]}),b.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"16px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[b.jsx("div",{className:"current-price-box",style:{backgroundColor:"#1b242c",margin:"-1px"},children:b.jsx(L0,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),y&&b.jsx("div",{style:{paddingBottom:"10px"},children:"Price Impact Alert. Be cautious before submitting your order."})]}),b.jsxs("div",{className:"swap-info-between",children:[b.jsx("div",{className:"left",children:"Slippage Tolerance"}),b.jsxs("div",{className:"right",children:[o,"%"]})]}),b.jsx(T8,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:h}),b.jsx(A8,{isLoading:!1,routerData:a,noTips:!0}),_&&b.jsxs("div",{style:{width:"100%",marginTop:"16px",gap:"1px"},children:[b.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"10px",paddingBottom:"10px",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?"}),b.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[b.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:A?"#72c1f7":"#7F98A7"},onClick:()=>{I(!0)},children:"Yes, please continue."}),b.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&&b.jsx("button",{disabled:H||P,className:"swap-btn cs-solid-btn",onClick:()=>{P||(N(!0),t(a))},children:P?b.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:b.jsx(M8,{})}):"Confirm Swap"}),F&&b.jsxs("div",{className:"price-update",children:[b.jsxs("div",{className:"left",children:[b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-alert"})}),b.jsx("span",{children:"Price update"})]}),b.jsx("div",{className:"right",children:b.jsx("button",{className:"cs-solid-btn",onClick:L,children:"Accept"})})]})]})}function Pl(e){const{text:t}=e,[r,n]=ie.useState(!1),{addCommonToast:i}=Go(),s=o=>{r||(Qu(o),H6(t,{debug:!1,message:"message"}),i("Copied"),n(!r))};return ie.useEffect(()=>{r&&setTimeout(()=>{n(!1)},2e3)},[r]),b.jsx(b.Fragment,{children:b.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:s,children:b.jsx("use",{xlinkHref:r?"#icon-sel":"#icon-copy"})})})}function RH({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=sn(),{getTokenInfo:a}=Us(),c=ie.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 b.jsxs("div",{className:"route-dialog",children:[b.jsx(U0,{title:"Route",backClick:e}),b.jsxs("div",{className:"route-dialog-content",children:[b.jsx("div",{className:"simple-router-box",children:b.jsx(o3,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),b.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[b.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[b.jsx(Gr,{src:n==null?void 0:n.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),b.jsx("span",{className:"amount",children:en(s,n==null?void 0:n.decimals)}),b.jsx("span",{className:"symbol",children:n==null?void 0:n.symbol})]}),b.jsx("div",{className:"route-box-h5 center",style:{backgroundColor:"#1B242C"},children:b.jsx("div",{className:"center",style:{width:"100%",gap:"32px",border:"1px dashed #2a3238",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px"},children:c==null?void 0:c.map((u,l)=>b.jsxs("div",{className:"route-item-box-h5",children:[b.jsxs("div",{className:"percent",children:[Ve(u.percentage).mul(100).toString(),"%"]}),b.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=>b.jsx("div",{className:"route-path-item",children:b.jsx(Ha,{position:"bottom",content:b.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column"},children:[b.jsx(DH,{poolAddress:f.pool_address}),b.jsx(Eg,{token:f.fromToken}),b.jsx(Eg,{token:f.toToken})]}),children:b.jsx(NH,{path:f})})},f.to_type))})]},l))})}),b.jsxs("div",{className:"center",style:{gap:"4px"},children:[b.jsx(Gr,{src:i==null?void 0:i.logo_url,style:{width:"26px",height:"26px",borderRadius:"100%"}}),b.jsx("span",{className:"amount",children:en(o,i==null?void 0:i.decimals)}),b.jsx("span",{className:"symbol",children:i==null?void 0:i.symbol})]})]})]})]})}function NH({path:e}){var t,r,n;return b.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[b.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[b.jsx(Gr,{src:(t=e.fromToken)==null?void 0:t.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}}),b.jsx(Gr,{src:(r=e.toToken)==null?void 0:r.logo_url,style:{width:"24px",height:"24px",borderRadius:"100%"}})]}),b.jsxs("span",{className:"provider",children:[(n=l4[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&b.jsxs("div",{className:"fee-tier",children:[" ",Ve(e.fee_rate).mul(100).toString(),"%"]})]})}function Eg({token:e}){const{getExplorerUrl:t}=$o();return b.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px",fontSize:"12px",gap:"12px"},children:[b.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px"},children:[b.jsx(Gr,{src:e==null?void 0:e.logo_url,style:{width:"20px",height:"20px",borderRadius:"100%"}}),b.jsx("span",{style:{color:"#fff",fontSize:"12px"},children:e==null?void 0:e.symbol})]}),b.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[b.jsx("a",{onClick:Qu,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"#909ca4"},children:Ps(e==null?void 0:e.coin_type)}),b.jsx(Pl,{text:(e==null?void 0:e.coin_type)||""})]})]})}function DH({poolAddress:e}){const{getExplorerUrl:t}=$o();return b.jsxs(b.Fragment,{children:[e&&b.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[b.jsx("span",{style:{color:"fff",fontSize:"12px"},children:"Pool"}),b.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[b.jsx("a",{style:{color:"#fff",textDecoration:"none"},onClick:Qu,href:t(e,"poolAddress"),target:"_blank",children:Ps(e)}),b.jsx(Pl,{text:e})]})]}),e&&b.jsx("div",{style:{width:"100%",height:"1px",marginTop:"12px",backgroundColor:"var(--cs-border)"}})]})}function o3({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var a,c,u;const[n,i]=ie.useState(!1),{getTokenInfo:s}=Us(),o=ie.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]);return b.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[b.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-con)":"#fff",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?b.jsx(qo,{style:{width:"80px",height:"18px"}}):b.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[b.jsx("span",{style:{textAlign:"right",color:"#fff"},children:o?(c=(a=r==null?void 0:r.routers[0])==null?void 0:a.paths)==null?void 0:c.map((l,f)=>{var h,y,_;return f===0?`${(h=s(l==null?void 0:l.from_type))==null?void 0:h.symbol} > ${(y=s(l==null?void 0:l.to_type))==null?void 0:y.symbol}`:(_=s(l==null?void 0:l.to_type))==null?void 0:_.symbol}).join(" > "):r==null?void 0:r.router_summery}),b.jsx("div",{className:"providers",children:(u=r==null?void 0:r.providers)==null?void 0:u.map((l,f)=>b.jsx(Ha,{content:b.jsx("div",{children:l4[l].name}),position:"top",delay:300,children:b.jsx(Gr,{src:vr[l],style:{width:"16px",height:"16px"}})},l))}),e&&b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"16px",height:"16px"},children:b.jsx("use",{xlinkHref:"#icon-spread"})})]}),n&&e&&b.jsx(RH,{data:r,isLoading:t,toBack:()=>i(!1)})]})}const mc=Ti((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||yi.setItem(o4,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=Kp(r.coin_type);o=i.filter(c=>Kp(c.coin_type)!==a)}return s(o),yi.setItem(a4,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}))}}));yi.getItem(o4).then(e=>{e!==null&&mc.getState().setCollectTokenMap(e,!0)});yi.getItem(a4).then(e=>{e&&mc.getState().setImportTokenList(e)});function a3(){const{setCollectTokenMap:e,collectTokenMap:t}=mc(),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=ie.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function $H(e){const{trustedTokenList:t}=dc(),{tokenBalanceObj:r,currentAccount:n}=Cn(),{coinPriceObj:i}=Y6(),{getTokenAmountValue:s}=yl(),{fetchTokenInfo:o}=Us(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:h,setImportToken:y,setCurrentImportTokenData:_,setImportTokenIsLoading:w,currentImportTokenData:A,searchInput:I,setSearchInput:P,importTokenIsLoading:N,showTokenListIsLoading:F,setCurrentTypeTab:L}=mc(),[H,q]=ie.useState(!1);ie.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&q(!0)},[t]);const[X,re]=ie.useState(!1);ie.useEffect(()=>{em(i)||re(!0)},[i]);const ae=ie.useRef({}),[oe,V]=ie.useState(!1);ie.useEffect(()=>{(!em(r)||!Zh(ae.current,r))&&(ae.current=r,V(!0))},[r]);const $=(v,R)=>{const se=R&&R.toLocaleLowerCase().trim(),ue=v.map(be=>{let Ce=0,Me=0;be.symbol.toLowerCase()===se||be.name.toLowerCase()===se||be.coin_type.toLowerCase()===se?(Ce=1e3,Me=2):be.symbol.toLowerCase().indexOf(se)>-1?(Ce=100,Me=0):be.name.toLowerCase().indexOf(se)>-1?(Ce=10,Me=0):be.coin_type.toLowerCase().indexOf(se)>-1?(Ce=1,Me=0):be.coin_type.toLowerCase()=="0x2::sui::sui"&&(Me=1);let Ke=Array.isArray(be==null?void 0:be.coin_priority)?Number(be.coin_priority[0])||0:Number(be==null?void 0:be.coin_priority)||0;return e===be.coin_type&&!R&&(Me=12,Ce=1e3,Ke=1e4),{...be,mark:Ce,sort:Me,coin_priority_sort:Ke,rateNumber:Number((be==null?void 0:be.rate)||"0"),balanceNumber:Number((be==null?void 0:be.balance)||"0")}});return jH(ue,[be=>!R&&e===be.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},p=(v,R=!1)=>{const se=R?v.trim():v.toLowerCase().trim(),ue=["symbol","name","coin_type"];return MH(se.length===0?l:[...l,...f],be=>ue.some(Ce=>{const Me=be[Ce];return typeof Me=="string"?(R?Me:Me.toLowerCase()).includes(se):!1}))},d=v=>{v||_(void 0);const R=p(v);if((R==null?void 0:R.length)===0){m(v);return}else if(v===I){const se=$(R,v);u(se)}},m=async v=>{var R;w(!0);try{if(r4(v)){const se=v.trim(),ue=Mr(se).full_address,xe=await o(ue);if(!xe){u([]);return}const be=((R=r==null?void 0:r[se])==null?void 0:R.totalBalanceFormat)||"0",Ce=Ve(be).gt("0")?s(se,be):"0",Me={...xe,balance:be,rate:Ce};u([Me]),_(Me)}else{u([]);return}}catch{_(void 0),u([]);return}finally{w(!1)}},x=v=>{if(v==="Default")k("All");else{const R=$(f,I);u(R)}},E=()=>{if(A){const v=y(A,!0),R=$(v,I);u(R),_(void 0),P("")}},C=v=>{const R=y(v,!1),se=$(R,I);u(se)},k=v=>{const R=v==="All"?[...l]:l.filter(ue=>v=="Native"?!ue.labels||ue.labels.length==0||ue.labels=="Native":ue.labels&&ue.labels.length>0&&ue.labels[0].toLowerCase()==v.toLowerCase()),se=$(R,I);u(se)};ie.useEffect(()=>{if(!H||!(t!=null&&t.length)){h([]);return}if(!(n!=null&&n.address))h(t);else if(n!=null&&n.address&&X){const v=[];for(const R of t){R!=null&&R.coin_type.includes("sui");const se=r==null?void 0:r[R==null?void 0:R.coin_type],ue=(se==null?void 0:se.totalBalanceFormat)||"0",xe=(se==null?void 0:se.displayBalance)||"0",be=Ve(ue).gt("0")?s(R==null?void 0:R.coin_type,ue):"0";v.push({...R,balance:xe,rate:en(be,4,!0)})}h(v)}},[H,X,oe,n==null?void 0:n.address]);const T=ie.useRef([]);ie.useEffect(()=>{if((l==null?void 0:l.length)>0&&!AH(T.current,l)){T.current=l;const v=$(l);e&&f.find(se=>se.coin_type===e)!==void 0?(L("Imported"),x("Imported")):u(v)}},[l,e]);const g=ie.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},[I,c,A,N,F]);return{showTokenList:c,handleSearch:d,handleChangePlatform:k,currentImportTokenData:A,handleChangeType:x,handleImportClick:E,handleDeleteImportClick:C,isNoData:g}}function BH({tokenList:e,onHandleTokenAction:t}){return b.jsx("div",{className:"token-collect-list",children:e.map(r=>b.jsx(LH,{token:r,onHandleTokenAction:t},r.coin_type))})}function LH({token:e,onHandleTokenAction:t}){return b.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[b.jsx("img",{src:e.logo_url,style:{marginRight:"8px"}}),b.jsx("span",{children:e.symbol}),b.jsx("i",{children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:b.jsx("use",{xlinkHref:"#icon-close"})})})]})}const UH=Ft("/images/img_no_data@2x.png");function FH(e){const{img:t=UH,text:r,width:n="100%",height:i="auto",padding:s="20px",subItem:o}=e;return b.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&b.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&b.jsx("div",{style:{color:"#fff",fontSize:"14px"},children:r}),o&&o]})}function zH({tabList:e,currentTab:t,changeTab:r}){return b.jsx("div",{className:"platform-tabs",children:e.map(n=>b.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var Mg=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function VH(e,t){return!!(e===t||Mg(e)&&Mg(t))}function qH(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!VH(e[r],t[r]))return!1;return!0}function GH(e,t){t===void 0&&(t=qH);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 jd(){return jd=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},jd.apply(null,arguments)}function Cg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pd(e,t){return Pd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Pd(e,t)}function HH(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Pd(e,t)}var Ag=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function WH(e,t){return!!(e===t||Ag(e)&&Ag(t))}function KH(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!WH(e[r],t[r]))return!1;return!0}function Ef(e,t){t===void 0&&(t=KH);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 Tg(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 XH=typeof performance=="object"&&typeof performance.now=="function",Og=XH?function(){return performance.now()}:function(){return Date.now()};function Ig(e){cancelAnimationFrame(e.id)}function YH(e,t){var r=Og();function n(){Og()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Mf=-1;function kg(e){if(e===void 0&&(e=!1),Mf===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Mf=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Mf}var Qs=null;function jg(e){if(e===void 0&&(e=!1),Qs===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?Qs="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Qs="negative":Qs="positive-ascending"),document.body.removeChild(t),Qs}return Qs}Wi.env.NODE_ENV;var JH=150,ZH=function(t,r){return t},eu=null,tu=null;Wi.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(eu=new WeakSet,tu=new WeakSet);function QH(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){HH(h,f);function h(_){var w;return w=f.call(this,_)||this,w._instanceProps=c(w.props,Cg(w)),w._outerRef=void 0,w._resetIsScrollingTimeoutId=null,w.state={instance:Cg(w),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof w.props.initialScrollOffset=="number"?w.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},w._callOnItemsRendered=void 0,w._callOnItemsRendered=Ef(function(A,I,P,N){return w.props.onItemsRendered({overscanStartIndex:A,overscanStopIndex:I,visibleStartIndex:P,visibleStopIndex:N})}),w._callOnScroll=void 0,w._callOnScroll=Ef(function(A,I,P){return w.props.onScroll({scrollDirection:A,scrollOffset:I,scrollUpdateWasRequested:P})}),w._getItemStyle=void 0,w._getItemStyle=function(A){var I=w.props,P=I.direction,N=I.itemSize,F=I.layout,L=w._getItemStyleCache(u&&N,u&&F,u&&P),H;if(L.hasOwnProperty(A))H=L[A];else{var q=r(w.props,A,w._instanceProps),X=i(w.props,A,w._instanceProps),re=P==="horizontal"||F==="horizontal",ae=P==="rtl",oe=re?q:0;L[A]=H={position:"absolute",left:ae?void 0:oe,right:ae?oe:void 0,top:re?0:q,height:re?"100%":X,width:re?X:"100%"}}return H},w._getItemStyleCache=void 0,w._getItemStyleCache=Ef(function(A,I,P){return{}}),w._onScrollHorizontal=function(A){var I=A.currentTarget,P=I.clientWidth,N=I.scrollLeft,F=I.scrollWidth;w.setState(function(L){if(L.scrollOffset===N)return null;var H=w.props.direction,q=N;if(H==="rtl")switch(jg()){case"negative":q=-N;break;case"positive-descending":q=F-P-N;break}return q=Math.max(0,Math.min(q,F-P)),{isScrolling:!0,scrollDirection:L.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._onScrollVertical=function(A){var I=A.currentTarget,P=I.clientHeight,N=I.scrollHeight,F=I.scrollTop;w.setState(function(L){if(L.scrollOffset===F)return null;var H=Math.max(0,Math.min(F,N-P));return{isScrolling:!0,scrollDirection:L.scrollOffset<H?"forward":"backward",scrollOffset:H,scrollUpdateWasRequested:!1}},w._resetIsScrollingDebounced)},w._outerRefSetter=function(A){var I=w.props.outerRef;w._outerRef=A,typeof I=="function"?I(A):I!=null&&typeof I=="object"&&I.hasOwnProperty("current")&&(I.current=A)},w._resetIsScrollingDebounced=function(){w._resetIsScrollingTimeoutId!==null&&Ig(w._resetIsScrollingTimeoutId),w._resetIsScrollingTimeoutId=YH(w._resetIsScrolling,JH)},w._resetIsScrolling=function(){w._resetIsScrollingTimeoutId=null,w.setState({isScrolling:!1},function(){w._getItemStyleCache(-1,null)})},w}h.getDerivedStateFromProps=function(w,A){return eW(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 I=this.props,P=I.itemCount,N=I.layout,F=this.state.scrollOffset;w=Math.max(0,Math.min(w,P-1));var L=0;if(this._outerRef){var H=this._outerRef;N==="vertical"?L=H.scrollWidth>H.clientWidth?kg():0:L=H.scrollHeight>H.clientHeight?kg():0}this.scrollTo(s(this.props,w,A,F,this._instanceProps,L))},y.componentDidMount=function(){var w=this.props,A=w.direction,I=w.initialScrollOffset,P=w.layout;if(typeof I=="number"&&this._outerRef!=null){var N=this._outerRef;A==="horizontal"||P==="horizontal"?N.scrollLeft=I:N.scrollTop=I}this._callPropsCallbacks()},y.componentDidUpdate=function(){var w=this.props,A=w.direction,I=w.layout,P=this.state,N=P.scrollOffset,F=P.scrollUpdateWasRequested;if(F&&this._outerRef!=null){var L=this._outerRef;if(A==="horizontal"||I==="horizontal")if(A==="rtl")switch(jg()){case"negative":L.scrollLeft=-N;break;case"positive-ascending":L.scrollLeft=N;break;default:var H=L.clientWidth,q=L.scrollWidth;L.scrollLeft=q-H-N;break}else L.scrollLeft=N;else L.scrollTop=N}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Ig(this._resetIsScrollingTimeoutId)},y.render=function(){var w=this.props,A=w.children,I=w.className,P=w.direction,N=w.height,F=w.innerRef,L=w.innerElementType,H=w.innerTagName,q=w.itemCount,X=w.itemData,re=w.itemKey,ae=re===void 0?ZH:re,oe=w.layout,V=w.outerElementType,$=w.outerTagName,p=w.style,d=w.useIsScrolling,m=w.width,x=this.state.isScrolling,E=P==="horizontal"||oe==="horizontal",C=E?this._onScrollHorizontal:this._onScrollVertical,k=this._getRangeToRender(),T=k[0],g=k[1],v=[];if(q>0)for(var R=T;R<=g;R++)v.push(ie.createElement(A,{data:X,key:ae(R,X),index:R,isScrolling:d?x:void 0,style:this._getItemStyle(R)}));var se=n(this.props,this._instanceProps);return ie.createElement(V||$||"div",{className:I,onScroll:C,ref:this._outerRefSetter,style:jd({position:"relative",height:N,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:P},p)},ie.createElement(L||H||"div",{children:v,ref:F,style:{height:E?"100%":se,pointerEvents:x?"none":void 0,width:E?se:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var w=this.props.itemCount;if(w>0){var A=this._getRangeToRender(),I=A[0],P=A[1],N=A[2],F=A[3];this._callOnItemsRendered(I,P,N,F)}}if(typeof this.props.onScroll=="function"){var L=this.state,H=L.scrollDirection,q=L.scrollOffset,X=L.scrollUpdateWasRequested;this._callOnScroll(H,q,X)}},y._getRangeToRender=function(){var w=this.props,A=w.itemCount,I=w.overscanCount,P=this.state,N=P.isScrolling,F=P.scrollDirection,L=P.scrollOffset;if(A===0)return[0,0,0,0];var H=o(this.props,L,this._instanceProps),q=a(this.props,H,L,this._instanceProps),X=!N||F==="backward"?Math.max(1,I):1,re=!N||F==="forward"?Math.max(1,I):1;return[Math.max(0,H-X),Math.max(0,Math.min(A-1,q+re)),H,q]},h}(ie.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var eW=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(Wi.env.NODE_ENV!=="production"){(a!=null||c!=null)&&tu&&!tu.has(l)&&(tu.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":eu&&!eu.has(l)&&(eu.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.'))}},tW=QH({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",_=y?h:c,w=Math.max(0,u*l-_),A=Math.min(w,r*l),I=Math.max(0,r*l-_+l+o);switch(n==="smart"&&(i>=I-_&&i<=A+_?n="auto":n="center"),n){case"start":return A;case"end":return I;case"center":{var P=Math.round(I+(A-I)/2);return P<Math.ceil(_/2)?0:P>w+Math.floor(_/2)?w:P}case"auto":default:return i>=I&&i<=A?i:i<I?I: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(Wi.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 Pg(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 rW=["style"],nW=["style"];function iW(e,t){var r=e.style,n=Tg(e,rW),i=t.style,s=Tg(t,nW);return!Pg(r,i)&&!Pg(n,s)}const sW=ie.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return b.jsx("div",{style:r,children:b.jsx(cW,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},iW),oW=GH((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function aW({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=ie.useRef(null);ie.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=oW(e,t,r,n);return b.jsx("div",{className:"token-list",children:b.jsx(tW,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:280,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:sW})})}function cW({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=a3(),{getExplorerUrl:s}=$o();return b.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[b.jsx(Gr,{className:"token-img",src:e==null?void 0:e.logo_url,showWarn:!t}),b.jsxs("div",{className:"token-info",children:[b.jsx("h4",{className:"token-symbol",children:b.jsx("span",{children:Un(e.symbol)})}),b.jsx("p",{className:"token-name",children:Un(e==null?void 0:e.name,20)}),b.jsxs("div",{className:"copy",children:[b.jsx("a",{onClick:Qu,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Ps(e==null?void 0:e.coin_type)}),b.jsx(Pl,{text:e==null?void 0:e.coin_type})]})]}),b.jsxs("div",{className:"token-balance",children:[b.jsxs("div",{className:"balance",children:[b.jsx("h4",{children:e==null?void 0:e.balance}),b.jsx("p",{children:e!=null&&e.rate?e4(e==null?void 0:e.rate,2):""})]}),r&&b.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-icon_del"})})}),t&&b.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function uW({currentType:e,changeTab:t}){const r=["Default","Imported"];return b.jsx("div",{className:"type-tabs",children:r.map(n=>b.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function lW({onClose:e,token:t,onSureClick:r}){const[n,i]=ie.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"dialog-mask",onClick:e}),b.jsxs("div",{className:"import-dialog",children:[b.jsxs("div",{className:"cs-dialog-header",children:[b.jsx("div",{className:"title",children:"Tips"}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:b.jsx("use",{xlinkHref:"#icon-close"})})]}),b.jsxs("div",{className:"import-content",children:[b.jsx("div",{className:"tip-text-box",children:b.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."})}),b.jsxs("div",{className:"import-token-info",children:[b.jsx(Gr,{style:{marginRight:"4px",width:"30px",height:"30px",borderRadius:"36px"},src:t.logo_url}),b.jsxs("div",{className:"info",children:[b.jsx("div",{className:"name",children:b.jsxs("span",{children:[" ",t.symbol," "]})}),b.jsxs("div",{className:"address",children:[b.jsx("span",{children:Ps(t.coin_type)}),b.jsx(Pl,{text:t.coin_type})]})]})]}),b.jsxs("div",{className:"risk-checkbox",children:[b.jsx(fl,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox",onClick:()=>{i(!n)}}),b.jsx("span",{children:"I acknowledge the risk"})]}),b.jsxs("div",{className:"button-block",children:[b.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),b.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:r,children:"Confirm"})]})]})]})]})}function fW({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=$H(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:h,currentPlatformTab:y,setCurrentPlatformTab:_,platformList:w,isOpenImportDialog:A,setIsOpenImportDialog:I,setSearchInput:P,searchInput:N,importTokenIsLoading:F,currentImportTokenData:L,setCurrentImportTokenData:H}=mc(),{isCustomMode:q}=bL(),[X,re]=ie.useState(void 0);ie.useEffect(()=>()=>{P(""),_("All"),h("Default"),H(void 0),re(void 0)},[]);const{handleCollectToken:ae,collectTokenMap:oe}=a3(),V=C=>{h(C),a(C)},$=C=>{_(C),o(C)},p=()=>{c(),I(!1)},d=C=>{let k=C.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();P(k),k?m(k):(m(""),V("Default"))},m=E8(C=>{r4(C)?s(Qh(C,!1)):s(C)},300),x=(C,k)=>{if(k==="delete_import"){u(C);return}if(k==="collect_token"||k==="un_collect"){ae(C);return}k==="select_token"&&(q&&!C.is_trusted?(re(C),I(!0)):(t(C),e()))},E=ie.useMemo(()=>Array.from(oe.values()),[oe]);return b.jsxs("div",{className:"token-select-modal",children:[b.jsx(U0,{backClick:e,title:"Select Token"}),b.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[b.jsxs("div",{className:"center-content",children:[b.jsxs("div",{className:"search-input",style:{position:"relative"},children:[b.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:N,onChange:C=>d(C.target.value),style:{paddingRight:"40px"}}),N.length>0&&b.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:C=>{d("")},children:b.jsx("use",{xlinkHref:"#icon-close"})})]}),E.length>0&&b.jsx(BH,{tokenList:E,onHandleTokenAction:x}),N.length===0&&b.jsx(uW,{currentType:f,changeTab:V}),N.length===0&&f==="Default"&&b.jsx(zH,{tabList:w,currentTab:y,changeTab:$})]}),i&&b.jsx(dW,{searchInputLength:N.length}),F&&b.jsx(W6,{}),L&&b.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&&b.jsx(aW,{showTokenList:n,showCollect:!L,showDelete:!L&&f==="Imported",onHandleTokenAction:x}),L&&b.jsx("div",{className:"center",style:{position:"absolute",top:"300px",left:"50%",transform:"translateX(-50%)"},children:b.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{p(),x(L,"select_token")},children:"Import"})}),A&&X&&b.jsx(lW,{onClose:()=>{re(void 0)},token:X,onSureClick:()=>{t(X),e()}})]})]})}function dW({searchInputLength:e}){return b.jsx("div",{style:{height:"360px"},children:b.jsx(FH,{text:e>0?"No tokens found":"No Imported Tokens",subItem:e>0?b.jsx("div",{children:b.jsx(Ha,{position:"bottom",content:b.jsx("div",{children:"The unique id of coin"}),children:b.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-con)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:b.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function c3(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 Ja;(function(e){e.event="event",e.props="prop"})(Ja||(Ja={}));function Fi(){}function hW(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 Za(e){return!!(e||"").match(/\d/)}function _o(e){return e==null}function pW(e){return typeof e=="number"&&isNaN(e)}function u3(e){return _o(e)||pW(e)||typeof e=="number"&&!isFinite(e)}function l3(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function mW(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 gW(e,t,r){var n=mW(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 vW(e){var t=ie.useRef(e);t.current=e;var r=ie.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function Y0(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 yW(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 f3(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Rg(e,t){return Array(t+1).join(e)}function d3(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."+Rg("0",Math.abs(o))+i:o>=a?i=i+Rg("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Ng(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=Y0(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,I){return w.length>I?(Number(w[0])+Number(A)).toString()+w.substring(1,w.length):A+w},l[0]));var h=f3(l[1]||"",t,r),y=a?"-":"",_=n?".":"";return""+y+f+_+h}function Ms(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 h3=hW(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}}}),bW=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function wW(e,t,r){return Math.min(Math.max(e,t),r)}function Cf(e){return Math.max(e.selectionStart,e.selectionEnd)}function _W(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function xW(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function SW(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function EW(e,t,r,n,i,s,o){o===void 0&&(o=SW);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 _=0,w=l;_<w;_++){var A=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:_});if(A&&f[_]!==!0){h[y]=_,f[_]=!0;break}}}for(var I=n;I<u&&(h[I]===-1||!s(r[I]));)I++;var P=I===u||h[I]===-1?l:h[I];for(I=n-1;I>0&&h[I]===-1;)I--;var N=I===-1||h[I]===-1?0:h[I]+1;return N>P?P:n-N<P-n?N:P}function Dg(e,t,r,n){var i=e.length;if(t=wW(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 MW(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Za(e[r])||Za(e[r-1]));return t}function p3(e,t,r,n,i,s){s===void 0&&(s=Fi);var o=vW(function(_,w){var A,I;return u3(_)?(I="",A=""):typeof _=="number"||w?(I=typeof _=="number"?d3(_):_,A=n(I)):(I=i(_,void 0),A=n(I)),{formattedValue:A,numAsString:I}}),a=ie.useState(function(){return o(_o(e)?t:e,r)}),c=a[0],u=a[1],l=function(_,w){_.formattedValue!==c.formattedValue&&u({formattedValue:_.formattedValue,numAsString:_.value}),s(_,w)},f=e,h=r;_o(e)&&(f=c.numAsString,h=!0);var y=o(f,h);return ie.useMemo(function(){u(y)},[y.formattedValue]),[c,l]}function CW(e){return e.replace(/[^0-9]/g,"")}function AW(e){return e}function TW(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=AW);var a=e.removeFormatting;a===void 0&&(a=CW);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,h=e.onChange;h===void 0&&(h=Fi);var y=e.onKeyDown;y===void 0&&(y=Fi);var _=e.onMouseUp;_===void 0&&(_=Fi);var w=e.onFocus;w===void 0&&(w=Fi);var A=e.onBlur;A===void 0&&(A=Fi);var I=e.value,P=e.getCaretBoundary;P===void 0&&(P=MW);var N=e.isValidInputCharacter;N===void 0&&(N=Za);var F=e.isCharacterSame,L=c3(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=p3(I,c,!!u,o,a,l),q=H[0],X=q.formattedValue,re=q.numAsString,ae=H[1],oe=ie.useRef(),V=ie.useRef({formattedValue:X,numAsString:re}),$=function(we,me){V.current={formattedValue:we.formattedValue,numAsString:we.value},ae(we,me)},p=ie.useState(!1),d=p[0],m=p[1],x=ie.useRef(null),E=ie.useRef({setCaretTimeout:null,focusTimeout:null});ie.useEffect(function(){return m(!0),function(){clearTimeout(E.current.setCaretTimeout),clearTimeout(E.current.focusTimeout)}},[]);var C=o,k=function(we,me){var Te=parseFloat(me);return{formattedValue:we,value:me,floatValue:isNaN(Te)?void 0:Te}},T=function(we,me,Te){we.selectionStart===0&&we.selectionEnd===we.value.length||(Ms(we,me),E.current.setCaretTimeout=setTimeout(function(){we.value===Te&&we.selectionStart!==me&&Ms(we,me)},0))},g=function(we,me,Te){return Dg(we,me,P(we),Te)},v=function(we,me,Te){var qe=P(me),De=EW(me,X,we,Te,qe,N,F);return De=Dg(me,De,qe),De},R=function(we){var me=we.formattedValue;me===void 0&&(me="");var Te=we.input,qe=we.source,De=we.event,Oe=we.numAsString,Ie;if(Te){var Le=we.inputValue||Te.value,ft=Cf(Te);Te.value=me,Ie=v(Le,me,ft),Ie!==void 0&&T(Te,Ie,me)}me!==X&&$(k(me,Oe),{event:De,source:qe})};ie.useEffect(function(){var we=V.current,me=we.formattedValue,Te=we.numAsString;(X!==me||re!==Te)&&$(k(X,re),{event:void 0,source:Ja.props})},[X,re]);var se=x.current?Cf(x.current):void 0,ue=typeof window<"u"?ie.useLayoutEffect:ie.useEffect;ue(function(){var we=x.current;if(X!==V.current.formattedValue&&we){var me=v(V.current.formattedValue,X,se);we.value=X,T(we,me,X)}},[X]);var xe=function(we,me,Te){var qe=me.target,De=oe.current?bW(oe.current,qe.selectionEnd):h3(X,we),Oe=Object.assign(Object.assign({},De),{lastValue:X}),Ie=a(we,Oe),Le=C(Ie);if(Ie=a(Le,void 0),f&&!f(k(Le,Ie))){var ft=me.target,dt=Cf(ft),He=v(we,X,dt);return ft.value=X,T(ft,He,X),!1}return R({formattedValue:Le,numAsString:Ie,inputValue:we,event:me,source:Te,input:me.target}),!0},be=function(we,me){me===void 0&&(me=0);var Te=we.selectionStart,qe=we.selectionEnd;oe.current={selectionStart:Te,selectionEnd:qe+me}},Ce=function(we){var me=we.target,Te=me.value,qe=xe(Te,we,Ja.event);qe&&h(we),oe.current=void 0},Me=function(we){var me=we.target,Te=we.key,qe=me.selectionStart,De=me.selectionEnd,Oe=me.value;Oe===void 0&&(Oe="");var Ie;Te==="ArrowLeft"||Te==="Backspace"?Ie=Math.max(qe-1,0):Te==="ArrowRight"?Ie=Math.min(qe+1,Oe.length):Te==="Delete"&&(Ie=qe);var Le=0;Te==="Delete"&&qe===De&&(Le=1);var ft=Te==="ArrowLeft"||Te==="ArrowRight";if(Ie===void 0||qe!==De&&!ft){y(we),be(me,Le);return}var dt=Ie;if(ft){var He=Te==="ArrowLeft"?"left":"right";dt=g(Oe,Ie,He),dt!==Ie&&we.preventDefault()}else Te==="Delete"&&!N(Oe[Ie])?dt=g(Oe,Ie,"right"):Te==="Backspace"&&!N(Oe[Ie])&&(dt=g(Oe,Ie,"left"));dt!==Ie&&T(me,dt,Oe),y(we),be(me,Le)},Ke=function(we){var me=we.target,Te=function(){var qe=me.selectionStart,De=me.selectionEnd,Oe=me.value;if(Oe===void 0&&(Oe=""),qe===De){var Ie=g(Oe,qe);Ie!==qe&&T(me,Ie,Oe)}};Te(),requestAnimationFrame(function(){Te()}),_(we),be(me)},Ue=function(we){we.persist&&we.persist();var me=we.target,Te=we.currentTarget;x.current=me,E.current.focusTimeout=setTimeout(function(){var qe=me.selectionStart,De=me.selectionEnd,Oe=me.value;Oe===void 0&&(Oe="");var Ie=g(Oe,qe);Ie!==qe&&!(qe===0&&De===Oe.length)&&T(me,Ie,Oe),w(Object.assign(Object.assign({},we),{currentTarget:Te}))},0)},lt=function(we){x.current=null,clearTimeout(E.current.focusTimeout),clearTimeout(E.current.setCaretTimeout),A(we)},ht=d&&_W()?"numeric":void 0,$e=Object.assign({inputMode:ht},L,{type:t,value:X,onChange:Ce,onKeyDown:Me,onMouseUp:Ke,onFocus:Ue,onBlur:lt});if(r==="text")return i?ie.createElement(ie.Fragment,null,i(X,L)||null):ie.createElement("span",Object.assign({},L,{ref:s}),X);if(n){var mt=n;return ie.createElement(mt,Object.assign({},$e,{ref:s}))}return ie.createElement("input",Object.assign({},$e,{ref:s}))}function $g(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=Rl(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,h=Y0(e,o),y=h.beforeDecimal,_=h.afterDecimal,w=h.addNegation;return r!==void 0&&(_=f3(_,r,!!n)),u&&(y=gW(y,u,a)),i&&(y=i+y),s&&(_=_+s),w&&(y="-"+y),e=y+(f&&l||"")+_,e}function Rl(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 OW(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 IW(e,t){return new RegExp("(^-)|[0-9]|"+l3(e),t?"g":void 0)}function kW(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function jW(e,t,r){var n;t===void 0&&(t=xW(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=Rl(r),y=h.allowedDecimalSeparators,_=h.decimalSeparator,w=e[f]===_;if(Za(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&y.indexOf(e[l])!==-1){var A=a===0?"":_;e=e.substring(0,l)+A+e.substring(l+1,e.length)}var I=function(x,E,C){var k=!1,T=!1;s.startsWith("-")?k=!1:x.startsWith("--")?(k=!1,T=!0):o.startsWith("-")&&x.length===o.length?k=!1:x[0]==="-"&&(k=!0);var g=k?1:0;return T&&(g=2),g&&(x=x.substring(g),E-=g,C-=g),{value:x,start:E,end:C,hasNegation:k}},P=I(e,l,f),N=P.hasNegation;n=P,e=n.value,l=n.start,f=n.end;var F=I(t.lastValue,c.start,c.end),L=F.start,H=F.end,q=F.value,X=e.substring(l,f);e.length&&q.length&&(L>q.length-o.length||H<s.length)&&!(X&&o.startsWith(X))&&(e=q);var re=0;e.startsWith(s)?re+=s.length:l<s.length&&(re=l),e=e.substring(re),f-=re;var ae=e.length,oe=e.length-o.length;e.endsWith(o)?ae=oe:(f>oe||f>e.length-o.length)&&(ae=f),e=e.substring(0,ae),e=OW(N?"-"+e:e,i),e=(e.match(IW(_,!0))||[]).join("");var V=e.indexOf(_);e=e.replace(new RegExp(l3(_),"g"),function(x,E){return E===V?".":""});var $=Y0(e,i),p=$.beforeDecimal,d=$.afterDecimal,m=$.addNegation;return u.end-u.start<c.end-c.start&&p===""&&w&&!parseFloat(d)&&(e=m?"-":""),e}function PW(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 RW(e){var t=Rl(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 hK(e){e=dK(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=Fi);var s=e.onBlur;s===void 0&&(s=Fi);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=K8(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=tf(e),T=w.decimalSeparator,P=w.allowedDecimalSeparators,R=function(m){return Iv(m,e)},N=function(m,x){return lK(m,x,e)},z=Co(f)?l:f,F=h??uK(z,u,t);Co(f)?Co(l)||(F=F||typeof l=="number"):F=F||typeof f=="number";var W=function(m){return X8(m)?m:(typeof m=="number"&&(m=Z8(m)),F&&typeof a=="number"?Tv(m,a,!!c):m)},q=eS(W(f),W(l),!!F,R,N,y),K=q[0],te=K.numAsString,se=K.formattedValue,H=q[1],L=function(m){var x=m.target,C=m.key,E=x.selectionStart,O=x.selectionEnd,M=x.value;if(M===void 0&&(M=""),(C==="Backspace"||C==="Delete")&&O<u.length){m.preventDefault();return}if(E!==O){i(m);return}C==="Backspace"&&M[0]==="-"&&E===u.length+1&&r&&As(x,1),a&&c&&(C==="Backspace"&&M[E-1]===T?(As(x,E-1),m.preventDefault()):C==="Delete"&&M[E]===T&&m.preventDefault()),P!=null&&P.includes(C)&&M[E]===T&&As(x,E+1);var g=o===!0?",":o;C==="Backspace"&&M[E-1]===g&&As(x,E-1),C==="Delete"&&M[E]===g&&As(x,E+1),i(m)},D=function(m){var x=te;if(x.match(/\d/g)||(x=""),n||(x=JG(x)),c&&a&&(x=Tv(x,a,c)),x!==te){var C=Iv(x,e);H({formattedValue:C,value:x,floatValue:parseFloat(x)},{event:m,source:tc.event})}s(m)},p=function(m){return m===T?!0:rc(m)},d=function(m){var x=m.currentValue,C=m.lastValue,E=m.formattedValue,O=m.currentValueIndex,M=m.formattedValueIndex,g=x[O],v=E[M],k=Q8(C,x),ee=k.to,ie=function(ge){return N(ge).indexOf(".")+u.length};return f===0&&c&&a&&x[ee.start]===T&&ie(x)<O&&ie(E)>M?!1:O>=ee.start&&O<ee.end&&P&&P.includes(g)&&v===T?!0:g===v};return Object.assign(Object.assign({},b),{value:se,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:H,format:R,removeFormatting:N,getCaretBoundary:function(m){return fK(m,e)},onKeyDown:L,onBlur:D})}function pK(e){var t=hK(e);return ae.createElement(oK,Object.assign({},t))}function mK(e){const{value:t,decimals:r,placeholder:n,style:i,onChange:s,maxValue:o,minValue:a=0,inputAllowed:c=!0,prefix:u,...l}=e,f=h=>{var w;const y=((w=h==null?void 0:h.target)==null?void 0:w.value)||"";let b=y;if(y.startsWith("0")&&y!=="0"&&!y.startsWith("0.")&&(b=y.replace(/^0+/,"")),b){if(b.startsWith(".")){s(b.slice(1,b.length));return}let T=String(b).replace(/,/g,"");if(T.startsWith("-")){s("");return}u&&(T=T.replace(u,"")),o!==void 0&&Ve(T).gt(o)?T=o.toString():a!==void 0&&Ve(T).lt(a)&&(T=a.toString()),s(String(T))}else s("")};return _.jsx(pK,{value:t,disabled:!c,placeholder:n,decimalScale:r,prefix:u,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:h=>!h.value.startsWith("-"),onChange:f,...l,style:{...i,cursor:c?"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 gK(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(Gr,{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 Pv({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}){const[f,h]=ae.useState(!1),{currentAccount:y}=On(),b=()=>{const T=Ve((n==null?void 0:n.totalBalanceFormat)||"0").div(2),P=rn(T.toString(),o==null?void 0:o.decimals,!0).toString();t&&Ve(P).eq(t)||i(P)},w=()=>{const T=Ve((n==null?void 0:n.totalBalanceFormat)||0),P=Mr((o==null?void 0:o.coin_type)||"").full_address===Sn.SUI_TYPE_ARG,R=.05;let N=T;P&&Ve(T).gt(R)&&(N=N.sub(R)),!(t&&Ve(N).eq(t))&&Ve(N).gte(0)&&i(N.toString())};return _.jsxs("div",{className:f?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e"},children:[_.jsxs("div",{className:"title",children:[" ",e," "]}),_.jsxs("div",{className:"token-input",children:[a?_.jsxs("div",{style:{flex:1},children:[" ",_.jsx(Yo,{style:{width:"200px",height:"28px",flex:1}})," "]}):_.jsx(mK,{value:t,placeholder:"0.0",style:{fontSize:"28px",color:"#fff",height:"28px",background:"none",border:"none",outline:"none",marginLeft:"-1px"},inputAllowed:l,onChange:i,onFocus:()=>h(!0),onBlur:()=>h(!1)}),_.jsx(gK,{token:o,handleTokenSelectClick:s})]}),_.jsxs("div",{className:"info-box",children:[_.jsx("div",{className:"input-rate",children:!a&&r&&+r?d4(r,2):""}),_.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[y&&_.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})]}),y&&_.jsxs("div",{className:"btn-box",children:[u&&_.jsx("button",{className:"cs-outline-btn",onClick:b,children:"HALF"}),c&&_.jsx("button",{className:"cs-outline-btn",onClick:w,children:"MAX"})]})]})]})]})}function vK({refreshCount:e,customWallet:t}){const{currentAccount:r,onWalletModal:n}=On(),{getOwnerCoinBalances:i}=Gu(),{fromCoin:s,toCoin:o,fromAmount:a,toAmount:c,findRouterLoading:u,byAmountIn:l,routerData:f,isOpenSecondary:h,setIsOpenSecondary:y}=In(),{handleAmountChange:b,handleSelectToken:w,fromBalanceInfo:T,toBalanceInfo:P,fromAmountValue:R,toAmountValue:N,doSwapAction:z,reCalculateRouteData:F,refreshMarketPrice:W,scamsText:q}=WU(),{slippage:K}=Xr(),{amountLimit:te}=a8(K,f),{formatSwapRouter:se}=kU(f),[H,L]=ae.useState(!1),{btnText:D,btnDisabled:p}=GU(T==null?void 0:T.totalBalanceFormat),[d,m]=ae.useState(!1),[x,C]=ae.useState(!1);ae.useEffect(()=>{h?e>=5&&E():e>=20&&E()},[e]);const E=()=>{F(),r&&i(),W()},O=()=>({...f}),M=async()=>{o&&w(o,!0)},g=ae.useMemo(()=>!(d||h),[d,h]);return _.jsxs("div",{className:"swap-trade-box",children:[_.jsxs("div",{className:"trade-form",style:{flexDirection:"column",display:g?"flex":"none"},children:[_.jsx(Pv,{loading:!l&&u,balance:T,amountValue:R,handleTokenSelectClick:()=>{C(!0),m(!0)},onInputChange:v=>{b(v,!0)},amount:a,token:s,label:"You pay"}),_.jsx("div",{onClick:M,className:"swap-icon",onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),style:{cursor:"pointer"},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:H?"rotate(90deg)":"none",width:H?"16px":"14px",height:H?"16px":"14px"},children:_.jsx("use",{xlinkHref:H?"#icon-swap":"#icon-trade"})})}),_.jsx(Pv,{loading:l&&u,balance:P,showHalf:!1,showMax:!1,amountValue:N,handleTokenSelectClick:()=>{C(!1),m(!0)},onInputChange:v=>{b(v,!1)},inputAllowed:!1,amount:c,token:o,label:"You receive"})]}),q&&_.jsx(XU,{scamsText:q}),_.jsxs("div",{className:"swap-bottom-block",style:{border:p?"0px solid #2a3238":"1px solid #2a3238"},children:[_.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:p||u,onClick:()=>{r?y(!0):t!=null&&t.connect?t.connect():n(!0)},children:u?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(f8,{})}):D}),a&&c&&+a&&+c&&_.jsxs("div",{className:"content",children:[_.jsxs("div",{className:"price-related-info",children:[f&&_.jsx(E0,{baseToken:s,quoteToken:o,baseAmount:f.fromAmountUi||"",quoteAmount:f.toAmountUi||"",loading:u}),_.jsx(h8,{isLoading:u,routerData:f})]}),_.jsx(p8,{isLoading:u,amountLimit:te}),_.jsx(W8,{hasSubMenu:!0,formatSwapRouter:se,isLoading:u})]})]}),h&&_.jsx(fG,{data:O(),toBack:()=>y(!1),onSubmitClick:async v=>{try{await z(v)}finally{y(!1)}}}),d&&_.jsx(VG,{currToken:x?s:o,backClick:()=>m(!1),onSelectToken:v=>{w(v,x),m(!1)}})]})}function yK({initProps:e={},customWallet:t}){vU();const{ToastContainer:r}=Zo(),{fetchRouterConfig:n}=aU(),{getTokens:i}=Hs(),{fetchTokenPrices:s}=Wl(),{transactionData:o,setTransactionData:a}=x0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=In(),[y,b]=ae.useState(0),w=ae.useRef(y);gU(e),ae.useEffect(()=>{i(),s([]),n()},[]),ae.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),cU({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&T():w.current>=20&&T()}});const T=()=>{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(nU,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),_.jsx(zF,{handleRefresh:T}),_.jsx(vK,{refreshCount:y,customWallet:t}),o&&_.jsx(iU,{transactionData:o,onClose:()=>{a(void 0)}}),_.jsx(r,{})]})})}function D0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Gu(),n=Lr.useCurrentAccount(),{saveCurrentAccount:i}=On(),{mutate:s}=Lr.useConnectWallet();return ae.useEffect(()=>{console.log("currentAccount: ",n),i(n||void 0),r(n==null?void 0:n.address)},[n]),ae.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(yK,{initProps:e,customWallet:t})}function bK({initProps:e,customWallet:t}){const[r,n]=ae.useState(!0);return _.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&_.jsx("div",{className:"swap-modal-box",children:_.jsx(D0,{initProps:e,customWallet:t})}),_.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function wK({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=ae.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:zt("/images/img-logo@2x.png")})}),i&&_.jsx("div",{className:`widget-modal ${t} ${e}`,children:_.jsx(D0,{initProps:r,customWallet:n})})]})}function _K({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return _.jsxs(Dl,{appearance:"dark",children:[r==="Integrated"&&_.jsx(D0,{initProps:e,customWallet:t}),r==="Widget"&&_.jsx(wK,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&_.jsx(bK,{initProps:e,customWallet:t})]})}const xK=_K;exports.CetusSwap=xK;
|
|
114
|
+
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function NW(e){e=RW(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=Fi);var s=e.onBlur;s===void 0&&(s=Fi);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,_=c3(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=Rl(e),A=w.decimalSeparator,I=w.allowedDecimalSeparators,P=function(m){return $g(m,e)},N=function(m,x){return jW(m,x,e)},F=_o(f)?l:f,L=h??kW(F,u,t);_o(f)?_o(l)||(L=L||typeof l=="number"):L=L||typeof f=="number";var H=function(m){return u3(m)?m:(typeof m=="number"&&(m=d3(m)),L&&typeof a=="number"?Ng(m,a,!!c):m)},q=p3(H(f),H(l),!!L,P,N,y),X=q[0],re=X.numAsString,ae=X.formattedValue,oe=q[1],V=function(m){var x=m.target,E=m.key,C=x.selectionStart,k=x.selectionEnd,T=x.value;if(T===void 0&&(T=""),(E==="Backspace"||E==="Delete")&&k<u.length){m.preventDefault();return}if(C!==k){i(m);return}E==="Backspace"&&T[0]==="-"&&C===u.length+1&&r&&Ms(x,1),a&&c&&(E==="Backspace"&&T[C-1]===A?(Ms(x,C-1),m.preventDefault()):E==="Delete"&&T[C]===A&&m.preventDefault()),I!=null&&I.includes(E)&&T[C]===A&&Ms(x,C+1);var g=o===!0?",":o;E==="Backspace"&&T[C-1]===g&&Ms(x,C-1),E==="Delete"&&T[C]===g&&Ms(x,C+1),i(m)},$=function(m){var x=re;if(x.match(/\d/g)||(x=""),n||(x=yW(x)),c&&a&&(x=Ng(x,a,c)),x!==re){var E=$g(x,e);oe({formattedValue:E,value:x,floatValue:parseFloat(x)},{event:m,source:Ja.event})}s(m)},p=function(m){return m===A?!0:Za(m)},d=function(m){var x=m.currentValue,E=m.lastValue,C=m.formattedValue,k=m.currentValueIndex,T=m.formattedValueIndex,g=x[k],v=C[T],R=h3(E,x),se=R.to,ue=function(xe){return N(xe).indexOf(".")+u.length};return f===0&&c&&a&&x[se.start]===A&&ue(x)<k&&ue(C)>T?!1:k>=se.start&&k<se.end&&I&&I.includes(g)&&v===A?!0:g===v};return Object.assign(Object.assign({},_),{value:ae,valueIsNumericString:!1,isValidInputCharacter:p,isCharacterSame:d,onValueChange:oe,format:P,removeFormatting:N,getCaretBoundary:function(m){return PW(m,e)},onKeyDown:V,onBlur:$})}function DW(e){var t=NW(e);return ie.createElement(TW,Object.assign({},t))}function $W(e){const{value:t,decimals:r,placeholder:n,style:i,onChange:s,maxValue:o,minValue:a=0,inputAllowed:c=!0,prefix:u,...l}=e,f=h=>{var w;const y=((w=h==null?void 0:h.target)==null?void 0:w.value)||"";let _=y;if(y.startsWith("0")&&y!=="0"&&!y.startsWith("0.")&&(_=y.replace(/^0+/,"")),_){if(_.startsWith(".")){s(_.slice(1,_.length));return}let A=String(_).replace(/,/g,"");if(A.startsWith("-")){s("");return}u&&(A=A.replace(u,"")),o!==void 0&&Ve(A).gt(o)?A=o.toString():a!==void 0&&Ve(A).lt(a)&&(A=a.toString()),s(String(A))}else s("")};return b.jsx(DW,{value:t,disabled:!c,placeholder:n,decimalScale:r,prefix:u,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:h=>!h.value.startsWith("-"),onChange:f,...l,style:{...i,cursor:c?"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 BW(e){const{token:t,handleTokenSelectClick:r}=e;return b.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[b.jsx("div",{className:"token-img-box",children:b.jsx(Gr,{src:t==null?void 0:t.logo_url})},t==null?void 0:t.coin_type),b.jsx("div",{className:"name",children:b.jsxs("h4",{className:"truncate-text",children:[" ",t==null?void 0:t.symbol]})}),b.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function Bg({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}){const[f,h]=ie.useState(!1),{currentAccount:y}=Cn(),_=()=>{const A=Ve((n==null?void 0:n.totalBalanceFormat)||"0").div(2),I=en(A.toString(),o==null?void 0:o.decimals,!0).toString();t&&Ve(I).eq(t)||i(I)},w=()=>{const A=Ve((n==null?void 0:n.totalBalanceFormat)||0),I=Mr((o==null?void 0:o.coin_type)||"").full_address===qd,P=.05;let N=A;I&&Ve(A).gt(P)&&(N=N.sub(P)),!(t&&Ve(N).eq(t))&&Ve(N).gte(0)&&i(N.toString())};return b.jsxs("div",{className:f?"active trade-input-box":"trade-input-box",style:{backgroundColor:l?"#121719":"#161a1e"},children:[b.jsxs("div",{className:"title",children:[" ",e," "]}),b.jsxs("div",{className:"token-input",children:[a?b.jsxs("div",{style:{flex:1},children:[" ",b.jsx(qo,{style:{width:"200px",height:"28px",flex:1}})," "]}):b.jsx($W,{value:t,placeholder:"0.0",style:{fontSize:"28px",color:"#fff",height:"28px",background:"none",border:"none",outline:"none",marginLeft:"-1px"},inputAllowed:l,onChange:i,onFocus:()=>h(!0),onBlur:()=>h(!1)}),b.jsx(BW,{token:o,handleTokenSelectClick:s})]}),b.jsxs("div",{className:"info-box",children:[b.jsx("div",{className:"input-rate",children:!a&&r&&+r?e4(r,2):""}),b.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[y&&b.jsxs("div",{className:"token-balance",children:[b.jsx("svg",{className:"icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-wallet"})}),b.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),y&&b.jsxs("div",{className:"btn-box",children:[u&&b.jsx("button",{className:"cs-outline-btn",onClick:_,children:"HALF"}),c&&b.jsx("button",{className:"cs-outline-btn",onClick:w,children:"MAX"})]})]})]})]})}function LW({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=Cn(),{getOwnerCoinBalances:s}=Pu(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:u,findRouterLoading:l,byAmountIn:f,routerData:h,isOpenSecondary:y,setIsOpenSecondary:_}=sn(),{handleAmountChange:w,handleSelectToken:A,fromBalanceInfo:I,toBalanceInfo:P,fromAmountValue:N,toAmountValue:F,doSwapAction:L,reCalculateRouteData:H,refreshMarketPrice:q,scamsText:X}=pF(),{slippage:re}=Wr(),{amountLimit:ae}=J6(re,h),{formatSwapRouter:oe}=vL(h),[V,$]=ie.useState(!1),{btnText:p,btnDisabled:d}=mF(I==null?void 0:I.totalBalanceFormat),[m,x]=ie.useState(!1),[E,C]=ie.useState(!1);ie.useEffect(()=>{y?e>=5&&k():e>=20&&k()},[e]);const k=()=>{H(),n&&s(),q()},T=()=>({...h}),g=async()=>{a&&A(a,!0)},v=ie.useMemo(()=>!(m||y),[m,y]);return b.jsxs("div",{className:"swap-trade-box",children:[b.jsxs("div",{className:"trade-form",style:{flexDirection:"column",display:"flex"},children:[b.jsx(Bg,{loading:!f&&l,balance:I,amountValue:N,handleTokenSelectClick:()=>{C(!0),x(!0)},onInputChange:R=>{w(R,!0)},amount:c,token:o}),b.jsx("div",{onClick:g,className:"swap-icon",onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),style:{cursor:"pointer"},children:b.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:V?"rotate(90deg)":"none",width:V?"16px":"14px",height:V?"16px":"14px"},children:b.jsx("use",{xlinkHref:V?"#icon-swap":"#icon-trade"})})}),b.jsx(Bg,{loading:f&&l,balance:P,showHalf:!1,showMax:!1,amountValue:F,handleTokenSelectClick:()=>{C(!1),x(!0)},onInputChange:R=>{w(R,!1)},inputAllowed:!1,amount:u,token:a})]}),X&&b.jsx(vF,{scamsText:X}),b.jsxs("div",{className:"swap-bottom-block",style:{border:d?"0px solid #2a3238":"1px solid #2a3238"},children:[b.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:d||l,onClick:()=>{n?_(!0):t!=null&&t.connect?t.connect():i(!0)},children:l?b.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:b.jsx(M8,{})}):p}),c&&u&&+c&&+u&&b.jsxs("div",{className:"content",children:[b.jsxs("div",{className:"price-related-info",children:[h&&b.jsx(L0,{baseToken:o,quoteToken:a,baseAmount:h.fromAmountUi||"",quoteAmount:h.toAmountUi||"",loading:l}),b.jsx(A8,{isLoading:l,routerData:h})]}),b.jsx(T8,{isLoading:l,amountLimit:ae}),b.jsx(o3,{hasSubMenu:!0,formatSwapRouter:oe,isLoading:l})]})]}),y&&b.jsx(PH,{data:T(),toBack:()=>_(!1),onSubmitClick:async R=>{try{await L(R,r==null?void 0:r.partner)}finally{_(!1)}}}),m&&b.jsx(fW,{currToken:E?o:a,backClick:()=>x(!1),onSelectToken:R=>{A(R,E),x(!1)}})]})}function UW({initProps:e={},customWallet:t}){rL();const{ToastContainer:r}=Go(),{fetchRouterConfig:n}=KB(),{getTokens:i}=Us(),{fetchTokenPrices:s}=yl(),{transactionData:o,setTransactionData:a}=k0(),{isOpenSecondary:c,fromCoin:u,toAmount:l,toCoin:f,fromAmount:h}=sn(),[y,_]=ie.useState(0),w=ie.useRef(y);tL(e),ie.useEffect(()=>{i(),s([]),n()},[]),ie.useEffect(()=>{w.current=0},[u==null?void 0:u.coin_type,f==null?void 0:f.coin_type,h,l]),XB({interval:1e3,callback:()=>{w.current=w.current+1,c?w.current>=5&&A():w.current>=20&&A()}});const A=()=>{w.current=20,_(20),setTimeout(()=>{w.current=0,_(0)},20)};return b.jsx(b.Fragment,{children:b.jsxs("div",{className:"swap-container",id:"cs-swap-widget",children:[b.jsx(qB,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t}),b.jsx(OB,{handleRefresh:A}),b.jsx(LW,{refreshCount:y,customWallet:t,initProps:e}),o&&b.jsx(GB,{transactionData:o,onClose:()=>{a(void 0)}}),b.jsx(r,{})]})})}function J0({initProps:e={},customWallet:t}){var o;const{getOwnerCoinBalances:r}=Pu(),n=$r.useCurrentAccount(),{saveCurrentAccount:i}=Cn(),{mutate:s}=$r.useConnectWallet();return ie.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),ie.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]),b.jsx(UW,{initProps:e,customWallet:t})}function FW({initProps:e,customWallet:t}){const[r,n]=ie.useState(!0);return b.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&b.jsx("div",{className:"swap-modal-box",children:b.jsx(J0,{initProps:e,customWallet:t})}),b.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function zW({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=ie.useState(!1),o=()=>{s(!i)};return b.jsxs("div",{className:"widget-btn-box",children:[b.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?b.jsx("svg",{className:"icon","aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-unfold"})}):b.jsx("img",{src:Ft("/images/img-logo@2x.png")})}),i&&b.jsx("div",{className:`widget-modal ${t} ${e}`,children:b.jsx(J0,{initProps:r,customWallet:n})})]})}function VW({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return b.jsxs(cl,{appearance:"dark",children:[r==="Integrated"&&b.jsx(J0,{initProps:e,customWallet:t}),r==="Widget"&&b.jsx(zW,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&b.jsx(FW,{initProps:e,customWallet:t})]})}const qW=VW;exports.CetusSwap=qW;
|